forked from External/mage
Dymamic Values, Sigil of Distinction as example, tooltip is generated badly
This commit is contained in:
parent
cba120cb24
commit
d06b3a924b
6 changed files with 274 additions and 10 deletions
|
|
@ -0,0 +1,38 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
public class CountersCount implements DynamicValue {
|
||||
private 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) {
|
||||
Permanent p = game.getPermanent(sourceAbility.getSourceId());
|
||||
if (p != null) {
|
||||
return p.getCounters().getCount(counter.getName());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue clone() {
|
||||
return new CountersCount(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "X";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue