Skip to content

Commit

Permalink
[OTJ] Implement Hell to Pay
Browse files Browse the repository at this point in the history
  • Loading branch information
theelk801 committed Feb 25, 2024
1 parent 816daa7 commit b0c3371
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
72 changes: 72 additions & 0 deletions Mage.Sets/src/mage/cards/h/HellToPay.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package mage.cards.h;

import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TreasureToken;
import mage.target.common.TargetCreaturePermanent;

import java.util.UUID;

/**
* @author TheElk801
*/
public final class HellToPay extends CardImpl {

public HellToPay(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");

// Hell to Pay deals X damage to target creature. Create a number of tapped Treasure tokens equal to the amount of excess damage dealt to that creature this way.
this.getSpellAbility().addEffect(new HellToPayEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

private HellToPay(final HellToPay card) {
super(card);
}

@Override
public HellToPay copy() {
return new HellToPay(this);
}
}

class HellToPayEffect extends OneShotEffect {

HellToPayEffect() {
super(Outcome.Benefit);
staticText = "{this} deals X damage to target creature. Create a number of tapped " +
"Treasure tokens equal to the amount of excess damage dealt to that creature this way";
}

private HellToPayEffect(final HellToPayEffect effect) {
super(effect);
}

@Override
public HellToPayEffect copy() {
return new HellToPayEffect(this);
}

@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent == null) {
return false;
}
int damage = source.getManaCostsToPay().getX();
int lethal = Math.min(permanent.getLethalDamage(source.getSourceId(), game), damage);
permanent.damage(lethal, source.getSourceId(), source, game);
if (damage > lethal) {
new TreasureToken().putOntoBattlefield(
damage - lethal, game, source, source.getControllerId(), true, false
);
}
return true;
}
}
1 change: 1 addition & 0 deletions Mage.Sets/src/mage/sets/OutlawsOfThunderJunction.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private OutlawsOfThunderJunction() {
this.hasBoosters = false; // temporary

cards.add(new SetCardInfo("Forest", 276, Rarity.LAND, mage.cards.basiclands.Forest.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Hell to Pay", 126, Rarity.RARE, mage.cards.h.HellToPay.class));
cards.add(new SetCardInfo("Island", 273, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Mountain", 275, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 272, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
Expand Down

0 comments on commit b0c3371

Please sign in to comment.