forked from External/mage
Restructured Mage module
This commit is contained in:
parent
727d62babb
commit
46eb6c0525
1502 changed files with 11 additions and 9 deletions
|
|
@ -0,0 +1,45 @@
|
|||
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.game.permanent.Permanent;
|
||||
|
||||
public class CountersCount implements DynamicValue {
|
||||
|
||||
private final CounterType counter;
|
||||
|
||||
public CountersCount(CounterType counter) {
|
||||
this.counter = counter;
|
||||
}
|
||||
|
||||
public CountersCount(final CountersCount countersCount) {
|
||||
this.counter = countersCount.counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
|
||||
if (permanent != null) {
|
||||
return permanent.getCounters().getCount(counter);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountersCount copy() {
|
||||
return new CountersCount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return counter.getName() + " counter on {this}";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue