This commit is contained in:
LevelX2 2013-11-12 01:13:58 +01:00
commit 47d50b42b3
15 changed files with 388 additions and 101 deletions

View file

@ -33,9 +33,9 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.OnlyDuringYourTurnCost;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
@ -76,9 +76,8 @@ public class WalkerOfSecretWays extends CardImpl<WalkerOfSecretWays> {
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new WalkerOfSecretWaysEffect(), true, true));
// {1}{U}: Return target Ninja you control to its owner's hand. Activate this ability only during your turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{1}{U}"));
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), new ManaCostsImpl("{1}{U}"), MyTurnCondition.getInstance());
ability.addTarget(new TargetControlledCreaturePermanent(1,1, filterCreature, false));
ability.addCost(new OnlyDuringYourTurnCost());
this.addAbility(ability);

View file

@ -0,0 +1,104 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.Condition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TurnPhase;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.turn.Phase;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author LevelX2
*/
public class HuaTuoHonoredPhysician extends CardImpl<HuaTuoHonoredPhysician> {
public HuaTuoHonoredPhysician(UUID ownerId) {
super(ownerId, 149, "Hua Tuo, Honored Physician", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
this.expansionSetCode = "C13";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.color.setGreen(true);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// {tap}: Put target creature card from your graveyard on top of your library. Activate this ability only during your turn, before attackers are declared.
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new PutOnLibraryTargetEffect(true), new TapSourceCost(), MyTurnBeforeAttackersDeclaredCondition.getInstance());
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.addAbility(ability);
}
public HuaTuoHonoredPhysician(final HuaTuoHonoredPhysician card) {
super(card);
}
@Override
public HuaTuoHonoredPhysician copy() {
return new HuaTuoHonoredPhysician(this);
}
}
class MyTurnBeforeAttackersDeclaredCondition implements Condition {
private static MyTurnBeforeAttackersDeclaredCondition fInstance = new MyTurnBeforeAttackersDeclaredCondition();
public static Condition getInstance() {
return fInstance;
}
@Override
public boolean apply(Game game, Ability source) {
if (game.getActivePlayerId().equals(source.getControllerId())) {
TurnPhase turnPhase = game.getTurn().getPhase().getType();
if (turnPhase.equals(TurnPhase.BEGINNING) || turnPhase.equals(TurnPhase.PRECOMBAT_MAIN)) {
return true;
}
if (turnPhase.equals(TurnPhase.COMBAT)) {
return !game.getTurn().isDeclareAttackersStepStarted();
}
}
return false;
}
@Override
public String toString() {
return "during your turn, before attackers are declared";
}
}

View file

