forked from External/mage
Replace more custom effects with SavedDamageValue
This commit is contained in:
parent
ca9b2ea135
commit
081b2f2f39
48 changed files with 318 additions and 1226 deletions
|
|
@ -1,16 +1,12 @@
|
|||
|
||||
|
||||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.dynamicvalue.common.SavedDamageValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -20,7 +16,7 @@ import mage.players.Player;
|
|||
public class DealsDamageGainLifeSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public DealsDamageGainLifeSourceTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainThatMuchLifeEffect(), false);
|
||||
super(Zone.BATTLEFIELD, new GainLifeEffect(SavedDamageValue.MUCH), false);
|
||||
}
|
||||
|
||||
public DealsDamageGainLifeSourceTriggeredAbility(final DealsDamageGainLifeSourceTriggeredAbility ability) {
|
||||
|
|
@ -53,34 +49,3 @@ public class DealsDamageGainLifeSourceTriggeredAbility extends TriggeredAbilityI
|
|||
return "Whenever {this} deals damage, " ;
|
||||
}
|
||||
}
|
||||
|
||||
class GainThatMuchLifeEffect extends OneShotEffect {
|
||||
|
||||
public GainThatMuchLifeEffect() {
|
||||
super(Outcome.GainLife);
|
||||
this.staticText = "you gain that much life";
|
||||
}
|
||||
|
||||
public GainThatMuchLifeEffect(final GainThatMuchLifeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GainThatMuchLifeEffect copy() {
|
||||
return new GainThatMuchLifeEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
int amount = (Integer) getValue("damage");
|
||||
if (amount > 0) {
|
||||
controller.gainLife(amount, game, source);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue