mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[TDC] Implement Jaws of Defeat
This commit is contained in:
parent
dec4970fb4
commit
339d7d6150
2 changed files with 71 additions and 0 deletions
70
Mage.Sets/src/mage/cards/j/JawsOfDefeat.java
Normal file
70
Mage.Sets/src/mage/cards/j/JawsOfDefeat.java
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
package mage.cards.j;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class JawsOfDefeat extends CardImpl {
|
||||
|
||||
public JawsOfDefeat(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
|
||||
|
||||
// Whenever a creature you control enters, target opponent loses life equal to the difference between that creature's power and its toughness.
|
||||
Ability ability = new EntersBattlefieldAllTriggeredAbility(
|
||||
new JawsOfDefeatEffect(), StaticFilters.FILTER_CONTROLLED_A_CREATURE
|
||||
);
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private JawsOfDefeat(final JawsOfDefeat card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JawsOfDefeat copy() {
|
||||
return new JawsOfDefeat(this);
|
||||
}
|
||||
}
|
||||
|
||||
class JawsOfDefeatEffect extends OneShotEffect {
|
||||
|
||||
JawsOfDefeatEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "target opponent loses life equal to the difference between that creature's power and its toughness";
|
||||
}
|
||||
|
||||
private JawsOfDefeatEffect(final JawsOfDefeatEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JawsOfDefeatEffect copy() {
|
||||
return new JawsOfDefeatEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
|
||||
Permanent permanent = (Permanent) getValue("permanentEnteringBattlefield");
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
int diff = Math.abs(permanent.getToughness().getValue() - permanent.getPower().getValue());
|
||||
return diff > 0 && player.loseLife(diff, game, source, false) > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -166,6 +166,7 @@ public final class TarkirDragonstormCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Izzet Signet", 320, Rarity.COMMON, mage.cards.i.IzzetSignet.class));
|
||||
cards.add(new SetCardInfo("Jaddi Offshoot", 260, Rarity.UNCOMMON, mage.cards.j.JaddiOffshoot.class));
|
||||
cards.add(new SetCardInfo("Jarad, Golgari Lich Lord", 293, Rarity.MYTHIC, mage.cards.j.JaradGolgariLichLord.class));
|
||||
cards.add(new SetCardInfo("Jaws of Defeat", 27, Rarity.RARE, mage.cards.j.JawsOfDefeat.class));
|
||||
cards.add(new SetCardInfo("Junji, the Midnight Sky", 183, Rarity.MYTHIC, mage.cards.j.JunjiTheMidnightSky.class));
|
||||
cards.add(new SetCardInfo("Karplusan Forest", 374, Rarity.RARE, mage.cards.k.KarplusanForest.class));
|
||||
cards.add(new SetCardInfo("Kaya, Geist Hunter", 294, Rarity.MYTHIC, mage.cards.k.KayaGeistHunter.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue