introduced YouGainedLifeCondition

This commit is contained in:
ingmargoudt 2017-04-05 17:54:06 +02:00
parent 3420d0d76c
commit 809c8c97c9
3 changed files with 36 additions and 51 deletions

View file

@ -27,17 +27,15 @@
*/
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.CountType;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.token.AngelToken;
import mage.watchers.common.PlayerGainedLifeWatcher;
@ -66,25 +64,3 @@ public class AngelicAccord extends CardImpl {
return new AngelicAccord(this);
}
}
class YouGainedLifeCondition extends IntCompareCondition {
public YouGainedLifeCondition(CountType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(Game game, Ability source) {
int gainedLife = 0;
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName());
if (watcher != null) {
gainedLife = watcher.getLiveGained(source.getControllerId());
}
return gainedLife;
}
@Override
public String toString() {
return "if you gained 4 or more life this turn ";
}
}

View file

@ -28,11 +28,10 @@
package mage.cards.l;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.CountType;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.condition.IntCompareCondition;
import mage.abilities.condition.common.YouGainedLifeCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -42,7 +41,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.i.ItThatRidesAsOne;
import mage.constants.CardType;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.watchers.common.PlayerGainedLifeWatcher;
@ -86,26 +84,4 @@ public class LoneRider extends CardImpl {
public LoneRider copy() {
return new LoneRider(this);
}
}
class YouGainedLifeCondition extends IntCompareCondition {
public YouGainedLifeCondition(CountType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(Game game, Ability source) {
int gainedLife = 0;
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName());
if (watcher != null) {
gainedLife = watcher.getLiveGained(source.getControllerId());
}
return gainedLife;
}
@Override
public String toString() {
return "if you gained 3 or more life this turn ";
}
}
}

View file

@ -0,0 +1,33 @@
package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.CountType;
import mage.abilities.condition.IntCompareCondition;
import mage.game.Game;
import mage.watchers.common.PlayerGainedLifeWatcher;
/**
* Created by IGOUDT on 5-4-2017.
*/
public class YouGainedLifeCondition extends IntCompareCondition {
public YouGainedLifeCondition(CountType type, int value) {
super(type, value);
}
@Override
protected int getInputValue(Game game, Ability source) {
int gainedLife = 0;
PlayerGainedLifeWatcher watcher = (PlayerGainedLifeWatcher) game.getState().getWatchers().get(PlayerGainedLifeWatcher.class.getName());
if (watcher != null) {
gainedLife = watcher.getLiveGained(source.getControllerId());
}
return gainedLife;
}
@Override
public String toString() {
return String.format("if you gained %s or more life this turn ", value);
}
}