mirror of
https://github.com/correl/mage.git
synced 2025-04-14 09:09:38 -09:00
[TSP] small change to paradox haze to not use watcher with argument
This commit is contained in:
parent
474c9655a4
commit
53877424a0
2 changed files with 28 additions and 59 deletions
Mage.Sets/src/mage/cards/p
Mage/src/main/java/mage/watchers/common
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -9,29 +7,26 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.turn.TurnMod;
|
||||
import mage.game.turn.UpkeepStep;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.FirstTimeStepWatcher;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
public final class ParadoxHaze extends CardImpl {
|
||||
|
||||
public ParadoxHaze(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant player
|
||||
|
@ -41,7 +36,7 @@ public final class ParadoxHaze extends CardImpl {
|
|||
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(), new FirstTimeStepWatcher(EventType.UPKEEP_STEP_POST));
|
||||
this.addAbility(new ParadoxHazeTriggeredAbility(), new ParadoxHazeWatcher());
|
||||
}
|
||||
|
||||
private ParadoxHaze(final ParadoxHaze card) {
|
||||
|
@ -60,7 +55,7 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
super(Zone.BATTLEFIELD, new ParadoxHazeEffect(), false);
|
||||
}
|
||||
|
||||
ParadoxHazeTriggeredAbility(final ParadoxHazeTriggeredAbility ability) {
|
||||
private ParadoxHazeTriggeredAbility(final ParadoxHazeTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
@ -77,17 +72,13 @@ class ParadoxHazeTriggeredAbility extends TriggeredAbilityImpl {
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent permanent = game.getPermanent(getSourceId());
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getAttachedTo());
|
||||
if (player != null && game.isActivePlayer(player.getId())) {
|
||||
FirstTimeStepWatcher watcher = game.getState().getWatcher(FirstTimeStepWatcher.class, EventType.UPKEEP_STEP_POST.toString());
|
||||
if (watcher != null && !watcher.conditionMet()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(player.getId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (permanent == null
|
||||
|| !game.isActivePlayer(permanent.getAttachedTo())
|
||||
|| game.getState().getWatcher(ParadoxHazeWatcher.class).conditionMet()) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
this.getEffects().setTargetPointer(new FixedTarget(permanent.getAttachedTo()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,7 +94,7 @@ class ParadoxHazeEffect extends OneShotEffect {
|
|||
this.staticText = "that player gets an additional upkeep step after this step";
|
||||
}
|
||||
|
||||
ParadoxHazeEffect(final ParadoxHazeEffect effect) {
|
||||
private ParadoxHazeEffect(final ParadoxHazeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -118,3 +109,17 @@ class ParadoxHazeEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class ParadoxHazeWatcher extends Watcher {
|
||||
|
||||
ParadoxHazeWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == EventType.UPKEEP_STEP_POST) {
|
||||
condition = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
package mage.watchers.common;
|
||||
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
* The watcher checks if a specific phase event has already happened during the
|
||||
* current turn. If not it returns false, otherwise true.
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class FirstTimeStepWatcher extends Watcher {
|
||||
|
||||
private final EventType eventType;
|
||||
|
||||
public FirstTimeStepWatcher(EventType eventType) {
|
||||
super(WatcherScope.GAME);
|
||||
this.eventType = eventType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == eventType) {
|
||||
condition = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBasicKey(){
|
||||
return eventType.toString() + FirstTimeStepWatcher.class.getSimpleName();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue