mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Lymph Sliver: adjust tooltip text, fully use PreventionEffectImpl
This commit is contained in:
parent
68a44caadd
commit
4219c4eeed
1 changed files with 2 additions and 32 deletions
|
@ -39,8 +39,6 @@ import mage.constants.Duration;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.game.Game;
|
|
||||||
import mage.game.events.GameEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -59,7 +57,7 @@ public class LymphSliver extends CardImpl {
|
||||||
|
|
||||||
// All Sliver creatures have absorb 1.
|
// All Sliver creatures have absorb 1.
|
||||||
Ability absorb = new SimpleStaticAbility(Zone.BATTLEFIELD, new SliverAbsorbEffect());
|
Ability absorb = new SimpleStaticAbility(Zone.BATTLEFIELD, new SliverAbsorbEffect());
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(absorb, Duration.WhileOnBattlefield, filter)));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(absorb, Duration.WhileOnBattlefield, filter, "If a source would deal damage to a Sliver, prevent 1 of that damage")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LymphSliver(final LymphSliver card) {
|
public LymphSliver(final LymphSliver card) {
|
||||||
|
@ -73,9 +71,8 @@ public class LymphSliver extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SliverAbsorbEffect extends PreventionEffectImpl {
|
class SliverAbsorbEffect extends PreventionEffectImpl {
|
||||||
//From Urza's Armor
|
|
||||||
public SliverAbsorbEffect() {
|
public SliverAbsorbEffect() {
|
||||||
super(Duration.WhileOnBattlefield);
|
super(Duration.WhileOnBattlefield, 1, false, false);
|
||||||
this.staticText = "If a source would deal damage to a Sliver, prevent 1 of that damage";
|
this.staticText = "If a source would deal damage to a Sliver, prevent 1 of that damage";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,33 +80,6 @@ class SliverAbsorbEffect extends PreventionEffectImpl {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
|
||||||
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), 1, false);
|
|
||||||
if (!game.replaceEvent(preventEvent)) {
|
|
||||||
int damage = event.getAmount();
|
|
||||||
if (damage > 0) {
|
|
||||||
event.setAmount(damage - 1);
|
|
||||||
game.informPlayers("1 damage has been prevented.");
|
|
||||||
}
|
|
||||||
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getSourceId(), source.getControllerId(), 1));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
|
||||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER) && event.getTargetId().equals(source.getControllerId())) {
|
|
||||||
return super.applies(event, source, game);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SliverAbsorbEffect copy() {
|
public SliverAbsorbEffect copy() {
|
||||||
return new SliverAbsorbEffect(this);
|
return new SliverAbsorbEffect(this);
|
||||||
|
|
Loading…
Reference in a new issue