[ICE] Implement Hipparion (#11505)

This commit is contained in:
Cameron Merkel 2023-12-03 20:42:37 -06:00 committed by GitHub
parent b89df53f54
commit 20fd17cadb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.effects.ReplacementEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import java.util.UUID;
/**
* @author Cguy7777
*/
public final class Hipparion extends CardImpl {
public Hipparion(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.subtype.add(SubType.HORSE);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// Hipparion can't block creatures with power 3 or greater unless you pay {1}.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new HipparionEffect()));
}
private Hipparion(final Hipparion card) {
super(card);
}
@Override
public Hipparion copy() {
return new Hipparion(this);
}
}
class HipparionEffect extends ReplacementEffectImpl {
HipparionEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "{this} can't block creatures with power 3 or greater unless you pay {1}";
}
private HipparionEffect(final HipparionEffect effect) {
super(effect);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId());
if (player == null) {
return false;
}
Permanent hipparion = game.getPermanent(event.getSourceId());
if (hipparion == null) {
return false;
}
Permanent attacker = game.getPermanent(event.getTargetId());
if (attacker == null || attacker.getPower().getValue() < 3) {
return false;
}
ManaCost cost = new GenericManaCost(1);
if (cost.canPay(source, source, player.getId(), game)
&& player.chooseUse(Outcome.Benefit, "Pay {1} to block creature with power 3 or greater?", source, game)) {
return !cost.pay(source, game, source, player.getId(), false, cost);
}
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARE_BLOCKER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getTargetId() != null && event.getSourceId().equals(source.getSourceId());
}
@Override
public ReplacementEffect copy() {
return new HipparionEffect(this);
}
}

View file

@ -206,6 +206,7 @@ public final class FifthEdition extends ExpansionSet {
cards.add(new SetCardInfo("Hecatomb", 167, Rarity.RARE, mage.cards.h.Hecatomb.class));
cards.add(new SetCardInfo("Helm of Chatzuk", 376, Rarity.RARE, mage.cards.h.HelmOfChatzuk.class));
cards.add(new SetCardInfo("Hill Giant", 239, Rarity.COMMON, mage.cards.h.HillGiant.class));
cards.add(new SetCardInfo("Hipparion", 34, Rarity.COMMON, mage.cards.h.Hipparion.class));
cards.add(new SetCardInfo("Hollow Trees", 418, Rarity.RARE, mage.cards.h.HollowTrees.class));
cards.add(new SetCardInfo("Holy Strength", 35, Rarity.COMMON, mage.cards.h.HolyStrength.class));
cards.add(new SetCardInfo("Homarid Warrior", 92, Rarity.COMMON, mage.cards.h.HomaridWarrior.class));

View file

@ -161,6 +161,7 @@ public final class IceAge extends ExpansionSet {
cards.add(new SetCardInfo("Heal", 30, Rarity.COMMON, mage.cards.h.Heal.class));
cards.add(new SetCardInfo("Hecatomb", 130, Rarity.RARE, mage.cards.h.Hecatomb.class));
cards.add(new SetCardInfo("Hematite Talisman", 320, Rarity.UNCOMMON, mage.cards.h.HematiteTalisman.class));
cards.add(new SetCardInfo("Hipparion", 31, Rarity.UNCOMMON, mage.cards.h.Hipparion.class));
cards.add(new SetCardInfo("Hoar Shade", 131, Rarity.COMMON, mage.cards.h.HoarShade.class));
cards.add(new SetCardInfo("Hot Springs", 248, Rarity.RARE, mage.cards.h.HotSprings.class));
cards.add(new SetCardInfo("Howl from Beyond", 132, Rarity.COMMON, mage.cards.h.HowlFromBeyond.class));