mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08:00
Fixed that fused cards allows to cast from graveyard (see prev commit 63dbf5f40b);
This commit is contained in:
parent
63dbf5f40b
commit
abda99e203
10 changed files with 143 additions and 40 deletions
|
|
@ -1,18 +1,19 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.mana.ManaOptions;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public interface ActivatedAbility extends Ability {
|
||||
|
||||
final public class ActivationStatus {
|
||||
final class ActivationStatus {
|
||||
|
||||
private final boolean canActivate;
|
||||
private final MageObjectReference permittingObject;
|
||||
|
|
@ -34,8 +35,13 @@ public interface ActivatedAbility extends Ability {
|
|||
return new ActivationStatus(false, null);
|
||||
}
|
||||
|
||||
public static ActivationStatus getTrue() {
|
||||
return new ActivationStatus(true, null);
|
||||
/**
|
||||
* @param permittingObjectAbility card or permanent that allows to activate current ability
|
||||
*/
|
||||
public static ActivationStatus getTrue(Ability permittingObjectAbility, Game game) {
|
||||
MageObject object = permittingObjectAbility == null ? null : permittingObjectAbility.getSourceObject(game);
|
||||
MageObjectReference ref = object == null ? null : new MageObjectReference(object, game);
|
||||
return new ActivationStatus(true, ref);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
package mage.abilities;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
|
@ -17,6 +15,9 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
|
@ -108,8 +109,12 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
|||
if (getSpellAbilityType() == SpellAbilityType.SPLIT_FUSED) {
|
||||
SplitCard splitCard = (SplitCard) game.getCard(getSourceId());
|
||||
if (splitCard != null) {
|
||||
return new ActivationStatus(splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game)
|
||||
&& splitCard.getRightHalfCard().getSpellAbility().canChooseTarget(game), null);
|
||||
// fused can be called from hand only, so not permitting object allows or other zones checks
|
||||
// see https://www.mtgsalvation.com/forums/magic-fundamentals/magic-rulings/magic-rulings-archives/251926-snapcaster-mage-and-fuse
|
||||
if (game.getState().getZone(splitCard.getId()) == Zone.HAND) {
|
||||
return new ActivationStatus(splitCard.getLeftHalfCard().getSpellAbility().canChooseTarget(game)
|
||||
&& splitCard.getRightHalfCard().getSpellAbility().canChooseTarget(game), null);
|
||||
}
|
||||
}
|
||||
return ActivationStatus.getFalse();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.effects.common.PassEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class PassAbility extends ActivatedAbilityImpl {
|
||||
|
|
@ -29,7 +28,7 @@ public class PassAbility extends ActivatedAbilityImpl {
|
|||
|
||||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
return ActivationStatus.getTrue();
|
||||
return ActivationStatus.getTrue(this, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class EmergeAbility extends SpellAbility {
|
|||
new FilterControlledCreaturePermanent(), this.getControllerId(), this.getSourceId(), game)) {
|
||||
ManaCost costToPay = CardUtil.reduceCost(emergeCost.copy(), creature.getConvertedManaCost());
|
||||
if (costToPay.canPay(this, this.getSourceId(), this.getControllerId(), game)) {
|
||||
return ActivationStatus.getTrue();
|
||||
return ActivationStatus.getTrue(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.costs.Cost;
|
||||
|
|
@ -9,21 +8,18 @@ import mage.abilities.effects.ContinuousEffect;
|
|||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SpellAbilityCastMode;
|
||||
import mage.constants.SpellAbilityType;
|
||||
import mage.constants.TimingRule;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 702.32. Flashback
|
||||
*
|
||||
* <p>
|
||||
* 702.32a. Flashback appears on some instants and sorceries. It represents two
|
||||
* static abilities: one that functions while the card is in a player‘s
|
||||
* graveyard and the other that functions while the card is on the stack.
|
||||
|
|
@ -69,6 +65,7 @@ public class FlashbackAbility extends SpellAbility {
|
|||
return ActivationStatus.getFalse();
|
||||
}
|
||||
// Flashback can never cast a split card by Fuse, because Fuse only works from hand
|
||||
// https://tappedout.net/mtg-questions/snapcaster-mage-and-flashback-on-a-fuse-card-one-or-both-halves-legal-targets/
|
||||
if (card.isSplitCard()) {
|
||||
if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) {
|
||||
return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game);
|
||||
|
|
@ -218,9 +215,7 @@ class FlashbackReplacementEffect extends ReplacementEffectImpl {
|
|||
&& ((ZoneChangeEvent) event).getToZone() != Zone.EXILED) {
|
||||
|
||||
int zcc = game.getState().getZoneChangeCounter(source.getSourceId());
|
||||
if (((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == zcc) {
|
||||
return true;
|
||||
}
|
||||
return ((FixedTarget) getTargetPointer()).getZoneChangeCounter() + 1 == zcc;
|
||||
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class SpectacleAbility extends SpellAbility {
|
|||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
if (OpponentsLostLifeCount.instance.calculate(game, playerId) > 0
|
||||
&& super.canActivate(playerId, game).canActivate()) {
|
||||
return ActivationStatus.getTrue();
|
||||
return ActivationStatus.getTrue(this, game);
|
||||
}
|
||||
return ActivationStatus.getFalse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class SurgeAbility extends SpellAbility {
|
|||
if (!player.hasOpponent(playerToCheckId, game)) {
|
||||
if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(playerToCheckId) > 0
|
||||
&& super.canActivate(playerId, game).canActivate()) {
|
||||
return ActivationStatus.getTrue();
|
||||
return ActivationStatus.getTrue(this, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue