mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
inlined handleUntap,
fixed release control problem
This commit is contained in:
@@ -39,7 +39,7 @@ public class ControlPlayerEffect extends SpellAbilityEffect {
|
|||||||
pTarget.obeyNewMaster(activator.getLobbyPlayer().createControllerFor(pTarget));
|
pTarget.obeyNewMaster(activator.getLobbyPlayer().createControllerFor(pTarget));
|
||||||
|
|
||||||
// on following cleanup release control
|
// on following cleanup release control
|
||||||
game.getCleanup().addAt(new Command() {
|
game.getEndOfTurn().addUntil(new Command() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
pTarget.releaseControl();
|
pTarget.releaseControl();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
package forge.game.phase;
|
package forge.game.phase;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@@ -25,9 +26,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import com.esotericsoftware.minlog.Log;
|
import com.esotericsoftware.minlog.Log;
|
||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
|
import forge.CardLists;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
import forge.GameEventType;
|
import forge.GameEventType;
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
|
import forge.CardPredicates.Presets;
|
||||||
import forge.card.trigger.TriggerType;
|
import forge.card.trigger.TriggerType;
|
||||||
import forge.game.GameState;
|
import forge.game.GameState;
|
||||||
import forge.game.GameType;
|
import forge.game.GameType;
|
||||||
@@ -313,7 +316,31 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable {
|
|||||||
case UNTAP:
|
case UNTAP:
|
||||||
//SDisplayUtil.showTab(EDocID.REPORT_STACK.getDoc());
|
//SDisplayUtil.showTab(EDocID.REPORT_STACK.getDoc());
|
||||||
game.getPhaseHandler().setPlayersPriorityPermission(false);
|
game.getPhaseHandler().setPlayersPriorityPermission(false);
|
||||||
PhaseUtil.handleUntap(game);
|
|
||||||
|
game.getCombat().reset(playerTurn);
|
||||||
|
|
||||||
|
// Tokens starting game in play should suffer from Sum. Sickness
|
||||||
|
final List<Card> list = playerTurn.getCardsIncludePhasingIn(ZoneType.Battlefield);
|
||||||
|
for (final Card c : list) {
|
||||||
|
if (playerTurn.getTurn() > 0 || !c.isStartsGameInPlay()) {
|
||||||
|
c.setSickness(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
playerTurn.incrementTurn();
|
||||||
|
|
||||||
|
game.getAction().resetActivationsPerTurn();
|
||||||
|
|
||||||
|
final List<Card> lands = CardLists.filter(playerTurn.getLandsInPlay(), Presets.UNTAPPED);
|
||||||
|
playerTurn.setNumPowerSurgeLands(lands.size());
|
||||||
|
|
||||||
|
// anything before this point happens regardless of whether the Untap
|
||||||
|
// phase is skipped
|
||||||
|
|
||||||
|
if (!PhaseUtil.isSkipUntap(playerTurn)) {
|
||||||
|
game.getUntap().executeUntil(playerTurn);
|
||||||
|
game.getUntap().executeAt();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPKEEP:
|
case UPKEEP:
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class PhaseUtil {
|
|||||||
* a {@link forge.game.player.Player} object.
|
* a {@link forge.game.player.Player} object.
|
||||||
* @return a boolean.
|
* @return a boolean.
|
||||||
*/
|
*/
|
||||||
private static boolean skipUntap(final Player p) {
|
static boolean isSkipUntap(final Player p) {
|
||||||
|
|
||||||
if (p.hasKeyword("Skip your next untap step.")) {
|
if (p.hasKeyword("Skip your next untap step.")) {
|
||||||
p.removeKeyword("Skip your next untap step.");
|
p.removeKeyword("Skip your next untap step.");
|
||||||
@@ -74,46 +74,6 @@ public class PhaseUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* handleUntap.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public static void handleUntap(GameState game) {
|
|
||||||
final PhaseHandler ph = game.getPhaseHandler();
|
|
||||||
final Player turn = ph.getPlayerTurn();
|
|
||||||
|
|
||||||
game.getCombat().reset(turn);
|
|
||||||
|
|
||||||
// Tokens starting game in play should suffer from Sum. Sickness
|
|
||||||
final List<Card> list = turn.getCardsIncludePhasingIn(ZoneType.Battlefield);
|
|
||||||
for (final Card c : list) {
|
|
||||||
if (turn.getTurn() > 0 || !c.isStartsGameInPlay()) {
|
|
||||||
c.setSickness(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
turn.incrementTurn();
|
|
||||||
|
|
||||||
game.getAction().resetActivationsPerTurn();
|
|
||||||
|
|
||||||
final List<Card> lands = CardLists.filter(turn.getLandsInPlay(), Presets.UNTAPPED);
|
|
||||||
turn.setNumPowerSurgeLands(lands.size());
|
|
||||||
|
|
||||||
// anything before this point happens regardless of whether the Untap
|
|
||||||
// phase is skipped
|
|
||||||
|
|
||||||
if (PhaseUtil.skipUntap(turn)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
game.getUntap().executeUntil(turn);
|
|
||||||
game.getUntap().executeAt();
|
|
||||||
|
|
||||||
// otherwise land seems to stay tapped when it is really untapped
|
|
||||||
// AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).updateObservers();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ********* Declare Attackers ***********
|
// ********* Declare Attackers ***********
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user