mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
Don't add additional instances of redundant abilities
This commit is contained in:
parent
c7dca62fd8
commit
1d2b6cbfab
1 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue