def get_num_hits(description): if 'twice' in description: return 2 if 'two' in description and 'five' in description: return fakerandom.fakerandint(2, 5) else: return 1
def PARTIALLYTRAPPEDonStart(pokemon, source): if (source.item == "GRIPCLAW"): pokemon.partiallytrapped_count = 8 else: pokemon.partiallytrapped_count = fakerandom.fakerandint(5, 7) if (pokemon.add_volatile(PARTIALLYTRAPPED)): log.message(pokemon.template.species + " was trapped") pokemon.partiallytrapped_source = source
def SLPonStart(target): if (target.set_status(SLP)): log.message(target.template.species + " fell asleep") target.set_status_counter(fakerandom.fakerandint(1, 3))
def CONFUSIONonStart(target, source, sourceEffect): # if (sourceEffect and source == "LOCKEDMOVE" and target.add_volatile(CONFUSION)): if (target.add_volatile(CONFUSION)): log.message(target.template.species + " became confused") # target.confusion_source = "FATIGUE" target.confusion_count = fakerandom.fakerandint(2, 6)
def make_random_team(num): teamsize = 6 team = [] pokemon_chosen = [] # Weird edge case moves that we didn't have time to implement skipped_moves = [ 'BIDE', 'COUNTER', 'DISABLE', 'DOUBLEEDGE', 'DRAGONRAGE', 'DREAMEATER', 'FOCUSENERGY', 'HAZE', 'HIGHJUMPKICK', 'HYPERBEAM', 'JUMPKICK', 'LIGHTSCREEN', 'MIMIC', 'MINIMIZE', 'MIRRORMOVE', 'MIST', 'PSYWAVE', 'RAGE', 'REFLECT', 'SEISMICTOSS', 'SONICBOOM', 'STRUGGLE', 'SUPERSONIC', 'TELEPORT', 'TRANSFORM', 'SKULLBASH', 'NIGHTSHADE', 'SUBSTITUTE', 'WHIRLWIND', 'ROAR', 'METRONOME', 'SELFDESTRUCT', 'EXPLOSION' ] # Until we have 6 pokemon while len(team) < teamsize: # choose a random pokemon from the pokedex (0-indexed) pokedex_num = fakerandom.fakerandint(0, 150) while pokedex_num in pokemon_chosen: pokedex_num = fakerandom.fakerandint(0, 150) species = pokedex.pokedex_list.keys()[pokedex_num] pokemon_chosen.append(pokedex_num) # skip ditto because we didnt implement transform if species == 'DITTO': continue # set constants that we dont want to randomize level = 100 ivs = [31, 31, 31, 31, 31, 31] evs = [0, 0, 0, 0, 0, 0, 0] # pick 4 attacks attacks = [] attacks_chosen = [] learnset = learnsets.learnset_list[pokedex.pokedex_list.keys() [pokedex_num]] while len(attacks) < 4: attack_num = fakerandom.fakerandint(0, len(learnset) - 1) while (attack_num in attacks_chosen and len(attacks_chosen) < len(learnset)): attack_num = fakerandom.fakerandint(0, len(learnset) - 1) attacks_chosen.append(attack_num) attack = learnset[attack_num] #skip attacks we didnt implement if attack in skipped_moves: continue attacks.append((attack, 3)) # pick gender based on pokemon's gender ratios gender = None ratios = pokedex.pokedex_list[species].gender_ratios counter = 0 gender_num = fakerandom.fakerandom() if gender_num >= counter and gender_num < counter + ratios[0]: gender = 'MALE' counter += ratios[0] if gender_num >= counter and gender_num < counter + ratios[1]: gender = 'FEMALE' team.append( pokemon.Pokemon(species, level, gender, num, ivs, evs, attacks)) return Team(team)