Skip to content

Commit b9b82a8

Browse files
committed
Added flank shot commendation
1 parent d8337d5 commit b9b82a8

3 files changed

Lines changed: 28 additions & 4 deletions

File tree

bin/data/Ruleset/Commendations.rul

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,8 @@ extraStrings:
293293
STR_MEDAL_HEADSHOT_DESCRIPTION: "Given to a soldier with a steady hand who has landed multiple headshots."
294294
STR_MEDAL_REARSHOT_NAME: "Cunning Citation"
295295
STR_MEDAL_REARSHOT_DESCRIPTION: "Given to a soldier who has demonstrated cunning, able to surprise enemies and kill them from behind."
296+
STR_MEDAL_FLANKSHOT_NAME: "Tactition Citation"
297+
STR_MEDAL_FLANKSHOT_DESCRIPTION: "Given to a soldier who has demonstratd great tactic, able to flank and kill enemies."
296298
STR_AWARD_0: "First award"
297299
STR_AWARD_1: "Second award"
298300
STR_AWARD_2: "Third award"
@@ -437,6 +439,8 @@ extraStrings:
437439
STR_MEDAL_HEADSHOT_DESCRIPTION: "Given to a soldier with a steady hand who has landed multiple headshots."
438440
STR_MEDAL_REARSHOT_NAME: "Cunning Citation"
439441
STR_MEDAL_REARSHOT_DESCRIPTION: "Given to a soldier who has demonstrated cunning, able to surprise enemies and kill them from behind."
442+
STR_MEDAL_FLANKSHOT_NAME: "Tactition Citation"
443+
STR_MEDAL_FLANKSHOT_DESCRIPTION: "Given to a soldier who has demonstratd great tactic, able to flank and kill enemies."
440444
STR_AWARD_0: "First award"
441445
STR_AWARD_1: "Second award"
442446
STR_AWARD_2: "Third award"
@@ -941,6 +945,7 @@ extraStrings:
941945
# isDead
942946
# totalHeadShots
943947
# totalRearShots
948+
# totalFlankShots
944949
# The following criteria use a hardcoded noun for the name/description.
945950
# They are INCOMPATIBLE with eachother. If used together,
946951
# the commendation will be given out repeatedly.
@@ -1178,7 +1183,12 @@ commendations:
11781183
description: STR_MEDAL_REARSHOT_DESCRIPTION
11791184
sprite: 32
11801185
criteria:
1181-
totalRearShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1186+
totalRearShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
1187+
- type: STR_MEDAL_FLANKSHOT_NAME
1188+
description: STR_MEDAL_FLANKSHOT_DESCRIPTION
1189+
sprite: 32
1190+
criteria:
1191+
totalFlankShots: [3, 6, 9, 9, 9, 9, 12, 12, 12, 12]
11821192
ufopaedia:
11831193
- id: STR_MEDAL_MILITARY_CROSS_NAME
11841194
type_id: 7
@@ -1431,7 +1441,14 @@ ufopaedia:
14311441
image_id: NIKE_CROSS
14321442
text: STR_MEDAL_REARSHOT_MEDAL_UFOPEDIA
14331443
text_width: 164
1434-
listOrder: 6033
1444+
listOrder: 6033
1445+
- id: STR_MEDAL_FLANKSHOT_NAME
1446+
type_id: 7
1447+
section: STR_HEAVY_WEAPONS_PLATFORMS
1448+
image_id: NIKE_CROSS
1449+
text: STR_MEDAL_FLANKSHOT_MEDAL_UFOPEDIA
1450+
text_width: 164
1451+
listOrder: 6033
14351452
# entries below move the HWPs to the Craft Section of the UFOPedia
14361453
- id: STR_TANK_CANNON
14371454
section: STR_XCOM_CRAFT_ARMAMENT

src/Savegame/SoldierDiary.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void SoldierDiary::load(const YAML::Node& node)
110110
_allAliensStunnedTotal = node["_allAliensStunnedTotal"].as<int>(_allAliensStunnedTotal);
111111
_headshotTotal = node["_headshotTotal"].as<int>(_headshotTotal);
112112
_rearshotTotal = node["_rearshotTotal"].as<int>(_rearshotTotal);
113+
_flankshotTotal = node["_flankshotTotal"].as<int>(_flankshotTotal);
113114
}
114115
/**
115116
* Saves the diary to a YAML file.
@@ -160,6 +161,7 @@ YAML::Node SoldierDiary::save() const
160161
if (_allAliensStunnedTotal) node["_allAliensStunnedTotal"] = _allAliensStunnedTotal;
161162
if (_headshotTotal) node["_headshotTotal"] = _headshotTotal;
162163
if (_rearshotTotal) node["_rearshotTotal"] = _rearshotTotal;
164+
if (_flankshotTotal) node["_flankshotTotal"] =_flankshotTotal;
163165
return node;
164166
}
165167
/**
@@ -186,6 +188,10 @@ void SoldierDiary::updateDiary(BattleUnitStatistics *unitStatistics, MissionStat
186188
if ((*kill)->getUnitSideString() == "SIDE_REAR")
187189
{
188190
_rearshotTotal++;
191+
}
192+
if ((*kill)->getUnitSideString() == "SIDE_LEFT" || (*kill)->getUnitSideString() == "SIDE_RIGHT")
193+
{
194+
_flankshotTotal++;
189195
}
190196
}
191197
else if ((*kill)->getUnitStatusString() == "STATUS_UNCONSCIOUS")
@@ -333,7 +339,8 @@ bool SoldierDiary::manageCommendations(Ruleset *rules)
333339
((*j).first == "totalAllAliensKilled" && _allAliensKilledTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
334340
((*j).first == "totalAllAliensStunned" && _allAliensStunnedTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
335341
((*j).first == "totalHeadShots" && _headshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
336-
((*j).first == "totalRearShots" && _rearshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) )
342+
((*j).first == "totalRearShots" && _rearshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) ||
343+
((*j).first == "totalFlankShots" && _flankshotTotal < (*j).second.at(nextCommendationLevel["noNoun"])) )
337344
{
338345
awardCommendationBool = false;
339346
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;
79+
_headshotTotal, _rearshotTotal, _flankshotTotal;
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)