mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Improvements to Quest game trying to update Battlefield Observers before it's finished being setup (not fixed, but seems better)
This commit is contained in:
@@ -20,6 +20,7 @@ import forge.control.FControl;
|
|||||||
import forge.control.input.InputMulligan;
|
import forge.control.input.InputMulligan;
|
||||||
import forge.deck.Deck;
|
import forge.deck.Deck;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
|
import forge.game.zone.PlayerZone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.gui.match.CMatchUI;
|
import forge.gui.match.CMatchUI;
|
||||||
import forge.gui.match.VMatchUI;
|
import forge.gui.match.VMatchUI;
|
||||||
@@ -57,35 +58,44 @@ public class GameNew {
|
|||||||
* @param iconEnemy
|
* @param iconEnemy
|
||||||
*   {@link java.lang.String}
|
*   {@link java.lang.String}
|
||||||
*/
|
*/
|
||||||
public static void newGame(final Deck humanDeck, final Deck computerDeck, final CardList human,
|
public static void newGame(final Deck humanDeck, final Deck computerDeck, final CardList humanStart,
|
||||||
final CardList computer, final int humanLife, final int computerLife, String iconEnemy) {
|
final CardList computerStart, final int humanLife, final int computerLife, String iconEnemy) {
|
||||||
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
Singletons.getControl().changeState(FControl.MATCH_SCREEN);
|
||||||
CMatchUI.SINGLETON_INSTANCE.initMatch(iconEnemy);
|
CMatchUI.SINGLETON_INSTANCE.initMatch(iconEnemy);
|
||||||
|
|
||||||
GameNew.newGameCleanup();
|
GameNew.newGameCleanup();
|
||||||
GameNew.newMatchCleanup();
|
GameNew.newMatchCleanup();
|
||||||
|
|
||||||
AllZone.getComputerPlayer().setStartingLife(computerLife);
|
Player human = AllZone.getHumanPlayer();
|
||||||
AllZone.getHumanPlayer().setStartingLife(humanLife);
|
Player computer = AllZone.getComputerPlayer();
|
||||||
AllZone.getHumanPlayer().updateObservers();
|
|
||||||
|
computer.setStartingLife(computerLife);
|
||||||
|
human.setStartingLife(humanLife);
|
||||||
|
human.updateObservers();
|
||||||
|
|
||||||
Card.resetUniqueNumber();
|
Card.resetUniqueNumber();
|
||||||
|
|
||||||
for (final Card c : human) {
|
PlayerZone humanBf = human.getZone(ZoneType.Battlefield);
|
||||||
AllZone.getHumanPlayer().getZone(ZoneType.Battlefield).add(c);
|
|
||||||
|
for (final Card c : humanStart) {
|
||||||
|
humanBf.add(c, false);
|
||||||
c.setSickness(true);
|
c.setSickness(true);
|
||||||
c.setStartsGameInPlay(true);
|
c.setStartsGameInPlay(true);
|
||||||
c.refreshUniqueNumber();
|
c.refreshUniqueNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final Card c : computer) {
|
PlayerZone aiBf = AllZone.getComputerPlayer().getZone(ZoneType.Battlefield);
|
||||||
AllZone.getComputerPlayer().getZone(ZoneType.Battlefield).add(c);
|
|
||||||
|
for (final Card c : computerStart) {
|
||||||
|
aiBf.add(c, false);
|
||||||
c.setSickness(true);
|
c.setSickness(true);
|
||||||
c.setStartsGameInPlay(true);
|
c.setStartsGameInPlay(true);
|
||||||
c.refreshUniqueNumber();
|
c.refreshUniqueNumber();
|
||||||
}
|
}
|
||||||
|
|
||||||
GameNew.actuateGame(humanDeck, computerDeck);
|
GameNew.actuateGame(humanDeck, computerDeck);
|
||||||
|
humanBf.updateObservers();
|
||||||
|
aiBf.updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -66,14 +66,7 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
|
|
||||||
// ************ BEGIN - these methods fire updateObservers() *************
|
// ************ BEGIN - these methods fire updateObservers() *************
|
||||||
|
|
||||||
/**
|
public void add(final Object o, boolean update) {
|
||||||
* Adds the.
|
|
||||||
*
|
|
||||||
* @param o
|
|
||||||
* a {@link java.lang.Object} object.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void add(final Object o) {
|
|
||||||
final Card c = (Card) o;
|
final Card c = (Card) o;
|
||||||
|
|
||||||
// Immutable cards are usually emblems,effects and the mana pool and we
|
// Immutable cards are usually emblems,effects and the mana pool and we
|
||||||
@@ -115,8 +108,23 @@ public class DefaultPlayerZone extends PlayerZone implements java.io.Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.getCardList().add(c);
|
this.getCardList().add(c);
|
||||||
|
|
||||||
|
if (update) {
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the.
|
||||||
|
*
|
||||||
|
* @param o
|
||||||
|
* a {@link java.lang.Object} object.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(final Object o) {
|
||||||
|
this.add(o, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update.
|
* Update.
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ interface IPlayerZone {
|
|||||||
*/
|
*/
|
||||||
void add(Object o);
|
void add(Object o);
|
||||||
|
|
||||||
|
void add(Object o, boolean b);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* add.
|
* add.
|
||||||
|
|||||||
Reference in New Issue
Block a user