mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 21:29:17 -08:00
[VOW] Implemented Ill-Tempered Loner / Howlpack Avenger
This commit is contained in:
parent
03926f114f
commit
8de8a24227
24 changed files with 230 additions and 147 deletions
|
|
@ -44,7 +44,7 @@ public final class BodyOfKnowledge extends CardImpl {
|
|||
|
||||
// Whenever Body of Knowledge is dealt damage, draw that many cards.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(
|
||||
new BodyOfKnowledgeEffect(), false, false, true
|
||||
new BodyOfKnowledgeEffect(), false, false
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
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.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -31,13 +31,15 @@ public final class BorosReckoner extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever Boros Reckoner is dealt damage, it deals that much damage to any target.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new BorosReckonerDealDamageEffect(), false, false, true);
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new DamageTargetEffect(SavedDamageValue.instance)
|
||||
.setText("it deals that much damage to any target"), false, false);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {R/W}: Boros Reckoner gains first strike until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(
|
||||
Zone.BATTLEFIELD, new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), new ManaCostsImpl("{R/W}")));
|
||||
this.addAbility(new SimpleActivatedAbility(new GainAbilitySourceEffect(
|
||||
FirstStrikeAbility.getInstance(), Duration.EndOfTurn
|
||||
), new ManaCostsImpl<>("{R/W}")));
|
||||
}
|
||||
|
||||
private BorosReckoner(final BorosReckoner card) {
|
||||
|
|
@ -49,38 +51,3 @@ public final class BorosReckoner extends CardImpl {
|
|||
return new BorosReckoner(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BorosReckonerDealDamageEffect extends OneShotEffect {
|
||||
|
||||
public BorosReckonerDealDamageEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "it deals that much damage to any target";
|
||||
}
|
||||
|
||||
public BorosReckonerDealDamageEffect(final BorosReckonerDealDamageEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BorosReckonerDealDamageEffect copy() {
|
||||
return new BorosReckonerDealDamageEffect(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;
|
||||
}
|
||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
if (creature != null) {
|
||||
creature.damage(amount, source.getSourceId(), source, game, false, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public final class BrashTaunter extends CardImpl {
|
|||
this.addAbility(IndestructibleAbility.getInstance());
|
||||
|
||||
// Whenever Brash Taunter is dealt damage, it deals that much damage to target opponent.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new BrashTaunterEffect(), false, false, true);
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new BrashTaunterEffect(), false, false);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public final class BroodhatchNantuko extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// 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, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new BroodhatchNantukoDealDamageEffect(), true, false));
|
||||
// Morph {2}{G}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{2}{G}")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
|
@ -12,7 +10,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -31,8 +28,8 @@ public final class CoalhaulerSwine extends CardImpl {
|
|||
|
||||
// Whenever Coalhauler Swine is dealt damage, it deals that much damage to each player.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new DamagePlayersEffect(
|
||||
Outcome.Neutral, CoalhaulerSwineValue.instance, TargetController.ANY, "it"
|
||||
), false, false, true));
|
||||
Outcome.Neutral, SavedDamageValue.instance, TargetController.ANY, "it"
|
||||
), false, false));
|
||||
}
|
||||
|
||||
private CoalhaulerSwine(final CoalhaulerSwine card) {
|
||||
|
|
@ -44,27 +41,3 @@ public final class CoalhaulerSwine extends CardImpl {
|
|||
return new CoalhaulerSwine(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum CoalhaulerSwineValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return (Integer) effect.getValue("damage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CoalhaulerSwineValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "that much";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public final class FiredrinkerSatyr extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Firedrinker Satyr is dealt damage, it deals that much damage to you.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new FiredrinkerSatyrDealDamageEffect(), false, false, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new FiredrinkerSatyrDealDamageEffect(), false, false));
|
||||
// {1}{R}: Firedrinker Satyr gets +1/+0 until end of turn and deals 1 damage to you.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}"));
|
||||
Effect effect = new DamageControllerEffect(1);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public final class Grollub extends CardImpl {
|
|||
|
||||
// Whenever Grollub is dealt damage, each opponent gains that much life.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(
|
||||
new EachOpponentGainsLifeEffect(), false, false, true));
|
||||
new EachOpponentGainsLifeEffect(), false, false));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public final class HornetNest extends CardImpl {
|
|||
this.addAbility(DefenderAbility.getInstance());
|
||||
|
||||
// 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, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new HornetNestDealDamageEffect(), false, false));
|
||||
}
|
||||
|
||||
private HornetNest(final HornetNest card) {
|
||||
|
|
|
|||
101
Mage.Sets/src/mage/cards/h/HowlpackAvenger.java
Normal file
101
Mage.Sets/src/mage/cards/h/HowlpackAvenger.java
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.keyword.NightboundAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPermanentBatchEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class HowlpackAvenger extends CardImpl {
|
||||
|
||||
public HowlpackAvenger(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "");
|
||||
|
||||
this.subtype.add(SubType.WEREWOLF);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.color.setRed(true);
|
||||
this.nightCard = true;
|
||||
|
||||
// Whenever a permanent you control is dealt damage, Howlpack Avenger deals that much damage to any target.
|
||||
this.addAbility(new HowlpackAvengerTriggeredAbility());
|
||||
|
||||
// {1}{R}: Howlpack Avenger gets +2/+0 until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(
|
||||
2, 0, Duration.EndOfTurn
|
||||
), new ManaCostsImpl<>("{1}{R}")));
|
||||
|
||||
// Nightbound
|
||||
this.addAbility(new NightboundAbility());
|
||||
}
|
||||
|
||||
private HowlpackAvenger(final HowlpackAvenger card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HowlpackAvenger copy() {
|
||||
return new HowlpackAvenger(this);
|
||||
}
|
||||
}
|
||||
|
||||
class HowlpackAvengerTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
HowlpackAvengerTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(SavedDamageValue.instance));
|
||||
this.addTarget(new TargetAnyTarget());
|
||||
}
|
||||
|
||||
private HowlpackAvengerTriggeredAbility(final HowlpackAvengerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HowlpackAvengerTriggeredAbility copy() {
|
||||
return new HowlpackAvengerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DAMAGED_PERMANENT_BATCH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
|
||||
int damage = dEvent
|
||||
.getEvents()
|
||||
.stream()
|
||||
.filter(damagedEvent -> isControlledBy(game.getControllerId(damagedEvent.getTargetId())))
|
||||
.mapToInt(GameEvent::getAmount)
|
||||
.sum();
|
||||
if (damage < 1) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("damage", damage);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a permanent you control is dealt damage, {this} deals that much damage to any target.";
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ public final class HungeringHydra extends CardImpl {
|
|||
// Whenever damage is dealt to Hungering Hydra, put that many +1/+1 counters on it.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(
|
||||
new HungeringHydraEffect(),
|
||||
false, false, true
|
||||
false, false
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
58
Mage.Sets/src/mage/cards/i/IllTemperedLoner.java
Normal file
58
Mage.Sets/src/mage/cards/i/IllTemperedLoner.java
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DealtDamageToSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.keyword.DayboundAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class IllTemperedLoner extends CardImpl {
|
||||
|
||||
public IllTemperedLoner(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WEREWOLF);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
this.secondSideCardClazz = mage.cards.h.HowlpackAvenger.class;
|
||||
|
||||
// Whenever Ill-Tempered Loner is dealt damage, it deals that much damage to any target.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new DamageTargetEffect(SavedDamageValue.instance)
|
||||
.setText("it deals that much damage to any target"), false, false);
|
||||
ability.addTarget(new TargetAnyTarget());
|
||||
this.addAbility(ability);
|
||||
|
||||
// {1}{R}: Ill-Tempered Loner gets +2/+0 until end of turn.
|
||||
this.addAbility(new SimpleActivatedAbility(new BoostSourceEffect(
|
||||
2, 0, Duration.EndOfTurn
|
||||
), new ManaCostsImpl<>("{1}{R}")));
|
||||
|
||||
// Daybound
|
||||
this.addAbility(new DayboundAbility());
|
||||
}
|
||||
|
||||
private IllTemperedLoner(final IllTemperedLoner card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IllTemperedLoner copy() {
|
||||
return new IllTemperedLoner(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ public final class IllusoryAmbusher extends CardImpl {
|
|||
this.addAbility(FlashAbility.getInstance());
|
||||
|
||||
// Whenever Illusory Ambusher is dealt damage, draw that many cards.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new IllusoryAmbusherDealtDamageEffect(), false, false, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new IllusoryAmbusherDealtDamageEffect(), false, false));
|
||||
}
|
||||
|
||||
private IllusoryAmbusher(final IllusoryAmbusher card) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public final class JackalPup extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Jackal Pup is dealt damage, it deals that much damage to you.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new JackalPupEffect(), false, false, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new JackalPupEffect(), false, false));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public final class JaggedPoppet extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever Jagged Poppet is dealt damage, discard that many cards.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new JaggedPoppetDealtDamageEffect(), false, false, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new JaggedPoppetDealtDamageEffect(), false, false));
|
||||
|
||||
// Hellbent - Whenever Jagged Poppet deals combat damage to a player, if you have no cards in hand, that player discards cards equal to the damage.
|
||||
Ability hellbentAbility = new ConditionalInterveningIfTriggeredAbility(
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.common.TapTargetCost;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
|
||||
|
|
@ -19,7 +18,6 @@ import mage.constants.SubType;
|
|||
import mage.constants.SuperType;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.permanent.TappedPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.ElfWarriorToken;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
|
|
@ -51,7 +49,7 @@ public final class LathrilBladeOfTheElves extends CardImpl {
|
|||
|
||||
// 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(
|
||||
new ElfWarriorToken(), LathrilBladeOfTheElvesValue.instance
|
||||
new ElfWarriorToken(), SavedDamageValue.instance
|
||||
).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.
|
||||
|
|
@ -70,22 +68,3 @@ public final class LathrilBladeOfTheElves extends CardImpl {
|
|||
return new LathrilBladeOfTheElves(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum LathrilBladeOfTheElvesValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return (Integer) effect.getValue("damage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public LathrilBladeOfTheElvesValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public final class MoggManiac extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Mogg Maniac is dealt damage, it deals that much damage to target opponent.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new MoggManiacDealDamageEffect(), false, false, true);
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(new MoggManiacDealDamageEffect(), false, false);
|
||||
ability.addTarget(new TargetOpponentOrPlaneswalker());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public final class SaberAnts extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// 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, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new SaberAntsEffect(), true, false));
|
||||
}
|
||||
|
||||
private SaberAnts(final SaberAnts card) {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public final class ShinkaGatekeeper extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever Shinka Gatekeeper is dealt damage, it deals that much damage to you.
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new ShinkaGatekeeperDealDamageEffect(), false, false, true));
|
||||
this.addAbility(new DealtDamageToSourceTriggeredAbility(new ShinkaGatekeeperDealDamageEffect(), false, false));
|
||||
}
|
||||
|
||||
private ShinkaGatekeeper(final ShinkaGatekeeper card) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public final class SpitefulSliver extends CardImpl {
|
|||
// Sliver creatures you control have "Whenever this creature is dealt damage, it deals that much damage to target player or planeswalker."
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(
|
||||
new SpitefulSliverEffect(),
|
||||
false, false, true
|
||||
false, false
|
||||
);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public final class ThrashingMudspawn extends CardImpl {
|
|||
|
||||
// Whenever Thrashing Mudspawn is dealt damage, you lose that much life.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(
|
||||
new ThrashingMudspawnEffect(), false, false, true
|
||||
new ThrashingMudspawnEffect(), false, false
|
||||
);
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public final class TruefireCaptain extends CardImpl {
|
|||
// Whenever Truefire Captain is dealt damage, it deals that much damage to target player.
|
||||
Ability ability = new DealtDamageToSourceTriggeredAbility(
|
||||
new TruefireCaptainEffect(),
|
||||
false, false, true
|
||||
false, false
|
||||
);
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
|
|
|
|||
|
|
@ -185,9 +185,11 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Hookhand Mariner", 203, Rarity.COMMON, mage.cards.h.HookhandMariner.class));
|
||||
cards.add(new SetCardInfo("Hopeful Initiate", 20, Rarity.RARE, mage.cards.h.HopefulInitiate.class));
|
||||
cards.add(new SetCardInfo("Howling Moon", 204, Rarity.RARE, mage.cards.h.HowlingMoon.class));
|
||||
cards.add(new SetCardInfo("Howlpack Avenger", 162, Rarity.RARE, mage.cards.h.HowlpackAvenger.class));
|
||||
cards.add(new SetCardInfo("Howlpack Piper", 205, Rarity.RARE, mage.cards.h.HowlpackPiper.class));
|
||||
cards.add(new SetCardInfo("Hullbreaker Horror", 63, Rarity.RARE, mage.cards.h.HullbreakerHorror.class));
|
||||
cards.add(new SetCardInfo("Hungry Ridgewolf", 161, Rarity.COMMON, mage.cards.h.HungryRidgewolf.class));
|
||||
cards.add(new SetCardInfo("Ill-Tempered Loner", 162, Rarity.RARE, mage.cards.i.IllTemperedLoner.class));
|
||||
cards.add(new SetCardInfo("Infestation Expert", 206, Rarity.UNCOMMON, mage.cards.i.InfestationExpert.class));
|
||||
cards.add(new SetCardInfo("Infested Werewolf", 206, Rarity.UNCOMMON, mage.cards.i.InfestedWerewolf.class));
|
||||
cards.add(new SetCardInfo("Innocent Traveler", 121, Rarity.UNCOMMON, mage.cards.i.InnocentTraveler.class));
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
|
||||
package mage.abilities.common;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamagedEvent;
|
||||
import mage.game.events.DamagedPermanentBatchEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
|
|
@ -17,19 +13,12 @@ import mage.game.events.GameEvent;
|
|||
*/
|
||||
public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final boolean useValue;
|
||||
|
||||
public DealtDamageToSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
}
|
||||
|
||||
public DealtDamageToSourceTriggeredAbility(Effect effect, boolean optional, boolean enrage) {
|
||||
this(effect, optional, enrage, false);
|
||||
}
|
||||
|
||||
public DealtDamageToSourceTriggeredAbility(Effect effect, boolean optional, boolean enrage, boolean useValue) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.useValue = useValue;
|
||||
if (enrage) {
|
||||
this.setAbilityWord(AbilityWord.ENRAGE);
|
||||
}
|
||||
|
|
@ -37,7 +26,6 @@ public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public DealtDamageToSourceTriggeredAbility(final DealtDamageToSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.useValue = ability.useValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -52,31 +40,18 @@ public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
|
||||
if (event == null || game == null || this.getSourceId() == null) {
|
||||
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
|
||||
int damage = dEvent
|
||||
.getEvents()
|
||||
.stream()
|
||||
.filter(damagedEvent -> getSourceId().equals(damagedEvent.getTargetId()))
|
||||
.mapToInt(GameEvent::getAmount)
|
||||
.sum();
|
||||
if (damage < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int damage = 0;
|
||||
DamagedPermanentBatchEvent dEvent = (DamagedPermanentBatchEvent) event;
|
||||
for (DamagedEvent damagedEvent : dEvent.getEvents()) {
|
||||
UUID targetID = damagedEvent.getTargetId();
|
||||
if (targetID == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (targetID == this.getSourceId()) {
|
||||
damage += damagedEvent.getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
if (damage > 0) {
|
||||
if (this.useValue) {
|
||||
this.getEffects().setValue("damage", damage);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
this.getEffects().setValue("damage", damage);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public enum SavedDamageValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
return (Integer) effect.getValue("damage");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SavedDamageValue copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "that much";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue