[OTJ] Implement Magebane Lizard

This commit is contained in:
theelk801 2024-03-31 11:01:00 -04:00
parent 6aea10654c
commit f012e45678
2 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SpellCastAllTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.watchers.common.SpellsCastWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MagebaneLizard extends CardImpl {
public MagebaneLizard(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.LIZARD);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Whenever a player casts a noncreature spell, Magebane Lizard deals damage to that player equal to the number of noncreature spells they've cast this turn.
this.addAbility(new SpellCastAllTriggeredAbility(
new MagebaneLizardEffect(), StaticFilters.FILTER_SPELL_A_NON_CREATURE,
false, SetTargetPointer.PLAYER
));
}
private MagebaneLizard(final MagebaneLizard card) {
super(card);
}
@Override
public MagebaneLizard copy() {
return new MagebaneLizard(this);
}
}
class MagebaneLizardEffect extends OneShotEffect {
MagebaneLizardEffect() {
super(Outcome.Benefit);
staticText = "{this} deals damage to that player equal to the number of noncreature spells they've cast this turn";
}
private MagebaneLizardEffect(final MagebaneLizardEffect effect) {
super(effect);
}
@Override
public MagebaneLizardEffect copy() {
return new MagebaneLizardEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player == null) {
return false;
}
int count = game
.getState()
.getWatcher(SpellsCastWatcher.class)
.getSpellsCastThisTurn(player.getId())
.stream()
.mapToInt(spell -> !spell.isCreature(game) ? 1 : 0)
.sum();
return player.damage(count, source, game) > 0;
}
}

View file

@ -124,6 +124,7 @@ public final class OutlawsOfThunderJunction extends ExpansionSet {
cards.add(new SetCardInfo("Lush Oasis", 261, Rarity.COMMON, mage.cards.l.LushOasis.class));
cards.add(new SetCardInfo("Luxurious Locomotive", 244, Rarity.UNCOMMON, mage.cards.l.LuxuriousLocomotive.class));
cards.add(new SetCardInfo("Magda, the Hoardmaster", 133, Rarity.RARE, mage.cards.m.MagdaTheHoardmaster.class));
cards.add(new SetCardInfo("Magebane Lizard", 134, Rarity.UNCOMMON, mage.cards.m.MagebaneLizard.class));
cards.add(new SetCardInfo("Make Your Own Luck", 218, Rarity.UNCOMMON, mage.cards.m.MakeYourOwnLuck.class));
cards.add(new SetCardInfo("Malcolm, the Eyes", 219, Rarity.RARE, mage.cards.m.MalcolmTheEyes.class));
cards.add(new SetCardInfo("Marauding Sphinx", 56, Rarity.UNCOMMON, mage.cards.m.MaraudingSphinx.class));