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

41 lines
No EOL
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 jeffwadsworth
*/
public class PreventCombatDamageBySourceEffect extends PreventionEffectImpl {
public PreventCombatDamageBySourceEffect(Duration duration) {
super(duration, Integer.MAX_VALUE, true);
staticText = "Prevent all combat damage that would be dealt by {this}" + duration.toString();
}
public PreventCombatDamageBySourceEffect(final PreventCombatDamageBySourceEffect effect) {
super(effect);
}
@Override
public PreventCombatDamageBySourceEffect copy() {
return new PreventCombatDamageBySourceEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getSourceId().equals(source.getSourceId())) {
return true;
}
}
return false;
}
}