@@ -40,7 +40,8 @@ Sint32 conductGameChallenges[NUM_CONDUCT_CHALLENGES] = { 0 }; // additional 'con
40
40
Sint32 gameStatistics[NUM_GAMEPLAY_STATISTICS] = { 0 }; // general saved game statistics to be stored in here.
41
41
std::vector<std::pair<Uint32, Uint32>> achievementRhythmOfTheKnightVec[MAXPLAYERS] = {};
42
42
bool achievementStatusRhythmOfTheKnight[MAXPLAYERS] = { false };
43
- std::pair<Uint32, Uint32> achievementThankTheTankPair[MAXPLAYERS] = { std::make_pair (0 , 0 ) };
43
+ bool achievementRhythmOfTheKnight[MAXPLAYERS] = { false };
44
+ std::map<Uint32, Uint32> achievementThankTheTankPair[MAXPLAYERS];
44
45
bool achievementStatusBaitAndSwitch[MAXPLAYERS] = { false };
45
46
Uint32 achievementBaitAndSwitchTimer[MAXPLAYERS] = { 0 };
46
47
std::unordered_set<int > clientLearnedAlchemyIngredients[MAXPLAYERS];
@@ -3453,11 +3454,11 @@ void setDefaultPlayerConducts()
3453
3454
for ( int c = 0 ; c < MAXPLAYERS; ++c )
3454
3455
{
3455
3456
achievementStatusRhythmOfTheKnight[c] = false ;
3457
+ achievementRhythmOfTheKnight[c] = false ;
3456
3458
achievementStatusStrobe[c] = false ;
3457
3459
achievementStatusThankTheTank[c] = false ;
3458
3460
achievementRhythmOfTheKnightVec[c].clear ();
3459
- achievementThankTheTankPair[c].first = 0 ;
3460
- achievementThankTheTankPair[c].second = 0 ;
3461
+ achievementThankTheTankPair[c].clear ();
3461
3462
achievementStrobeVec[c].clear ();
3462
3463
achievementStatusBaitAndSwitch[c] = false ;
3463
3464
achievementBaitAndSwitchTimer[c] = 0 ;
@@ -4023,7 +4024,11 @@ void updateAchievementRhythmOfTheKnight(int player, Entity* target, bool playerI
4023
4024
{
4024
4025
// messagePlayer(0, "achievement get!, time taken %f", timeTaken);
4025
4026
achievementStatusRhythmOfTheKnight[player] = true ;
4026
- steamAchievementClient (player, " BARONY_ACH_RHYTHM_OF_THE_KNIGHT" );
4027
+ if ( !achievementRhythmOfTheKnight[player] )
4028
+ {
4029
+ steamAchievementClient (player, " BARONY_ACH_RHYTHM_OF_THE_KNIGHT" );
4030
+ achievementRhythmOfTheKnight[player] = true ;
4031
+ }
4027
4032
}
4028
4033
achievementRhythmOfTheKnightVec[player].clear ();
4029
4034
}
@@ -4100,40 +4105,39 @@ void updateAchievementThankTheTank(int player, Entity* target, bool targetKilled
4100
4105
{
4101
4106
return ;
4102
4107
}
4103
- if ( !target )
4108
+ if ( !target || target-> behavior != &actMonster )
4104
4109
{
4105
4110
return ;
4106
4111
}
4107
- if ( achievementStatusThankTheTank[player] || multiplayer == CLIENT )
4112
+ if ( multiplayer == CLIENT )
4108
4113
{
4109
4114
return ;
4110
4115
}
4111
4116
4117
+
4118
+ auto & entry = achievementThankTheTankPair[player][target->getUID ()];
4112
4119
if ( !targetKilled )
4113
4120
{
4114
- achievementThankTheTankPair[player] = std::make_pair ( ticks, target-> getUID ()); // track the monster UID defending against
4121
+ entry = ticks;
4115
4122
// messagePlayer(0, "pair: %d, %d", achievementThankTheTankPair[player].first, achievementThankTheTankPair[player].second);
4116
4123
}
4117
- else if ( achievementThankTheTankPair[player].first != 0
4118
- && achievementThankTheTankPair[player].second != 0 ) // check there is a ticks/UID entry.
4124
+ else if ( entry != 0 ) // check there is a ticks/UID entry.
4119
4125
{
4120
4126
if ( players[player] && players[player]->entity )
4121
4127
{
4122
4128
if ( players[player]->entity ->checkEnemy (target) )
4123
4129
{
4124
- if ( target->getUID () == achievementThankTheTankPair[player].second )
4130
+ // check timestamp within 3 seconds.
4131
+ if ( (ticks - entry) / 50 .f < 3 .f )
4125
4132
{
4126
- // same target dying, check timestamp within 3 seconds.
4127
- if ( (ticks - achievementThankTheTankPair[player].first ) / 50 .f < 3 .f )
4133
+ achievementStatusThankTheTank[player] = true ;
4134
+ achievementThankTheTankPair[player].erase (target->getUID ());
4135
+ if ( players[player]->mechanics .allowedRaiseBlockingAgainstEntity (*target) )
4128
4136
{
4129
- achievementStatusThankTheTank [player] = true ;
4130
- if ( players[player]-> mechanics . allowedRaiseBlockingAgainstEntity (*target) )
4137
+ int skillLVL = 3 * (stats [player]-> getProficiency (PRO_SHIELD) / 20 ) ;
4138
+ if ( local_rng. rand () % ( 5 + skillLVL) == 0 )
4131
4139
{
4132
- int skillLVL = 3 * (stats[player]->getProficiency (PRO_SHIELD) / 20 );
4133
- if ( local_rng.rand () % (5 + skillLVL) == 0 )
4134
- {
4135
- players[player]->entity ->increaseSkill (PRO_SHIELD);
4136
- }
4140
+ players[player]->entity ->increaseSkill (PRO_SHIELD);
4137
4141
}
4138
4142
}
4139
4143
}
0 commit comments