[NEO] Implemented Prosperous Thief

This commit is contained in:
Evan Kranzler 2022-02-03 20:32:09 -05:00
parent 36643ed0cd
commit 9c11deb070
2 changed files with 103 additions and 0 deletions

View file

@ -0,0 +1,102 @@
package mage.cards.p;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.NinjutsuAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TreasureToken;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ProsperousThief extends CardImpl {
public ProsperousThief(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.NINJA);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Ninjutsu {1}{U}
this.addAbility(new NinjutsuAbility("{1}{U}"));
// Whenever one or more Ninja or Rogue creatures you control deal combat damage to a player, create a Treasure token.
this.addAbility(new ProsperousThiefTriggeredAbility());
}
private ProsperousThief(final ProsperousThief card) {
super(card);
}
@Override
public ProsperousThief copy() {
return new ProsperousThief(this);
}
}
class ProsperousThiefTriggeredAbility extends TriggeredAbilityImpl {
private final List<UUID> damagedPlayerIds = new ArrayList<>();
ProsperousThiefTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new TreasureToken()), false);
}
private ProsperousThiefTriggeredAbility(final ProsperousThiefTriggeredAbility ability) {
super(ability);
}
@Override
public ProsperousThiefTriggeredAbility copy() {
return new ProsperousThiefTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) {
damagedPlayerIds.clear();
return false;
}
if (event.getType() != GameEvent.EventType.DAMAGED_PLAYER
|| !((DamagedPlayerEvent) event).isCombatDamage()
|| damagedPlayerIds.contains(event.getTargetId())) {
return false;
}
Permanent creature = game.getPermanent(event.getSourceId());
if (creature == null
|| !isControlledBy(creature.getControllerId())
|| (!creature.hasSubtype(SubType.NINJA, game)
&& !creature.hasSubtype(SubType.ROGUE, game))) {
return false;
}
damagedPlayerIds.add(event.getTargetId());
return true;
}
@Override
public String getRule() {
return "Whenever one or more Ninja or Rogue creatures you control " +
"deal combat damage to a player, create a Treasure token.";
}
}

View file

@ -118,6 +118,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet {
cards.add(new SetCardInfo("Plains", 283, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Portrait of Michiko", 29, Rarity.UNCOMMON, mage.cards.p.PortraitOfMichiko.class));
cards.add(new SetCardInfo("Prodigy's Prototype", 231, Rarity.UNCOMMON, mage.cards.p.ProdigysPrototype.class));
cards.add(new SetCardInfo("Prosperous Thief", 73, Rarity.UNCOMMON, mage.cards.p.ProsperousThief.class));
cards.add(new SetCardInfo("Raiyuu, Storm's Edge", 232, Rarity.RARE, mage.cards.r.RaiyuuStormsEdge.class));
cards.add(new SetCardInfo("Reality Heist", 75, Rarity.UNCOMMON, mage.cards.r.RealityHeist.class));
cards.add(new SetCardInfo("Reckoner Bankbuster", 255, Rarity.RARE, mage.cards.r.ReckonerBankbuster.class));