mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix event finally
This commit is contained in:
@@ -2,14 +2,15 @@ package forge.game.event;
|
||||
|
||||
import forge.game.card.Card;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GameEventRemoveSummoningSickness extends GameEvent {
|
||||
|
||||
public final Collection<Card> cards;
|
||||
public GameEventRemoveSummoningSickness(Card affected) {
|
||||
cards = Arrays.asList(affected);
|
||||
|
||||
public GameEventRemoveSummoningSickness(List<Card> affected) {
|
||||
cards = affected;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,6 +73,7 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
private final transient Stack<ExtraTurn> extraTurns = new Stack<>();
|
||||
private final transient Map<PhaseType, Stack<PhaseType>> extraPhases = Maps.newEnumMap(PhaseType.class);
|
||||
private final List<Card> toUpdate = new ArrayList<>();
|
||||
|
||||
private int nUpkeepsThisTurn = 0;
|
||||
private int nUpkeepsThisGame = 0;
|
||||
@@ -177,10 +178,11 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
// Tokens starting game in play should suffer from Sum. Sickness
|
||||
final CardCollectionView list = playerTurn.getCardsIncludePhasingIn(ZoneType.Battlefield);
|
||||
toUpdate.clear();
|
||||
for (final Card c : list) {
|
||||
if (playerTurn.getTurn() > 0 || !c.isStartsGameInPlay()) {
|
||||
if (c.isSick() && c.isToken()) //update token stacking on battlefield
|
||||
game.fireEvent(new GameEventRemoveSummoningSickness(c));
|
||||
if (c.isSick() && c.isToken()) //add toupdate stacking tokens
|
||||
toUpdate.add(c);
|
||||
|
||||
c.setSickness(false);
|
||||
}
|
||||
@@ -191,6 +193,8 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
final List<Card> lands = CardLists.filter(playerTurn.getLandsInPlay(), Presets.UNTAPPED);
|
||||
playerTurn.setNumPowerSurgeLands(lands.size());
|
||||
if (!toUpdate.isEmpty()) //fire event toupdate stacking tokens
|
||||
game.fireEvent(new GameEventRemoveSummoningSickness(toUpdate));
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventTurnPhase(playerTurn, phase, phaseType));
|
||||
|
||||
@@ -357,6 +357,12 @@ public class FControlGameEventHandler extends IGameEventVisitor.Base<Void> {
|
||||
return processCards(cards, cardsRefreshDetails);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visit(final GameEventRemoveSummoningSickness event) {
|
||||
processCards(event.cards, cardsRefreshDetails);
|
||||
return processCards(event.cards, cardsUpdate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Void visit(final GameEventShuffle event) {
|
||||
//pfps the change to the library has already been performed by a setCards call
|
||||
|
||||
Reference in New Issue
Block a user