mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Fixed a problem with checkPlayableState (could be reset to early) and fixed a problem of getUsableAcitavedAbilities.
This commit is contained in:
parent
2a0723b7cd
commit
eded48648f
1 changed files with 12 additions and 8 deletions
|
@ -1574,29 +1574,33 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
@Override
|
|
||||||
public LinkedHashMap<UUID, ActivatedAbility> getUseableActivatedAbilities(MageObject object, Zone zone, Game game) {
|
public LinkedHashMap<UUID, ActivatedAbility> getUseableActivatedAbilities(MageObject object, Zone zone, Game game) {
|
||||||
// TODO: replace with getPlayableFromNonHandCardAll (uses for all tests)
|
// TODO: replace with getPlayableFromNonHandCardAll (uses for all tests)
|
||||||
|
boolean previousState = game.inCheckPlayableState();
|
||||||
game.setCheckPlayableState(true);
|
game.setCheckPlayableState(true);
|
||||||
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
|
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
|
||||||
if (object instanceof StackAbility) { // It may not be possible to activate abilities of stack abilities
|
if (object instanceof StackAbility) { // It may not be possible to activate abilities of stack abilities
|
||||||
return useable;
|
return useable;
|
||||||
}
|
}
|
||||||
if (object instanceof SplitCard) {
|
if (object instanceof SplitCard) { // TODO: use of getAbilities(game)
|
||||||
SplitCard splitCard = (SplitCard) object;
|
SplitCard splitCard = (SplitCard) object;
|
||||||
getUseableActivatedAbilitiesHalfImpl(splitCard.getLeftHalfCard(),
|
getUseableActivatedAbilitiesHalfImpl(splitCard.getLeftHalfCard(),
|
||||||
zone, game, splitCard.getLeftHalfCard().getAbilities(), useable);
|
zone, game, splitCard.getLeftHalfCard().getAbilities(game), useable);
|
||||||
getUseableActivatedAbilitiesHalfImpl(splitCard.getRightHalfCard(),
|
getUseableActivatedAbilitiesHalfImpl(splitCard.getRightHalfCard(),
|
||||||
zone, game, splitCard.getRightHalfCard().getAbilities(), useable);
|
zone, game, splitCard.getRightHalfCard().getAbilities(game), useable);
|
||||||
getUseableActivatedAbilitiesHalfImpl(splitCard,
|
getUseableActivatedAbilitiesHalfImpl(splitCard,
|
||||||
zone, game, splitCard.getSharedAbilities(), useable);
|
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,
|
getUseableActivatedAbilitiesHalfImpl(object,
|
||||||
zone, game, object.getAbilities(), useable);
|
zone, game, object.getAbilities(), useable);
|
||||||
|
getOtherUseableActivatedAbilities(object, zone, game, useable);
|
||||||
}
|
}
|
||||||
getOtherUseableActivatedAbilities(object, zone, game, useable);
|
|
||||||
game.setCheckPlayableState(false);
|
game.setCheckPlayableState(previousState);
|
||||||
return useable;
|
return useable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue