mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 12:19:59 -08:00
[ECL] Implement Pitiless Fists
This commit is contained in:
parent
7d43f50500
commit
ad4b504646
6 changed files with 111 additions and 122 deletions
|
|
@ -2,12 +2,11 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.FightEnchantedTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
|
|
@ -15,8 +14,6 @@ import mage.abilities.keyword.TrampleAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
|
|
@ -24,14 +21,13 @@ import mage.target.common.TargetOpponentsCreaturePermanent;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stravant
|
||||
*/
|
||||
public final class CartoucheOfStrength extends CardImpl {
|
||||
|
||||
public CartoucheOfStrength(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.AURA, SubType.CARTOUCHE);
|
||||
|
||||
// Enchant creature you control
|
||||
|
|
@ -42,7 +38,8 @@ public final class CartoucheOfStrength extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Cartouche of Strength enters the battlefield, you may have enchanted creature fight target creature an opponent controls.
|
||||
ability = new EntersBattlefieldTriggeredAbility(new FightEnchantedTargetEffect(), /* optional = */true);
|
||||
ability = new EntersBattlefieldTriggeredAbility(new FightEnchantedTargetEffect()
|
||||
.setText("enchanted creature fight target creature an opponent controls"), true);
|
||||
ability.addTarget(new TargetOpponentsCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -63,49 +60,3 @@ public final class CartoucheOfStrength extends CardImpl {
|
|||
return new CartoucheOfStrength(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @author stravant
|
||||
*/
|
||||
class FightEnchantedTargetEffect extends OneShotEffect {
|
||||
|
||||
FightEnchantedTargetEffect() {
|
||||
super(Outcome.Damage);
|
||||
this.staticText = "you may have enchanted creature fight target creature an opponent controls. " +
|
||||
"<i>(Each deals damage equal to its power to the other.)</i>";
|
||||
}
|
||||
|
||||
private FightEnchantedTargetEffect(final FightEnchantedTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null) {
|
||||
Permanent originalCreature = game.getPermanentOrLKIBattlefield(sourcePermanent.getAttachedTo());
|
||||
if (originalCreature != null) {
|
||||
Permanent enchantedCreature = game.getPermanent(sourcePermanent.getAttachedTo());
|
||||
// only if target is legal the effect will be applied
|
||||
if (source.getTargets().get(0).isLegal(source, game)) {
|
||||
Permanent creature1 = game.getPermanent(source.getTargets().get(0).getFirstTarget());
|
||||
// 20110930 - 701.10
|
||||
if (creature1 != null && enchantedCreature != null) {
|
||||
if (creature1.isCreature(game) && enchantedCreature.isCreature(game)) {
|
||||
return enchantedCreature.fight(creature1, source, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!game.isSimulation())
|
||||
game.informPlayers(originalCreature.getLogName() + ": Fighting effect has been fizzled.");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FightEnchantedTargetEffect copy() {
|
||||
return new FightEnchantedTargetEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package mage.cards.m;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.FightEnchantedTargetEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedByMoreThanOneAttachedEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
|
|
@ -14,13 +14,10 @@ import mage.constants.AttachmentType;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
|
@ -40,7 +37,7 @@ public final class MeltstridersResolve extends CardImpl {
|
|||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// When this Aura enters, enchanted creature fights up to one target creature an opponent controls.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new MeltstridersResolveEffect());
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new FightEnchantedTargetEffect());
|
||||
ability.addTarget(new TargetOpponentsCreaturePermanent(0, 1));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -60,31 +57,3 @@ public final class MeltstridersResolve extends CardImpl {
|
|||
return new MeltstridersResolve(this);
|
||||
}
|
||||
}
|
||||
|
||||
class MeltstridersResolveEffect extends OneShotEffect {
|
||||
|
||||
MeltstridersResolveEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "enchanted creature fights up to one target creature an opponent controls";
|
||||
}
|
||||
|
||||
private MeltstridersResolveEffect(final MeltstridersResolveEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MeltstridersResolveEffect copy() {
|
||||
return new MeltstridersResolveEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = Optional
|
||||
.ofNullable(source.getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getPermanent)
|
||||
.orElse(null);
|
||||
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
return permanent != null && creature != null && permanent.fight(creature, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
54
Mage.Sets/src/mage/cards/p/PitilessFists.java
Normal file
54
Mage.Sets/src/mage/cards/p/PitilessFists.java
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.FightEnchantedTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PitilessFists extends CardImpl {
|
||||
|
||||
public PitilessFists(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature you control
|
||||
TargetPermanent auraTarget = new TargetControlledCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
this.addAbility(new EnchantAbility(auraTarget));
|
||||
|
||||
// When this Aura enters, enchanted creature fights up to one target creature an opponent controls.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new FightEnchantedTargetEffect());
|
||||
ability.addTarget(new TargetOpponentsCreaturePermanent(0, 1));
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted creature gets +2/+2.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEnchantedEffect(2, 2)));
|
||||
}
|
||||
|
||||
private PitilessFists(final PitilessFists card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PitilessFists copy() {
|
||||
return new PitilessFists(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,8 @@ package mage.cards.w;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.FightEnchantedTargetEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
@ -13,8 +13,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -37,7 +35,7 @@ public final class WarbriarBlessing extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// When Warbriar Blessing enters the battlefield, enchanted creature fights up to one target creature you don't control.
|
||||
ability = new EntersBattlefieldTriggeredAbility(new WarbriarBlessingEffect());
|
||||
ability = new EntersBattlefieldTriggeredAbility(new FightEnchantedTargetEffect());
|
||||
ability.addTarget(new TargetPermanent(0, 1, StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL, false));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
@ -54,35 +52,3 @@ public final class WarbriarBlessing extends CardImpl {
|
|||
return new WarbriarBlessing(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WarbriarBlessingEffect extends OneShotEffect {
|
||||
|
||||
WarbriarBlessingEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "enchanted creature fights up to one target creature you don't control. " +
|
||||
"<i>(Each deals damage equal to its power to the other.)</i>";
|
||||
}
|
||||
|
||||
private WarbriarBlessingEffect(final WarbriarBlessingEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WarbriarBlessingEffect copy() {
|
||||
return new WarbriarBlessingEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
|
||||
Permanent opponentsPermanent = game.getPermanent(source.getFirstTarget());
|
||||
if (permanent == null || opponentsPermanent == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent attach = game.getPermanent(permanent.getAttachedTo());
|
||||
if (attach == null) {
|
||||
return false;
|
||||
}
|
||||
return attach.fight(opponentsPermanent, source, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ public final class LorwynEclipsed extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Personify", 28, Rarity.UNCOMMON, mage.cards.p.Personify.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Personify", 402, Rarity.UNCOMMON, mage.cards.p.Personify.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Pestered Wellguard", 63, Rarity.UNCOMMON, mage.cards.p.PesteredWellguard.class));
|
||||
cards.add(new SetCardInfo("Pitiless Fists", 187, Rarity.UNCOMMON, mage.cards.p.PitilessFists.class));
|
||||
cards.add(new SetCardInfo("Plains", 269, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Plains", 274, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Plains", 279, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class FightEnchantedTargetEffect extends OneShotEffect {
|
||||
|
||||
public FightEnchantedTargetEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
||||
private FightEnchantedTargetEffect(final FightEnchantedTargetEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FightEnchantedTargetEffect copy() {
|
||||
return new FightEnchantedTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = Optional
|
||||
.ofNullable(source.getSourcePermanentOrLKI(game))
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getPermanent)
|
||||
.orElse(null);
|
||||
Permanent creature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
return permanent != null && creature != null && permanent.fight(creature, source, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
return "enchanted creature fights " + getTargetPointer().describeTargets(mode.getTargets(), "it");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue