forked from External/mage
* refactor: standard enum style for SourcePermanentToughnessValue * refactor SourcePermanentPowerCount to enum SourcePermanentPowerValue add comments on usage of NOT_NEGATIVE vs ALLOW_NEGATIVE
35 lines
864 B
Java
35 lines
864 B
Java
package mage.abilities.dynamicvalue.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.dynamicvalue.DynamicValue;
|
|
import mage.abilities.effects.Effect;
|
|
import mage.game.Game;
|
|
import mage.game.permanent.Permanent;
|
|
|
|
/**
|
|
* @author xenohedron
|
|
*/
|
|
public enum SourcePermanentToughnessValue implements DynamicValue {
|
|
instance;
|
|
|
|
@Override
|
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
|
Permanent sourcePermanent = sourceAbility.getSourcePermanentOrLKI(game);
|
|
return sourcePermanent == null ? 0 : sourcePermanent.getToughness().getValue();
|
|
}
|
|
|
|
@Override
|
|
public SourcePermanentToughnessValue copy() {
|
|
return instance;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "X";
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return "{this}'s toughness";
|
|
}
|
|
}
|