@@ -40,7 +40,7 @@ SoldierDiary::SoldierDiary() : _killList(), _regionTotal(), _countryTotal(), _ty
4040 _totalShotByFriendlyCounter(0 ), _totalShotFriendlyCounter(0 ), _ironManTotal(0 ), _importantMissionTotal(0 ), _longDistanceHitCounterTotal(0 ),
4141 _lowAccuracyHitCounterTotal(0 ), _shotsFiredCounterTotal(0 ), _shotsLandedCounterTotal(0 ), _shotAtCounter10in1Mission(0 ), _hitCounter5in1Mission(0 ),
4242 _reactionFireTotal(0 ), _timesWoundedTotal(0 ), _valiantCruxTotal(0 ), _KIA(0 ), _trapKillTotal(0 ), _alienBaseAssaultTotal(0 ), _allAliensKilledTotal(0 ), _allAliensStunnedTotal(0 ),
43- _woundsHealedTotal(0 ), _allUFOs(0 ), _allMissionTypes(0 )
43+ _woundsHealedTotal(0 ), _allUFOs(0 ), _allMissionTypes(0 ), _statGainTotal( 0 )
4444{
4545}
4646/* *
@@ -112,6 +112,7 @@ void SoldierDiary::load(const YAML::Node& node)
112112 _woundsHealedTotal = node[" _woundsHealedTotal" ].as <int >(_woundsHealedTotal);
113113 _allUFOs = node[" _allUFOs" ].as <int >(_allUFOs);
114114 _allMissionTypes = node[" _allMissionTypes" ].as <int >(_allMissionTypes);
115+ _statGainTotal = node[" _statGainTotal" ].as <int >(_statGainTotal);
115116}
116117/* *
117118 * Saves the diary to a YAML file.
@@ -163,6 +164,7 @@ YAML::Node SoldierDiary::save() const
163164 if (_woundsHealedTotal) node[" _woundsHealedTotal" ] = _woundsHealedTotal;
164165 if (_allUFOs) node[" _allUFOs" ] = _allUFOs;
165166 if (_allMissionTypes) node[" _allMissionTypes" ] = _allMissionTypes;
167+ if (_statGainTotal) node[" _statGainTotal" ] =_statGainTotal;
166168 return node;
167169}
168170/* *
@@ -253,6 +255,20 @@ void SoldierDiary::updateDiary(BattleUnitStatistics *unitStatistics, MissionStat
253255 _allUFOs = 1 ;
254256 if ((_UFOTotal.size () + _typeTotal.size ()) == (rules->getUfosList ().size () + rules->getDeploymentsList ().size () - 2 ))
255257 _allMissionTypes = 1 ;
258+
259+ // Stat change long hand calculation
260+ _statGainTotal += unitStatistics->delta .tu ;
261+ _statGainTotal += unitStatistics->delta .stamina ;
262+ _statGainTotal += unitStatistics->delta .health ;
263+ _statGainTotal += unitStatistics->delta .bravery / 10 ; // Normalize
264+ _statGainTotal += unitStatistics->delta .reactions ;
265+ _statGainTotal += unitStatistics->delta .firing ;
266+ _statGainTotal += unitStatistics->delta .throwing ;
267+ _statGainTotal += unitStatistics->delta .strength ;
268+ _statGainTotal += unitStatistics->delta .psiStrength ;
269+ _statGainTotal += unitStatistics->delta .melee ;
270+ _statGainTotal += unitStatistics->delta .psiSkill ;
271+
256272 _missionIdList.push_back (missionStatistics->id );
257273}
258274/* *
@@ -334,7 +350,8 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
334350 ((*j).first == " totalAllAliensStunned" && _allAliensStunnedTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
335351 ((*j).first == " totalWoundsHealed" && _woundsHealedTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
336352 ((*j).first == " totalAllUFOs" && _allUFOs < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
337- ((*j).first == " totalAllMissionTypes" && _allMissionTypes < (*j).second .at (nextCommendationLevel[" noNoun" ])) )
353+ ((*j).first == " totalAllMissionTypes" && _allMissionTypes < (*j).second .at (nextCommendationLevel[" noNoun" ])) ||
354+ ((*j).first == " totalStatGain" && _statGainTotal < (*j).second .at (nextCommendationLevel[" noNoun" ])) )
338355 {
339356 awardCommendationBool = false ;
340357 break ;
0 commit comments