Example #1
0
 public static void InitCardSite(CardGameBean gameBean, int playerID) {
   GenCardSource(gameBean, playerID);
   CardDeckBean site = gameBean.getDeck().get(playerID);
   if (site == null) return;
   site.setEmptyCardMap();
   gameBean.AddCard(playerID, 20001, CardBean.HERO_ZONE_ID);
   for (int i = 0; i < Constants.DEFAULT_HAND_CARD_NUM; i++) {
     Integer cardID = site.getDrawCard();
     gameBean.AddCard(playerID, cardID, CardBean.HAND_ZONE_ID);
   }
 }
Example #2
0
 public static Boolean ExistDirtyCard(CardGameBean game) {
   for (CardDeckBean site : game.getDeck().values()) {
     for (CardBean card : site.getCardMap().values()) {
       if (card.getDirtyFlag() > 0) return true;
     }
   }
   return false;
 }
Example #3
0
 public static void GenCardSource(CardGameBean gameBean, int playerID) {
   CardDeckBean site = gameBean.getDeck().get(playerID);
   if (site == null) return;
   List<Integer> Cards = new ArrayList<Integer>();
   for (int i = 0; i < _cardStore.length; i++) {
     Cards.add(_cardStore[i]);
   }
   //		List<Integer> washCards = WashCard(Cards);
   //		site.setCardSource(washCards);
   site.setCardSource(Cards);
 }
Example #4
0
 public static void InitGameCard(CardGameBean newGame) {
   for (CardDeckBean site : newGame.getDeck().values()) {
     InitCardSite(newGame, site.getPlayerID());
   }
 }
Example #5
0
  /*
  public static void quitGame(GameBean gameBean, BattleFarmExtension extension)
  {
  	// Remove game from gameList
  	extension.getGames().remove(gameBean);

  	// Destroy game objects
  	gameBean.setPlayers(null);
  	gameBean.setBaseGameMapBean(null);

  	extension.trace("Battlefarm: game " + gameBean.getId() + " destroyed");

  	gameBean = null;
  }
  */
  public static void RemovePlayer(int gameID, int playerID) {
    CardGameBean game = GameLobbyBean.GetInstance().getGameMap().get(gameID);
    if (game == null) return;
    if (game.getDeck().get(playerID) == null) return;
    game.setNeedClose();
  }
Example #6
0
 public static Boolean ExistGameSupport(CardGameBean game, int which, int type) {
   for (CardDeckBean deck : game.getDeck().values()) {
     if (SupportCardBsn.ExistDeckSupport(deck, which, type) == true) return true;
   }
   return false;
 }
Example #7
0
 public static void StartGame(CardGameBean newGame) {
   newGame.setStarted(true);
   newGame.getStateBean().setState(BattleStateBean.ST_INIT_BATTLE);
 }