mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
fixed Boros Battleshaper
This commit is contained in:
@@ -106,8 +106,17 @@ public class FThreads {
|
|||||||
public static void invokeInNewThread(final Runnable proc, boolean lockUI) {
|
public static void invokeInNewThread(final Runnable proc, boolean lockUI) {
|
||||||
Runnable toRun = proc;
|
Runnable toRun = proc;
|
||||||
final InputQueue iq = Singletons.getControl().getMatch().getInput();
|
final InputQueue iq = Singletons.getControl().getMatch().getInput();
|
||||||
|
//final GameState game = Singletons.getControl().getMatch().getCurrentGame();
|
||||||
|
//final InputQueue iq = game.getMatch().getInput();
|
||||||
if( lockUI ) {
|
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();
|
iq.lock();
|
||||||
toRun = new Runnable() {
|
toRun = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class HumanPlaySpellAbility {
|
|||||||
|
|
||||||
// freeze Stack. No abilities should go onto the stack while I'm filling requirements.
|
// freeze Stack. No abilities should go onto the stack while I'm filling requirements.
|
||||||
game.getStack().freezeStack();
|
game.getStack().freezeStack();
|
||||||
|
game.getMatch().getInput().lock();
|
||||||
|
|
||||||
// Announce things like how many times you want to Multikick or the value of X
|
// Announce things like how many times you want to Multikick or the value of X
|
||||||
if (!this.announceRequirements()) {
|
if (!this.announceRequirements()) {
|
||||||
@@ -88,6 +89,7 @@ public class HumanPlaySpellAbility {
|
|||||||
}
|
}
|
||||||
beingTargeted = beingTargeted.getSubAbility();
|
beingTargeted = beingTargeted.getSubAbility();
|
||||||
} while (beingTargeted != null);
|
} while (beingTargeted != null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Payment
|
// Payment
|
||||||
@@ -101,19 +103,21 @@ public class HumanPlaySpellAbility {
|
|||||||
rollbackAbility(fromZone, zonePosition);
|
rollbackAbility(fromZone, zonePosition);
|
||||||
return;
|
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()) {
|
// no worries here. The same thread must resolve, and by this moment ability will have been resolved already
|
||||||
if (skipStack) {
|
clearTargets(ability);
|
||||||
AbilityUtils.resolve(this.ability, false);
|
game.getAction().checkStateEffects();
|
||||||
} 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,6 +149,7 @@ public class HumanPlaySpellAbility {
|
|||||||
this.ability.resetOnceResolved();
|
this.ability.resetOnceResolved();
|
||||||
this.payment.refundPayment();
|
this.payment.refundPayment();
|
||||||
game.getStack().clearFrozen();
|
game.getStack().clearFrozen();
|
||||||
|
game.getMatch().getInput().unlock();
|
||||||
// Singletons.getModel().getGame().getStack().removeFromFrozenStack(this.ability);
|
// Singletons.getModel().getGame().getStack().removeFromFrozenStack(this.ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -936,8 +936,9 @@ public class MagicStack extends MyObservable implements Iterable<SpellAbilitySta
|
|||||||
this.chooseOrderOfSimultaneousStackEntry(playerTurn);
|
this.chooseOrderOfSimultaneousStackEntry(playerTurn);
|
||||||
|
|
||||||
if (playerTurn != null) {
|
if (playerTurn != null) {
|
||||||
for (final Player otherP : playerTurn.getAllOtherPlayers()) {
|
for(final Player other : playerTurn.getGame().getPlayers()) {
|
||||||
this.chooseOrderOfSimultaneousStackEntry(otherP);
|
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.
|
* a {@link forge.game.player.Player} object.
|
||||||
*/
|
*/
|
||||||
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
|
public final void chooseOrderOfSimultaneousStackEntry(final Player activePlayer) {
|
||||||
if (this.getSimultaneousStackEntryList().size() == 0) {
|
if (this.getSimultaneousStackEntryList().isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ArrayList<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
|
final List<SpellAbility> activePlayerSAs = new ArrayList<SpellAbility>();
|
||||||
for (int i = 0; i < this.getSimultaneousStackEntryList().size(); i++) {
|
for (int i = 0; i < this.getSimultaneousStackEntryList().size(); i++) {
|
||||||
SpellAbility sa = this.getSimultaneousStackEntryList().get(i);
|
SpellAbility sa = this.getSimultaneousStackEntryList().get(i);
|
||||||
Player activator = sa.getActivatingPlayer();
|
Player activator = sa.getActivatingPlayer();
|
||||||
|
|||||||
Reference in New Issue
Block a user