fixed Boros Battleshaper

This commit is contained in:
Maxmtg
2013-05-20 15:07:51 +00:00
parent 0afcef03f5
commit 55afc18103
3 changed files with 31 additions and 16 deletions

View File

@@ -106,8 +106,17 @@ public class FThreads {
public static void invokeInNewThread(final Runnable proc, boolean lockUI) {
Runnable toRun = proc;
final InputQueue iq = Singletons.getControl().getMatch().getInput();
//final GameState game = Singletons.getControl().getMatch().getCurrentGame();
//final InputQueue iq = game.getMatch().getInput();
if( lockUI ) {
// checkEDT("FThreads.invokeInNewthread", true)
// StackTraceElement[] trace = Thread.currentThread().getStackTrace();
// System.out.printf("%s > Invoke in new thread during %s called from %s%n", FThreads.isEDT() ? "EDT" : "TRD", game.getPhaseHandler().getPhase(), trace[2].toString());
// if( trace[2].toString().contains("InputBase.stop"))
// for(StackTraceElement se : trace) {
// System.out.println(se.toString());
// }
iq.lock();
toRun = new Runnable() {
@Override

View File

@@ -63,6 +63,7 @@ public class HumanPlaySpellAbility {
// freeze Stack. No abilities should go onto the stack while I'm filling requirements.
game.getStack().freezeStack();
game.getMatch().getInput().lock();
// Announce things like how many times you want to Multikick or the value of X
if (!this.announceRequirements()) {
@@ -88,6 +89,7 @@ public class HumanPlaySpellAbility {
}
beingTargeted = beingTargeted.getSubAbility();
} while (beingTargeted != null);
}
// Payment
@@ -101,19 +103,21 @@ public class HumanPlaySpellAbility {
rollbackAbility(fromZone, zonePosition);
return;
}
else {
game.getMatch().getInput().unlock();
if (isFree || this.payment.isFullyPaid()) {
if (skipStack) {
AbilityUtils.resolve(this.ability, false);
} else {
this.enusureAbilityHasDescription(this.ability);
this.ability.getActivatingPlayer().getManaPool().clearManaPaid(this.ability, false);
game.getStack().addAndUnfreeze(this.ability);
}
else if (isFree || this.payment.isFullyPaid()) {
if (skipStack) {
AbilityUtils.resolve(this.ability, false);
} else {
this.enusureAbilityHasDescription(this.ability);
this.ability.getActivatingPlayer().getManaPool().clearManaPaid(this.ability, false);
game.getStack().addAndUnfreeze(this.ability);
// no worries here. The same thread must resolve, and by this moment ability will have been resolved already
clearTargets(ability);
game.getAction().checkStateEffects();
}
// no worries here. The same thread must resolve, and by this moment ability will have been resolved already
clearTargets(ability);
game.getAction().checkStateEffects();
}
}
@@ -145,6 +149,7 @@ public class HumanPlaySpellAbility {
this.ability.resetOnceResolved();
this.payment.refundPayment();
game.getStack().clearFrozen();
game.getMatch().getInput().unlock();
// Singletons.getModel().getGame().getStack().removeFromFrozenStack(this.ability);
}

View File

@@ -936,8 +936,9 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
this.chooseOrderOfSimultaneousStackEntry(playerTurn);
if (playerTurn != null) {
for (final Player otherP : playerTurn.getAllOtherPlayers()) {
this.chooseOrderOfSimultaneousStackEntry(otherP);
for(final Player other : playerTurn.getGame().getPlayers()) {
if ( other == playerTurn ) continue;
this.chooseOrderOfSimultaneousStackEntry(other);
}
}
}
@@ -951,11 +952,11 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
* a {@link forge.game.player.Player} object.
*/
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
if (this.getSimultaneousStackEntryList().size() == 0) {
if (this.getSimultaneousStackEntryList().isEmpty()) {
return;
}
final ArrayList<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
final List<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
for (int i = 0; i < this.getSimultaneousStackEntryList().size(); i++) {
SpellAbility sa = this.getSimultaneousStackEntryList().get(i);
Player activator = sa.getActivatingPlayer();