Simplify Power Fist and Westgate Regent

This commit is contained in:
PurpleCrowbar 2024-04-11 13:44:09 +01:00
parent 8a29dcc735
commit 5d73901ad3
2 changed files with 9 additions and 70 deletions

View file

@ -3,16 +3,15 @@ package mage.cards.p;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.EquipAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
@ -29,7 +28,9 @@ public final class PowerFist extends CardImpl {
// Equipped creature has trample and "Whenever this creature deals combat damage to a player, put that many +1/+1 counters on it."
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(TrampleAbility.getInstance(), AttachmentType.EQUIPMENT));
ability.addEffect(new GainAbilityAttachedEffect(
new DealsCombatDamageToAPlayerTriggeredAbility(new PowerFistEffect(), false, true), AttachmentType.EQUIPMENT
new DealsCombatDamageToAPlayerTriggeredAbility(new AddCountersSourceEffect(
CounterType.P1P1.createInstance(), SavedDamageValue.MANY, false
).setText("put that many +1/+1 counters on it"), false, true), AttachmentType.EQUIPMENT
).setText("and \"Whenever this creature deals combat damage to a player, put that many +1/+1 counters on it.\""));
this.addAbility(ability);
@ -46,33 +47,3 @@ public final class PowerFist extends CardImpl {
return new PowerFist(this);
}
}
class PowerFistEffect extends OneShotEffect {
PowerFistEffect() {
super(Outcome.Benefit);
staticText = "put that many +1/+1 counters on it";
}
private PowerFistEffect(final PowerFistEffect effect) {
super(effect);
}
@Override
public PowerFistEffect copy() {
return new PowerFistEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
int damage = (Integer) getValue("damage");
if (permanent == null || damage < 1) {
return false;
}
return permanent.addCounters(
CounterType.P1P1.createInstance(damage),
source.getControllerId(), source, game
);
}
}

View file

@ -1,20 +1,17 @@
package mage.cards.w;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.SavedDamageValue;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.WardAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
@ -38,7 +35,8 @@ public final class WestgateRegent extends CardImpl {
// Whenever Westgate Regent deals combat damage to a player, put that many +1/+1 counters on it.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new WestgateRegentEffect(), false, true
new AddCountersSourceEffect(CounterType.P1P1.createInstance(), SavedDamageValue.MANY, false)
.setText("put that many +1/+1 counters on it"), false, true
));
}
@ -51,33 +49,3 @@ public final class WestgateRegent extends CardImpl {
return new WestgateRegent(this);
}
}
class WestgateRegentEffect extends OneShotEffect {
WestgateRegentEffect() {
super(Outcome.Benefit);
staticText = "put that many +1/+1 counters on it";
}
private WestgateRegentEffect(final WestgateRegentEffect effect) {
super(effect);
}
@Override
public WestgateRegentEffect copy() {
return new WestgateRegentEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentIfItStillExists(game);
int damage = (Integer) getValue("damage");
if (permanent == null || damage < 1) {
return false;
}
return permanent.addCounters(
CounterType.P1P1.createInstance(damage),
source.getControllerId(), source, game
);
}
}