Renamed and improved ActivateOncePerTurnActivatedAbility to LimitedTimesPerTurnActivatedAbility-

This commit is contained in:
LevelX2 2014-02-26 12:38:09 +01:00
parent 9b10da0551
commit 48efe70625
30 changed files with 96 additions and 78 deletions

View file

@ -34,7 +34,7 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -55,7 +55,7 @@ public class PutridLeech extends CardImpl<PutridLeech> {
this.subtype.add("Leech");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new PayLifeCost(2)));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new PayLifeCost(2)));
}
public PutridLeech(final PutridLeech card) {

View file

@ -33,7 +33,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.effects.OneShotEffect;
import mage.ObjectColor;
import mage.abilities.costs.common.TapSourceCost;
@ -69,7 +69,7 @@ public class PatronOfTheOrochi extends CardImpl<PatronOfTheOrochi> {
this.addAbility(new OfferingAbility("Snake"));
// {T}: Untap all Forests and all green creatures. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new PatronOfTheOrochiEffect(), new TapSourceCost()));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new PatronOfTheOrochiEffect(), new TapSourceCost()));
}

View file

@ -30,7 +30,7 @@ package mage.sets.bornofthegods;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount;
@ -62,7 +62,7 @@ public class GraverobberSpider extends CardImpl<GraverobberSpider> {
this.addAbility(ReachAbility.getInstance());
// {3}{B}: Graverobber Spider gets +X/+X until end of turn, where X is the number of creature cards in your graveyard. Activate this ability only once each turn.
DynamicValue xValue = new CardsInControllerGraveyardCount(new FilterCreatureCard("creature cards"));
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(xValue, xValue, Duration.EndOfTurn, true), new ManaCostsImpl("{3}{B}"));
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(xValue, xValue, Duration.EndOfTurn, true), new ManaCostsImpl("{3}{B}"));
this.addAbility(ability);
}

View file

@ -34,7 +34,7 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -59,7 +59,7 @@ public class AkkiAvalanchers extends CardImpl<AkkiAvalanchers> {
this.toughness = new MageInt(1);
// Sacrifice a land: Akki Avalanchers gets +2/+0 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 0, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledPermanent(filter))));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 0, Duration.EndOfTurn), new SacrificeTargetCost(new TargetControlledPermanent(filter))));
}
public AkkiAvalanchers(final AkkiAvalanchers card) {

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
@ -86,7 +86,7 @@ public class BrutalDeceiver extends CardImpl<BrutalDeceiver> {
}
}
class BrutalDeceiverAbility extends ActivateOncePerTurnActivatedAbility {
class BrutalDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public BrutalDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
@ -86,7 +86,7 @@ public class CallousDeceiver extends CardImpl<CallousDeceiver> {
}
class CallousDeceiverAbility extends ActivateOncePerTurnActivatedAbility {
class CallousDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public CallousDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -70,7 +70,7 @@ public class CruelDeceiver extends CardImpl<CruelDeceiver> {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
// {2}: Reveal the top card of your library. If it's a land card, Cruel Deceiver gains "Whenever Cruel Deceiver deals damage to a creature, destroy that creature" until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new CruelDeceiverEffect(), new ManaCostsImpl("{2}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new CruelDeceiverEffect(), new ManaCostsImpl("{2}")));
}
public CruelDeceiver(final CruelDeceiver card) {

View file

@ -34,7 +34,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
@ -85,7 +85,7 @@ public class FeralDeceiver extends CardImpl<FeralDeceiver> {
}
}
class FeralDeceiverAbility extends ActivateOncePerTurnActivatedAbility {
class FeralDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public FeralDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
@ -85,7 +85,7 @@ public class HarshDeceiver extends CardImpl<HarshDeceiver> {
}
}
class HarshDeceiverAbility extends ActivateOncePerTurnActivatedAbility {
class HarshDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
public HarshDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
@ -58,7 +58,7 @@ public class ViashinoSlaughtermaster extends CardImpl<ViashinoSlaughtermaster> {
this.addAbility(DoubleStrikeAbility.getInstance());
// {B}{G}: Viashino Slaughtermaster gets +1/+1 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{B}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{B}{G}")));
}
public ViashinoSlaughtermaster(final ViashinoSlaughtermaster card) {

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.TwoOrMoreSpellsWereCastLastTurnCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -60,7 +60,7 @@ public class KrallenhordeKiller extends CardImpl<KrallenhordeKiller> {
this.canTransform = true;
// {3}{G}: Krallenhorde Killer gets +4/+4 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Krallenhorde Killer.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new TransformSourceEffect(false), TargetController.ANY, false);

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.common.NoSpellsWereCastLastTurnCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -62,7 +62,7 @@ public class WolfbittenCaptive extends CardImpl<WolfbittenCaptive> {
this.secondSideCard = new KrallenhordeKiller(ownerId);
// {1}{G}: Wolfbitten Captive gets +2/+2 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
// At the beginning of each upkeep, if no spells were cast last turn, transform Wolfbitten Captive.
this.addAbility(new TransformAbility());

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
@ -62,7 +62,7 @@ public class BeetleformMage extends CardImpl<BeetleformMage> {
this.toughness = new MageInt(2);
// {G}{U}: Beetleform Mage gets +2/+2 and gains flying until end of turn. Activate this ability only once each turn.
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,2, Duration.EndOfTurn), new ManaCostsImpl("{G}{U}"));
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,2, Duration.EndOfTurn), new ManaCostsImpl("{G}{U}"));
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn));
this.addAbility(ability);

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.WitherAbility;
@ -55,7 +55,7 @@ public class TwinbladeSlasher extends CardImpl<TwinbladeSlasher> {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addAbility(WitherAbility.getInstance());
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
}
public TwinbladeSlasher(final TwinbladeSlasher card) {

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -55,7 +55,7 @@ public class FrilledOculus extends CardImpl<FrilledOculus> {
this.toughness = new MageInt(3);
// {1}{G}: Frilled Oculus gets +2/+2 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
}
public FrilledOculus(final FrilledOculus card) {

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -55,7 +55,7 @@ public class GhorClanBloodscale extends CardImpl<GhorClanBloodscale> {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
this.addAbility(FirstStrikeAbility.getInstance());
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
}
public GhorClanBloodscale(final GhorClanBloodscale card) {

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -55,7 +55,7 @@ public class DarkthicketWolf extends CardImpl<DarkthicketWolf> {
this.toughness = new MageInt(2);
// {2}{G}: Darkthicket Wolf gets +2/+2 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{2}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{2}{G}")));
}
public DarkthicketWolf(final DarkthicketWolf card) {

View file

@ -35,7 +35,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BecomesCreatureSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -59,7 +59,7 @@ public class Skinshifter extends CardImpl<Skinshifter> {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD,
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD,
new BecomesCreatureSourceEffect(new RhinoToken(), "", Duration.EndOfTurn),
new ManaCostsImpl("{G}"));

View file

@ -29,7 +29,7 @@ package mage.sets.odyssey;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -58,7 +58,7 @@ public class PulsatingIllusion extends CardImpl<PulsatingIllusion> {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Discard a card: Pulsating Illusion gets +4/+4 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new DiscardTargetCost(new TargetCardInHand())));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new DiscardTargetCost(new TargetCardInHand())));
}
public PulsatingIllusion(final PulsatingIllusion card) {

View file

@ -30,7 +30,7 @@ package mage.sets.scarsofmirrodin;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -66,7 +66,7 @@ public class SteelHellkite extends CardImpl<SteelHellkite> {
// {2}: Steel Hellkite gets +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new GenericManaCost(2)));
// {X}: Destroy each nonland permanent with converted mana cost X whose controller was dealt combat damage by Steel Hellkite this turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new SteelHellkiteDestroyEffect(), new ManaCostsImpl("{X}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new SteelHellkiteDestroyEffect(), new ManaCostsImpl("{X}")));
this.addWatcher(new SteelHellkiteWatcher());
}

View file

@ -33,7 +33,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.CardImpl;
@ -64,7 +64,7 @@ public class WirewoodSymbiote extends CardImpl<WirewoodSymbiote> {
this.toughness = new MageInt(1);
// Return an Elf you control to its owner's hand: Untap target creature. Activate this ability only once each turn.
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -34,7 +34,7 @@ import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -56,7 +56,7 @@ public class KnightOfTheSkywardEye extends CardImpl<KnightOfTheSkywardEye> {
this.toughness = new MageInt(2);
// {3}{G}: Knight of the Skyward Eye gets +3/+3 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(3, 3, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(3, 3, Duration.EndOfTurn), new ManaCostsImpl("{3}{G}")));
}

View file

@ -32,7 +32,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.cards.CardImpl;
@ -52,7 +52,7 @@ public class Rootwalla extends CardImpl<Rootwalla> {
this.color.setGreen(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
}
public Rootwalla(final Rootwalla card) {

View file

@ -29,7 +29,7 @@ package mage.sets.theros;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -57,7 +57,7 @@ public class SetessanGriffin extends CardImpl<SetessanGriffin> {
// Flying
this.addAbility(FlyingAbility.getInstance());
// {2}{G}{G}: Setessan Griffin gets +2/+2 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,2, Duration.EndOfTurn), new ManaCostsImpl("{2}{G}{G}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,2, Duration.EndOfTurn), new ManaCostsImpl("{2}{G}{G}")));
}
public SetessanGriffin(final SetessanGriffin card) {

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.keyword.FlashAbility;
@ -77,7 +77,7 @@ public class ScrybRanger extends CardImpl<ScrybRanger> {
// protection from blue
this.addAbility(new ProtectionAbility(filter));
// Return a Forest you control to its owner's hand: Untap target creature. Activate this ability only once each turn.
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filterForest)));
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filterForest)));
ability.addTarget(new TargetCreaturePermanent(1));
this.addAbility(ability);
}

View file

@ -30,7 +30,7 @@ package mage.sets.torment;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.MadnessAbility;
@ -56,7 +56,7 @@ public class BaskingRootwalla extends CardImpl<BaskingRootwalla> {
this.toughness = new MageInt(1);
// {1}{G}: Basking Rootwalla gets +2/+2 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD,
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(2, 2, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")));
// Madness {0}

View file

@ -33,7 +33,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.cards.CardImpl;
@ -64,7 +64,7 @@ public class QuirionRanger extends CardImpl<QuirionRanger> {
this.toughness = new MageInt(1);
// Return a Forest you control to its owner's hand: Untap target creature. Activate this ability only once each turn.
Ability ability = new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -29,7 +29,7 @@ package mage.sets.visions;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
@ -57,7 +57,7 @@ public class SpittingDrake extends CardImpl<SpittingDrake> {
// Flying
this.addAbility(FlyingAbility.getInstance());
// {R}: Spitting Drake gets +1/+0 until end of turn. Activate this ability only once each turn.
this.addAbility(new ActivateOncePerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{R}")));
}
public SpittingDrake(final SpittingDrake card) {

View file

@ -40,26 +40,29 @@ import mage.util.CardUtil;
*
* @author BetaSteward_at_googlemail.com
*/
public class ActivateOncePerTurnActivatedAbility extends ActivatedAbilityImpl<ActivateOncePerTurnActivatedAbility> {
public class LimitedTimesPerTurnActivatedAbility extends ActivatedAbilityImpl<LimitedTimesPerTurnActivatedAbility> {
public ActivateOncePerTurnActivatedAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);
private int maxActivationsPerTurn;
public LimitedTimesPerTurnActivatedAbility(Zone zone, Effect effect, Cost cost) {
this(zone, effect, cost, 1);
}
public ActivateOncePerTurnActivatedAbility(ActivateOncePerTurnActivatedAbility ability) {
public LimitedTimesPerTurnActivatedAbility(Zone zone, Effect effect, Cost cost, int maxActivationsPerTurn) {
super(zone, effect, cost);
this.maxActivationsPerTurn = maxActivationsPerTurn;
}
public LimitedTimesPerTurnActivatedAbility(LimitedTimesPerTurnActivatedAbility ability) {
super(ability);
this.maxActivationsPerTurn = ability.maxActivationsPerTurn;
}
@Override
public boolean canActivate(UUID playerId, Game game) {
if (super.canActivate(playerId, game)) {
Boolean activated = (Boolean)game.getState().getValue(CardUtil.getCardZoneString("activated", sourceId, game));
if (activated == null) {
return true;
}
else {
return !activated;
}
Integer activations = (Integer) game.getState().getValue(CardUtil.getCardZoneString("activations", sourceId, game));
return activations == null || activations < maxActivationsPerTurn;
}
return false;
}
@ -68,7 +71,13 @@ public class ActivateOncePerTurnActivatedAbility extends ActivatedAbilityImpl<Ac
public boolean activate(Game game, boolean noMana) {
if (canActivate(this.controllerId, game)) {
if (super.activate(game, noMana)) {
game.getState().setValue(CardUtil.getCardZoneString("activated", sourceId, game), Boolean.TRUE);
Integer activations = (Integer) game.getState().getValue(CardUtil.getCardZoneString("activations", sourceId, game));
if (activations == null) {
activations = new Integer(1);
} else {
activations++;
}
game.getState().setValue(CardUtil.getCardZoneString("activations", sourceId, game), activations);
return true;
}
}
@ -77,25 +86,34 @@ public class ActivateOncePerTurnActivatedAbility extends ActivatedAbilityImpl<Ac
@Override
public void reset(Game game) {
game.getState().setValue(CardUtil.getCardZoneString("activated", sourceId, game), Boolean.FALSE);
game.getState().setValue(CardUtil.getCardZoneString("activations", sourceId, game), new Integer(0));
}
@Override
public boolean resolve(Game game) {
if (super.resolve(game)) {
return true;
}
return false;
return super.resolve(game);
}
@Override
public String getRule() {
return super.getRule() + " Activate this ability only once each turn.";
StringBuilder sb = new StringBuilder(super.getRule()).append("Activate this ability ");
switch(maxActivationsPerTurn) {
case 1:
sb.append("only once");
break;
case 2:
sb.append("no more than twice");
break;
default:
sb.append("no more than ").append(CardUtil.numberToText(maxActivationsPerTurn)).append(" times");
}
sb.append(" each turn");
return sb.toString();
}
@Override
public ActivateOncePerTurnActivatedAbility copy() {
return new ActivateOncePerTurnActivatedAbility(this);
public LimitedTimesPerTurnActivatedAbility copy() {
return new LimitedTimesPerTurnActivatedAbility(this);
}
}

View file

@ -28,7 +28,7 @@
package mage.abilities.keyword;
import java.util.UUID;
import mage.abilities.common.ActivateOncePerTurnActivatedAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RevealSourceFromYourHandCost;
import mage.abilities.effects.Effect;
@ -51,7 +51,7 @@ import mage.game.Game;
* @author LevelX2
*
*/
public class ForecastAbility extends ActivateOncePerTurnActivatedAbility {
public class ForecastAbility extends LimitedTimesPerTurnActivatedAbility {
public ForecastAbility(Effect effect, Cost cost) {
super(Zone.HAND, effect, cost);