mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
Revenant Patriarch trigger fixed
This commit is contained in:
parent
5c65b278ab
commit
bbeb421f91
1 changed files with 15 additions and 13 deletions
|
@ -30,10 +30,11 @@ package mage.sets.sorinvstibalt;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.TriggeredAbility;
|
||||||
import mage.abilities.common.CantBlockAbility;
|
import mage.abilities.common.CantBlockAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.condition.Condition;
|
|
||||||
import mage.abilities.condition.common.ManaWasSpentCondition;
|
import mage.abilities.condition.common.ManaWasSpentCondition;
|
||||||
|
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -44,6 +45,7 @@ import mage.constants.TurnPhase;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.turn.TurnMod;
|
import mage.game.turn.TurnMod;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetPlayer;
|
||||||
import mage.watchers.common.ManaSpentToCastWatcher;
|
import mage.watchers.common.ManaSpentToCastWatcher;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +62,10 @@ public class RevenantPatriarch extends CardImpl {
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
// When Revenant Patriarch enters the battlefield, if {W} was spent to cast it, target player skips his or her next combat phase.
|
// When Revenant Patriarch enters the battlefield, if {W} was spent to cast it, target player skips his or her next combat phase.
|
||||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new SkipNextCombatIfConditionEffect(new ManaWasSpentCondition(ColoredManaSymbol.W)), false), new ManaSpentToCastWatcher());
|
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new TargetPlayerSkipNextCombatEffect(), false);
|
||||||
|
ability.addTarget(new TargetPlayer());
|
||||||
|
this.addAbility(new ConditionalTriggeredAbility(ability, new ManaWasSpentCondition(ColoredManaSymbol.W),
|
||||||
|
"if {W} was spent to cast it, target player skips his or her next combat phase."), new ManaSpentToCastWatcher());
|
||||||
// Revenant Patriarch can't block.
|
// Revenant Patriarch can't block.
|
||||||
this.addAbility(new CantBlockAbility());
|
this.addAbility(new CantBlockAbility());
|
||||||
}
|
}
|
||||||
|
@ -75,33 +80,30 @@ public class RevenantPatriarch extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SkipNextCombatIfConditionEffect extends OneShotEffect {
|
class TargetPlayerSkipNextCombatEffect extends OneShotEffect {
|
||||||
|
|
||||||
protected Condition condition;
|
public TargetPlayerSkipNextCombatEffect() {
|
||||||
|
|
||||||
public SkipNextCombatIfConditionEffect(Condition condition) {
|
|
||||||
super(Outcome.Detriment);
|
super(Outcome.Detriment);
|
||||||
staticText = "that player skips his or her next combat phase";
|
|
||||||
this.condition = condition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SkipNextCombatIfConditionEffect(final SkipNextCombatIfConditionEffect effect) {
|
public TargetPlayerSkipNextCombatEffect(final TargetPlayerSkipNextCombatEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.condition = effect.condition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||||
if (player != null && !condition.apply(game, source)) {
|
|
||||||
|
if (player != null) {
|
||||||
game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true));
|
game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SkipNextCombatIfConditionEffect copy() {
|
public TargetPlayerSkipNextCombatEffect copy() {
|
||||||
return new SkipNextCombatIfConditionEffect(this);
|
return new TargetPlayerSkipNextCombatEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue