Skip to content

Commit cfdd703

Browse files
committed
Fix duplicate conquered villain messages when killing fighters after a duel
1 parent 46fef70 commit cfdd703

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

collective.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ const optional<Collective::AlarmInfo>& Collective::getAlarmInfo() const {
747747
}
748748

749749
bool Collective::needsToBeKilledToConquer(const Creature* c) const {
750-
return hasTrait(c, MinionTrait::FIGHTER) || hasTrait(c, MinionTrait::LEADER);
750+
return (hasTrait(c, MinionTrait::FIGHTER) && !c->wasDuel()) || hasTrait(c, MinionTrait::LEADER);
751751
}
752752

753753
bool Collective::creatureConsideredPlayer(Creature* c) const {

creature.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,10 @@ void Creature::removePrivateEnemy(const Creature* c) {
17031703
privateEnemies.erase(c);
17041704
}
17051705

1706+
bool Creature::wasDuel() const {
1707+
return !!duelInfo;
1708+
}
1709+
17061710
void Creature::setDuel(TribeId enemyTribe, Creature* opponent, GlobalTime timeout) {
17071711
duelInfo = DuelInfo{enemyTribe, opponent ? opponent->getUniqueId() : Creature::Id{}, timeout};
17081712
if (steed)

creature.h

+1
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ class Creature : public Renderable, public UniqueEntity<Creature>, public OwnedO
343343
bool canBeCaptured() const;
344344
void removePrivateEnemy(const Creature*);
345345
void setDuel(TribeId enemyTribe, Creature* opponent, GlobalTime timeout);
346+
bool wasDuel() const;
346347
const vector<AutomatonPart>& getAutomatonParts() const;
347348
bool isAutomaton() const;
348349
void addAutomatonPart(AutomatonPart);

0 commit comments

Comments
 (0)