private void generateLoner( String team, List<String> allowedItems, List<String> allowedWeapons, LevelBlock room) { double[] randomLocation = levelManager.randomInPosition(room); AiImage aiImg = new AiImage( aiCrowd, combatMembersManager, combatUiManager, combatVisualManager, panningManager, 0, 0, mouseAbilityHandler, floatingIcons); ThinkingAi ai; DialoguePool dialoguePool = new DialoguePool(LONER, missionManager, cartographer, messageBox); ai = new LonerAi( panningManager, aiCrowd, combatVisualManager, turnProcess, floatingIcons, mouseAbilityHandler, combatMembersManager, randomName(), randomLocation[0], randomLocation[1], levelManager, combatInorganicManager, combatUiManager, lootbox, dialoguePool); ai.setBaseAggression(ThinkingAiEmotion.PASSIVE_RESPOND); ai.setImage(randomImage()); ai.setTeam(team); applyLootList(allowedItems, allowedWeapons, ai); ai.assignAbilities(); aiImg.setAi(ai); aiCrowd.addDisplayItem(aiImg); aiCrowd.addMouseActionItem(aiImg); aiCrowd.addActor(ai, new DirectorClassification(DirectorArchetype.UNDECIDED)); aiCrowd.addMask(aiImg); combatMembersManager.addAi(ai); }
private void generateTeam( String team, int members, List<String> allowedItems, List<String> allowedWeapons, LevelBlock spawnRoom) { double[] randomLocation = levelManager.randomInPosition(spawnRoom); Pattern numberPattern = Pattern.compile("[0-9]+"); Matcher numberMatcher; numberMatcher = numberPattern.matcher(team); numberMatcher.find(); for (int i = 0; i < members; i++) { AiImage aiImg = new AiImage( aiCrowd, combatMembersManager, combatUiManager, combatVisualManager, panningManager, 0, 0, mouseAbilityHandler, floatingIcons); String faction = team.substring(numberMatcher.group().length()); DialoguePool dialoguePool = new DialoguePool(faction, missionManager, cartographer, messageBox); ThinkingAi ai = new ThinkingAi( dialoguePool, panningManager, combatVisualManager, turnProcess, floatingIcons, mouseAbilityHandler, aiCrowd, combatMembersManager, randomName(), randomLocation[0], randomLocation[1], levelManager, combatInorganicManager, combatUiManager, lootbox); ai.setImage(randomImage()); ai.setTeam(team); applyLootList(allowedItems, allowedWeapons, ai); switch (ai.getFaction()) { case BANDITS: ai.setBaseAggression(ThinkingAiEmotion.AGGRESSIVE_FIGHTER); ai.setImage("Bandit"); break; case WHITE_VISTA: ai.setBaseAggression(ThinkingAiEmotion.PASSIVE_RESPOND); ai.setImage("Armour"); break; } ai.assignAbilities(); aiImg.setAi(ai); aiCrowd.addDisplayItem(aiImg); aiCrowd.addMouseActionItem(aiImg); aiCrowd.addActor(ai, new DirectorClassification(DirectorArchetype.UNDECIDED)); aiCrowd.addMask(aiImg); randomLocation = levelManager.randomInPosition(spawnRoom); combatMembersManager.addAi(ai); } }
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); }
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]); } }