mirror of
https://github.com/magefree/mage.git
synced 2025-12-24 04:22:01 -08:00
Implemented The Wanderer
This commit is contained in:
parent
a54bb5024a
commit
9b43285df4
3 changed files with 80 additions and 8 deletions
|
|
@ -2,34 +2,38 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Duration;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.filter.FilterInPlay;
|
||||
import mage.constants.Duration;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.DamageEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
|
||||
|
||||
protected final FilterPermanent filter;
|
||||
private final boolean andToYou;
|
||||
|
||||
public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter) {
|
||||
super(duration, Integer.MAX_VALUE, false);
|
||||
this.filter = filter;
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + filter.getMessage() + ' ' + duration.toString();
|
||||
this(duration, filter, false);
|
||||
}
|
||||
|
||||
public PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) {
|
||||
public PreventAllNonCombatDamageToAllEffect(Duration duration, FilterPermanent filter, boolean andToYou) {
|
||||
super(duration, Integer.MAX_VALUE, false);
|
||||
this.filter = filter;
|
||||
this.andToYou = andToYou;
|
||||
staticText = "Prevent all non combat damage that would be dealt to " + (andToYou ? "you and " : "") + filter.getMessage() + ' ' + duration.toString();
|
||||
}
|
||||
|
||||
private PreventAllNonCombatDamageToAllEffect(final PreventAllNonCombatDamageToAllEffect effect) {
|
||||
super(effect);
|
||||
this.filter = effect.filter.copy();
|
||||
this.andToYou = effect.andToYou;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -45,6 +49,7 @@ public class PreventAllNonCombatDamageToAllEffect extends PreventionEffectImpl {
|
|||
if (permanent != null) {
|
||||
return filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
|
||||
}
|
||||
return andToYou && source.getControllerId().equals(event.getTargetId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue