mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
introduced YouGainedLifeCondition
This commit is contained in:
parent
3420d0d76c
commit
809c8c97c9
3 changed files with 36 additions and 51 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue