mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Fixed a bug in TargetSpell that allowed a spell to select itself as target (#491).
This commit is contained in:
parent
2ca945fabf
commit
609b5af2fe
1 changed files with 9 additions and 5 deletions
|
@ -91,13 +91,12 @@ public class TargetSpell extends TargetObject {
|
|||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
return canChoose(sourceControllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
int count = 0;
|
||||
for (StackObject stackObject: game.getStack()) {
|
||||
// rule 114.4. A spell or ability on the stack is an illegal target for itself.
|
||||
if (sourceId != null && sourceId.equals(stackObject.getSourceId())) {
|
||||
continue;
|
||||
}
|
||||
if (canBeChosen(stackObject, sourceControllerId, game)) {
|
||||
count++;
|
||||
if (count >= this.minNumberOfTargets) {
|
||||
|
@ -108,6 +107,11 @@ public class TargetSpell extends TargetObject {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canChoose(UUID sourceControllerId, Game game) {
|
||||
return canChoose(null, sourceControllerId, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UUID> possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) {
|
||||
return possibleTargets(sourceControllerId, game);
|
||||
|
|
Loading…
Reference in a new issue