コード例 #1
0
ファイル: AiGenerator.java プロジェクト: Whet/Atrophy
  public void generateAi(List<AiGeneratorInterface.GenerateCommand> generationCommands) {

    squadCount = 0;

    for (AiGeneratorInterface.GenerateCommand command : generationCommands) {

      if (command instanceof DaemonRandomSpawn) {
        generateDaemonAi((DaemonRandomSpawn) command, squadCount);
        squadCount++;
        continue;
      }

      if (command instanceof SoloGenerateCommand) {
        generateSoloAi((SoloGenerateCommand) command, squadCount);
        squadCount++;
        continue;
      }

      switch (command.getFaction()) {
        case WHITE_VISTA:
          generateTeam(
              Integer.toString(squadCount) + WHITE_VISTA,
              command.getTeamSize(),
              command.getAllowedItems(),
              command.getAllowedWeapons(),
              combatMembersManager.getCommander(WHITE_VISTA).getSpawnRoom());
          break;
        case BANDITS:
          generateTeam(
              Integer.toString(squadCount) + BANDITS,
              command.getTeamSize(),
              command.getAllowedItems(),
              command.getAllowedWeapons(),
              combatMembersManager.getCommander(BANDITS).getSpawnRoom());
          break;
        case PLAYER:
          generatePlayerTeam(command.getSquad(), levelManager.getCurrentLevel().getPlayerSpawn());
          break;
        case LONER:
          generateLoner(
              Integer.toString(squadCount) + LONER,
              command.getAllowedItems(),
              command.getAllowedWeapons(),
              levelManager.randomRoom());
          break;
      }
      squadCount++;
    }

    combatMembersManager.pickStartingAi();
    generateRosters();
    combatUiManager.getAllyRoster().generatePortraits();
    aiCrowd.shuffleAi();
  }
コード例 #2
0
ファイル: DaemonAi.java プロジェクト: Whet/Atrophy
  @Override
  public void setDead(Ai killer, boolean dead) {
    if (dead) {
      LevelBlock randomRoom;
      do {
        randomRoom = levelManager.randomRoom();
      } while (randomRoom == this.getLevelBlock());

      this.setLocation(levelManager.randomInPosition(randomRoom));
      this.setLevelBlock(randomRoom);
      this.setMoveLocationToSelf();
    }
  }