#1 2011-12-24 15:15:33

Marduk
Administrator
From: Rotterdam, Netherlands
Posts: 151

Re: Poll: import_veteran_levels

heh this is cool, I had no idea this was being tested. but wouldn't it create spies that are even more invincible than they already are? One elite spy can already kill stacks of normal spies.

Offline

#2 2011-12-24 15:28:25

akfaew
Administrator
Posts: 622

Re: Poll: import_veteran_levels

Here is the relevant code:

   1072 /**************************************************************************
   1073   This determines if a diplomat/spy succeeds against some defender,
   1074   who is also a diplomat or spy. Note: a superspy attacker always
   1075   succeeds, otherwise a superspy defender always wins.
   1076
   1077   Return TRUE if the "attacker" succeeds.
   1078 **************************************************************************/
   1079 static bool diplomat_success_vs_defender(struct unit *pattacker,
   1080                                          struct unit *pdefender,
   1081                                          struct tile *pdefender_tile)
   1082 {  
   1083   int chance = 50; /* Base 50% chance */
   1084
   1085   if (unit_has_type_flag(pattacker, F_SUPERSPY)) {
   1086     return TRUE;
   1087   }
   1088   if (unit_has_type_flag(pdefender, F_SUPERSPY)) {
   1089     return FALSE;
   1090   }
   1091
   1092   /* Add or remove 25% if spy flag. */                                                                                                   
   1093   if (unit_has_type_flag(pattacker, F_SPY)) { 
   1094     chance += 25;
   1095   }
   1096   if (unit_has_type_flag(pdefender, F_SPY)) {
   1097     chance -= 25;
   1098   }
   1099
   1100   /* Add or remove up to 20% for veteran level. */
   1101   chance += diplomat_add_chance_veteran(20, pattacker);
   1102   chance -= diplomat_add_chance_veteran(20, pdefender);
   1103
   1104   if (tile_city(pdefender_tile)) {
   1105     /* Reduce the chance of an attack by EFT_SPY_RESISTANCE percent. */
   1106     chance -= chance * get_city_bonus(tile_city(pdefender_tile),
   1107                                       EFT_SPY_RESISTANT) / 100;
   1108   } else {
   1109     /* Reduce the chance of an attack if BF_DIPLOMAT_DEFENSE is active. */
   1110     if (tile_has_base_flag_for_unit(pdefender_tile, unit_type(pdefender),
   1111                                     BF_DIPLOMAT_DEFENSE)) {
   1112       chance -= chance * 25 / 100; /* 25% penalty */
   1113     }
   1114   }
   1115
   1116   return fc_rand(100) < chance;
   1117 }
   1118
   1119 /*****************************************************************************
   1120   Calculate the additional chance due to veteran levels. It is given by:
   1121
   1122   chance = base chance * (veteran level * power factor of veteran level)
   1123            / (max veteran level * power factor of max veteran level);
   1124 *****************************************************************************/
   1125 static int diplomat_add_chance_veteran(int base_chance,
   1126                                        const struct unit *punit)
   1127 {
   1128   const struct veteran_system *vsystem;
   1129   const struct veteran_level *vlevel, *vlevel_max;
   1130   int chance;
   1131
   1132   fc_assert_ret_val(punit != NULL, 0);
   1133
   1134   vsystem = utype_veteran_system(unit_type(punit));
   1135
   1136   vlevel = utype_veteran_level(unit_type(punit), punit->veteran);
   1137   fc_assert_ret_val(vlevel != NULL, 0);
   1138
   1139   vlevel_max = utype_veteran_level(unit_type(punit), vsystem->levels - 1);
   1140   fc_assert_ret_val(vlevel_max != NULL, 0);
   1141
   1142   chance = (float)base_chance * (punit->veteran * vlevel->power_fact)
   1143            / (vsystem->levels * vlevel_max->power_fact);
   1144
   1145   log_debug("add chance for %s [level %d]: %d = %d * (%d * %d) / (%d * %d)",
   1146             unit_name_translation(punit), punit->veteran, chance, base_chance,
   1147             punit->veteran, vlevel->power_fact, vsystem->levels,
   1148             vlevel_max->power_fact);
   1149
   1150   return chance;
   1151 }

The part about veterans is this:

   1142   chance = (float)base_chance * (punit->veteran * vlevel->power_fact)
   1143            / (vsystem->levels * vlevel_max->power_fact);

So an elite 3 spy would have: 20 * (10 * 350) / 10 * 350 = +20%.
So if anything this change would make spies weaker (since it's harder to get the new elite 3 than the old vvv).

Offline

#3 2011-12-24 23:31:05

canuck101
Player
Posts: 25

Re: Poll: import_veteran_levels

As far as I understand, this would make progression more gradual, rather than create more powerful levels above elite?

Offline

#4 2011-12-25 08:49:03

akfaew
Administrator
Posts: 622

Re: Poll: import_veteran_levels

Yes, but only for diplomats and spies.

Offline

#5 2011-12-25 10:35:51

Marduk
Administrator
From: Rotterdam, Netherlands
Posts: 151

Re: Poll: import_veteran_levels

Ok, then I'm all for it!

Offline

Board footer

Powered by FluxBB