Skip to content

Commit ae8897e

Browse files
committed
Made body part and side part of the custom commendation system
1 parent fd383d9 commit ae8897e

3 files changed

Lines changed: 22 additions & 28 deletions

File tree

bin/data/Ruleset/Commendations.rul

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,8 @@ extraStrings:
964964
# or one of these factions: FACTION_HOSTILE, FACTION_NEUTRAL, FACTION_PLAYER.
965965
# or one of these battle types: BT_FIREARM, BT_AMMO, BT_MELEE, BT_GRENADE, BT_PROXIMITYGRENADE, BT_MEDIKIT, BT_SCANNER, BT_MINDPROBE, BT_PSIAMP, BT_FLARE, BT_CORPSE
966966
# or one of these damage types: DT_AP, DT_IN, DT_HE, DT_LASER, DT_PLASMA, DT_STUN, DT_MELEE, DT_ACID, DT_SMOKE
967+
# or one of these sides: SIDE_FRONT, SIDE_LEFT, SIDE_RIGHT, SIDE_REAR, SIDE_UNDER
968+
# or one of these body parts: BODYPART_HEAD, BODYPART_TORSO, BODYPART_RIGHTARM, BODYPART_LEFTARM, BODYPART_RIGHTLEG, BODYPART_LEFTLEG
967969
# Use the strings from the ruleset to define them (mods can be used too).
968970
# For example, look at "STR_MEDAL_BOLTS_CROSS_NAME". It is awarded if a soldier
969971
# stuns one hostile commander or stuns one hostile leader.
@@ -1182,22 +1184,33 @@ commendations:
11821184
description: STR_MEDAL_HEADSHOT_DESCRIPTION
11831185
sprite: 32
11841186
criteria:
1185-
totalHeadShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1187+
killsWithCriteriaCareer: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1188+
killCriteria:
1189+
-
1190+
1: ["BODYPART_HEAD", "FACTION_HOSTILE", "STATUS_DEAD"]
11861191
- type: STR_MEDAL_REARSHOT_NAME
11871192
description: STR_MEDAL_REARSHOT_DESCRIPTION
11881193
sprite: 32
11891194
criteria:
1190-
totalRearShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1195+
killsWithCriteriaCareer: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1196+
killCriteria:
1197+
-
1198+
1: ["SIDE_REAR", "FACTION_HOSTILE", "STATUS_DEAD"]
11911199
- type: STR_MEDAL_FLANKSHOT_NAME
11921200
description: STR_MEDAL_FLANKSHOT_DESCRIPTION
11931201
sprite: 32
11941202
criteria:
1195-
totalFlankShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1203+
killsWithCriteriaCareer: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1204+
killCriteria:
1205+
-
1206+
1: ["SIDE_LEFT", "FACTION_HOSTILE", "STATUS_DEAD"]
1207+
-
1208+
1: ["SIDE_RIGHT", "FACTION_HOSTILE", "STATUS_DEAD"]
11961209
- type: STR_MEDAL_HEALER_NAME
11971210
description: STR_MEDAL_HEALER_DESCRIPTION
11981211
sprite: 32
11991212
criteria:
1200-
totalWoundsHealed: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1213+
killsWithCriteriaCareer: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
12011214
ufopaedia:
12021215
- id: STR_MEDAL_MILITARY_CROSS_NAME
12031216
type_id: 7

