forked from External/mage
[LTC] Implement Motivated Pony (#10716)
This commit is contained in:
parent
daa201d524
commit
67407a8780
4 changed files with 135 additions and 2 deletions
132
Mage.Sets/src/mage/cards/m/MotivatedPony.java
Normal file
132
Mage.Sets/src/mage/cards/m/MotivatedPony.java
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
package mage.cards.m;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.AttacksTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.UntapAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostAllEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.EntersTheBattlefieldEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public final class MotivatedPony extends CardImpl {
|
||||
|
||||
public MotivatedPony(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}");
|
||||
|
||||
this.subtype.add(SubType.HORSE);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
// Haste
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
|
||||
// Whenever Motivated Pony attacks, attacking creatures get +1/+1 until end of turn. If a Food entered the battlefield under your control this turn, untap those creatures and they get an additional +2/+2 until end of turn.
|
||||
TriggeredAbility trigger = new AttacksTriggeredAbility(new MotivatedPonyEffect());
|
||||
trigger.addWatcher(new MotivatedPonyWatcher());
|
||||
this.addAbility(trigger);
|
||||
}
|
||||
|
||||
private MotivatedPony(final MotivatedPony card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotivatedPony copy() {
|
||||
return new MotivatedPony(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MotivatedPonyWatcher extends Watcher {
|
||||
|
||||
// players that had a Food enter this turn.
|
||||
private final Set<UUID> players = new HashSet<>();
|
||||
|
||||
MotivatedPonyWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD
|
||||
&& ((EntersTheBattlefieldEvent) event).getTarget().getSubtype(game).contains(SubType.FOOD)) {
|
||||
players.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
players.clear();
|
||||
}
|
||||
|
||||
public boolean checkPlayer(UUID playerId) {
|
||||
return players.contains(playerId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class MotivatedPonyEffect extends OneShotEffect {
|
||||
|
||||
MotivatedPonyEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "attacking creatures get +1/+1 until end of turn. If a Food entered the battlefield under "
|
||||
+ "your control this turn, untap those creatures and they get an additional +2/+2 until end of turn.";
|
||||
}
|
||||
|
||||
private MotivatedPonyEffect(final MotivatedPonyEffect ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotivatedPonyEffect copy() {
|
||||
return new MotivatedPonyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MotivatedPonyWatcher watcher = game.getState().getWatcher(MotivatedPonyWatcher.class);
|
||||
if (controller == null || watcher == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean additionalEffect = watcher.checkPlayer(controller.getId());
|
||||
int valueBoost = additionalEffect ? 1 + 2 : 1;
|
||||
|
||||
game.addEffect(new BoostAllEffect(
|
||||
valueBoost,
|
||||
valueBoost,
|
||||
Duration.EndOfTurn,
|
||||
StaticFilters.FILTER_ATTACKING_CREATURES,
|
||||
false
|
||||
), source);
|
||||
|
||||
if (additionalEffect) {
|
||||
new UntapAllEffect(StaticFilters.FILTER_ATTACKING_CREATURES).apply(game, source);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -173,6 +173,7 @@ public final class TalesOfMiddleEarthCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Monstrosity of the Lake", 22, Rarity.RARE, mage.cards.m.MonstrosityOfTheLake.class));
|
||||
cards.add(new SetCardInfo("Moria Scavenger", 63, Rarity.RARE, mage.cards.m.MoriaScavenger.class));
|
||||
cards.add(new SetCardInfo("Mortify", 269, Rarity.UNCOMMON, mage.cards.m.Mortify.class));
|
||||
cards.add(new SetCardInfo("Motivated Pony", 42, Rarity.RARE, mage.cards.m.MotivatedPony.class));
|
||||
cards.add(new SetCardInfo("Mouth of Ronom", 370, Rarity.MYTHIC, mage.cards.m.MouthOfRonom.class));
|
||||
cards.add(new SetCardInfo("Murmuring Bosk", 320, Rarity.RARE, mage.cards.m.MurmuringBosk.class));
|
||||
cards.add(new SetCardInfo("Mystic Confluence", 193, Rarity.RARE, mage.cards.m.MysticConfluence.class));
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class AttacksTriggeredAbility extends TriggeredAbilityImpl {
|
|||
setTriggerPhrase("Whenever {this} attacks, ");
|
||||
}
|
||||
|
||||
public AttacksTriggeredAbility(final AttacksTriggeredAbility ability) {
|
||||
protected AttacksTriggeredAbility(final AttacksTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.text = ability.text;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class UntapAllEffect extends OneShotEffect {
|
|||
this.filter = filter;
|
||||
}
|
||||
|
||||
public UntapAllEffect(final UntapAllEffect effect) {
|
||||
protected UntapAllEffect(final UntapAllEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue