MoreWillRollStats

Tracking Issue: #936

This feature provides mods additional options when creating will loss events through XComGameStateContext_WillRoll. Adds new elements to enum WillEventRoll_StatType and adds implementation of the new elements to CalculateWillRoll. Elements of WillEventRoll_StatType are used when creating WillEventRollData in configuration files. Example from XComGameCore.ini:

[XComGame.X2EventListener_DefaultWillEvents]
SawEnemyUnitWillRollData=(WillLossChance=0.5, \\
                          FlatWillLossChance=true, \\
                          WillLossStat=WillEventRollStat_MaxWill, \\
                          WillLossStatMultiplier=0.05, \\
                          MinimumWillLoss=1, \\
                          MaxWillPercentageLostPerMission=0.33)

Current Additions

WillEventRollStat_Flat

  • Calculated Will Loss: 1.0f
  • This element existed, but was not implemented in the base game code.
  • Similar to WillEventRollStat_None, but allows will loss to be modified by X2SitRepEffect_ModifyWillPenalties effects.
  • For example usage of X2SitRepEffect_ModifyWillPenalties see X2SitRep_DefaultSitRepEffects:CreateDarkEventDarkTowerEffectTemplate.

WillEventRollStat_CHPercentageHealthLost

  • Calculated Will Loss: (Unit's Max HP - Unit's Current HP) / Unit's Max HP
  • Corrected version of WillEventRollStat_PercentageHealthLost that actually gives the health lost (as opposed to health remaining).
  • If a soldier with 5 max HP takes 2 damage to ablative HP, the calculation for will loss would be (5 - 5) / 5 = 0. If they then took another 3 damage, the will loss would be (5 - 2) / 5 = 0.6, as they have lost 60% of their total HP at this point.

WillEventRollStat_CHTurnCountDecimal

  • Calculated Will Loss: 1 + (Player's Turn Count / 10)
  • This allows for a gradual increase in the amount of will lost as the mission goes on.
  • At turn 1 the calculated will loss is 1.1, and at turn 10 it will have nearly doubled to 2.0.

Source code references