mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 22:42:03 -08:00
refactor together experience counter DynamicValue
This commit is contained in:
parent
8843bd387f
commit
74adbf222c
6 changed files with 129 additions and 145 deletions
|
|
@ -0,0 +1,48 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public enum SourceControllerCountersCount implements DynamicValue {
|
||||
EXPERIENCE(CounterType.EXPERIENCE),
|
||||
RAD(CounterType.RAD);
|
||||
|
||||
private final CounterType counterType;
|
||||
|
||||
|
||||
SourceControllerCountersCount(CounterType counterType) {
|
||||
this.counterType = counterType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SourceControllerCountersCount copy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
Player player = game.getPlayer(sourceAbility.getControllerId());
|
||||
if (player != null) {
|
||||
amount = player.getCounters().getCount(counterType);
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return counterType.getName() + " you have";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue