mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
* KickedCondtion - used LockedInCondition where needed, some cleanup.
This commit is contained in:
parent
0953b1477f
commit
001cbbf4c5
11 changed files with 55 additions and 69 deletions
|
@ -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;
|
||||
|
|
|
@ -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<OrimsChantCantCastE
|
|||
class OrimsChantCantAttackEffect extends ReplacementEffectImpl<OrimsChantCantAttackEffect> {
|
||||
|
||||
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<OrimsChantCantAtt
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && KickedCondition.getInstance().apply(game, source)) {
|
||||
if ( event.getType() == GameEvent.EventType.DECLARE_ATTACKER && condition.apply(game, source)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -28,10 +28,9 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
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.decorator.ConditionalContinousEffect;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
@ -41,6 +40,9 @@ import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
|
|||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
|
||||
|
@ -50,19 +52,19 @@ import mage.game.Game;
|
|||
*/
|
||||
public class BoldDefense extends CardImpl<BoldDefense> {
|
||||
|
||||
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<BoldDefense> {
|
|||
|
||||
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
|
||||
|
|
|
@ -49,8 +49,10 @@ public class BurstLightning extends CardImpl<BurstLightning> {
|
|||
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"));
|
||||
|
|
|
@ -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<ElementalAppeal> {
|
|||
// 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"));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<GatekeeperOfMalakir> {
|
|||
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);
|
||||
|
|
|
@ -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<Gigantiform> {
|
|||
// 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<GigantiformAbility> {
|
|||
}
|
||||
}
|
||||
|
||||
class GigantiformTriggeredAbility extends TriggeredAbilityImpl<GigantiformTriggeredAbility> {
|
||||
|
||||
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<GigantiformEffect> {
|
||||
|
||||
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<GigantiformEffect> {
|
|||
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());
|
||||
|
|
|
@ -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<GoblinBushwhacker> {
|
|||
// 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) {
|
||||
|
|
|
@ -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<KorAeronaut> {
|
|||
|
||||
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) {
|
||||
|
|
|
@ -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<VampiresBite> {
|
|||
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) {
|
||||
|
|
|
@ -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<VinesOfVastwood> {
|
|||
|
||||
// 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) {
|
||||
|
|
Loading…
Reference in a new issue