forked from External/mage
Replace more custom effects with SavedDamageValue
This commit is contained in:
parent
ca9b2ea135
commit
081b2f2f39
48 changed files with 318 additions and 1226 deletions
|
|
@ -1,45 +0,0 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author MTGfan
|
||||
*/
|
||||
public enum AttachedPermanentToughnessValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
// In the case that the enchantment is blinked
|
||||
Permanent enchantment = (Permanent) game.getLastKnownInformation(sourceAbility.getSourceId(), Zone.BATTLEFIELD);
|
||||
if (enchantment == null) {
|
||||
// It was not blinked, use the standard method
|
||||
enchantment = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
|
||||
}
|
||||
if (enchantment == null) {
|
||||
return 0;
|
||||
}
|
||||
Permanent enchanted = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
|
||||
return enchanted.getToughness().getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttachedPermanentToughnessValue copy() {
|
||||
return AttachedPermanentToughnessValue.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "equal to";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "that creature's toughness";
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ public enum SavedDamageValue implements DynamicValue {
|
|||
private final String message;
|
||||
|
||||
SavedDamageValue(String message) {
|
||||
this.message = message;
|
||||
this.message = "that " + message;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -30,7 +30,7 @@ public enum SavedDamageValue implements DynamicValue {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "that " + message;
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue