Don't add additional instances of redundant abilities

This commit is contained in:
xenohedron 2023-06-09 21:01:45 -04:00
parent c7dca62fd8
commit 1d2b6cbfab

View file

@ -1202,6 +1202,12 @@ public class GameState implements Serializable, Copyable<GameState> {
Ability newAbility;
if (ability instanceof MageSingleton || !copyAbility) {
// Avoid adding another instance of an ability where multiple copies are redundant
if (attachedTo.getAbilities().contains(ability)
|| (getAllOtherAbilities(attachedTo.getId()) != null
&& getAllOtherAbilities(attachedTo.getId()).contains(ability))) {
return;
}
newAbility = ability;
} else {
// must use new id, so you can add multiple instances of the same ability