mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
TestPlayer fixed that target events created by RestPlayer are reset back if ability activation failed.
This commit is contained in:
parent
d10e63bea4
commit
f6ec543b1b
2 changed files with 9 additions and 4 deletions
|
@ -370,6 +370,7 @@ public class TestPlayer implements Player {
|
|||
}
|
||||
for (Ability ability : computerPlayer.getPlayable(game, true)) {
|
||||
if (ability.toString().startsWith(groups[0])) {
|
||||
int bookmark = game.bookmarkState();
|
||||
Ability newAbility = ability.copy();
|
||||
if (groups.length > 1 && !groups[1].equals("target=NO_TARGET")) {
|
||||
if (!addTargets(newAbility, groups, game)) {
|
||||
|
@ -377,9 +378,13 @@ public class TestPlayer implements Player {
|
|||
break;
|
||||
}
|
||||
}
|
||||
computerPlayer.activateAbility((ActivatedAbility) newAbility, game);
|
||||
actions.remove(action);
|
||||
return true;
|
||||
if (computerPlayer.activateAbility((ActivatedAbility) newAbility, game)) {
|
||||
actions.remove(action);
|
||||
return true;
|
||||
} else {
|
||||
game.restoreState(bookmark, ability.getRule());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} else if (action.getAction().startsWith("manaActivate:")) {
|
||||
|
|
|
@ -1105,7 +1105,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void restoreState(int bookmark, String text, Game game) {
|
||||
protected void restoreState(int bookmark, String text, Game game) {
|
||||
game.restoreState(bookmark, text);
|
||||
if (storedBookmark >= bookmark) {
|
||||
resetStoredBookmark(game);
|
||||
|
|
Loading…
Reference in a new issue