forked from External/mage
Merge pull request #7584 from weirddan455/cascade
Implemented updated Cascade ruling 702.84a
This commit is contained in:
commit
39f6b69391
12 changed files with 201 additions and 45 deletions
|
|
@ -1519,7 +1519,20 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return spells for possible cast
|
||||
* Uses in GUI to show only playable spells for choosing from the card
|
||||
* (example: effect allow to cast card and player must choose the spell ability)
|
||||
*
|
||||
* @param playerId
|
||||
* @param object
|
||||
* @param zone
|
||||
* @param game
|
||||
* @return
|
||||
*/
|
||||
public static LinkedHashMap<UUID, ActivatedAbility> getSpellAbilities(UUID playerId, MageObject object, Zone zone, Game game) {
|
||||
// it uses simple check from spellCanBeActivatedRegularlyNow
|
||||
// reason: no approved info here (e.g. forced to choose spell ability from cast card)
|
||||
LinkedHashMap<UUID, ActivatedAbility> useable = new LinkedHashMap<>();
|
||||
Abilities<Ability> allAbilities;
|
||||
if (object instanceof Card) {
|
||||
|
|
@ -1532,8 +1545,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (ability instanceof SpellAbility) {
|
||||
switch (((SpellAbility) ability).getSpellAbilityType()) {
|
||||
case BASE_ALTERNATE:
|
||||
ActivationStatus as = ((SpellAbility) ability).canActivate(playerId, game);
|
||||
if (as.canActivate()) {
|
||||
if (((SpellAbility) ability).spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(ability.getId(), (SpellAbility) ability); // example: Chandra, Torch of Defiance +1 loyal ability
|
||||
}
|
||||
return useable;
|
||||
|
|
@ -1567,7 +1579,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
return useable;
|
||||
default:
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
if (((SpellAbility) ability).spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2720,7 +2734,9 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
// casting selected card
|
||||
// TODO: fix costs (why is Panglacial Wurm automatically accepting payment?)
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), Boolean.TRUE);
|
||||
targetPlayer.cast(targetPlayer.chooseAbilityForCast(card, game, false), game, false, null);
|
||||
game.getState().setValue("PlayFromNotOwnHandZone" + card.getId(), null);
|
||||
castableCards.remove(card.getId());
|
||||
casted = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue