[VOW] Fix Howlpack Avenger; replace various custom abilities with SavedDamageValue

This commit is contained in:
Alex W. Jackson 2022-03-31 08:56:12 -04:00
parent 5854bd45dd
commit 6ca93d1936
15 changed files with 66 additions and 341 deletions

View file

@ -1,18 +1,19 @@
package mage.cards.b; package mage.cards.b;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.dynamicvalue.common.CardsInControllerHandCount; import mage.abilities.dynamicvalue.common.CardsInControllerHandCount;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect; import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect; import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.*; import mage.constants.CardType;
import mage.game.Game; import mage.constants.Duration;
import mage.players.Player; import mage.constants.SubType;
import mage.constants.Zone;
import java.util.UUID; import java.util.UUID;
@ -44,8 +45,7 @@ public final class BodyOfKnowledge extends CardImpl {
// Whenever Body of Knowledge is dealt damage, draw that many cards. // Whenever Body of Knowledge is dealt damage, draw that many cards.
this.addAbility(new DealtDamageToSourceTriggeredAbility( this.addAbility(new DealtDamageToSourceTriggeredAbility(
new BodyOfKnowledgeEffect(), false, false new DrawCardSourceControllerEffect(SavedDamageValue.MANY), false));
));
} }
private BodyOfKnowledge(final BodyOfKnowledge card) { private BodyOfKnowledge(final BodyOfKnowledge card) {
@ -57,29 +57,3 @@ public final class BodyOfKnowledge extends CardImpl {
return new BodyOfKnowledge(this); return new BodyOfKnowledge(this);
} }
} }
class BodyOfKnowledgeEffect extends OneShotEffect {
BodyOfKnowledgeEffect() {
super(Outcome.Benefit);
staticText = "draw that many cards";
}
private BodyOfKnowledgeEffect(final BodyOfKnowledgeEffect effect) {
super(effect);
}
@Override
public BodyOfKnowledgeEffect copy() {
return new BodyOfKnowledgeEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
Player player = game.getPlayer(source.getControllerId());
return player != null
&& amount > 0
&& player.drawCards(amount, source, game) > 0;
}
}

View file

@ -31,8 +31,8 @@ public final class BorosReckoner extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Whenever Boros Reckoner is dealt damage, it deals that much damage to any target. // Whenever Boros Reckoner is dealt damage, it deals that much damage to any target.
Ability ability = new DealtDamageToSourceTriggeredAbility(new DamageTargetEffect(SavedDamageValue.instance) Ability ability = new DealtDamageToSourceTriggeredAbility(
.setText("it deals that much damage to any target"), false, false); new DamageTargetEffect(SavedDamageValue.MUCH, "it"), false);
ability.addTarget(new TargetAnyTarget()); ability.addTarget(new TargetAnyTarget());
this.addAbility(ability); this.addAbility(ability);

View file

@ -6,20 +6,17 @@ import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.FightTargetSourceEffect; import mage.abilities.effects.common.FightTargetSourceEffect;
import mage.abilities.keyword.IndestructibleAbility; import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.AnotherPredicate; import mage.filter.predicate.mageobject.AnotherPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
@ -48,15 +45,15 @@ public final class BrashTaunter extends CardImpl {
this.addAbility(IndestructibleAbility.getInstance()); this.addAbility(IndestructibleAbility.getInstance());
// Whenever Brash Taunter is dealt damage, it deals that much damage to target opponent. // Whenever Brash Taunter is dealt damage, it deals that much damage to target opponent.
Ability ability = new DealtDamageToSourceTriggeredAbility(new BrashTaunterEffect(), false, false); Ability ability = new DealtDamageToSourceTriggeredAbility(new DamageTargetEffect(SavedDamageValue.MUCH, "it"), false);
ability.addTarget(new TargetOpponent()); ability.addTarget(new TargetOpponent());
this.addAbility(ability); this.addAbility(ability);
// {2}{R}, {T}: Brash Taunter fights another target creature. // {2}{R}, {T}: Brash Taunter fights another target creature.
Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new FightTargetSourceEffect(), new ManaCostsImpl("{2}{R}")); ability = new SimpleActivatedAbility(new FightTargetSourceEffect(), new ManaCostsImpl("{2}{R}"));
ability1.addCost(new TapSourceCost()); ability.addCost(new TapSourceCost());
ability1.addTarget(new TargetPermanent(filter)); ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability1); this.addAbility(ability);
} }
private BrashTaunter(final BrashTaunter card) { private BrashTaunter(final BrashTaunter card) {
@ -68,33 +65,3 @@ public final class BrashTaunter extends CardImpl {
return new BrashTaunter(this); return new BrashTaunter(this);
} }
} }
class BrashTaunterEffect extends OneShotEffect {
public BrashTaunterEffect() {
super(Outcome.Damage);
this.staticText = "it deals that much damage to target opponent";
}
public BrashTaunterEffect(final BrashTaunterEffect effect) {
super(effect);
}
@Override
public BrashTaunterEffect copy() {
return new BrashTaunterEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
player.damage(amount, source.getSourceId(), source, game);
return true;
}
}
return false;
}
}

View file

@ -1,22 +1,17 @@
package mage.cards.b; package mage.cards.b;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.MorphAbility; import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.token.InsectToken; import mage.game.permanent.token.InsectToken;
import mage.players.Player;
/** /**
* *
@ -31,7 +26,8 @@ public final class BroodhatchNantuko extends CardImpl {
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever Broodhatch Nantuko is dealt damage, you may create that many 1/1 green Insect creature tokens. // Whenever Broodhatch Nantuko is dealt damage, you may create that many 1/1 green Insect creature tokens.
this.addAbility(new DealtDamageToSourceTriggeredAbility(new BroodhatchNantukoDealDamageEffect(), true, false)); this.addAbility(new DealtDamageToSourceTriggeredAbility(
new CreateTokenEffect(new InsectToken(), SavedDamageValue.MANY), true));
// Morph {2}{G} // Morph {2}{G}
this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{G}"))); this.addAbility(new MorphAbility(this, new ManaCostsImpl<>("{2}{G}")));
@ -46,31 +42,3 @@ public final class BroodhatchNantuko extends CardImpl {
return new BroodhatchNantuko(this); return new BroodhatchNantuko(this);
} }
} }
class BroodhatchNantukoDealDamageEffect extends OneShotEffect {
public BroodhatchNantukoDealDamageEffect() {
super(Outcome.Damage);
this.staticText = "create that many 1/1 green Insect creature tokens";
}
public BroodhatchNantukoDealDamageEffect(final BroodhatchNantukoDealDamageEffect effect) {
super(effect);
}
@Override
public BroodhatchNantukoDealDamageEffect copy() {
return new BroodhatchNantukoDealDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) { return false; }
int amount = (Integer) getValue("damage");
if (amount <= 0) { return false; }
return new CreateTokenEffect(new InsectToken(), amount).apply(game, source);
}
}

View file

@ -28,8 +28,7 @@ public final class CoalhaulerSwine extends CardImpl {
// Whenever Coalhauler Swine is dealt damage, it deals that much damage to each player. // Whenever Coalhauler Swine is dealt damage, it deals that much damage to each player.
this.addAbility(new DealtDamageToSourceTriggeredAbility(new DamagePlayersEffect( this.addAbility(new DealtDamageToSourceTriggeredAbility(new DamagePlayersEffect(
Outcome.Neutral, SavedDamageValue.instance, TargetController.ANY, "it" Outcome.Damage, SavedDamageValue.MUCH, TargetController.ANY, "it"), false));
), false, false));
} }
private CoalhaulerSwine(final CoalhaulerSwine card) { private CoalhaulerSwine(final CoalhaulerSwine card) {

View file

@ -1,19 +1,15 @@
package mage.cards.h; package mage.cards.h;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.DefenderAbility; import mage.abilities.keyword.DefenderAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.token.InsectDeathToken; import mage.game.permanent.token.InsectDeathToken;
import mage.players.Player;
import java.util.UUID; import java.util.UUID;
@ -33,7 +29,8 @@ public final class HornetNest extends CardImpl {
this.addAbility(DefenderAbility.getInstance()); this.addAbility(DefenderAbility.getInstance());
// Whenever Hornet Nest is dealt damage, create that many 1/1 green Insect creature tokens with flying and deathtouch. // Whenever Hornet Nest is dealt damage, create that many 1/1 green Insect creature tokens with flying and deathtouch.
this.addAbility(new DealtDamageToSourceTriggeredAbility(new HornetNestDealDamageEffect(), false, false)); this.addAbility(new DealtDamageToSourceTriggeredAbility(
new CreateTokenEffect(new InsectDeathToken(), SavedDamageValue.MANY), false));
} }
private HornetNest(final HornetNest card) { private HornetNest(final HornetNest card) {
@ -45,32 +42,3 @@ public final class HornetNest extends CardImpl {
return new HornetNest(this); return new HornetNest(this);
} }
} }
class HornetNestDealDamageEffect extends OneShotEffect {
public HornetNestDealDamageEffect() {
super(Outcome.Damage);
this.staticText = "create that many 1/1 green Insect creature tokens with flying and deathtouch";
}
public HornetNestDealDamageEffect(final HornetNestDealDamageEffect effect) {
super(effect);
}
@Override
public HornetNestDealDamageEffect copy() {
return new HornetNestDealDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
return new CreateTokenEffect(new InsectDeathToken(), amount).apply(game, source);
}
}
return false;
}
}

View file

@ -60,7 +60,7 @@ public final class HowlpackAvenger extends CardImpl {
class HowlpackAvengerTriggeredAbility extends TriggeredAbilityImpl { class HowlpackAvengerTriggeredAbility extends TriggeredAbilityImpl {
HowlpackAvengerTriggeredAbility() { HowlpackAvengerTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(SavedDamageValue.instance)); super(Zone.BATTLEFIELD, new DamageTargetEffect(SavedDamageValue.MUCH));
this.addTarget(new TargetAnyTarget()); this.addTarget(new TargetAnyTarget());
} }
@ -91,11 +91,11 @@ class HowlpackAvengerTriggeredAbility extends TriggeredAbilityImpl {
return false; return false;
} }
this.getEffects().setValue("damage", damage); this.getEffects().setValue("damage", damage);
return false; return true;
} }
@Override @Override
public String getRule() { public String getTriggerPhrase() {
return "Whenever a permanent you control is dealt damage, {this} deals that much damage to any target."; return "Whenever a permanent you control is dealt damage, ";
} }
} }

View file

@ -33,8 +33,8 @@ public final class IllTemperedLoner extends CardImpl {
this.secondSideCardClazz = mage.cards.h.HowlpackAvenger.class; this.secondSideCardClazz = mage.cards.h.HowlpackAvenger.class;
// Whenever Ill-Tempered Loner is dealt damage, it deals that much damage to any target. // Whenever Ill-Tempered Loner is dealt damage, it deals that much damage to any target.
Ability ability = new DealtDamageToSourceTriggeredAbility(new DamageTargetEffect(SavedDamageValue.instance) Ability ability = new DealtDamageToSourceTriggeredAbility(
.setText("it deals that much damage to any target"), false, false); new DamageTargetEffect(SavedDamageValue.MUCH, "it"), false);
ability.addTarget(new TargetAnyTarget()); ability.addTarget(new TargetAnyTarget());
this.addAbility(ability); this.addAbility(ability);

View file

@ -1,19 +1,15 @@
package mage.cards.i; package mage.cards.i;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.keyword.FlashAbility; import mage.abilities.keyword.FlashAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
/** /**
* *
@ -32,7 +28,8 @@ public final class IllusoryAmbusher extends CardImpl {
this.addAbility(FlashAbility.getInstance()); this.addAbility(FlashAbility.getInstance());
// Whenever Illusory Ambusher is dealt damage, draw that many cards. // Whenever Illusory Ambusher is dealt damage, draw that many cards.
this.addAbility(new DealtDamageToSourceTriggeredAbility(new IllusoryAmbusherDealtDamageEffect(), false, false)); this.addAbility(new DealtDamageToSourceTriggeredAbility(
new DrawCardSourceControllerEffect(SavedDamageValue.MANY), false));
} }
private IllusoryAmbusher(final IllusoryAmbusher card) { private IllusoryAmbusher(final IllusoryAmbusher card) {
@ -44,33 +41,3 @@ public final class IllusoryAmbusher extends CardImpl {
return new IllusoryAmbusher(this); return new IllusoryAmbusher(this);
} }
} }
class IllusoryAmbusherDealtDamageEffect extends OneShotEffect {
public IllusoryAmbusherDealtDamageEffect() {
super(Outcome.Damage);
this.staticText = "draw that many cards";
}
public IllusoryAmbusherDealtDamageEffect(final IllusoryAmbusherDealtDamageEffect effect) {
super(effect);
}
@Override
public IllusoryAmbusherDealtDamageEffect copy() {
return new IllusoryAmbusherDealtDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
player.drawCards(amount, source, game);
}
return true;
}
return false;
}
}

View file

@ -48,9 +48,8 @@ public final class LathrilBladeOfTheElves extends CardImpl {
this.addAbility(new MenaceAbility(false)); this.addAbility(new MenaceAbility(false));
// Whenever Lathril, Blade of the Elves deals combat damage to a player, create that many 1/1 green Elf Warrior creature tokens. // Whenever Lathril, Blade of the Elves deals combat damage to a player, create that many 1/1 green Elf Warrior creature tokens.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new CreateTokenEffect( this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new ElfWarriorToken(), SavedDamageValue.instance new CreateTokenEffect(new ElfWarriorToken(), SavedDamageValue.MANY), false, true));
).setText("create that many 1/1 green Elf Warrior creature tokens"), false, true));
// {T}, Tap ten untapped Elves you control: Each opponent loses 10 life and you gain 10 life. // {T}, Tap ten untapped Elves you control: Each opponent loses 10 life and you gain 10 life.
Ability ability = new SimpleActivatedAbility(new LoseLifeOpponentsEffect(10), new TapSourceCost()); Ability ability = new SimpleActivatedAbility(new LoseLifeOpponentsEffect(10), new TapSourceCost());

View file

@ -1,17 +1,15 @@
package mage.cards.m; package mage.cards.m;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.target.common.TargetOpponentOrPlaneswalker; import mage.target.common.TargetOpponentOrPlaneswalker;
/** /**
@ -26,8 +24,9 @@ public final class MoggManiac extends CardImpl {
this.power = new MageInt(1); this.power = new MageInt(1);
this.toughness = new MageInt(1); this.toughness = new MageInt(1);
// Whenever Mogg Maniac is dealt damage, it deals that much damage to target opponent. // Whenever Mogg Maniac is dealt damage, it deals that much damage to target opponent or planeswalker.
Ability ability = new DealtDamageToSourceTriggeredAbility(new MoggManiacDealDamageEffect(), false, false); Ability ability = new DealtDamageToSourceTriggeredAbility(
new DamageTargetEffect(SavedDamageValue.MUCH, "it"), false);
ability.addTarget(new TargetOpponentOrPlaneswalker()); ability.addTarget(new TargetOpponentOrPlaneswalker());
this.addAbility(ability); this.addAbility(ability);
} }
@ -41,30 +40,3 @@ public final class MoggManiac extends CardImpl {
return new MoggManiac(this); return new MoggManiac(this);
} }
} }
class MoggManiacDealDamageEffect extends OneShotEffect {
public MoggManiacDealDamageEffect() {
super(Outcome.Damage);
this.staticText = "it deals that much damage to target opponent or planeswalker";
}
public MoggManiacDealDamageEffect(final MoggManiacDealDamageEffect effect) {
super(effect);
}
@Override
public MoggManiacDealDamageEffect copy() {
return new MoggManiacDealDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
if (amount > 0) {
game.damagePlayerOrPlaneswalker(targetPointer.getFirst(game, source), amount, source.getSourceId(), source, game, false, true);
return true;
}
return false;
}
}

View file

@ -1,20 +1,15 @@
package mage.cards.s; package mage.cards.s;
import java.util.UUID; import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.token.InsectToken; import mage.game.permanent.token.InsectToken;
import mage.players.Player;
/** /**
* *
@ -30,7 +25,8 @@ public final class SaberAnts extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// Whenever Saber Ants is dealt damage, you may create that many 1/1 green Insect creature tokens. // Whenever Saber Ants is dealt damage, you may create that many 1/1 green Insect creature tokens.
this.addAbility(new DealtDamageToSourceTriggeredAbility(new SaberAntsEffect(), true, false)); this.addAbility(new DealtDamageToSourceTriggeredAbility(
new CreateTokenEffect(new InsectToken(), SavedDamageValue.MANY), true));
} }
private SaberAnts(final SaberAnts card) { private SaberAnts(final SaberAnts card) {
@ -42,30 +38,3 @@ public final class SaberAnts extends CardImpl {
return new SaberAnts(this); return new SaberAnts(this);
} }
} }
class SaberAntsEffect extends OneShotEffect {
public SaberAntsEffect() {
super(Outcome.Benefit);
this.staticText = "you may create that many 1/1 green Insect creature tokens";
}
public SaberAntsEffect(final SaberAntsEffect effect) {
super(effect);
}
@Override
public SaberAntsEffect copy() {
return new SaberAntsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int damage = (Integer) this.getValue("damage");
return new CreateTokenEffect(new InsectToken(), damage).apply(game, source);
}
return false;
}
}

View file

@ -4,15 +4,13 @@ import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DealtDamageToSourceTriggeredAbility; import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.DamageTargetEffect; import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;
import mage.abilities.keyword.MentorAbility; import mage.abilities.keyword.MentorAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.SubType;
import mage.game.Game;
import mage.target.TargetPlayer; import mage.target.TargetPlayer;
/** /**
@ -34,9 +32,7 @@ public final class TruefireCaptain extends CardImpl {
// Whenever Truefire Captain is dealt damage, it deals that much damage to target player. // Whenever Truefire Captain is dealt damage, it deals that much damage to target player.
Ability ability = new DealtDamageToSourceTriggeredAbility( Ability ability = new DealtDamageToSourceTriggeredAbility(
new TruefireCaptainEffect(), new DamageTargetEffect(SavedDamageValue.MUCH, "it"), false);
false, false
);
ability.addTarget(new TargetPlayer()); ability.addTarget(new TargetPlayer());
this.addAbility(ability); this.addAbility(ability);
} }
@ -50,26 +46,3 @@ public final class TruefireCaptain extends CardImpl {
return new TruefireCaptain(this); return new TruefireCaptain(this);
} }
} }
class TruefireCaptainEffect extends OneShotEffect {
public TruefireCaptainEffect() {
super(Outcome.Damage);
this.staticText = "it deals that much damage to target player";
}
public TruefireCaptainEffect(final TruefireCaptainEffect effect) {
super(effect);
}
@Override
public TruefireCaptainEffect copy() {
return new TruefireCaptainEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = (Integer) getValue("damage");
return new DamageTargetEffect(amount).apply(game, source);
}
}

View file

@ -6,8 +6,7 @@ import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.LeavesBattlefieldTriggeredAbility; import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect; import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenTargetEffect; import mage.abilities.effects.common.CreateTokenTargetEffect;
import mage.abilities.effects.common.combat.CantAttackYouOrPlaneswalkerAllEffect; import mage.abilities.effects.common.combat.CantAttackYouOrPlaneswalkerAllEffect;
import mage.abilities.effects.common.combat.CantBlockAllEffect; import mage.abilities.effects.common.combat.CantBlockAllEffect;
@ -16,13 +15,10 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent; import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.token.SurvivorToken; import mage.game.permanent.token.SurvivorToken;
/** /**
@ -31,11 +27,8 @@ import mage.game.permanent.token.SurvivorToken;
*/ */
public final class VarchildBetrayerOfKjeldor extends CardImpl { public final class VarchildBetrayerOfKjeldor extends CardImpl {
private static final FilterCreaturePermanent filter1 private static final FilterCreaturePermanent filter1 = new FilterCreaturePermanent(SubType.SURVIVOR, "Survivors your opponents control");
= new FilterCreaturePermanent( private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(SubType.SURVIVOR, "all Survivors");
SubType.SURVIVOR,
"Survivors your opponents control"
);
static { static {
filter1.add(TargetController.OPPONENT.getControllerPredicate()); filter1.add(TargetController.OPPONENT.getControllerPredicate());
@ -52,16 +45,10 @@ public final class VarchildBetrayerOfKjeldor extends CardImpl {
// Whenever Varchild, Betrayer of Kjeldor deals combat damage to a player, that player creates that many 1/1 red Survivor creature tokens. // Whenever Varchild, Betrayer of Kjeldor deals combat damage to a player, that player creates that many 1/1 red Survivor creature tokens.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility( this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new VarchildBetrayerOfKjeldorEffect(), false, true new CreateTokenTargetEffect(new SurvivorToken(), SavedDamageValue.MANY), false, true));
));
// Survivors your opponents control can't block, and they can't attack you or a planeswalker you control. // Survivors your opponents control can't block, and they can't attack you or a planeswalker you control.
Ability ability = new SimpleStaticAbility( Ability ability = new SimpleStaticAbility(new CantBlockAllEffect(filter1, Duration.WhileOnBattlefield));
Zone.BATTLEFIELD,
new CantBlockAllEffect(
filter1, Duration.WhileOnBattlefield
)
);
ability.addEffect(new CantAttackYouOrPlaneswalkerAllEffect( ability.addEffect(new CantAttackYouOrPlaneswalkerAllEffect(
Duration.WhileOnBattlefield, filter1 Duration.WhileOnBattlefield, filter1
).setText("and can't attack you or planeswalkers you control")); ).setText("and can't attack you or planeswalkers you control"));
@ -69,8 +56,7 @@ public final class VarchildBetrayerOfKjeldor extends CardImpl {
// When Varchild leaves the battlefield, gain control of all Survivors. // When Varchild leaves the battlefield, gain control of all Survivors.
this.addAbility(new LeavesBattlefieldTriggeredAbility( this.addAbility(new LeavesBattlefieldTriggeredAbility(
new GainControlAllEffect(Duration.Custom, new FilterCreaturePermanent(SubType.SURVIVOR, "all Survivors")), false new GainControlAllEffect(Duration.Custom, filter2), false));
));
} }
private VarchildBetrayerOfKjeldor(final VarchildBetrayerOfKjeldor card) { private VarchildBetrayerOfKjeldor(final VarchildBetrayerOfKjeldor card) {
@ -82,32 +68,3 @@ public final class VarchildBetrayerOfKjeldor extends CardImpl {
return new VarchildBetrayerOfKjeldor(this); return new VarchildBetrayerOfKjeldor(this);
} }
} }
class VarchildBetrayerOfKjeldorEffect extends OneShotEffect {
public VarchildBetrayerOfKjeldorEffect() {
super(Outcome.Benefit);
this.staticText = "that player creates "
+ "that many 1/1 red Survivor creature tokens";
}
public VarchildBetrayerOfKjeldorEffect(final VarchildBetrayerOfKjeldorEffect effect) {
super(effect);
}
@Override
public VarchildBetrayerOfKjeldorEffect copy() {
return new VarchildBetrayerOfKjeldorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int damage = (int) this.getValue("damage");
if (damage > 0) {
Effect effect = new CreateTokenTargetEffect(new SurvivorToken(), damage);
effect.setTargetPointer(getTargetPointer());
return effect.apply(game, source);
}
return false;
}
}

View file

@ -9,7 +9,14 @@ import mage.game.Game;
* @author TheElk801 * @author TheElk801
*/ */
public enum SavedDamageValue implements DynamicValue { public enum SavedDamageValue implements DynamicValue {
instance; MANY("many"),
MUCH("much");
private final String message;
SavedDamageValue(String message) {
this.message = message;
}
@Override @Override
public int calculate(Game game, Ability sourceAbility, Effect effect) { public int calculate(Game game, Ability sourceAbility, Effect effect) {
@ -21,8 +28,13 @@ public enum SavedDamageValue implements DynamicValue {
return this; return this;
} }
@Override
public String toString() {
return "that " + message;
}
@Override @Override
public String getMessage() { public String getMessage() {
return "that much"; return "";
} }
} }