foul-magics/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToSourceEffect.java
Susucre f75b1c9f0a
Code cleanup: protect all copy constructors (#10750)
* apply regex to change public copy constructors to protected
* cleanup code using now protected constructors
* fix manaBuilder weird casting of Mana into ConditionalMana
2023-08-04 19:34:58 -04:00

36 lines
1.1 KiB
Java

package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.events.GameEvent;
/**
* @author BetaSteward_at_googlemail.com
*/
public class PreventAllDamageToSourceEffect extends PreventionEffectImpl {
public PreventAllDamageToSourceEffect(Duration duration) {
super(duration, Integer.MAX_VALUE, false);
if (duration == Duration.EndOfTurn) {
staticText = "Prevent all damage that would be dealt to {this} this turn";
} else {
staticText = "Prevent all damage that would be dealt to {this}";
}
}
protected PreventAllDamageToSourceEffect(final PreventAllDamageToSourceEffect effect) {
super(effect);
}
@Override
public PreventAllDamageToSourceEffect copy() {
return new PreventAllDamageToSourceEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return super.applies(event, source, game) && event.getTargetId().equals(source.getSourceId());
}
}