Due to a sudden burst in spammer activity, account creation has been temporarily disabled. Sorry for the inconvenience to any new potential contributors.

Retreat Chance formula and modding

From AGEWiki

Jump to: navigation, search

Retreat Chance Formula

Preliminary Only, pending review by the Master

//Starting value

Result := cbtRetreatBase_; {10%}

// Test for inability to retreat

// The group is in a locked region or frozen sea etc.
   Result := 0; Stop calculations. No retreat

// Adjustment for longer battles (more rounds)

// Chance increases each round: calculated and accumulated per round, start at 0 (round 0)
   Increase Result by value of  NumRound * cbtRetreatBonusRounds_ 

// Gather adjustments to the value

// retreat bonus from evasion, x2 chance if 50% of SU have the *Retreater* attribute
   RetreatBonus := Round(RetreatBonus * cbtRetreatCoeffAttribRet_/100);
   Increase Result by value of RetreatBonus (coming for either Evasion or Hide value)
// Determine if force is "small" or "medium"
   if the Command Points used are <= CP given by a 1 star general then
     Increase Result by value of  cbtRetreatBonusSmall_
   else  
   if the Command Points used are <= CP given by a 2 star general then
     Increase Result by value of  cbtRetreatBonusAverage_
// Strategic bonus, first round only
      StratBonus := cbtRetreatLeaderMinBonus_; {even without leader, give bonus}
      StratBonus := Max(StratBonus, Leader Strategic value * cbtRetreatLeaderBonus_);
      Increase Result by value of  StratBonus
// Ambush adjustment
   if Ambush is set then
     Increase Result by value of  cbtRetreatAmbushMod_
// Bonus if another group succeeded already
     Increase Result by value of  cbtRetreatAdjIfOtherRetreating_); {15%}
// Bonus at the region level, if not at the group level
   Search the group and region for other Retreat bonus abilities coming from leaders
   If found:
   Increase Result by value of  (AbiSubU.pAbiDef.RetreatBonus + abiRetBonusPerLevel_ * (AbiSubU.cuLevel-1));
// if in passive without rulROE (BoA only)
     Increase Result by value of  cbtRetreatBonusPassive
// Wind gauge
  has Windgage:      Increase Result by value of  cbtWindGaugeRetBonus_
  lacks Windgage:    Decrease Result by value of  cbtWindGaugeRetBonus_
// **Coefficient** ROE 
     Adjust each round by using ROE modifiers on retreat
//Limit the numerical range of the resulting answer
     if in Ambush, no limit, otherwise max value is cbtRetreatMax

And this ends with Result !!!!!!!

Modding parameters

Parameters affecting retreat are found in \Settings folder options files (GameLogic.opt)

Values shown are from WIA as of: December 4, 2010

// ***** COMBATS *****

cbtSupportCoeffAutoRet = 50 // supports are worth 50% in weight for auto retreat checking
cbtBasePercentAutoRet = 20 // % of losses triggering automatic retreat
cbtCohBonusrAutoRetCoeff= 50 // bonus to cohesion as per: autoretreat% = BasePercent * (Coh + bonus) / 100

// ***** CONTROL & RETREAT *****

cbtRetreatMax = 100 // Max retreat chance
cbtRetreatBaseCoeff = 50 // base damage coefficient to retreat global formula
cbtRetreatCoeffChangeRnd = 10 // +10% retreat damage per round after the first
cbtRetreatCoeffBaseSize = 75 // 75 SU don't change damages because of size of retreater
cbtRetreatMoreSizeChunk = 1 // each 1 SU above BaseSize (75) leads to +1 damage %
cbtRetreatLessSizeChunk = 1 // each 1 SU under BaseSize (75) leads to -1 damage % (so 1 SU retreating = -74% damages)
cbtRetreatMaxSizeMod = 200 // Can't take more than 200% of damages because of big size
cbtRetreatMinSizeMod = 25 // Can't take less than 25% of damages because of small size

added for game engines dated 120413 or later:

cbtMaxDmgReducScreener = 50 // *screener* can at most reduce dmg by 50%
cbtMaxDmgIncDisrupter = 50 // Each *disrupt* functions at +50% for retreat damage

discount for the AI is hard coded, you can't change it for now (from no discount to 50% discount)

Cavalry do more damage if only they have the *disrupt* attribute (although the damage inflicted is also
dependent on the subunit speed, so fast units have an innate expertise here). They can also reduce the damages
taken by own's side if they have *screener*. Each parameter can be changed, for example:

cbtMaxDmgIncDisrupter = 300 would mean that a *disrupt* SU would be worth 4 times his calculated worth
     (based already on combat power but also on speed, so fast SU have an innate bonus in fact)
Forums