mirror of
https://github.com/correl/mage.git
synced 2024-11-16 03:00:12 +00:00
Merge origin/master
This commit is contained in:
commit
3413814533
2 changed files with 14 additions and 6 deletions
|
@ -31,12 +31,14 @@ import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.PreventionEffectImpl;
|
import mage.abilities.effects.PreventionEffectImpl;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.filter.FilterObject;
|
import mage.filter.FilterObject;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.target.TargetSource;
|
import mage.target.TargetSource;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -65,7 +67,6 @@ public class PreventDamageBySourceEffect extends PreventionEffectImpl {
|
||||||
public PreventDamageBySourceEffect(final PreventDamageBySourceEffect effect) {
|
public PreventDamageBySourceEffect(final PreventDamageBySourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.target = effect.target.copy();
|
this.target = effect.target.copy();
|
||||||
this.mageObjectReference = effect.mageObjectReference;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,15 +77,15 @@ public class PreventDamageBySourceEffect extends PreventionEffectImpl {
|
||||||
@Override
|
@Override
|
||||||
public void init(Ability source, Game game) {
|
public void init(Ability source, Game game) {
|
||||||
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||||
mageObjectReference = new MageObjectReference(target.getFirstTarget(), game);
|
setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (super.applies(event, source, game)) {
|
if (super.applies(event, source, game)) {
|
||||||
MageObject mageObject = game.getObject(event.getSourceId());
|
Card card = game.getCard(((FixedTarget)getTargetPointer()).getTarget());
|
||||||
if (mageObject != null && mageObjectReference.refersTo(mageObject, game)) {
|
if(card != null) {
|
||||||
return true;
|
return card.getId().equals(event.getSourceId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -37,6 +38,7 @@ import mage.cards.Card;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
import mage.target.targetpointer.FixedTarget;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,9 +86,14 @@ public class ReturnToBattlefieldUnderYourControlTargetEffect extends OneShotEffe
|
||||||
card = exileZone.get(getTargetPointer().getFirst(game, source), game);
|
card = exileZone.get(getTargetPointer().getFirst(game, source), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(targetPointer instanceof FixedTarget) {
|
||||||
|
card = game.getCard(((FixedTarget) targetPointer).getTarget());
|
||||||
} else {
|
} else {
|
||||||
card = game.getCard(targetPointer.getFirst(game, source));
|
card = game.getCard(targetPointer.getFirst(game, source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
Zone currentZone = game.getState().getZone(card.getId());
|
Zone currentZone = game.getState().getZone(card.getId());
|
||||||
controller.putOntoBattlefieldWithInfo(card, game, currentZone, source.getSourceId());
|
controller.putOntoBattlefieldWithInfo(card, game, currentZone, source.getSourceId());
|
||||||
|
|
Loading…
Reference in a new issue