Difficulty scaling: Difference between revisions

m
adding some lines to help the translation extension split
m (It is this template that I am missing)
m (adding some lines to help the translation extension split)
Line 217: Line 217:
<!--T:32-->
<!--T:32-->
Interestingly, the game calculates a single point value based on the kill counter flags but calculates two separate values for weapons and enemies with two different multipliers. This format makes it possible to easily change the scaling.
Interestingly, the game calculates a single point value based on the kill counter flags but calculates two separate values for weapons and enemies with two different multipliers. This format makes it possible to easily change the scaling.
<source lang="c++">
<source lang="c++">
float points = 0.0;
float points = 0.0;
Line 222: Line 224:
     int kill_count = GameData::getIntegerFlag(kill_flag["name"]);
     int kill_count = GameData::getIntegerFlag(kill_flag["name"]);
     points += kill_count * kill_flag["point"];
     points += kill_count * kill_flag["point"];
 
\\
<!--T:33-->
this->points = points;
this->points = points;
this->weapon_points = points * this->byml["setting"].Level2WeaponPower;
this->weapon_points = points * this->byml["setting"].Level2WeaponPower;
this->enemy_points = points * this->byml["setting"].Level2EnemyPower;
this->enemy_points = points * this->byml["setting"].Level2EnemyPower;
</source>
</source>
In practice, settings have never been modified. 1.5.0 (which will likely be the last game update) still has the same Level2WeaponPower and Level2EnemyPower.
In practice, settings have never been modified. 1.5.0 (which will likely be the last game update) still has the same Level2WeaponPower and Level2EnemyPower.


Line 241: Line 244:
<!--T:37-->
<!--T:37-->
Pseudocode (1.0.0):
Pseudocode (1.0.0):
<source lang="c++">
<source lang="c++">
bool Ecosystem::LevelSensor::scaleWeapon(const sead::SafeString& weapon_to_look_up,
bool Ecosystem::LevelSensor::scaleWeapon(const sead::SafeString& weapon_to_look_up,
Line 249: Line 254:
{
{
   // some checks using 'unknown' here which seems to be a pointer to the actor
   // some checks using 'unknown' here which seems to be a pointer to the actor
 
  //
   <!--T:38-->
   for (weapon_table : this->byml["weapon"]) {
for (weapon_table : this->byml["weapon"]) {
     // find the first weapon entry for which the player has enough points
     // find the first weapon entry for which the player has enough points
     // with the specified name and modifier
     // with the specified name and modifier
Line 258: Line 262:
       entry = weapon_table["actors"][j];
       entry = weapon_table["actors"][j];
       float points_for_next_transition = entry["value"];
       float points_for_next_transition = entry["value"];
 
      //
       <!--T:39-->
       if (this->weapon_points > points_for_next_transition &&
if (this->weapon_points > points_for_next_transition &&
           weapon_to_look_up == entry["name"] &&
           weapon_to_look_up == entry["name"] &&
           convert_to_modifier(entry["plus"]) == required_modifier) {
           convert_to_modifier(entry["plus"]) == required_modifier) {
Line 267: Line 270:
       }
       }
     }
     }
 
    //
     <!--T:40-->
     if (i == -1)
if (i == -1)
       continue;
       continue;
 
    //
     <!--T:41-->
     do {
do {
       entry = weapon_table["actors"][i];
       entry = weapon_table["actors"][i];
 
      //
       <!--T:42-->
       // not_rank_up means there is no link between weapons;
// not_rank_up means there is no link between weapons;
       // this table is just used to look up modifiers.
       // this table is just used to look up modifiers.
       // so go down the list until there are no more entries for the requested weapon
       // so go down the list until there are no more entries for the requested weapon
Line 283: Line 283:
       if (weapon_table["not_rank_up"] && entry["name"] != weapon_to_look_up)
       if (weapon_table["not_rank_up"] && entry["name"] != weapon_to_look_up)
         break;
         break;
 
      //
       <!--T:43-->
       // otherwise, just go down the list until we reach the end or a weapon which
// otherwise, just go down the list until we reach the end or a weapon which
       // requires more points. this will possibly upgrade the weapon (e.g. Knight -> Royal).
       // requires more points. this will possibly upgrade the weapon (e.g. Knight -> Royal).
       if (this->weapon_points <= entry["value"])
       if (this->weapon_points <= entry["value"])
         break;
         break;
 
      //
       <!--T:44-->
       ++i;
++i;
     } while (i < weapon_table["actors"].size);
     } while (i < weapon_table["actors"].size);
 
    //
     <!--T:45-->
     *weapon_to_use_name = entry["name"];
*weapon_to_use_name = entry["name"];
     *modifier_to_use = convert_to_modifier(entry["plus"]);
     *modifier_to_use = convert_to_modifier(entry["plus"]);
     return true;
     return true;
Line 308: Line 305:
<!--T:47-->
<!--T:47-->
Pseudocode (1.0.0):
Pseudocode (1.0.0):
<source lang="c++">
<source lang="c++">
if (actor->params["LevelSensorMode"] < 1)
if (actor->params["LevelSensorMode"] < 1)
   return false;
   return false;
 
//
<!--T:48-->
if (actor_name.contains("Enemy")) {
if (actor_name.contains("Enemy")) {
   for (enemy_table : this->byml["enemy"]) {
   for (enemy_table : this->byml["enemy"]) {
Line 323: Line 321:
       }
       }
     }
     }
 
    //
     <!--T:49-->
     if (i == -1)
if (i == -1)
       continue;
       continue;
 
    //
     <!--T:50-->
     do {
do {
       entry = enemy_table["actors"][i];
       entry = enemy_table["actors"][i];
       if (this->enemy_points <= entry["value"])
       if (this->enemy_points <= entry["value"])
Line 335: Line 331:
       ++i;
       ++i;
     } while (i < enemy_table["actors"].size);
     } while (i < enemy_table["actors"].size);
 
    //
     <!--T:51-->
     *actor_to_use = entry["name"];
*actor_to_use = entry["name"];
     return true;
     return true;
   }
   }
   return false;  // cannot scale up
   return false;  // cannot scale up
}
}
 
//
<!--T:52-->
if (actor_name.contains("Weapon")) {
if (actor_name.contains("Weapon")) {
   weapon_name = actor->getWeaponName();
   weapon_name = actor->getWeaponName();
Line 349: Line 343:
   if (modifier == WeaponModifier::RandomBlue)
   if (modifier == WeaponModifier::RandomBlue)
     modifier = get_random_blue_modifier(actor->getWeaponName());
     modifier = get_random_blue_modifier(actor->getWeaponName());
 
  //
   <!--T:53-->
   if (scaleWeapon(weapon_name, &weapon_to_use, &modifier_to_use)) {
if (scaleWeapon(weapon_name, &weapon_to_use, &modifier_to_use)) {
     actor->setProperty("SharpWeaponJudgeType", modifier_to_use);
     actor->setProperty("SharpWeaponJudgeType", modifier_to_use);
     *actor_to_use = weapon_to_use;
     *actor_to_use = weapon_to_use;
translator
745

edits