From eded48648f60293381c2ac205bc5072cc9dfc51d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Fri, 10 Jan 2020 15:51:44 +0100 Subject: [PATCH] * Fixed a problem with checkPlayableState (could be reset to early) and fixed a problem of getUsableAcitavedAbilities. --- .../main/java/mage/players/PlayerImpl.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index ff095fb42b..084a717f0a 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -1574,29 +1574,33 @@ public abstract class PlayerImpl implements Player, Serializable { } } } - - @Override + @Override public LinkedHashMap getUseableActivatedAbilities(MageObject object, Zone zone, Game game) { // TODO: replace with getPlayableFromNonHandCardAll (uses for all tests) + boolean previousState = game.inCheckPlayableState(); game.setCheckPlayableState(true); LinkedHashMap useable = new LinkedHashMap<>(); if (object instanceof StackAbility) { // It may not be possible to activate abilities of stack abilities return useable; } - if (object instanceof SplitCard) { + if (object instanceof SplitCard) { // TODO: use of getAbilities(game) SplitCard splitCard = (SplitCard) object; getUseableActivatedAbilitiesHalfImpl(splitCard.getLeftHalfCard(), - zone, game, splitCard.getLeftHalfCard().getAbilities(), useable); + zone, game, splitCard.getLeftHalfCard().getAbilities(game), useable); getUseableActivatedAbilitiesHalfImpl(splitCard.getRightHalfCard(), - zone, game, splitCard.getRightHalfCard().getAbilities(), useable); + zone, game, splitCard.getRightHalfCard().getAbilities(game), useable); getUseableActivatedAbilitiesHalfImpl(splitCard, zone, game, splitCard.getSharedAbilities(), useable); - } else { + } else if (object instanceof Card){ + getUseableActivatedAbilitiesHalfImpl(object, + zone, game, ((Card)object).getAbilities(game), useable); + } else if (object != null) { getUseableActivatedAbilitiesHalfImpl(object, zone, game, object.getAbilities(), useable); + getOtherUseableActivatedAbilities(object, zone, game, useable); } - getOtherUseableActivatedAbilities(object, zone, game, useable); - game.setCheckPlayableState(false); + + game.setCheckPlayableState(previousState); return useable; }