foul-magics/Mage/src/main/java/mage/abilities/effects/common/PreventAllDamageToSourceEffect.java
2018-06-02 17:59:49 +02:00

41 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);
staticText = "Prevent all damage that would be dealt to {this} " + duration.toString();
}
public PreventAllDamageToSourceEffect(final PreventAllDamageToSourceEffect effect) {
super(effect);
}
@Override
public PreventAllDamageToSourceEffect copy() {
return new PreventAllDamageToSourceEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getSourceId())) {
return true;
}
}
return false;
}
}