[NEC] Implemented Smoke Spirits' Aid

This commit is contained in:
Evan Kranzler 2022-02-14 19:15:05 -05:00
parent 1f16718583
commit 21dd720336
3 changed files with 169 additions and 0 deletions

View file

@ -0,0 +1,91 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SmokeBlessingToken;
import mage.game.permanent.token.Token;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetadjustment.TargetAdjuster;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SmokeSpiritsAid extends CardImpl {
public SmokeSpiritsAid(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
// For each of up to X target creatures, create a red Aura enchantment token named Smoke Blessing attached to that creature. Those tokens have enchant creature and "When enchanted creature dies, it deals 1 damage to its controller and you create a Treasure token."
this.getSpellAbility().addEffect(new SmokeSpiritsAidEffect());
this.getSpellAbility().setTargetAdjuster(SmokeSpiritsAidAdjuster.instance);
}
private SmokeSpiritsAid(final SmokeSpiritsAid card) {
super(card);
}
@Override
public SmokeSpiritsAid copy() {
return new SmokeSpiritsAid(this);
}
}
enum SmokeSpiritsAidAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getManaCostsToPay().getX() > 0) {
ability.getTargets().clear();
ability.addTarget(new TargetCreaturePermanent(0, ability.getManaCostsToPay().getX()));
}
}
}
class SmokeSpiritsAidEffect extends OneShotEffect {
SmokeSpiritsAidEffect() {
super(Outcome.Benefit);
staticText = "for each of up to X target creatures, create a red Aura enchantment token " +
"named Smoke Blessing attached to that creature. Those tokens have enchant creature and " +
"\"When enchanted creature dies, it deals 1 damage to its controller and you create a Treasure token.\"";
}
private SmokeSpiritsAidEffect(final SmokeSpiritsAidEffect effect) {
super(effect);
}
@Override
public SmokeSpiritsAidEffect copy() {
return new SmokeSpiritsAidEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Token token = new SmokeBlessingToken();
for (UUID targetId : getTargetPointer().getTargets(game, source)) {
Permanent permanent = game.getPermanent(targetId);
if (permanent == null) {
continue;
}
token.putOntoBattlefield(1, game, source);
for (UUID tokenId : token.getLastAddedTokenIds()) {
Permanent aura = game.getPermanent(tokenId);
if (aura == null) {
continue;
}
aura.getAbilities().get(0).getTargets().get(0).add(source.getFirstTarget(), game);
aura.getAbilities().get(0).getEffects().get(0).apply(game, aura.getAbilities().get(0));
}
}
return true;
}
}

View file

@ -127,6 +127,7 @@ public final class NeonDynastyCommander extends ExpansionSet {
cards.add(new SetCardInfo("Silver Myr", 158, Rarity.COMMON, mage.cards.s.SilverMyr.class));
cards.add(new SetCardInfo("Skycloud Expanse", 177, Rarity.RARE, mage.cards.s.SkycloudExpanse.class));
cards.add(new SetCardInfo("Skysovereign, Consul Flagship", 159, Rarity.MYTHIC, mage.cards.s.SkysovereignConsulFlagship.class));
cards.add(new SetCardInfo("Smoke Spirits' Aid", 22, Rarity.RARE, mage.cards.s.SmokeSpiritsAid.class));
cards.add(new SetCardInfo("Smuggler's Copter", 160, Rarity.RARE, mage.cards.s.SmugglersCopter.class));
cards.add(new SetCardInfo("Snake Umbra", 130, Rarity.UNCOMMON, mage.cards.s.SnakeUmbra.class));
cards.add(new SetCardInfo("Sol Ring", 161, Rarity.UNCOMMON, mage.cards.s.SolRing.class));

View file

@ -0,0 +1,77 @@
package mage.game.permanent.token;
import mage.abilities.Ability;
import mage.abilities.common.DiesAttachedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
* @author TheElk801
*/
public final class SmokeBlessingToken extends TokenImpl {
public SmokeBlessingToken() {
super(
"Smoke Blessing", "red Aura enchantment token named Smoke Blessing " +
"attached to that creature. Those tokens have enchant creature and " +
"\"When enchanted creature dies, it deals 1 damage to its controller and you create a Treasure token.\""
);
cardType.add(CardType.ENCHANTMENT);
color.setRed(true);
subtype.add(SubType.AURA);
TargetPermanent auraTarget = new TargetPermanent();
Ability ability = new EnchantAbility(auraTarget.getTargetName());
ability.addTarget(auraTarget);
ability.addEffect(new AttachEffect(Outcome.BoostCreature));
this.addAbility(ability);
this.addAbility(new DiesAttachedTriggeredAbility(new SmokeBlessingTokenEffect(), "enchanted creature"));
}
public SmokeBlessingToken(final SmokeBlessingToken token) {
super(token);
}
public SmokeBlessingToken copy() {
return new SmokeBlessingToken(this);
}
}
class SmokeBlessingTokenEffect extends OneShotEffect {
SmokeBlessingTokenEffect() {
super(Outcome.Benefit);
staticText = "it deals 1 damage to its controller and you create a Treasure token";
}
private SmokeBlessingTokenEffect(final SmokeBlessingTokenEffect effect) {
super(effect);
}
@Override
public SmokeBlessingTokenEffect copy() {
return new SmokeBlessingTokenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) getValue("attachedTo");
if (permanent != null) {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
player.damage(1, permanent.getId(), source, game);
}
}
new TreasureToken().putOntoBattlefield(1, game, source);
return true;
}
}