mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
* Paradox Haze - Fixed that check if a step is the first upkeep step of a turn did not work always correctly (fixes #1313).
This commit is contained in:
parent
aa525bf0d2
commit
303362fa12
4 changed files with 183 additions and 23 deletions
|
|
@ -28,13 +28,12 @@
|
|||
package mage.sets.tempest;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.permanent.token.SaprolingToken;
|
||||
|
||||
|
|
@ -51,6 +50,8 @@ public class VerdantForce extends CardImpl {
|
|||
|
||||
this.power = new MageInt(7);
|
||||
this.toughness = new MageInt(7);
|
||||
|
||||
// At the beginning of each upkeep, put a 1/1 green Saproling creature token onto the battlefield.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new CreateTokenEffect(new SaprolingToken()), TargetController.ANY, false));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import mage.game.turn.UpkeepStep;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.FirstTimeStepWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -59,15 +60,14 @@ public class ParadoxHaze extends CardImpl {
|
|||
this.expansionSetCode = "TSP";
|
||||
this.subtype.add("Aura");
|
||||
|
||||
|
||||
// Enchant player
|
||||
TargetPlayer auraTarget = new TargetPlayer();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Neutral));
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
|
||||
// At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step.
|
||||
this.addAbility(new ParadoxHazeTriggeredAbility());
|
||||
this.addAbility(new ParadoxHazeTriggeredAbility(), new FirstTimeStepWatcher(EventType.UPKEEP_STEP_POST));
|
||||
}
|
||||
|
||||
public ParadoxHaze(final ParadoxHaze card) {
|
||||
|
|
@ -81,18 +81,15 @@ public class ParadoxHaze extends CardImpl {
|
|||
}
|
||||
|
||||
class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
protected int lastTriggerTurnNumber;
|
||||
|
||||
|
||||
ParadoxHazeTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new ParadoxHazeEffect(), false);
|
||||
}
|
||||
|
||||
|
||||
ParadoxHazeTriggeredAbility(final ParadoxHazeTriggeredAbility ability) {
|
||||
super(ability);
|
||||
lastTriggerTurnNumber = ability.lastTriggerTurnNumber;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ParadoxHazeTriggeredAbility copy() {
|
||||
return new ParadoxHazeTriggeredAbility(this);
|
||||
|
|
@ -102,21 +99,23 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.UPKEEP_STEP_PRE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(this.sourceId);
|
||||
Permanent permanent = game.getPermanent(getSourceId());
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getAttachedTo());
|
||||
if (player != null && game.getActivePlayerId().equals(player.getId()) && lastTriggerTurnNumber != game.getTurnNum()) {
|
||||
lastTriggerTurnNumber = game.getTurnNum();
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||
return true;
|
||||
if (player != null && game.getActivePlayerId().equals(player.getId())) {
|
||||
FirstTimeStepWatcher watcher = (FirstTimeStepWatcher) game.getState().getWatchers().get(EventType.UPKEEP_STEP_POST.toString() + FirstTimeStepWatcher.class.getName());
|
||||
if (watcher != null && !watcher.conditionMet()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "At the beginning of enchanted player's first upkeep each turn, that player gets an additional upkeep step after this step.";
|
||||
|
|
@ -124,21 +123,21 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
class ParadoxHazeEffect extends OneShotEffect {
|
||||
|
||||
|
||||
ParadoxHazeEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "that player gets an additional upkeep step after this step";
|
||||
}
|
||||
|
||||
|
||||
ParadoxHazeEffect(final ParadoxHazeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ParadoxHazeEffect copy() {
|
||||
return new ParadoxHazeEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
game.getState().getTurnMods().add(new TurnMod(this.getTargetPointer().getFirst(game, source), new UpkeepStep(), null));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue