public Character getCharacterByCord(int row, int col) { for (Iterator it = team2.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); if (player.getHero().isThere(row, col)) { return player.getHero(); } } for (Iterator it = team1.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); if (player.getHero().isThere(row, col)) { return player.getHero(); } } for (Iterator it = monsters.iterator(); it.hasNext(); ) { Monster monster = (Monster) it.next(); if (monster.getRow() == row && monster.getCol() == col) { return monster; } } for (Iterator it = tower.iterator(); it.hasNext(); ) { Tower t = (Tower) it.next(); if (t.getSelf().contains(new Cell(row, col))) { return t; } } return null; }
public GameMatch(GameMatch one) { this.team1 = new ArrayList<Player>(); this.team2 = new ArrayList<Player>(); this.monsters = new ArrayList<Monster>(); for (Player player : one.team1) { this.team1.add(new Player(player)); } for (Player player : one.team2) { this.team2.add(new Player(player)); } for (Monster monster : one.monsters) { try { this.monsters.add(monster.clone()); } catch (CloneNotSupportedException e) { } } this.counter = one.counter; this.isFull = one.isFull; this.gameIndex = one.gameIndex; turnIndex = 0; sightTower1 = sightTower(Team.team1); sightTower2 = sightTower(Team.team2); }
public Monster getMonsterByCord(int row, int col) { for (Iterator it = monsters.iterator(); it.hasNext(); ) { Monster monster = (Monster) it.next(); if (monster.getRow() == row && monster.getCol() == col) { return monster; } } return null; }
public void createMonsters() { MonsterFactory mF = new MonsterFactory(); ArrayList<Cell> t = new ArrayList<Cell>(dao.getAllMonsterPositions()); int index = 1; for (Iterator it = t.iterator(); it.hasNext(); ) { Monster monster = mF.createMonster(index); index++; if (index > 3) index = 1; Cell cell = (Cell) it.next(); monster.setRow(cell.getRowPos()); monster.setCol(cell.getColPos()); monster.setX(cell.getColPos() * Utilizer.TILE_SIZE); monster.setY(cell.getRowPos() * Utilizer.TILE_SIZE); monsters.add(monster); } }
public void resetMoveMap() { for (Iterator it = team2.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); int row = player.getHero().getRow(); int col = player.getHero().getCol(); Utilizer.MOVEMAP[row][col] = 12; } for (Iterator it = team1.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); // if(player.getSlotIndex()!=request.getSlotIndex()) int row = player.getHero().getRow(); int col = player.getHero().getCol(); Utilizer.MOVEMAP[row][col] = 12; } for (Iterator it = monsters.iterator(); it.hasNext(); ) { Monster monster = (Monster) it.next(); int row = monster.getRow(); int col = monster.getCol(); Utilizer.MOVEMAP[row][col] = 12; } }
public void drawMonsters(Graphics g, int scrollX, int scrollY) { for (Iterator it = monsters.iterator(); it.hasNext(); ) { Monster monster = (Monster) it.next(); monster.draw(g, scrollX, scrollY); } }