[AFR] Implemented Kalain, Reclusive Painter

This commit is contained in:
Evan Kranzler 2021-07-07 20:33:54 -04:00
parent 2f3328ce20
commit 28e8f48826
2 changed files with 102 additions and 0 deletions

View file

@ -0,0 +1,101 @@
package mage.cards.k;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TreasureToken;
import mage.watchers.common.ManaPaidSourceWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KalainReclusivePainter extends CardImpl {
public KalainReclusivePainter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ELF);
this.subtype.add(SubType.BARD);
this.power = new MageInt(1);
this.toughness = new MageInt(2);
// When Kalain, Reclusive Painter enters the battlefield, create a Treasure token.
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new TreasureToken())));
// Other creatures you control enter the battlefield with an additional +1/+1 counter on them for each mana from a Treasure spent to cast them.
this.addAbility(new SimpleStaticAbility(new KalainReclusivePainterEffect()));
}
private KalainReclusivePainter(final KalainReclusivePainter card) {
super(card);
}
@Override
public KalainReclusivePainter copy() {
return new KalainReclusivePainter(this);
}
}
class KalainReclusivePainterEffect extends ReplacementEffectImpl {
KalainReclusivePainterEffect() {
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
staticText = "other creatures you control enter the battlefield with " +
"an additional +1/+1 counter on them for each mana from a Treasure spent to cast them";
}
private KalainReclusivePainterEffect(final KalainReclusivePainterEffect effect) {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
return creature != null
&& !creature.getId().equals(source.getSourceId())
&& creature.isControlledBy(source.getControllerId())
&& creature.isCreature();
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget();
if (creature == null) {
return false;
}
int manaPaid = ManaPaidSourceWatcher.getTreasurePaid(creature.getId(), game);
if (manaPaid < 1) {
return false;
}
creature.addCounters(
CounterType.P1P1.createInstance(manaPaid),
source.getControllerId(), source, game, event.getAppliedEffects()
);
return false;
}
@Override
public KalainReclusivePainterEffect copy() {
return new KalainReclusivePainterEffect(this);
}
}

View file

@ -135,6 +135,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Island", 266, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Iymrith, Desert Doom", 62, Rarity.MYTHIC, mage.cards.i.IymrithDesertDoom.class));
cards.add(new SetCardInfo("Jaded Sell-Sword", 152, Rarity.COMMON, mage.cards.j.JadedSellSword.class));
cards.add(new SetCardInfo("Kalain, Reclusive Painter", 225, Rarity.UNCOMMON, mage.cards.k.KalainReclusivePainter.class));
cards.add(new SetCardInfo("Keen-Eared Sentry", 22, Rarity.UNCOMMON, mage.cards.k.KeenEaredSentry.class));
cards.add(new SetCardInfo("Kick in the Door", 153, Rarity.COMMON, mage.cards.k.KickInTheDoor.class));
cards.add(new SetCardInfo("Krydle of Baldur's Gate", 226, Rarity.UNCOMMON, mage.cards.k.KrydleOfBaldursGate.class));