Festival, False Peace, Empty City Ruse, Moment of Silence impl. Extracted SkipNextCombatPhase class.

This commit is contained in:
drmDev 2016-07-27 09:42:45 -04:00
parent bbd9e0e323
commit 0d8b892272
9 changed files with 355 additions and 106 deletions

View file

@ -34,13 +34,8 @@ import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.Outcome;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.turn.TurnMod;
import mage.target.Target;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
/** /**
@ -60,8 +55,7 @@ public class StonehornDignitary extends CardImpl {
// When Stonehorn Dignitary enters the battlefield, target opponent skips his or her next combat phase. // When Stonehorn Dignitary enters the battlefield, target opponent skips his or her next combat phase.
Ability ability = new EntersBattlefieldTriggeredAbility(new SkipNextCombatEffect()); Ability ability = new EntersBattlefieldTriggeredAbility(new SkipNextCombatEffect());
Target target = new TargetOpponent(); ability.addTarget(new TargetOpponent());
ability.addTarget(target);
this.addAbility(ability); this.addAbility(ability);
} }
@ -74,30 +68,3 @@ public class StonehornDignitary extends CardImpl {
return new StonehornDignitary(this); return new StonehornDignitary(this);
} }
} }
class SkipNextCombatEffect extends OneShotEffect {
public SkipNextCombatEffect() {
super(Outcome.Detriment);
staticText = "target opponent skips his or her next combat phase";
}
public SkipNextCombatEffect(SkipNextCombatEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
UUID targetId = source.getFirstTarget();
if (targetId != null) {
game.getState().getTurnMods().add(new TurnMod(targetId, TurnPhase.COMBAT, null, true));
return true;
}
return false;
}
@Override
public SkipNextCombatEffect copy() {
return new SkipNextCombatEffect();
}
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.mercadianmasques;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class MomentOfSilence extends CardImpl {
public MomentOfSilence(UUID ownerId) {
super(ownerId, 28, "Moment of Silence", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "MMQ";
// Target player skips his or her next combat phase this turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public MomentOfSilence(final MomentOfSilence card) {
super(card);
}
@Override
public MomentOfSilence copy() {
return new MomentOfSilence(this);
}
}

View file

@ -30,18 +30,12 @@ package mage.sets.nemesis;
import java.util.UUID; import java.util.UUID;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.TurnPhase; import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.game.Game;
import mage.game.turn.TurnMod;
import mage.players.Player;
/** /**
* *
@ -72,30 +66,3 @@ public class BlindingAngel extends CardImpl {
return new BlindingAngel(this); return new BlindingAngel(this);
} }
} }
class SkipNextCombatEffect extends OneShotEffect {
public SkipNextCombatEffect() {
super(Outcome.Detriment);
staticText = "that player skips his or her next combat phase";
}
public SkipNextCombatEffect(final SkipNextCombatEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true));
return true;
}
return false;
}
@Override
public SkipNextCombatEffect copy() {
return new SkipNextCombatEffect(this);
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.portal;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class FalsePeace extends mage.sets.starter1999.FalsePeace {
public FalsePeace(UUID ownerId) {
super(ownerId);
this.cardNumber = "176";
this.expansionSetCode = "POR";
this.rarity = Rarity.COMMON;
}
public FalsePeace(final FalsePeace card) {
super(card);
}
@Override
public FalsePeace copy() {
return new FalsePeace(this);
}
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.portalthreekingdoms;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetOpponent;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class EmptyCityRuse extends CardImpl {
public EmptyCityRuse(UUID ownerId) {
super(ownerId, 3, "Empty City Ruse", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{W}");
this.expansionSetCode = "PTK";
// Target opponent skips all combat phases of his or her next turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addTarget(new TargetOpponent());
}
public EmptyCityRuse(final EmptyCityRuse card) {
super(card);
}
@Override
public EmptyCityRuse copy() {
return new EmptyCityRuse(this);
}
}

View file

@ -29,24 +29,18 @@ 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.TriggeredAbility; 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.common.ManaWasSpentCondition; import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ColoredManaSymbol; import mage.constants.ColoredManaSymbol;
import mage.constants.Outcome;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.turn.TurnMod;
import mage.players.Player;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
import mage.watchers.common.ManaSpentToCastWatcher; import mage.watchers.common.ManaSpentToCastWatcher;
import mage.abilities.effects.common.SkipNextCombatEffect;
/** /**
* *
@ -62,7 +56,7 @@ 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.
TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new TargetPlayerSkipNextCombatEffect(), false); TriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new SkipNextCombatEffect(), false);
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(new ConditionalTriggeredAbility(ability, new ManaWasSpentCondition(ColoredManaSymbol.W), 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()); "if {W} was spent to cast it, target player skips his or her next combat phase."), new ManaSpentToCastWatcher());
@ -79,31 +73,3 @@ public class RevenantPatriarch extends CardImpl {
return new RevenantPatriarch(this); return new RevenantPatriarch(this);
} }
} }
class TargetPlayerSkipNextCombatEffect extends OneShotEffect {
public TargetPlayerSkipNextCombatEffect() {
super(Outcome.Detriment);
}
public TargetPlayerSkipNextCombatEffect(final TargetPlayerSkipNextCombatEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null) {
game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true));
return true;
}
return false;
}
@Override
public TargetPlayerSkipNextCombatEffect copy() {
return new TargetPlayerSkipNextCombatEffect(this);
}
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.starter1999;
import java.util.UUID;
import mage.abilities.effects.common.SkipNextCombatEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.TargetPlayer;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class FalsePeace extends CardImpl {
public FalsePeace(UUID ownerId) {
super(ownerId, 16, "False Peace", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{W}");
this.expansionSetCode = "S99";
// Target player skips all combat phases of his or her next turn.
this.getSpellAbility().addEffect(new SkipNextCombatEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public FalsePeace(final FalsePeace card) {
super(card);
}
@Override
public FalsePeace copy() {
return new FalsePeace(this);
}
}

View file

@ -0,0 +1,68 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.thedark;
import java.util.UUID;
import mage.abilities.common.CastOnlyDuringPhaseStepSourceAbility;
import mage.abilities.condition.common.OnOpponentsTurnCondition;
import mage.abilities.effects.common.combat.CantAttackAnyPlayerAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.filter.common.FilterCreaturePermanent;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class Festival extends CardImpl {
public Festival(UUID ownerId) {
super(ownerId, 81, "Festival", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}");
this.expansionSetCode = "DRK";
// Cast Festival only during an opponent's upkeep.
this.addAbility(new CastOnlyDuringPhaseStepSourceAbility(null, PhaseStep.UPKEEP, OnOpponentsTurnCondition.getInstance(),
"Cast {this} only during an opponent's upkeep"));
// Creatures can't attack this turn.
this.getSpellAbility().addEffect(new CantAttackAnyPlayerAllEffect(Duration.EndOfTurn, new FilterCreaturePermanent("creatures")));
}
public Festival(final Festival card) {
super(card);
}
@Override
public Festival copy() {
return new Festival(this);
}
}

View file

@ -0,0 +1,47 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.turn.TurnMod;
import mage.players.Player;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class SkipNextCombatEffect extends OneShotEffect {
public SkipNextCombatEffect() {
super(Outcome.Detriment);
staticText = "target opponent skips his or her next combat phase";
}
public SkipNextCombatEffect(SkipNextCombatEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
if (targetPointer != null) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
game.getState().getTurnMods().add(new TurnMod(player.getId(), TurnPhase.COMBAT, null, true));
return true;
}
}
return false;
}
@Override
public SkipNextCombatEffect copy() {
return new SkipNextCombatEffect();
}
}