src/Savegame/SoldierDiary.cpp

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ SoldierDiary::SoldierDiary() : _killList(), _regionTotal(), _countryTotal(), _ty
3939
_nightTerrorMissionTotal(0), _monthsService(0), _unconciousTotal(0), _shotAtCounterTotal(0), _hitCounterTotal(0), _loneSurvivorTotal(0),
4040
_totalShotByFriendlyCounter(0), _totalShotFriendlyCounter(0), _ironManTotal(0), _importantMissionTotal(0), _longDistanceHitCounterTotal(0),
4141
_lowAccuracyHitCounterTotal(0), _shotsFiredCounterTotal(0), _shotsLandedCounterTotal(0), _shotAtCounter10in1Mission(0), _hitCounter5in1Mission(0),
42-
_reactionFireTotal(0), _timesWoundedTotal(0), _valiantCruxTotal(0), _KIA(0), _trapKillTotal(0), _alienBaseAssaultTotal(0), _allAliensKilledTotal(0), _allAliensStunnedTotal(0)
42+
_reactionFireTotal(0), _timesWoundedTotal(0), _valiantCruxTotal(0), _KIA(0), _trapKillTotal(0), _alienBaseAssaultTotal(0), _allAliensKilledTotal(0), _allAliensStunnedTotal(0),
43+
_woundsHealedTotal(0)
4344
{
4445
}
4546
/**
@@ -108,9 +109,6 @@ void SoldierDiary::load(const YAML::Node& node)
108109
_alienBaseAssaultTotal = node["alienBaseAssaultTotal"].as<int>(_alienBaseAssaultTotal);
109110
_allAliensKilledTotal = node["allAliensKilledTotal"].as<int>(_allAliensKilledTotal);
110111
_allAliensStunnedTotal = node["_allAliensStunnedTotal"].as<int>(_allAliensStunnedTotal);
111-
_headshotTotal = node["_headshotTotal"].as<int>(_headshotTotal);
112-
_rearshotTotal = node["_rearshotTotal"].as<int>(_rearshotTotal);
113-
_flankshotTotal = node["_flankshotTotal"].as<int>(_flankshotTotal);
114112
_woundsHealedTotal = node["_woundsHealedTotal"].as<int>(_woundsHealedTotal);
115113
}
116114
/**
@@ -160,9 +158,6 @@ YAML::Node SoldierDiary::save() const
160158
if (_alienBaseAssaultTotal) node["alienBaseAssaultTotal"] = _alienBaseAssaultTotal;
161159
if (_allAliensKilledTotal) node["allAliensKilledTotal"] = _allAliensKilledTotal;
162160
if (_allAliensStunnedTotal) node["_allAliensStunnedTotal"] = _allAliensStunnedTotal;
163-
if (_headshotTotal) node["_headshotTotal"] = _headshotTotal;
164-
if (_rearshotTotal) node["_rearshotTotal"] = _rearshotTotal;
165-
if (_flankshotTotal) node["_flankshotTotal"] =_flankshotTotal;
166161
if (_woundsHealedTotal) node["_woundsHealedTotal"] = _woundsHealedTotal;
167162
return node;
168163
}
@@ -183,18 +178,6 @@ void SoldierDiary::updateDiary(BattleUnitStatistics *unitStatistics, MissionStat
183178
if ((*kill)->getUnitStatusString() == "STATUS_DEAD")
184179
{
185180
_killTotal++;
186-
if ((*kill)->getUnitBodyPartString() == "BODYPART_HEAD")
187-
{
188-
_headshotTotal++;
189-
}
190-
if ((*kill)->getUnitSideString() == "SIDE_REAR")
191-
{
192-
_rearshotTotal++;
193-
}
194-
if ((*kill)->getUnitSideString() == "SIDE_LEFT" || (*kill)->getUnitSideString() == "SIDE_RIGHT")
195-
{
196-
_flankshotTotal++;
197-
}
198181
}
199182
else if ((*kill)->getUnitStatusString() == "STATUS_UNCONSCIOUS")
200183
{
@@ -341,9 +324,6 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
341324
((*j).first == "totalAlienBaseAssaults" && _alienBaseAssaultTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
342325
((*j).first == "totalAllAliensKilled" && _allAliensKilledTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
343326
((*j).first == "totalAllAliensStunned" && _allAliensStunnedTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
344-
((*j).first == "totalHeadShots" && _headshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
345-
((*j).first == "totalRearShots" && _rearshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
346-
((*j).first == "totalFlankShots" && _flankshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
347327
((*j).first == "totalWoundsHealed" && _woundsHealedTotal < (*j).second.at(nextCommendationLevel["noNoun"])) )
348328
{
349329
awardCommendationBool = false;
@@ -479,7 +459,8 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
479459
(*singleKill)->weapon != (*detail) && (*singleKill)->weaponAmmo != (*detail) &&
480460
(*singleKill)->getUnitStatusString() != (*detail) && (*singleKill)->getUnitFactionString() != (*detail) &&
481461
rules->getItem((*singleKill)->weaponAmmo)->getDamageType() != damageType &&
482-
rules->getItem((*singleKill)->weapon)->getBattleType() != battleType) )
462+
rules->getItem((*singleKill)->weapon)->getBattleType() != battleType &&
463+
(*singleKill)->getUnitSideString() != (*detail) && (*singleKill)->getUnitBodyPartString() != (*detail)) )
483464
{
484465
foundMatch = false;
485466
break;

src/Savegame/SoldierDiary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SoldierDiary
7676
_terrorMissionTotal, _nightMissionTotal, _nightTerrorMissionTotal, _monthsService, _unconciousTotal, _shotAtCounterTotal, _hitCounterTotal, _ironManTotal,
7777
_importantMissionTotal, _longDistanceHitCounterTotal, _lowAccuracyHitCounterTotal, _shotsFiredCounterTotal, _shotsLandedCounterTotal, _shotAtCounter10in1Mission,
7878
_hitCounter5in1Mission, _reactionFireTotal, _timesWoundedTotal, _valiantCruxTotal, _KIA, _trapKillTotal, _alienBaseAssaultTotal, _allAliensKilledTotal, _allAliensStunnedTotal,
79-
_headshotTotal, _rearshotTotal, _flankshotTotal, _woundsHealedTotal;
79+
_woundsHealedTotal;
8080
void manageModularCommendations(std::map<std::string, int> &nextCommendationLevel, std::map<std::string, int> &modularCommendations, std::pair<std::string, int> statTotal, int criteria);
8181
void awardCommendation(std::string type, std::string noun = "noNoun");
8282
public:

0 commit comments

Comments
 (0)