[KHM] Implemented Tormentor's Helm (#7385)

Co-authored-by: Evan Kranzler <theelk801@gmail.com>
This commit is contained in:
Daniel Bomar 2021-01-13 19:43:59 -06:00 committed by GitHub
parent 6c39fa63a4
commit 539172a234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,124 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author weirddan455
*/
public final class TormentorsHelm extends CardImpl {
public TormentorsHelm(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{R}");
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature gets +1/+1.
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 1)));
// Whenever equipped creature becomes blocked, it deals 1 damage to defending player.
this.addAbility(new TormentorsHelmTriggeredAbility());
// Equip {1}
this.addAbility(new EquipAbility(1));
}
private TormentorsHelm(final TormentorsHelm card) {
super(card);
}
@Override
public TormentorsHelm copy() {
return new TormentorsHelm(this);
}
}
class TormentorsHelmTriggeredAbility extends TriggeredAbilityImpl {
public TormentorsHelmTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
}
private TormentorsHelmTriggeredAbility(final TormentorsHelmTriggeredAbility ability) {
super(ability);
}
@Override
public TormentorsHelmTriggeredAbility copy() {
return new TormentorsHelmTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
Permanent equipment = game.getPermanent(sourceId);
if (equipment != null) {
Permanent creature = game.getPermanent(equipment.getAttachedTo());
if (creature != null && creature.getId().equals(event.getTargetId())) {
this.getEffects().clear();
TormentorsHelmEffect effect = new TormentorsHelmEffect(creature.getId());
effect.setTargetPointer(new FixedTarget(event.getPlayerId(), game));
this.addEffect(effect);
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever equipped creature becomes blocked, it deals 1 damage to defending player.";
}
}
class TormentorsHelmEffect extends OneShotEffect {
private final UUID creatureId;
public TormentorsHelmEffect(UUID creatureId) {
super(Outcome.Damage);
this.creatureId = creatureId;
}
private TormentorsHelmEffect(final TormentorsHelmEffect effect) {
super(effect);
this.creatureId = effect.creatureId;
}
@Override
public TormentorsHelmEffect copy() {
return new TormentorsHelmEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(targetPointer.getFirst(game, source));
if (player != null) {
player.damage(1, creatureId, source, game);
return true;
}
return false;
}
}

View file

@ -175,6 +175,7 @@ public final class Kaldheim extends ExpansionSet {
cards.add(new SetCardInfo("The Trickster-God's Heist", 232, Rarity.UNCOMMON, mage.cards.t.TheTricksterGodsHeist.class));
cards.add(new SetCardInfo("The World Tree", 275, Rarity.RARE, mage.cards.t.TheWorldTree.class));
cards.add(new SetCardInfo("Thornmantle Striker", 387, Rarity.UNCOMMON, mage.cards.t.ThornmantleStriker.class));
cards.add(new SetCardInfo("Tormentor's Helm", 155, Rarity.COMMON, mage.cards.t.TormentorsHelm.class));
cards.add(new SetCardInfo("Toralf, God of Fury", 154, Rarity.MYTHIC, mage.cards.t.ToralfGodOfFury.class));
cards.add(new SetCardInfo("Toski, Bearer of Secrets", 197, Rarity.RARE, mage.cards.t.ToskiBearerOfSecrets.class));
cards.add(new SetCardInfo("Tyvar Kell", 198, Rarity.MYTHIC, mage.cards.t.TyvarKell.class));