Replace more custom effects with SavedDamageValue

This commit is contained in:
Alex W. Jackson 2022-04-02 02:11:12 -04:00
parent ca9b2ea135
commit 081b2f2f39
48 changed files with 318 additions and 1226 deletions

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common;
import mage.constants.Outcome;
@ -21,39 +19,35 @@ public class DamageControllerEffect extends OneShotEffect {
protected boolean preventable;
private String sourceName = "{this}";
public DamageControllerEffect(int amount, String whoDealDamageName) {
this(amount, true, whoDealDamageName);
}
public DamageControllerEffect(int amount) {
this(amount, true);
}
public DamageControllerEffect(int amount, boolean preventable, String whoDealDamageName) {
super(Outcome.Damage);
this.amount = StaticValue.get(amount);
this.preventable = preventable;
this.sourceName = whoDealDamageName;
public DamageControllerEffect(int amount, boolean preventable) {
this(amount, preventable, "{this}");
}
public DamageControllerEffect(int amount, boolean preventable) {
super(Outcome.Damage);
this.amount = StaticValue.get(amount);
this.preventable = preventable;
public DamageControllerEffect(int amount, String whoDealDamageName) {
this(amount, true, whoDealDamageName);
}
public DamageControllerEffect(int amount, boolean preventable, String whoDealDamageName) {
this(StaticValue.get(amount), preventable, whoDealDamageName);
}
public DamageControllerEffect(DynamicValue amount) {
this(amount, "{this}");
}
public DamageControllerEffect(DynamicValue amount, String whoDealDamageName) {
this(amount, true, whoDealDamageName);
}
public DamageControllerEffect(DynamicValue amount, boolean preventable, String whoDealDamageName) {
super(Outcome.Damage);
this.amount = amount;
this.preventable = true;
}
public int getAmount() {
if (amount instanceof StaticValue) {
return amount.calculate(null, null, this);
} else {
return 0;
}
this.preventable = preventable;
this.sourceName = whoDealDamageName;
}
public DamageControllerEffect(final DamageControllerEffect effect) {
@ -77,7 +71,7 @@ public class DamageControllerEffect extends OneShotEffect {
}
return false;
}
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
@ -107,12 +101,4 @@ public class DamageControllerEffect extends OneShotEffect {
}
return sb.toString();
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
}