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

@ -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);
}
}