forked from External/mage
* Disrupting Scepter - Fixed that it could only be activated as a Sorcery insteady correctly on your turn. (also for other cards) Replaced handling of the restriction as a cost to conditional ability.
This commit is contained in:
parent
e24ac705f6
commit
efc2aae026
9 changed files with 36 additions and 92 deletions
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue