* Commander: fixed duplicated triggers after play (example: Esika, God of the Tree, see #7501, #7503, #7505);

This commit is contained in:
Oleg Agafonov 2021-02-06 10:51:41 +04:00
parent aa13b06af9
commit ac98a3a31a
6 changed files with 108 additions and 19 deletions

View file

@ -630,10 +630,6 @@ public class GameState implements Serializable, Copyable<GameState> {
}
}
private void addTrigger(TriggeredAbility ability, MageObject attachedTo) {
addTrigger(ability, null, attachedTo);
}
private void addTrigger(TriggeredAbility ability, UUID sourceId, MageObject attachedTo) {
if (sourceId == null) {
triggers.add(ability, attachedTo);

View file

@ -73,10 +73,21 @@ public class Commander implements CommandObject {
// other abilities
for (Ability ability : card.getAbilities()) {
if (!(ability instanceof SpellAbility) && !(ability instanceof PlayLandAbility)) {
Ability newAbility = ability.copy();
abilities.add(newAbility);
// skip already added above
if (ability instanceof SpellAbility || ability instanceof PlayLandAbility) {
continue;
}
// skip triggers
// workaround to fix double triggers for commanders on battlefield (example: Esika, God of the Tree)
// TODO: is commanders on command zone can have triggers (is there a card with triggered ability in all zones)?
if (ability instanceof TriggeredAbility) {
continue;
}
// OK, can add it (example: activated, static, alternative cost, etc)
Ability newAbility = ability.copy();
abilities.add(newAbility);
}
}