コード例 #1
0
ファイル: Battle.java プロジェクト: dekarrin/yuuki-jrpg
 /**
  * Decrements the ID of all fighters on the given team with an higher than the given one.
  *
  * @param teamId The ID of the team whose fighters to reassign.
  * @param id The ID to shift all fighters left towards.
  */
 private void reassignIds(int teamId, int id) {
   ArrayList<Character> team = fighters.get(teamId);
   for (Character c : team) {
     if (c.getFighterId() > id) {
       c.setFighterId(c.getFighterId() - 1);
     }
   }
 }
コード例 #2
0
ファイル: Battle.java プロジェクト: dekarrin/yuuki-jrpg
 /**
  * Removes a fighter from the field. All of the Character's battle params are reset and it is
  * removed from the list of fighters.
  *
  * @param f The fighter to remove.
  */
 private void removeFighter(Character f) {
   int team = f.getTeamId();
   int id = f.getFighterId();
   int turnId = turnOrder.indexOf(f);
   turnOrder.remove(turnId);
   if (currentFighter > turnId) {
     currentFighter--;
   }
   fighters.get(team).remove(id);
   reassignIds(team, id);
   removedFighters.add(f);
 }