diff --git a/Mage.Sets/src/mage/cards/g/GattaAndLuzzu.java b/Mage.Sets/src/mage/cards/g/GattaAndLuzzu.java new file mode 100644 index 00000000000..b763e715cba --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GattaAndLuzzu.java @@ -0,0 +1,87 @@ +package mage.cards.g; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.PreventionEffectImpl; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.target.common.TargetControlledCreaturePermanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class GattaAndLuzzu extends CardImpl { + + public GattaAndLuzzu(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // When Gatta and Luzzu enters, choose target creature you control. If damage would be dealt to that creature this turn, prevent that damage and put that many +1/+1 counters on it. + Ability ability = new EntersBattlefieldTriggeredAbility(new GattaAndLuzzuEffect()); + ability.addTarget(new TargetControlledCreaturePermanent()); + this.addAbility(ability); + } + + private GattaAndLuzzu(final GattaAndLuzzu card) { + super(card); + } + + @Override + public GattaAndLuzzu copy() { + return new GattaAndLuzzu(this); + } +} + +class GattaAndLuzzuEffect extends PreventionEffectImpl { + + GattaAndLuzzuEffect() { + super(Duration.EndOfTurn, Integer.MAX_VALUE, false, false); + staticText = "choose target creature you control. If damage would be dealt " + + "to that creature this turn, prevent that damage and put that many +1/+1 counters on it"; + } + + private GattaAndLuzzuEffect(final GattaAndLuzzuEffect effect) { + super(effect); + } + + @Override + public GattaAndLuzzuEffect copy() { + return new GattaAndLuzzuEffect(this); + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return super.applies(event, source, game) + && event.getTargetId().equals(getTargetPointer().getFirst(game, source)); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + Optional.ofNullable(getTargetPointer().getFirst(game, source)) + .map(game::getPermanent) + .ifPresent(permanent -> permanent.addCounters( + CounterType.P1P1.createInstance(event.getAmount()), source, game + )); + return super.replaceEvent(event, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java index 4aa5d7fc716..705d3ad786c 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasyCommander.java +++ b/Mage.Sets/src/mage/sets/FinalFantasyCommander.java @@ -153,6 +153,8 @@ public final class FinalFantasyCommander extends ExpansionSet { cards.add(new SetCardInfo("Furious Rise", 294, Rarity.UNCOMMON, mage.cards.f.FuriousRise.class)); cards.add(new SetCardInfo("Furycalm Snarl", 397, Rarity.RARE, mage.cards.f.FurycalmSnarl.class)); cards.add(new SetCardInfo("Game Trail", 398, Rarity.RARE, mage.cards.g.GameTrail.class)); + cards.add(new SetCardInfo("Gatta and Luzzu", 134, Rarity.RARE, mage.cards.g.GattaAndLuzzu.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Gatta and Luzzu", 19, Rarity.RARE, mage.cards.g.GattaAndLuzzu.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gau, Feral Youth", 152, Rarity.RARE, mage.cards.g.GauFeralYouth.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Gau, Feral Youth", 55, Rarity.RARE, mage.cards.g.GauFeralYouth.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("General Leo Cristophe", 135, Rarity.RARE, mage.cards.g.GeneralLeoCristophe.class, NON_FULL_USE_VARIOUS));