Allies - initialization

This commit is contained in:
Maxmtg
2013-05-21 06:57:56 +00:00
parent 13dc9fedd9
commit 364667855d
6 changed files with 21 additions and 11 deletions

View File

@@ -237,9 +237,6 @@ public class GameNew {
final Map<LobbyPlayer, PlayerStartConditions> playersConditions = game.getMatch().getPlayers();
for (Player player : game.getPlayers()) {
final PlayerStartConditions psc = playersConditions.get(player.getLobbyPlayer());
player.setStartingLife(psc.getStartingLife());
player.setMaxHandSize(psc.getStartingHand());
player.setStartingHandSize(psc.getStartingHand());
putCardsOnBattlefield(player, psc.getCardsOnBattlefield(player));
initVariantsZones(player, psc);

View File

@@ -100,6 +100,12 @@ public class GameState {
Player pl = kv.getKey().getPlayer(this);
players.add(pl);
ingamePlayers.add(pl);
PlayerStartConditions psc = kv.getValue();
pl.setStartingLife(psc.getStartingLife());
pl.setMaxHandSize(psc.getStartingHand());
pl.setStartingHandSize(psc.getStartingHand());
pl.setAllies(psc.getAllies());
}
allPlayers = Collections.unmodifiableList(players);

View File

@@ -156,7 +156,6 @@ public class MatchController {
} catch (Exception e) {
BugReporter.reportException(e);
}
}
public static void attachUiToMatch(MatchController match, LobbyPlayerHuman humanLobbyPlayer) {

View File

@@ -23,7 +23,7 @@ public class PlayerStartConditions {
private Iterable<? extends IPaperCard> schemes = null;
private Iterable<CardPrinted> planes = null;
private List<LobbyPlayer> allies = new ArrayList<LobbyPlayer>();
public PlayerStartConditions(Deck deck0) {
originalDeck = deck0;
currentDeck = originalDeck;
@@ -41,6 +41,9 @@ public class PlayerStartConditions {
this.currentDeck = currentDeck0;
}
public Iterable<LobbyPlayer> getAllies() {
return allies;
}
public final int getStartingLife() {
return startingLife;

View File

@@ -210,6 +210,12 @@ public class Player extends GameEntity implements Comparable<Player> {
public final PlayerStatistics getStats() {
return stats;
}
public final void setAllies(Iterable<LobbyPlayer> allys) {
for(LobbyPlayer a : allys) {
allies.add(a);
}
}
@Deprecated
public boolean isHuman() { return getType() == PlayerType.HUMAN; }
@@ -242,13 +248,10 @@ public class Player extends GameEntity implements Comparable<Player> {
}
game.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
activeScheme = getZone(ZoneType.SchemeDeck).get(0);
// gameAction moveTo ?
getZone(ZoneType.SchemeDeck).remove(activeScheme);
this.getZone(ZoneType.Command).add(activeScheme);
game.getTriggerHandler().clearSuppression(TriggerType.ChangesZone);
// Run triggers

View File

@@ -242,6 +242,7 @@ public enum VStack implements IVDoc<CStack> {
@Override
public void actionPerformed(ActionEvent arg0) {
if ( localPlayer == null ) return;
localPlayer.setShouldAlwaysAcceptTrigger(triggerID);
}
@@ -251,6 +252,7 @@ public enum VStack implements IVDoc<CStack> {
@Override
public void actionPerformed(ActionEvent arg0) {
if ( localPlayer == null ) return;
localPlayer.setShouldAlwaysDeclineTrigger(triggerID);
}
@@ -260,7 +262,7 @@ public enum VStack implements IVDoc<CStack> {
@Override
public void actionPerformed(ActionEvent arg0) {
System.out.println("ask");
if ( localPlayer == null ) return;
localPlayer.setShouldAlwaysAskTrigger(triggerID);
}
@@ -273,7 +275,7 @@ public enum VStack implements IVDoc<CStack> {
public void setStackInstance(final SpellAbilityStackInstance SI, Player viewer)
{
localPlayer = viewer.getController();
localPlayer = viewer == null ? null : viewer.getController();
triggerID = SI.getSpellAbility().getSourceTrigger();