mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed source damage prevention not working properly.
Tested for Burrenton Forge-Tender.
This commit is contained in:
parent
ddc2128f78
commit
efb48e2ace
1 changed files with 6 additions and 5 deletions
|
@ -31,12 +31,14 @@ import mage.MageObject;
|
|||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetSource;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -65,7 +67,6 @@ public class PreventDamageBySourceEffect extends PreventionEffectImpl {
|
|||
public PreventDamageBySourceEffect(final PreventDamageBySourceEffect effect) {
|
||||
super(effect);
|
||||
this.target = effect.target.copy();
|
||||
this.mageObjectReference = effect.mageObjectReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,15 +77,15 @@ public class PreventDamageBySourceEffect extends PreventionEffectImpl {
|
|||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
this.target.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), game);
|
||||
mageObjectReference = new MageObjectReference(target.getFirstTarget(), game);
|
||||
setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (super.applies(event, source, game)) {
|
||||
MageObject mageObject = game.getObject(event.getSourceId());
|
||||
if (mageObject != null && mageObjectReference.refersTo(mageObject, game)) {
|
||||
return true;
|
||||
Card card = game.getCard(((FixedTarget)getTargetPointer()).getTarget());
|
||||
if(card != null) {
|
||||
return card.getId().equals(event.getSourceId());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue