From 001cbbf4c57401983a9d9ddeec49e52ee36704f4 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 22 Jul 2013 14:16:22 +0200 Subject: [PATCH] * KickedCondtion - used LockedInCondition where needed, some cleanup. --- .../sets/invasion/VerdelothTheAncient.java | 1 - .../src/mage/sets/planeshift/OrimsChant.java | 13 +++-- .../src/mage/sets/zendikar/BoldDefense.java | 24 +++++--- .../mage/sets/zendikar/BurstLightning.java | 2 + .../mage/sets/zendikar/ElementalAppeal.java | 3 +- .../sets/zendikar/GatekeeperOfMalakir.java | 13 ++--- .../src/mage/sets/zendikar/Gigantiform.java | 55 +++++-------------- .../mage/sets/zendikar/GoblinBushwhacker.java | 4 +- .../src/mage/sets/zendikar/KorAeronaut.java | 3 +- .../src/mage/sets/zendikar/VampiresBite.java | 3 +- .../mage/sets/zendikar/VinesOfVastwood.java | 3 +- 11 files changed, 55 insertions(+), 69 deletions(-) diff --git a/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java b/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java index 097592c348..1f64786922 100644 --- a/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java +++ b/Mage.Sets/src/mage/sets/invasion/VerdelothTheAncient.java @@ -35,7 +35,6 @@ import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.dynamicvalue.DynamicValue; -import mage.abilities.dynamicvalue.common.MultikickerCount; import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.continious.BoostAllEffect; import mage.abilities.keyword.KickerAbility; diff --git a/Mage.Sets/src/mage/sets/planeshift/OrimsChant.java b/Mage.Sets/src/mage/sets/planeshift/OrimsChant.java index f18ac3dce4..713cf1710b 100644 --- a/Mage.Sets/src/mage/sets/planeshift/OrimsChant.java +++ b/Mage.Sets/src/mage/sets/planeshift/OrimsChant.java @@ -29,16 +29,17 @@ package mage.sets.planeshift; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.KickedCondition; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; @@ -118,14 +119,16 @@ class OrimsChantCantCastEffect extends ReplacementEffectImpl { private static final String effectText = "If Orim's Chant was kicked, creatures can't attack this turn"; + private Condition condition = new LockedInCondition(KickedCondition.getInstance()); OrimsChantCantAttackEffect ( ) { super(Duration.EndOfTurn, Outcome.Benefit); staticText = effectText; } - OrimsChantCantAttackEffect ( OrimsChantCantAttackEffect effect ) { + OrimsChantCantAttackEffect (final OrimsChantCantAttackEffect effect ) { super(effect); + this.condition = effect.condition; } @Override @@ -143,7 +146,7 @@ class OrimsChantCantAttackEffect extends ReplacementEffectImpl { - private final String staticText = "If Bold Defense was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn"; + private final String staticText = "If {this]} was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn"; public BoldDefense(UUID ownerId) { super(ownerId, 3, "Bold Defense", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}"); this.expansionSetCode = "ZEN"; this.color.setWhite(true); + // Kicker {3}{W} (You may pay an additional {3}{W} as you cast this spell.) this.addAbility(new KickerAbility("{3}{W}")); + // Creatures you control get +1/+1 until end of turn. If Bold Defense was kicked, instead creatures you control get +2/+2 and gain first strike until end of turn. DynamicValue dn = new BoldDefensePTCount(); this.getSpellAbility().addEffect(new BoostControlledEffect(dn, dn, Duration.EndOfTurn)); - - ContinuousEffect effect = new GainAbilityControlledEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, new FilterCreaturePermanent(), false); this.getSpellAbility().addEffect(new ConditionalContinousEffect(effect, KickedCondition.getInstance(), staticText)); } @@ -79,22 +81,28 @@ public class BoldDefense extends CardImpl { class BoldDefensePTCount implements DynamicValue { + private Condition condition = new LockedInCondition(KickedCondition.getInstance()); + public BoldDefensePTCount() { } @Override public int calculate(Game game, Ability sourceAbility) { - if (KickedCondition.getInstance().apply(game, sourceAbility)) { + if (condition.apply(game, sourceAbility)) { return 2; } else { return 1; } } + public BoldDefensePTCount(final BoldDefensePTCount dynamicValue) { + this.condition = dynamicValue.condition; + + } @Override public DynamicValue copy() { - return new BoldDefensePTCount(); + return new BoldDefensePTCount(this); } @Override diff --git a/Mage.Sets/src/mage/sets/zendikar/BurstLightning.java b/Mage.Sets/src/mage/sets/zendikar/BurstLightning.java index f4ab3cfb36..8432584824 100644 --- a/Mage.Sets/src/mage/sets/zendikar/BurstLightning.java +++ b/Mage.Sets/src/mage/sets/zendikar/BurstLightning.java @@ -49,8 +49,10 @@ public class BurstLightning extends CardImpl { this.expansionSetCode = "ZEN"; this.color.setRed(true); + // Kicker {4} (You may pay an additional {4} as you cast this spell.) this.addAbility(new KickerAbility("{4}")); + // Burst Lightning deals 2 damage to target creature or player. If Burst Lightning was kicked, it deals 4 damage to that creature or player instead. this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new DamageTargetEffect(4), new DamageTargetEffect(2), KickedCondition.getInstance(), "{this} deals 2 damage to target creature or player. If {this} was kicked, it deals 4 damage to that creature or player instead")); diff --git a/Mage.Sets/src/mage/sets/zendikar/ElementalAppeal.java b/Mage.Sets/src/mage/sets/zendikar/ElementalAppeal.java index ec75e33817..24014b66d1 100644 --- a/Mage.Sets/src/mage/sets/zendikar/ElementalAppeal.java +++ b/Mage.Sets/src/mage/sets/zendikar/ElementalAppeal.java @@ -35,6 +35,7 @@ import mage.constants.Rarity; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; +import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalContinousEffect; import mage.abilities.effects.OneShotEffect; @@ -65,7 +66,7 @@ public class ElementalAppeal extends CardImpl { // If Elemental Appeal was kicked, that creature gets +7/+0 until end of turn. this.getSpellAbility().addEffect(new ConditionalContinousEffect( new BoostTargetEffect(7, 0, Duration.EndOfTurn), - KickedCondition.getInstance(), + new LockedInCondition(KickedCondition.getInstance()), "If {this} was kicked, that creature gets +7/+0 until end of turn")); } diff --git a/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java b/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java index 58e2757d53..3e84501c8b 100644 --- a/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java +++ b/Mage.Sets/src/mage/sets/zendikar/GatekeeperOfMalakir.java @@ -27,22 +27,21 @@ */ package mage.sets.zendikar; -import mage.constants.CardType; -import mage.constants.Rarity; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.SacrificeEffect; +import mage.abilities.keyword.KickerAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.TargetPlayer; -import java.util.UUID; -import mage.abilities.keyword.KickerAbility; - /** * * @author maurer.it_at_gmail.com @@ -66,12 +65,12 @@ public class GatekeeperOfMalakir extends CardImpl { this.power = new MageInt(2); this.toughness = new MageInt(2); + // Kicker {B} (You may pay an additional {B} as you cast this spell.) this.addAbility(new KickerAbility("{B}")); - + // When Gatekeeper of Malakir enters the battlefield, if it was kicked, target player sacrifices a creature. EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new SacrificeEffect(filter, 1, "target player")); - Ability conditionalAbility = new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target player sacrifices a creature."); conditionalAbility.addTarget(new TargetPlayer()); this.addAbility(conditionalAbility); diff --git a/Mage.Sets/src/mage/sets/zendikar/Gigantiform.java b/Mage.Sets/src/mage/sets/zendikar/Gigantiform.java index 4a111ed9d4..698375013f 100644 --- a/Mage.Sets/src/mage/sets/zendikar/Gigantiform.java +++ b/Mage.Sets/src/mage/sets/zendikar/Gigantiform.java @@ -28,18 +28,12 @@ package mage.sets.zendikar; import java.util.UUID; - -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.StaticAbility; -import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.condition.common.KickedCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; @@ -49,10 +43,15 @@ import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.TrampleAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.constants.AttachmentType; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.filter.FilterCard; import mage.filter.predicate.mageobject.NamePredicate; import mage.game.Game; -import mage.game.events.GameEvent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCardInLibrary; @@ -83,7 +82,10 @@ public class Gigantiform extends CardImpl { // Enchanted creature is 8/8 and has trample. this.addAbility(new GigantiformAbility()); // When Gigantiform enters the battlefield, if it was kicked, you may search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library. - this.addAbility(new GigantiformTriggeredAbility()); + this.addAbility(new ConditionalTriggeredAbility( + new EntersBattlefieldTriggeredAbility(new GigantiformEffect(), true), + KickedCondition.getInstance(), + "When Gigantiform enters the battlefield, if it was kicked, you may search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library.")); } public Gigantiform(final Gigantiform card) { @@ -119,39 +121,8 @@ class GigantiformAbility extends StaticAbility { } } -class GigantiformTriggeredAbility extends TriggeredAbilityImpl { - - public GigantiformTriggeredAbility() { - super(Zone.BATTLEFIELD, new GigantiformEffect()); - } - - public GigantiformTriggeredAbility(final GigantiformTriggeredAbility ability) { - super(ability); - } - - @Override - public GigantiformTriggeredAbility copy() { - return new GigantiformTriggeredAbility(this); - } - - @Override - public boolean checkTrigger(GameEvent event, Game game) { - if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && event.getTargetId().equals(this.getSourceId()) - && KickedCondition.getInstance().apply(game, this)) { - return true; - } - return false; - } - - @Override - public String getRule() { - return "When Gigantiform enters the battlefield, if it was kicked, you may search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library."; - } -} - class GigantiformEffect extends OneShotEffect { - private static final String message = "Do you wish to search your library for a card named Gigantiform, put it onto the battlefield, then shuffle your library?"; private static final FilterCard filter = new FilterCard("card named Gigantiform"); static { @@ -175,7 +146,7 @@ class GigantiformEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); TargetCardInLibrary target = new TargetCardInLibrary(filter); - if (player != null && player.chooseUse(Outcome.PutCardInPlay, message, game) && player.searchLibrary(target, game)) { + if (player != null && player.searchLibrary(target, game)) { Card card = player.getLibrary().getCard(target.getFirstTarget(), game); if (card != null) { card.putOntoBattlefield(game, Zone.LIBRARY, source.getId(), source.getControllerId()); diff --git a/Mage.Sets/src/mage/sets/zendikar/GoblinBushwhacker.java b/Mage.Sets/src/mage/sets/zendikar/GoblinBushwhacker.java index 7a574e80bc..bb1e02b40d 100644 --- a/Mage.Sets/src/mage/sets/zendikar/GoblinBushwhacker.java +++ b/Mage.Sets/src/mage/sets/zendikar/GoblinBushwhacker.java @@ -33,6 +33,7 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.continious.BoostControlledEffect; @@ -60,11 +61,10 @@ public class GoblinBushwhacker extends CardImpl { // Kicker {R} (You may pay an additional {R} as you cast this spell.) this.addAbility(new KickerAbility("{R}")); - // When Goblin Bushwhacker enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn. EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new BoostControlledEffect(1, 0, Duration.EndOfTurn), false); ability.addEffect(new GainAbilityControlledEffect(HasteAbility.getInstance(), Duration.EndOfTurn)); - this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn.")); + this.addAbility(new ConditionalTriggeredAbility(ability, new LockedInCondition(KickedCondition.getInstance()), "When {this} enters the battlefield, if it was kicked, creatures you control get +1/+0 and gain haste until end of turn.")); } public GoblinBushwhacker(final GoblinBushwhacker card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/KorAeronaut.java b/Mage.Sets/src/mage/sets/zendikar/KorAeronaut.java index 93de979198..c8ada0332a 100644 --- a/Mage.Sets/src/mage/sets/zendikar/KorAeronaut.java +++ b/Mage.Sets/src/mage/sets/zendikar/KorAeronaut.java @@ -33,6 +33,7 @@ import mage.constants.Duration; import mage.constants.Rarity; import mage.MageInt; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.condition.LockedInCondition; import mage.abilities.condition.common.KickedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.continious.GainAbilityTargetEffect; @@ -64,7 +65,7 @@ public class KorAeronaut extends CardImpl { EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), false); ability.addTarget(new TargetCreaturePermanent()); - this.addAbility(new ConditionalTriggeredAbility(ability, KickedCondition.getInstance(), "When {this} enters the battlefield, if it was kicked, target creature gains flying until end of turn.")); + this.addAbility(new ConditionalTriggeredAbility(ability, new LockedInCondition(KickedCondition.getInstance()), "When {this} enters the battlefield, if it was kicked, target creature gains flying until end of turn.")); } public KorAeronaut(final KorAeronaut card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/VampiresBite.java b/Mage.Sets/src/mage/sets/zendikar/VampiresBite.java index 69a40c8e9b..e1d180c80e 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VampiresBite.java +++ b/Mage.Sets/src/mage/sets/zendikar/VampiresBite.java @@ -28,6 +28,7 @@ package mage.sets.zendikar; import java.util.UUID; +import mage.abilities.condition.LockedInCondition; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; @@ -60,7 +61,7 @@ public class VampiresBite extends CardImpl { this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addEffect(new BoostTargetEffect(3, 0, Duration.EndOfTurn)); ContinuousEffect effect = new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn); - this.getSpellAbility().addEffect(new ConditionalContinousEffect(effect, KickedCondition.getInstance(), "If {this} was kicked, that creature gains lifelink until end of turn")); + this.getSpellAbility().addEffect(new ConditionalContinousEffect(effect, new LockedInCondition(KickedCondition.getInstance()), "If {this} was kicked, that creature gains lifelink until end of turn")); } public VampiresBite(final VampiresBite card) { diff --git a/Mage.Sets/src/mage/sets/zendikar/VinesOfVastwood.java b/Mage.Sets/src/mage/sets/zendikar/VinesOfVastwood.java index 5139ae8d53..786badc5ca 100644 --- a/Mage.Sets/src/mage/sets/zendikar/VinesOfVastwood.java +++ b/Mage.Sets/src/mage/sets/zendikar/VinesOfVastwood.java @@ -29,6 +29,7 @@ package mage.sets.zendikar; import java.util.UUID; +import mage.abilities.condition.LockedInCondition; import mage.constants.CardType; import mage.constants.Duration; import mage.constants.Rarity; @@ -63,7 +64,7 @@ public class VinesOfVastwood extends CardImpl { // If Vines of Vastwood was kicked, that creature gets +4/+4 until end of turn. this.getSpellAbility().addEffect(new ConditionalContinousEffect(new BoostTargetEffect(4, 4, Duration.EndOfTurn), - KickedCondition.getInstance(), staticText)); + new LockedInCondition(KickedCondition.getInstance()), staticText)); } public VinesOfVastwood(final VinesOfVastwood card) {