mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
* Alternative costs - fixed that it can be activated on free cast (example: cascade with overload, #6925, #7410, #7741, #6342);
This commit is contained in:
parent
6aaf461362
commit
6bc5a00e8a
7 changed files with 151 additions and 44 deletions
|
|
@ -1544,13 +1544,14 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* for choosing from the card (example: effect allow to cast card and player
|
||||
* must choose the spell ability)
|
||||
*
|
||||
* @param game
|
||||
* @param playerId
|
||||
* @param object
|
||||
* @param zone
|
||||
* @param game
|
||||
* @param noMana
|
||||
* @return
|
||||
*/
|
||||
public static LinkedHashMap<UUID, ActivatedAbility> getSpellAbilities(UUID playerId, MageObject object, Zone zone, Game game) {
|
||||
public static LinkedHashMap<UUID, ActivatedAbility> getCastableSpellAbilities(Game game, UUID playerId, MageObject object, Zone zone, boolean noMana) {
|
||||
// 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<>();
|
||||
|
|
@ -1563,16 +1564,29 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
|
||||
for (Ability ability : allAbilities) {
|
||||
if (ability instanceof SpellAbility) {
|
||||
switch (((SpellAbility) ability).getSpellAbilityType()) {
|
||||
SpellAbility spellAbility = (SpellAbility) ability;
|
||||
|
||||
switch (spellAbility.getSpellAbilityType()) {
|
||||
case BASE_ALTERNATE:
|
||||
if (((SpellAbility) ability).spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(ability.getId(), (SpellAbility) ability); // example: Chandra, Torch of Defiance +1 loyal ability
|
||||
// rules:
|
||||
// If you cast a spell “without paying its mana cost,” you can’t choose to cast it for
|
||||
// any alternative costs. You can, however, pay additional costs, such as kicker costs.
|
||||
// If the card has any mandatory additional costs, those must be paid to cast the spell.
|
||||
// (2021-02-05)
|
||||
if (!noMana) {
|
||||
if (spellAbility.spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(spellAbility.getId(), spellAbility); // example: Chandra, Torch of Defiance +1 loyal ability
|
||||
}
|
||||
return useable;
|
||||
}
|
||||
return useable;
|
||||
break;
|
||||
case SPLIT_FUSED:
|
||||
// rules:
|
||||
// If you cast a split card with fuse from your hand without paying its mana cost,
|
||||
// you can choose to use its fuse ability and cast both halves without paying their mana costs.
|
||||
if (zone == Zone.HAND) {
|
||||
if (ability.canChooseTarget(game, playerId)) {
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
if (spellAbility.canChooseTarget(game, playerId)) {
|
||||
useable.put(spellAbility.getId(), spellAbility);
|
||||
}
|
||||
}
|
||||
case SPLIT:
|
||||
|
|
@ -1599,8 +1613,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
return useable;
|
||||
default:
|
||||
if (((SpellAbility) ability).spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(ability.getId(), (SpellAbility) ability);
|
||||
if (spellAbility.spellCanBeActivatedRegularlyNow(playerId, game)) {
|
||||
useable.put(spellAbility.getId(), spellAbility);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue