[MOM] Implement War-Trained Slasher

This commit is contained in:
theelk801 2023-04-07 08:36:34 -04:00
parent 7eb20380db
commit 3cc959e9a1
2 changed files with 116 additions and 0 deletions

View file

@ -0,0 +1,115 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class WarTrainedSlasher extends CardImpl {
public WarTrainedSlasher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.subtype.add(SubType.WOLVERINE);
this.subtype.add(SubType.DINOSAUR);
this.power = new MageInt(4);
this.toughness = new MageInt(3);
// Menace
this.addAbility(new MenaceAbility());
// Whenever War-Trained Slasher attacks a battle, double its power until end of turn.
this.addAbility(new WarTrainedSlasherTriggeredAbility());
}
private WarTrainedSlasher(final WarTrainedSlasher card) {
super(card);
}
@Override
public WarTrainedSlasher copy() {
return new WarTrainedSlasher(this);
}
}
class WarTrainedSlasherTriggeredAbility extends TriggeredAbilityImpl {
WarTrainedSlasherTriggeredAbility() {
super(Zone.BATTLEFIELD, new WarTrainedSlasherEffect());
}
private WarTrainedSlasherTriggeredAbility(final WarTrainedSlasherTriggeredAbility ability) {
super(ability);
}
@Override
public WarTrainedSlasherTriggeredAbility copy() {
return new WarTrainedSlasherTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
return Optional
.ofNullable(this.getSourceId())
.map(game.getCombat()::getDefenderId)
.map(game::getPermanent)
.filter(Objects::nonNull)
.map(permanent -> permanent.isBattle(game))
.orElse(false);
}
@Override
public String getRule() {
return "Whenever {this} attacks a battle, double its power until end of turn.";
}
}
class WarTrainedSlasherEffect extends OneShotEffect {
WarTrainedSlasherEffect() {
super(Outcome.Benefit);
}
private WarTrainedSlasherEffect(final WarTrainedSlasherEffect effect) {
super(effect);
}
@Override
public WarTrainedSlasherEffect copy() {
return new WarTrainedSlasherEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
if (permanent == null) {
return false;
}
int power = permanent.getPower().getValue();
if (power == 0) {
return false;
}
game.addEffect(new BoostSourceEffect(power, 0, Duration.EndOfTurn), source);
return true;
}
}

View file

@ -205,6 +205,7 @@ public final class MarchOfTheMachine extends ExpansionSet {
cards.add(new SetCardInfo("Vanquish the Weak", 129, Rarity.COMMON, mage.cards.v.VanquishTheWeak.class));
cards.add(new SetCardInfo("Voldaren Thrillseeker", 171, Rarity.RARE, mage.cards.v.VoldarenThrillseeker.class));
cards.add(new SetCardInfo("War Historian", 214, Rarity.COMMON, mage.cards.w.WarHistorian.class));
cards.add(new SetCardInfo("War-Trained Slasher", 172, Rarity.COMMON, mage.cards.w.WarTrainedSlasher.class));
cards.add(new SetCardInfo("Wary Thespian", 215, Rarity.COMMON, mage.cards.w.WaryThespian.class));
cards.add(new SetCardInfo("Wildwood Escort", 216, Rarity.COMMON, mage.cards.w.WildwoodEscort.class));
cards.add(new SetCardInfo("Wind-Scarred Crag", 276, Rarity.COMMON, mage.cards.w.WindScarredCrag.class));