mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Fixed a bug of Turn Aside not allowing to target spells with more than one target object.
This commit is contained in:
parent
215ccb8eb5
commit
ef13eb6f8d
1 changed files with 9 additions and 4 deletions
|
@ -45,6 +45,7 @@ import mage.target.TargetObject;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.target.Target;
|
||||
|
||||
/**
|
||||
* @author ayratn
|
||||
|
@ -57,6 +58,8 @@ public class TurnAside extends CardImpl<TurnAside> {
|
|||
super(ownerId, 49, "Turn Aside", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{U}");
|
||||
this.expansionSetCode = "SOM";
|
||||
this.color.setBlue(true);
|
||||
|
||||
// Counter target spell that targets a permanent you control.
|
||||
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
||||
this.getSpellAbility().addTarget(new CustomTargetSpell(filter));
|
||||
}
|
||||
|
@ -157,10 +160,12 @@ public class TurnAside extends CardImpl<TurnAside> {
|
|||
StackObject spell = game.getStack().getStackObject(id);
|
||||
if (spell != null) {
|
||||
Ability ability = spell.getStackAbility();
|
||||
for (UUID permanentId : ability.getTargets().get(0).getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null && permanent.getControllerId().equals(controllerId)) {
|
||||
return true;
|
||||
for (Target target : ability.getTargets()) {
|
||||
for (UUID permanentId : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(permanentId);
|
||||
if (permanent != null && permanent.getControllerId().equals(controllerId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue