refactor: replacement effects don't use apply method now (#11484)

This commit is contained in:
xenohedron 2023-11-28 02:17:28 -05:00 committed by GitHub
parent 8ad3238109
commit 05e2cf11e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
275 changed files with 171 additions and 1545 deletions

View file

@ -20,15 +20,15 @@ public abstract class PreventionEffectImpl extends ReplacementEffectImpl impleme
protected final boolean onlyCombat;
protected boolean consumable;
public PreventionEffectImpl(Duration duration) {
protected PreventionEffectImpl(Duration duration) {
this(duration, Integer.MAX_VALUE, false);
}
public PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat) {
protected PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat) {
this(duration, amountToPrevent, onlyCombat, true);
}
public PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat, boolean consumable) {
protected PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat, boolean consumable) {
this(duration, amountToPrevent, onlyCombat, consumable, null);
}
@ -40,7 +40,7 @@ public abstract class PreventionEffectImpl extends ReplacementEffectImpl impleme
* @param amountToPreventDynamic if set, on init amountToPrevent is set to
* calculated value of amountToPreventDynamic
*/
public PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat, boolean consumable, DynamicValue amountToPreventDynamic) {
protected PreventionEffectImpl(Duration duration, int amountToPrevent, boolean onlyCombat, boolean consumable, DynamicValue amountToPreventDynamic) {
super(duration, Outcome.PreventDamage);
this.effectType = EffectType.PREVENTION;
this.amountToPrevent = amountToPrevent;
@ -65,12 +65,6 @@ public abstract class PreventionEffectImpl extends ReplacementEffectImpl impleme
}
}
@Override
public boolean apply(Game game, Ability source) {
// not used for prevention effect
return true;
}
protected PreventionEffectData preventDamageAction(GameEvent event, Ability source, Game game) {
PreventionEffectData preventionData = game.preventDamage(event, source, game, amountToPrevent);
if (!preventionData.isError() && !preventionData.isReplaced()) {