use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.
the class PokemonRaidStrategyService method populateRaidInfoForBoss.
private void populateRaidInfoForBoss(PokemonRepository pokemonRepository, String pokemonName, String maxCp, int bossTier) {
final Pokemon pokemon = pokemonRepository.getByName(pokemonName.toUpperCase());
if (pokemon == null) {
LOGGER.warn("Exception when getting pokemon by name " + pokemonName + " - needs to be added to repo data file.");
return;
}
pokemonRaidInfo.put(pokemonName.toUpperCase(), new PokemonRaidInfo(pokemon, maxCp, bossTier));
}
use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.
the class RaidOverviewCommand method getOverviewMessage.
private static String getOverviewMessage(Config config, LocaleService localeService, RaidRepository raidRepository, ClockService clockService, Locale locale, PokemonRaidStrategyService strategyService) {
Set<Raid> raids = raidRepository.getAllRaidsForRegion(config.getRegion());
StringBuilder stringBuilder = new StringBuilder();
if (raids.size() == 0) {
stringBuilder.append(localeService.getMessageFor(LocaleService.LIST_NO_RAIDS, locale));
} else {
StringBuilder exRaids = new StringBuilder();
stringBuilder.append("**").append(localeService.getMessageFor(LocaleService.CURRENT_RAIDS, locale));
stringBuilder.append(":**");
stringBuilder.append("\n").append(localeService.getMessageFor(LocaleService.RAID_DETAILS, locale)).append("\n");
Pokemon currentPokemon = null;
for (Raid raid : raids) {
final Pokemon raidBoss = raid.getPokemon();
if (!raid.isExRaid() && (currentPokemon == null || (!currentPokemon.equals(raidBoss)))) {
currentPokemon = raid.getPokemon();
final PokemonRaidInfo raidInfo = strategyService.getRaidInfo(currentPokemon);
stringBuilder.append("\n**").append(currentPokemon.getName()).append("**");
if (raidInfo != null && raidInfo.getBossTier() > 0) {
stringBuilder.append(" (").append(raidInfo.getBossTier()).append(")");
}
stringBuilder.append("\n");
}
final int numberOfPeople = raid.getNumberOfPeopleSignedUp();
final Gym raidGym = raid.getGym();
final Set<RaidGroup> groups = raidRepository.getGroups(raid);
if (!raid.isExRaid()) {
if (raidGym.isExGym()) {
stringBuilder.append("**").append(raidGym.getName()).append(Emotes.STAR + "**");
} else {
stringBuilder.append("*").append(raidGym.getName()).append("*");
}
stringBuilder.append(" ").append(printTimeIfSameDay(getStartOfRaid(raid.getEndOfRaid(), false))).append("-").append(printTime(raid.getEndOfRaid().toLocalTime()));
if (groups.size() < 1) {
stringBuilder.append(" (**").append(numberOfPeople).append("**)");
} else {
stringBuilder.append(raidRepository.listGroupsForRaid(raid, groups));
}
stringBuilder.append("\n");
} else {
exRaids.append("\n*").append(raidGym.getName());
exRaids.append("* ").append(localeService.getMessageFor(LocaleService.RAID_BETWEEN, locale, printTimeIfSameDay(getStartOfRaid(raid.getEndOfRaid(), true)), printTime(raid.getEndOfRaid().toLocalTime())));
if (groups.size() < 1) {
exRaids.append(" (**").append(numberOfPeople).append("**)");
} else {
exRaids.append(raidRepository.listGroupsForRaid(raid, groups));
}
}
}
final String exRaidList = exRaids.toString();
if (exRaidList.length() > 1) {
stringBuilder.append("\n**Raid-EX:**").append(exRaidList);
}
}
stringBuilder.append("\n\n").append(localeService.getMessageFor(LocaleService.UPDATED_EVERY_X, locale, LocaleService.asString(TimeUnit.SECONDS, locale), String.valueOf(60))).append(" ").append(localeService.getMessageFor(LocaleService.LAST_UPDATE, locale, printTime(clockService.getCurrentTime())));
return stringBuilder.toString();
}
use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.
the class RaidPokemonsTest method verifyAllLegendaryPokemonsAreTier5.
@Test
public void verifyAllLegendaryPokemonsAreTier5() {
final PokemonRaidInfo raikou = strategyService.getRaidInfo(pokemonRepository.search("raikou", null));
assertNotNull(raikou);
assertThat(raikou.getBossTier(), is(5));
final PokemonRaidInfo hooh = strategyService.getRaidInfo(pokemonRepository.search("ho-oh", null));
assertNotNull(hooh);
assertThat(hooh.getBossTier(), is(5));
}
use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.
the class RaidPokemonsTest method verifyRaidbosses.
@Test
public void verifyRaidbosses() {
RaidBossCounters counters;
PokemonRaidInfo raidInfo = strategyService.getRaidInfo(pokemonRepository.search("machamp", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(3));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(7));
assertThat(counters.getSupremeCounters().size(), is(2));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("wailmer", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(1));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters == null, is(true));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("kyogre", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(4));
assertThat(counters.getSupremeCounters().size(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("latias", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(0));
assertThat(counters.getSupremeCounters().size(), is(5));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("latios", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(0));
assertThat(counters.getSupremeCounters().size(), is(5));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("rayquaza", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(3));
assertThat(counters.getSupremeCounters().size(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("registeel", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(4));
assertThat(counters.getSupremeCounters().size(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("aggron", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(4));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(4));
assertThat(counters.getSupremeCounters().size(), is(1));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("celebi", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getMaxCp(), is(1766));
assertThat(raidInfo.getBossTier(), is(5));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(6));
assertThat(counters.getSupremeCounters().size(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("mew", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(5));
assertThat(raidInfo.getMaxCp(), is(1766));
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(counters.getGoodCounters().size(), is(7));
assertThat(counters.getSupremeCounters().size(), is(1));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("snorunt", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(1));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("swablu", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(1));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("dewgong", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(2));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("azumarill", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("jynx", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("piloswine", null));
assertNotNull(raidInfo);
assertThat(raidInfo.getBossTier(), is(3));
raidInfo = strategyService.getRaidInfo(pokemonRepository.search("feraligatr", null));
assertNotNull(raidInfo);
counters = strategyService.getCounters(raidInfo.getPokemon());
assertThat(raidInfo.getBossTier(), is(4));
assertThat(counters.getGoodCounters().size(), is(4));
assertThat(counters.getSupremeCounters().size(), is(3));
}
use of pokeraidbot.domain.pokemon.PokemonRaidInfo in project pokeraidbot by magnusmickelsson.
the class PokemonRaidStrategyService method getMaxCp.
public String getMaxCp(Pokemon pokemon) {
final PokemonRaidInfo pokemonRaidInfo = this.pokemonRaidInfo.get(pokemon.getName().toUpperCase());
if (pokemonRaidInfo == null) {
return null;
}
final String maxCp = String.valueOf(pokemonRaidInfo.getMaxCp());
if (maxCp != null && (!maxCp.isEmpty())) {
return maxCp;
} else {
return null;
}
}
Aggregations