This commit is contained in:
Jeff Wadsworth 2024-01-10 17:24:42 -06:00
parent b6042f7b22
commit 58739cf2d6
3 changed files with 17 additions and 3 deletions

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
@ -44,6 +43,10 @@ public class PreventAllDamageFromChosenSourceToYouEffect extends PreventionEffec
@Override
public void init(Ability source, Game game) {
this.targetSource.choose(Outcome.PreventDamage, source.getControllerId(), source.getSourceId(), source, game);
// be sure to note the target source's zcc, etc, if able.
if (targetSource.getFirstTarget() != null) {
this.targetSource.updateTarget(targetSource.getFirstTarget(), game);
}
}
@Override
@ -55,7 +58,9 @@ public class PreventAllDamageFromChosenSourceToYouEffect extends PreventionEffec
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getTargetId().equals(source.getControllerId()) && event.getSourceId().equals(targetSource.getFirstTarget())) {
if (event.getTargetId().equals(source.getControllerId())
&& event.getSourceId().equals(targetSource.getFirstTarget())
&& targetSource.isLegal(source, game)) { // source is blinked, becomes a new object, etc.
return true;
}
}