Пример #1
0
  private void generateDaemonAi(DaemonRandomSpawn command, int squadCount) {
    double[] location = levelManager.randomPosition();

    AiImage aiImg =
        new AiImage(
            aiCrowd,
            combatMembersManager,
            combatUiManager,
            combatVisualManager,
            panningManager,
            0,
            0,
            mouseAbilityHandler,
            floatingIcons);
    ThinkingAi ai = null;

    DialoguePool dialoguePool = new DialoguePool(DAEMON, missionManager, cartographer, messageBox);

    ai =
        new DaemonAi(
            panningManager,
            combatVisualManager,
            turnProcess,
            floatingIcons,
            mouseAbilityHandler,
            aiCrowd,
            combatMembersManager,
            randomDaemonName(),
            location[0],
            location[1],
            levelManager,
            combatInorganicManager,
            combatUiManager,
            lootbox,
            dialoguePool);
    ai.setBaseAggression(ThinkingAiEmotion.MINDLESS_TERROR);
    aiImg =
        new DaemonImage(
            aiCrowd,
            combatMembersManager,
            combatUiManager,
            combatVisualManager,
            panningManager,
            location[0],
            location[1],
            mouseAbilityHandler,
            floatingIcons);
    ai.setTeam(squadCount + DAEMON);

    ai.setWeapon(new DaemonWeapon());

    ai.assignAbilities();
    aiImg.setAi(ai);

    aiCrowd.addDisplayItem(aiImg);
    aiCrowd.addMouseActionItem(aiImg);

    aiCrowd.addActor(ai, new DirectorClassification(DirectorArchetype.UNDECIDED));
    aiCrowd.addMask(aiImg);

    combatMembersManager.addAi(ai);
  }
Пример #2
0
  private void generateSoloAi(SoloGenerateCommand command, int team) {

    double[] location = null;

    if (command.x == null && !command.getFaction().equals(AiGenerator.LONER))
      location =
          levelManager.randomInPosition(
              combatMembersManager.getCommander(command.getFaction()).getSpawnRoom());
    else if (command.x == null && command.getFaction().equals(AiGenerator.LONER))
      location = levelManager.randomPosition();
    else location = new double[] {command.x, command.y};

    AiImage aiImg =
        new AiImage(
            aiCrowd,
            combatMembersManager,
            combatUiManager,
            combatVisualManager,
            panningManager,
            0,
            0,
            mouseAbilityHandler,
            floatingIcons);
    ThinkingAi ai = null;

    DialoguePool dialoguePool =
        new DialoguePool(command.getFaction(), missionManager, cartographer, messageBox);

    switch (command.getFaction()) {
      case AiGenerator.LONER:
        if (command.isDaemon()) {
          ai =
              new DaemonAi(
                  panningManager,
                  combatVisualManager,
                  turnProcess,
                  floatingIcons,
                  mouseAbilityHandler,
                  aiCrowd,
                  combatMembersManager,
                  command.getName(),
                  location[0],
                  location[1],
                  levelManager,
                  combatInorganicManager,
                  combatUiManager,
                  lootbox,
                  dialoguePool);
          ai.setBaseAggression(ThinkingAiEmotion.MINDLESS_TERROR);
          aiImg =
              new DaemonImage(
                  aiCrowd,
                  combatMembersManager,
                  combatUiManager,
                  combatVisualManager,
                  panningManager,
                  location[0],
                  location[1],
                  mouseAbilityHandler,
                  floatingIcons);
        } else {
          ai =
              new LonerAi(
                  panningManager,
                  aiCrowd,
                  combatVisualManager,
                  turnProcess,
                  floatingIcons,
                  mouseAbilityHandler,
                  combatMembersManager,
                  command.getName(),
                  location[0],
                  location[1],
                  levelManager,
                  combatInorganicManager,
                  combatUiManager,
                  lootbox,
                  dialoguePool);
          ai.setBaseAggression(ThinkingAiEmotion.PASSIVE_RESPOND);
          ai.setImage(randomImage());
        }
        ai.setTeam(team + LONER);
        break;
      case AiGenerator.WHITE_VISTA:
        ai =
            new ThinkingAi(
                dialoguePool,
                panningManager,
                combatVisualManager,
                turnProcess,
                floatingIcons,
                mouseAbilityHandler,
                aiCrowd,
                combatMembersManager,
                command.getName(),
                location[0],
                location[1],
                levelManager,
                combatInorganicManager,
                combatUiManager,
                lootbox);
        ai.setBaseAggression(ThinkingAiEmotion.PASSIVE_RESPOND);
        ai.setImage("Armour");
        ai.setTeam(team + WHITE_VISTA);
        break;
      case AiGenerator.BANDITS:
        ai =
            new ThinkingAi(
                dialoguePool,
                panningManager,
                combatVisualManager,
                turnProcess,
                floatingIcons,
                mouseAbilityHandler,
                aiCrowd,
                combatMembersManager,
                command.getName(),
                location[0],
                location[1],
                levelManager,
                combatInorganicManager,
                combatUiManager,
                lootbox);
        ai.setBaseAggression(ThinkingAiEmotion.AGGRESSIVE_FIGHTER);
        ai.setImage("Bandit");
        ai.setTeam(team + BANDITS);
        break;
    }

    if (command.isDaemon()) {
      ai.setWeapon(new DaemonWeapon());
    } else {
      ai.setWeapon(Weapon.stringToWeapon(command.getWeapon()));

      if (command.getItems() != null)
        for (int i = 0; i < command.getItems().length; i++) {
          ai.addItem(Item.stringToItem(command.getItems()[i]));
        }
    }

    ai.assignAbilities();
    aiImg.setAi(ai);

    aiCrowd.addDisplayItem(aiImg);
    aiCrowd.addMouseActionItem(aiImg);

    aiCrowd.addActor(ai, new DirectorClassification(command.directorClass));
    aiCrowd.addMask(aiImg);

    if (command.getAiNode() != null) {
      List<String> priority = new ArrayList<String>(1);
      priority.add(ai.getName());
      command.getAiNode().addPriorities(priority);
      ai.setAiNode(command.getAiNode());
    }

    combatMembersManager.addAi(ai);

    String[] alliances = command.getAlliances();
    if (alliances != null)
      for (int i = 0; i < alliances.length; i++) {
        ai.getCommander().addAlliance(alliances[i]);
      }
  }