@ -0,0 +1,157 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class PrimalVigor extends CardImpl<PrimalVigor> {
public PrimalVigor(UUID ownerId) {
super(ownerId, 162, "Primal Vigor", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{4}{G}");
this.expansionSetCode = "C13";
this.color.setGreen(true);
// If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorTokenEffect()));
// If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PrimalVigorCounterEffect()));
}
public PrimalVigor(final PrimalVigor card) {
super(card);
}
@Override
public PrimalVigor copy() {
return new PrimalVigor(this);
}
}
class PrimalVigorTokenEffect extends ReplacementEffectImpl<PrimalVigorTokenEffect> {
public PrimalVigorTokenEffect() {
super(Duration.WhileOnBattlefield, Outcome.Copy);
staticText = "If one or more tokens would be put onto the battlefield, twice that many of those tokens are put onto the battlefield instead";
}
public PrimalVigorTokenEffect(final PrimalVigorTokenEffect effect) {
super(effect);
}
@Override
public PrimalVigorTokenEffect copy() {
return new PrimalVigorTokenEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
switch (event.getType()) {
case CREATE_TOKEN:
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
event.setAmount(event.getAmount() * 2);
return false;
}
}
class PrimalVigorCounterEffect extends ReplacementEffectImpl<PrimalVigorCounterEffect> {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent();
PrimalVigorCounterEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature, false);
staticText = "If one or more +1/+1 counters would be placed on a creature, twice that many +1/+1 counters are placed on that creature instead";
}
PrimalVigorCounterEffect(final PrimalVigorCounterEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent p = game.getPermanent(event.getTargetId());
if (p != null) {
p.addCounters(CounterType.P1P1.createInstance(event.getAmount() * 2), game, event.getAppliedEffects());
return true;
}
return false;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ADD_COUNTER) {
Permanent target = game.getPermanent(event.getTargetId());
if (target != null && filter.match(target, game)
&& event.getData() != null && event.getData().equals("+1/+1")) {
return true;
}
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public PrimalVigorCounterEffect copy() {
return new PrimalVigorCounterEffect(this);
}
}

View file

@ -0,0 +1,75 @@
/*
* 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.commander2013;
import java.util.UUID;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class SpoilsOfVictory extends CardImpl<SpoilsOfVictory> {
private static final FilterCard filter = new FilterCard("Plains, Island, Swamp, Mountain, or Forest card");
static {
filter.add(Predicates.or(
new SubtypePredicate("Plains"),
new SubtypePredicate("Island"),
new SubtypePredicate("Swamp"),
new SubtypePredicate("Mountain"),
new SubtypePredicate("Forest")));
}
public SpoilsOfVictory(UUID ownerId) {
super(ownerId, 172, "Spoils of Victory", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{2}{G}");
this.expansionSetCode = "C13";
this.color.setGreen(true);
// Search your library for a Plains, Island, Swamp, Mountain, or Forest card and put that card onto the battlefield. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), false, Outcome.PutLandInPlay));
}
public SpoilsOfVictory(final SpoilsOfVictory card) {
super(card);
}
@Override
public SpoilsOfVictory copy() {
return new SpoilsOfVictory(this);
}
}

View file

@ -30,8 +30,8 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.OnlyDuringYourTurnCost;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
@ -59,8 +59,7 @@ public class Fleshformer extends CardImpl<Fleshformer> {
this.toughness = new MageInt(2);
// {W}{U}{B}{R}{G}: Fleshformer gets +2/+2 and gains fear until end of turn. Target creature gets -2/-2 until end of turn. Activate this ability only during your turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{W}{U}{B}{R}{G}"));
ability.addCost(new OnlyDuringYourTurnCost());
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{W}{U}{B}{R}{G}"), MyTurnCondition.getInstance());
ability.addEffect(new BoostTargetEffect(-2, -2, Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent(true));
this.addAbility(ability);

View file

@ -32,8 +32,8 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.OnlyDuringYourTurnCost;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DiscardTargetEffect;
@ -54,10 +54,9 @@ public class ScepterOfFugue extends CardImpl<ScepterOfFugue> {
this.color.setBlack(true);
// {1}{B}, {tap}: Target player discards a card. Activate this ability only during your turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"));
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{1}{B}"), MyTurnCondition.getInstance());
ability.addCost(new TapSourceCost());
ability.addCost(new OnlyDuringYourTurnCost());
ability.addTarget(new TargetPlayer());
ability.addTarget(new TargetPlayer(true));
this.addAbility(ability);
}

View file

@ -156,12 +156,10 @@ class NightveilSpecterEffect extends AsThoughEffectImpl<NightveilSpecterEffect>
if (card.getCardType().contains(CardType.LAND)) {
// If the revealed card is a land, you can play it only if it's your turn and you haven't yet played a land this turn.
if (game.getActivePlayerId().equals(source.getControllerId()) && controller.canPlayLand()) {
card.setControllerId(source.getControllerId());
return true;
}
} else {
if (card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game)) {
card.setControllerId(source.getControllerId());
return true;
}
}

View file

@ -32,8 +32,6 @@ import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DrawCardTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.OnlyDuringYourTurnCost;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
@ -45,6 +43,8 @@ import mage.counters.CounterType;
import mage.game.permanent.token.Token;
import java.util.UUID;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
/**
*
@ -59,9 +59,8 @@ public class HoofprintsOfTheStag extends CardImpl<HoofprintsOfTheStag> {
this.subtype.add("Elemental");
this.color.setWhite(true);
this.addAbility(new DrawCardTriggeredAbility(new AddCountersSourceEffect(CounterType.HOOFPRINT.createInstance(1)), true));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new WhiteElementalToken(), 1), new ManaCostsImpl("{2}{W}"));
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new WhiteElementalToken(), 1), new ManaCostsImpl("{2}{W}"), MyTurnCondition.getInstance());
ability.addCost(new RemoveCountersSourceCost(CounterType.HOOFPRINT.createInstance(4)));
ability.addCost(new OnlyDuringYourTurnCost());
this.addAbility(ability);
}

View file

@ -34,8 +34,8 @@ import mage.constants.Zone;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.OnlyDuringYourTurnCost;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.cards.CardImpl;
@ -52,9 +52,8 @@ public class SundialOfTheInfinite extends CardImpl<SundialOfTheInfinite> {
this.expansionSetCode = "M12";
// {1}, {tap}: End the turn. Activate this ability only during your turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EndTurnEffect(), new GenericManaCost(1));
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new EndTurnEffect(), new GenericManaCost(1), MyTurnCondition.getInstance());
ability.addCost(new TapSourceCost());
ability.addCost(new OnlyDuringYourTurnCost());
this.addAbility(ability);
}

View file

@ -32,7 +32,8 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.ActivateIfConditionActivatedAbility;
import mage.abilities.condition.common.MyTurnCondition;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.DiscardTargetEffect;
@ -51,8 +52,8 @@ public class DisruptingScepter extends CardImpl<DisruptingScepter> {
this.expansionSetCode = "7ED";
// {3}, {tap}: Target player discards a card. Activate this ability only during your turn.
Ability ability = new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{3}"));
ability.addTarget(new TargetPlayer());
Ability ability = new ActivateIfConditionActivatedAbility(Zone.BATTLEFIELD, new DiscardTargetEffect(1), new ManaCostsImpl("{3}"), new MyTurnCondition());
ability.addTarget(new TargetPlayer(true));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}

View file

@ -29,11 +29,11 @@
package mage.abilities.common;
import java.util.UUID;
import mage.constants.Zone;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.condition.Condition;
import mage.abilities.costs.Cost;
import mage.abilities.effects.Effect;
import mage.constants.Zone;
import mage.game.Game;
/**
@ -80,7 +80,16 @@ public class ActivateIfConditionActivatedAbility extends ActivatedAbilityImpl<Ac
@Override
public String getRule() {
return new StringBuilder(super.getRule()).append(" Activate this ability only if ").append(condition.toString()).append(".").toString() ;
StringBuilder sb = new StringBuilder(super.getRule()).append(" Activate this ability only ");
if (condition.toString() != null) {
if (!condition.toString().startsWith("during")) {
sb.append("if ");
}
sb.append(condition.toString()).append(".");
} else {
sb.append(" [Condition toSting() == null] ");
}
return sb.toString() ;
}
@Override

View file

@ -42,4 +42,9 @@ public class MyTurnCondition implements Condition {
public boolean apply(Game game, Ability source) {
return game.getActivePlayerId().equals(source.getControllerId());
}
@Override
public String toString() {
return "during your turn";
}
}

View file

@ -1,66 +0,0 @@
/*
* Copyright 2011 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.abilities.costs.common;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.game.Game;
import java.util.UUID;
/**
*
* @author nantuko
*/
public class OnlyDuringYourTurnCost extends CostImpl<OnlyDuringYourTurnCost> {
public OnlyDuringYourTurnCost() {
text = "Activate this ability only during your turn";
}
public OnlyDuringYourTurnCost(final OnlyDuringYourTurnCost cost) {
super(cost);
}
@Override
public OnlyDuringYourTurnCost copy() {
return new OnlyDuringYourTurnCost(this);
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return game.getActivePlayerId().equals(controllerId);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = true;
return paid;
}
}

View file

@ -61,6 +61,7 @@ public class DeclareAttackersStep extends Step<DeclareAttackersStep> {
@Override
public void beginStep(Game game, UUID activePlayerId) {
super.beginStep(game, activePlayerId);
game.getTurn().setDeclareAttackersStepStarted(true);
game.getCombat().selectAttackers(game);
}

View file

@ -28,18 +28,16 @@
package mage.game.turn;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.constants.PhaseStep;
import mage.constants.TurnPhase;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
/**
*
@ -50,6 +48,7 @@ public class Turn implements Serializable {
private Phase currentPhase;
private UUID activePlayerId;
private List<Phase> phases = new ArrayList<Phase>();
private boolean declareAttackersStepStarted = false;
public Turn() {
phases.add(new BeginningPhase());
@ -109,6 +108,7 @@ public class Turn implements Serializable {
}
public void play(Game game, UUID activePlayerId) {
this.setDeclareAttackersStepStarted(false);
if (game.isPaused() || game.isGameOver()) {
return;
}
@ -270,6 +270,14 @@ public class Turn implements Serializable {
//phase.play(game, activePlayerId);
}
public boolean isDeclareAttackersStepStarted() {
return declareAttackersStepStarted;
}
public void setDeclareAttackersStepStarted(boolean declareAttackersStepStarted) {
this.declareAttackersStepStarted = declareAttackersStepStarted;
}
public Turn copy() {
return new Turn(this);
}