Implemented Mtenda Lion

This commit is contained in:
Evan Kranzler 2019-10-03 19:42:09 -04:00
parent 69b06087f2
commit 193182aa3d
3 changed files with 86 additions and 15 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.m;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.PreventCombatDamageBySourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MtendaLion extends CardImpl {
public MtendaLion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{G}");
this.subtype.add(SubType.CAT);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Whenever Mtenda Lion attacks, defending player may pay {U}. If that player does, prevent all combat damage that would be dealt by Mtenda Lion this turn.
this.addAbility(new AttacksTriggeredAbility(new MtendaLionEffect(), false));
}
private MtendaLion(final MtendaLion card) {
super(card);
}
@Override
public MtendaLion copy() {
return new MtendaLion(this);
}
}
class MtendaLionEffect extends OneShotEffect {
MtendaLionEffect() {
super(Outcome.Benefit);
staticText = "defending player may pay {U}. If that player does, " +
"prevent all combat damage that would be dealt by {this} this turn.";
}
private MtendaLionEffect(final MtendaLionEffect effect) {
super(effect);
}
@Override
public MtendaLionEffect copy() {
return new MtendaLionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getCombat().getDefendingPlayerId(source.getSourceId(), game));
if (player == null) {
return false;
}
Cost cost = new ManaCostsImpl("{U}");
if (!player.chooseUse(outcome, "Pay {U} to prevent damage?", source, game)
|| !cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
return false;
}
game.addEffect(new PreventCombatDamageBySourceEffect(Duration.EndOfTurn), source);
return true;
}
}

View file

@ -208,6 +208,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Mountain", 346, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mountain", 346, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mtenda Griffin", 28, Rarity.UNCOMMON, mage.cards.m.MtendaGriffin.class)); cards.add(new SetCardInfo("Mtenda Griffin", 28, Rarity.UNCOMMON, mage.cards.m.MtendaGriffin.class));
cards.add(new SetCardInfo("Mtenda Herder", 29, Rarity.COMMON, mage.cards.m.MtendaHerder.class)); cards.add(new SetCardInfo("Mtenda Herder", 29, Rarity.COMMON, mage.cards.m.MtendaHerder.class));
cards.add(new SetCardInfo("Mtenda Lion", 128, Rarity.COMMON, mage.cards.m.MtendaLion.class));
cards.add(new SetCardInfo("Mystical Tutor", 80, Rarity.UNCOMMON, mage.cards.m.MysticalTutor.class)); cards.add(new SetCardInfo("Mystical Tutor", 80, Rarity.UNCOMMON, mage.cards.m.MysticalTutor.class));
cards.add(new SetCardInfo("Natural Balance", 231, Rarity.RARE, mage.cards.n.NaturalBalance.class)); cards.add(new SetCardInfo("Natural Balance", 231, Rarity.RARE, mage.cards.n.NaturalBalance.class));
cards.add(new SetCardInfo("Nettletooth Djinn", 232, Rarity.UNCOMMON, mage.cards.n.NettletoothDjinn.class)); cards.add(new SetCardInfo("Nettletooth Djinn", 232, Rarity.UNCOMMON, mage.cards.n.NettletoothDjinn.class));

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -9,7 +7,6 @@ import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public class PreventCombatDamageBySourceEffect extends PreventionEffectImpl { public class PreventCombatDamageBySourceEffect extends PreventionEffectImpl {
@ -30,12 +27,7 @@ public class PreventCombatDamageBySourceEffect extends PreventionEffectImpl {
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) { return super.applies(event, source, game)
if (event.getSourceId().equals(source.getSourceId())) { && event.getSourceId().equals(source.getSourceId());
return true;
} }
} }
return false;
}
}