mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
Fix TargetSelection adding spell as card when choosing from multiple zones
This commit is contained in:
committed by
Hans Mackowiak
parent
98dc6edc99
commit
0d08cfd1f5
@@ -263,7 +263,22 @@ public class TargetSelection {
|
|||||||
if (!gameCacheChooseCard.containsKey(chosen)) {
|
if (!gameCacheChooseCard.containsKey(chosen)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ability.getTargets().add(gameCacheChooseCard.get((CardView) chosen));
|
if (((CardView) chosen).getZone().equals(ZoneType.Stack)) {
|
||||||
|
for (final SpellAbilityStackInstance si : game.getStack()) {
|
||||||
|
// avoid peeking own SI so target is not changed
|
||||||
|
if (si.compareToSpellAbility(ability)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SpellAbility abilityOnStack = si.getSpellAbility(true);
|
||||||
|
if (abilityOnStack.getHostCard().getView().equals(chosen)) {
|
||||||
|
ability.getTargets().add(abilityOnStack);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ability.getTargets().add(gameCacheChooseCard.get((CardView) chosen));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -277,12 +292,12 @@ public class TargetSelection {
|
|||||||
|
|
||||||
final Game game = ability.getActivatingPlayer().getGame();
|
final Game game = ability.getActivatingPlayer().getGame();
|
||||||
for (final SpellAbilityStackInstance si : game.getStack()) {
|
for (final SpellAbilityStackInstance si : game.getStack()) {
|
||||||
SpellAbility abilityOnStack = si.getSpellAbility(true);
|
// avoid peeking own SI so target is not changed
|
||||||
if (ability.equals(abilityOnStack)) {
|
if (si.compareToSpellAbility(ability)) {
|
||||||
// By peeking at stack item, target is set to its SI state. So set it back before adding targets
|
continue;
|
||||||
ability.resetTargets();
|
|
||||||
}
|
}
|
||||||
else if (ability.canTargetSpellAbility(abilityOnStack)) {
|
SpellAbility abilityOnStack = si.getSpellAbility(true);
|
||||||
|
if (ability.canTargetSpellAbility(abilityOnStack)) {
|
||||||
stackItemViewCache.put(si.getView(), si);
|
stackItemViewCache.put(si.getView(), si);
|
||||||
selectOptions.add(si.getView());
|
selectOptions.add(si.getView());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user