def set_starters():
    starters = []
    starters.append(pokemon(gd=bulbasaur_d)._randomize_vital_statistics(set_level=5))
    starters.append(pokemon(gd=charmander_d)._randomize_vital_statistics(set_level=5))
    starters.append(pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5))
    #starters.append(pokemon(gd=pikachuv)._randomize_vital_statistics(set_level=5))
    return starters
def set_wild_pokemon():
    wild = []
    wild.append(pokemon(gd=bulbasaur_d)._randomize_vital_statistics(min_level=2, max_level=5))
    wild.append(pokemon(gd=charmander_d)._randomize_vital_statistics(min_level=2, max_level=5))
    wild.append(pokemon(gd=squirtle_d)._randomize_vital_statistics(min_level=2, max_level=5))
    #wild.append(pokemon(gd=pikachuv)._randomize_vital_statistics(min_level=2, max_level=5, min_iv=0, max_iv=31,ev_diff_dict=None))
    return wild
Esempio n. 3
0
def set_starters():
    starters = []
    starters.append(
        pokemon(gd=bulbasaur_d)._randomize_vital_statistics(set_level=5))
    starters.append(
        pokemon(gd=charmander_d)._randomize_vital_statistics(set_level=5))
    starters.append(
        pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5))
    #starters.append(pokemon(gd=pikachuv)._randomize_vital_statistics(set_level=5))
    return starters
Esempio n. 4
0
def set_wild_pokemon():
    wild = []
    wild.append(
        pokemon(gd=bulbasaur_d)._randomize_vital_statistics(min_level=2,
                                                            max_level=5))
    wild.append(
        pokemon(gd=charmander_d)._randomize_vital_statistics(min_level=2,
                                                             max_level=5))
    wild.append(
        pokemon(gd=squirtle_d)._randomize_vital_statistics(min_level=2,
                                                           max_level=5))
    #wild.append(pokemon(gd=pikachuv)._randomize_vital_statistics(min_level=2, max_level=5, min_iv=0, max_iv=31,ev_diff_dict=None))
    return wild
Esempio n. 5
0
def create_random_enemy_by_level(level_avg):
    # This gets a random pokemon.
    random_pokemon_number = random.randint(0, 8)
    if random_pokemon_number == 0:
        random_pokemon_value = __builtin__.POKEMON["BULBASAUR"]
    elif random_pokemon_number == 1:
        random_pokemon_value = __builtin__.POKEMON["CHARMANDER"]
    elif random_pokemon_number == 2:
        random_pokemon_value = __builtin__.POKEMON["SQUIRTLE"]
    elif random_pokemon_number == 3:
        random_pokemon_value = __builtin__.POKEMON["PIDGEY"]
    elif random_pokemon_number == 4:
        random_pokemon_value = __builtin__.POKEMON["GEODUDE"]
    elif random_pokemon_number == 5:
        random_pokemon_value = __builtin__.POKEMON["SANDSHREW"]
    elif random_pokemon_number == 6:
        random_pokemon_value = __builtin__.POKEMON["CATERPIE"]
    elif random_pokemon_number == 7:
        random_pokemon_value = __builtin__.POKEMON["EKANS"]
    elif random_pokemon_number == 8:
        random_pokemon_value = __builtin__.POKEMON["RATATA"]

    random_level = random.randint(int(level_avg) - 4, int(level_avg))
    if random_level <= 1:
        random_level = random.randint(2, 3)

    pkm = pokemon.pokemon(
        random_pokemon_value,
        random_level)  # Create a new instance of the pokemon class.
    pkm.check_new_move()  # Remember to set the pokemon's initial moves.

    return pkm
Esempio n. 6
0
def main():
    clear()
    bulbasaur = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(set_level=14).set_nickname(nickname="Saura")
    print bulbasaur.get_pokemon_full_stats()
    bulbasaur.earn_exp(bulbasaur.get_exp_to_next_level())
    print bulbasaur.get_pokemon_full_stats()
    #
    print "\n\nCan evolve by level up?: {}\n".format(bulbasaur.can_evolve_by_level_up())
    bulbasaur.earn_exp(bulbasaur.get_exp_to_next_level())
    print bulbasaur.get_pokemon_full_stats()
    #
    print "\n\nCan evolve by level up?: {}\n".format(bulbasaur.can_evolve_by_level_up())
    if bulbasaur.can_evolve_by_level_up() is not None:
        bulbasaur.evolve(bulbasaur.can_evolve_by_level_up())
    print bulbasaur.get_pokemon_full_stats()
    
    eevee = pokemon(gd=eevee_d)._randomize_vital_statistics(set_level=15).set_nickname(nickname="Maev")
    print eevee.get_pokemon_full_stats()
    print "\n\nCan evolve by level up?: {}\n".format(bulbasaur.can_evolve_by_level_up())
Esempio n. 7
0
def main():
    clear()
    bulbasaur = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(
        set_level=14).set_nickname(nickname="Saura")
    print bulbasaur.get_pokemon_full_stats()
    bulbasaur.earn_exp(bulbasaur.get_exp_to_next_level())
    print bulbasaur.get_pokemon_full_stats()
    #
    print "\n\nCan evolve by level up?: {}\n".format(
        bulbasaur.can_evolve_by_level_up())
    bulbasaur.earn_exp(bulbasaur.get_exp_to_next_level())
    print bulbasaur.get_pokemon_full_stats()
    #
    print "\n\nCan evolve by level up?: {}\n".format(
        bulbasaur.can_evolve_by_level_up())
    if bulbasaur.can_evolve_by_level_up() is not None:
        bulbasaur.evolve(bulbasaur.can_evolve_by_level_up())
    print bulbasaur.get_pokemon_full_stats()

    eevee = pokemon(gd=eevee_d)._randomize_vital_statistics(
        set_level=15).set_nickname(nickname="Maev")
    print eevee.get_pokemon_full_stats()
    print "\n\nCan evolve by level up?: {}\n".format(
        bulbasaur.can_evolve_by_level_up())
Esempio n. 8
0
def main():
    player_1 = create_trainer_1()
    player_2 = create_trainer_2()
    pkm1_1 = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(
        set_level=5, gender=constants.male).set_nickname("Bulba")
    pkm1_2 = pokemon(gd=charmander_d)._randomize_vital_statistics(
        set_level=5, gender=constants.female).set_nickname("Char Char")
    pkm1_3 = pokemon(gd=squirtle_d)._randomize_vital_statistics(
        set_level=5, gender=constants.male).set_nickname("Squirts")

    pkm2_1 = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(
        set_level=5, gender=constants.female).set_nickname("Saura")
    pkm2_2 = pokemon(gd=charmander_d)._randomize_vital_statistics(
        set_level=5, gender=constants.male).set_nickname("Ander")
    pkm2_3 = pokemon(gd=squirtle_d)._randomize_vital_statistics(
        set_level=5, gender=constants.female).set_nickname("Turts")

    player_1.capture_pokemon(pkm1_1)
    player_1.capture_pokemon(pkm1_2)
    player_1.capture_pokemon(pkm1_3)

    player_2.capture_pokemon(pkm2_1)
    player_2.capture_pokemon(pkm2_2)
    player_2.capture_pokemon(pkm2_3)
    clear()
    test_name = "--- Trainer Battle Using Interfaces ---\n"
    cmd_console = cmd_interface()
    trainer_battle = battle()
    #
    print test_name
    print player_1.get_trainer_card()
    print player_1.show_party()
    print player_2.get_trainer_card()
    print player_2.show_party()
    #
    print "Entering the field."
    petc()
    print trainer_battle.wild_pokemon_battle(
        trainer_1=player_1,
        wild_pokemon=random_pokemon_from_list(set_wild_pokemon()))
    print "Leaving the field."
    player_1.fully_heal_all_party_members
    print "Entering the arena."
    petc()
    print trainer_battle.trainer_pokemon_battle(trainer_1=player_1,
                                                trainer_2=player_2)
    print "Leaving the arena."
    petc()
    print player_1.get_trainer_card()
    print player_1.show_party()
    print player_2.get_trainer_card()
    print player_2.show_party()
def main():
    player_1 = create_trainer_1()
    player_2 = create_trainer_2()
    pkm1_1 = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(set_level=5, gender=constants.male).set_nickname("Bulba")
    pkm1_2 = pokemon(gd=charmander_d)._randomize_vital_statistics(set_level=5, gender=constants.female).set_nickname("Char Char")
    pkm1_3 = pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5, gender=constants.male).set_nickname("Squirts")

    pkm2_1 = pokemon(gd=bulbasaur_d)._randomize_vital_statistics(set_level=5, gender=constants.female).set_nickname("Saura")
    pkm2_2 = pokemon(gd=charmander_d)._randomize_vital_statistics(set_level=5, gender=constants.male).set_nickname("Ander")
    pkm2_3 = pokemon(gd=squirtle_d)._randomize_vital_statistics(set_level=5, gender=constants.female).set_nickname("Turts")

    player_1.capture_pokemon(pkm1_1)
    player_1.capture_pokemon(pkm1_2)
    player_1.capture_pokemon(pkm1_3)

    player_2.capture_pokemon(pkm2_1)
    player_2.capture_pokemon(pkm2_2)
    player_2.capture_pokemon(pkm2_3)
    clear()
    test_name = "--- Trainer Battle Using Interfaces ---\n"
    cmd_console = cmd_interface()
    trainer_battle = battle()
    #
    print test_name      
    print player_1.get_trainer_card()
    print player_1.show_party()
    print player_2.get_trainer_card()
    print player_2.show_party()
    #
    print "Entering the field."
    petc()
    print trainer_battle.wild_pokemon_battle(trainer_1=player_1, wild_pokemon=random_pokemon_from_list(set_wild_pokemon()))
    print "Leaving the field."
    player_1.fully_heal_all_party_members
    print "Entering the arena."
    petc()
    print trainer_battle.trainer_pokemon_battle(trainer_1=player_1, trainer_2=player_2)
    print "Leaving the arena."
    petc()
    print player_1.get_trainer_card()
    print player_1.show_party()
    print player_2.get_trainer_card()
    print player_2.show_party()
Esempio n. 10
0
    def read_teams(self):
        decoded = self._get_json()

        for team in decoded:
            yield (team['name'], team['format'], [pokemon(t) for t in team['team']])
Esempio n. 11
0
    def create(self, Sql, send, sleep, cfg, gmt):
        attacke = attacks.attacks()
        pokeID = pokemon.pokemon()
        overview = ""
        i = 0
        id = 0

        now = datetime.datetime.now()
        print("####################==========\\ *** IV *** Update " +
              cfg.areaName + " " + now.strftime("%m/%d/%Y, %H:%M:%S") +
              " /==========####################\n")

        try:
            for encounter in Sql.encounter_id:
                name = pokeID.getPokemon(Sql.pokemon_id[i])
                verify = " \u2705 " if not Sql.calc_endminsec[
                    i] == None else " \u2754"
                angriff = Sql.individual_attack[i]
                verteidigung = Sql.individual_defense[i]
                leben = Sql.individual_stamina[i]
                iv = round(((angriff + verteidigung + leben) / 45) * 100)
                kurzattacke = attacke.getShortAttack(Sql.shortattack[i])
                ladeattacke = attacke.getLoadAttack(Sql.loadattack[i])
                cp_multiplier = Sql.cp_multiplier[i]
                level = pokeID.getLevel(cp_multiplier)
                mode = pokeID.mode
                zeit = Sql.disappear_time[i]
                zeit = zeit + datetime.timedelta(hours=gmt)

                if (iv == 100):
                    highlight = cfg.iv100 + " "
                elif (iv == 0):
                    highlight = cfg.iv0 + " "
                else:
                    highlight = ""

                # Costum  bolt_line/normal_line
                bolt_line = str(highlight) + str(
                    int(iv)) + "% " + str(name) + " " + pokeID.getGeschlecht(
                        Sql.gender[i]) + " (" + str(Sql.cp[i]) + ")" + str(
                            zeit.strftime(" %H:%M:%S")) + verify
                normal_line = "(L" + str(level) + ", " + str(
                    angriff) + "/" + str(verteidigung) + "/" + str(
                        leben) + ") " + str(kurzattacke) + "/" + str(
                            ladeattacke)
                ###############################

                if send.list_output.__contains__(encounter):
                    print(cfg.areaName + " bereits gesendet")
                    f = open(cfg.areaName + "output.txt", "r")
                    # Split the string based on space delimiter
                    list_string = f.read()
                    list_string = list_string[1:len(list_string) - 1]
                    f.close()
                    list_string = list_string.split(', ')
                    id = list_string[send.list_output.index(encounter)]
                    # Costum  Overview
                    overview += "<b>" + str(highlight) + str(
                        iv
                    ) + "% " + str(name) + " " + str(
                        pokeID.getGeschlecht(Sql.gender[i])
                    ) + " " + str(Sql.cp[i]) + "WP, " + str(
                        zeit.strftime(" %H:%M:%S")
                    ) + "</b>" + verify + "\n└ <a href='" + cfg.ivchatUrl + "/" + str(
                        id) + "'>(L" + str(level) + ", " + str(
                            angriff) + "/" + str(verteidigung) + "/" + str(
                                leben) + ") " + str(kurzattacke) + "/" + str(
                                    ladeattacke) + "</a>\n"
                else:
                    if not mode:
                        if ((iv >= pokeID.iv or level >= pokeID.level) or iv
                                == 0 or iv == 100) and not pokeID.iv == 200:
                            id = send.send(bolt_line, normal_line, encounter,
                                           Sql.latitude[i], Sql.longitude[i])
                            # Costum  Overview
                            overview += "<b>" + str(highlight) + str(
                                iv
                            ) + "% " + str(name) + " " + str(
                                pokeID.getGeschlecht(Sql.gender[i])
                            ) + " " + str(Sql.cp[i]) + "WP, " + str(
                                zeit.strftime(" %H:%M:%S")
                            ) + "</b>" + verify + "\n└ <a href='" + cfg.ivchatUrl + "/" + str(
                                id) + "'>(L" + str(level) + ", " + str(
                                    angriff) + "/" + str(
                                        verteidigung) + "/" + str(
                                            leben) + ") " + str(
                                                kurzattacke) + "/" + str(
                                                    ladeattacke) + "</a>\n"
                    else:
                        if ((iv >= pokeID.iv and level >= pokeID.level) or iv
                                == 0 or iv == 100) and not pokeID.iv == 200:
                            id = send.send(bolt_line, normal_line, encounter,
                                           Sql.latitude[i], Sql.longitude[i])
                            # Costum  Overview
                            overview += "<b>" + str(highlight) + str(
                                iv
                            ) + "% " + str(name) + " " + str(
                                pokeID.getGeschlecht(Sql.gender[i])
                            ) + " " + str(Sql.cp[i]) + "WP, " + str(
                                zeit.strftime(" %H:%M:%S")
                            ) + "</b>" + verify + "\n└ <a href='" + cfg.ivchatUrl + "/" + str(
                                id) + "'>(L" + str(level) + ", " + str(
                                    angriff) + "/" + str(
                                        verteidigung) + "/" + str(
                                            leben) + ") " + str(
                                                kurzattacke) + "/" + str(
                                                    ladeattacke) + "</a>\n"
                i += 1
            scanned = "\n(von " + str(i) + " aktiv gescannten Pok\u00E9mon)"
            send.sendOverview(overview, scanned)
            print("spawns: " + str(i))

        except Exception as e:
            outF = open(cfg.areaName + "error.txt", "w")
            ausgabe = "Passierte in der CreateMessage.py\n"
            ausgabe += "encounter_id: " + str(Sql.encounter_id.__len__) + "\n"
            ausgabe += "calc_endminsec: " + str(
                Sql.calc_endminsec.__len__) + "\n"
            ausgabe += "pokemon_id: " + str(Sql.pokemon_id.__len__) + "\n"
            ausgabe += "individual_attack: " + str(
                Sql.individual_attack.__len__) + "\n"
            ausgabe += "individual_defense: " + str(
                Sql.individual_defense.__len__) + "\n"
            ausgabe += "individual_stamina: " + str(
                Sql.individual_stamina.__len__) + "\n"
            ausgabe += "disappear_time: " + str(
                Sql.disappear_time.__len__) + "\n"
            ausgabe += "cp: " + str(Sql.cp.__len__) + "\n"
            ausgabe += "cp_multiplier: " + str(
                Sql.cp_multiplier.__len__) + "\n"
            ausgabe += "shortattack: " + str(Sql.shortattack.__len__) + "\n"
            ausgabe += "loadattack: " + str(Sql.loadattack.__len__) + "\n"
            ausgabe += "gender: " + str(Sql.gender.__len__) + "\n"
            ausgabe += "longitude: " + str(Sql.longitude.__len__) + "\n"
            ausgabe += "latitude: " + str(Sql.latitude.__len__) + "\n"
            ausgabe += "Wert i = " + str(i) + "\n"
            outF.writelines(ausgabe + str(e))
            outF.close()
from pokemon import pokemon
import random
choice = input("choose your wepon \n big bad bob  \n wheres my whey jay \n ")
if choice == "big bad bob":
    your_pokemon = pokemon(choice, 100, 60, 80, "water")
else:
    your_pokemon = pokemon(choice, 100, 80, 60, "fire")

battle = input("choose a pokemon to battle \n C \n D \n ")

if choice == "C":
    opponent_pokemon = pokemon(choice, 100, 60, 80, "grass")
else:
    opponent_pokemon = pokemon(choice, 100, 80, 60, "water")

while getattr(your_pokemon, "hp") > 0:
    cmd = input("x to attack")
    if cmd == "x":
        damage = your_pokemon.calculate_damage(
            getattr(your_pokemon, "type_"), getattr(opponent_pokemon, "type_"),
            random.randint(1, 50), random.randint(1, 50))
        print("damage ", damage)
        setattr(opponent_pokemon, "hp",
                getattr(opponent_pokemon, "hp") - damage)
        print("opponents hp: ", getattr(opponent_pokemon, "hp"))
Esempio n. 13
0
from pokemon import pokemon
from entero import entero

if __name__ == "__main__":
    turno = 1
    pikachuAtaque = entero('Introduce el ataque de pikachu: \n')
    jigglypuffAtaque = entero('Introduce el ataque de jigglypuff: \n')
    pikachu = pokemon("pikachu", pikachuAtaque)
    jigglypuff = pokemon("jigglypuff", jigglypuffAtaque)
    pikachu.life()
    jigglypuff.life()
    print("-------------------------------------------------------")
    while jigglypuff.vida > 0 and pikachu.vida > 0:
        if turno == 1:
            jigglypuff.vida -= pikachu.ataque
            pikachu.life()
            jigglypuff.life()
            print("-------------------------------------------------------")
            turno = 0
        else:
            pikachu.vida -= jigglypuff.ataque
            pikachu.life()
            jigglypuff.life()
            print("-------------------------------------------------------")
            turno = 1
    if pikachu.vida <= 0:
        jigglypuff.win()
        pikachu.life()
        jigglypuff.life()
    else:
        pikachu.win()
Esempio n. 14
0
    atk = IntField(required=True, min_value=10, max_value=50)
    defense = IntField(required=True,
                       min_value=10,
                       max_value=50,
                       db_field='def')
    energy = IntField(required=True, min_value=0, max_value=100)
    moves = EmbeddedDocumentField('MovesP')
    candy = StringField(required=True)
    candy_count = IntField(min_value=0, max_value=500)
    current_candy = IntField(min_value=0, max_value=500)
    weaknesses = ListField(choice=TYPES, required=True)


'''Pokemon'''
#Script para crear los pokemons, modulo creado en otro punto py
pokemons = pokemon.pokemon()
collPokemon.insert_many(pokemons)
''' Ataques '''
Chikorita = Pokemon(
    pid=152.0,
    num="152",
    name="Chikorita",
    img="a.com",
    type=["Grass"],
    height="0.9 m",
    weight="6.4 kg",
    candy="Chikorita Candy",
    candy_count=25.0,
    egg="2 Km",
    spawn_chance=0.69,
    avg_spawns=69.0,
Esempio n. 15
0
def add_pokemon(pokemon_val, level):
    pokemon_list.append(pokemon.pokemon(pokemon_val, level))
Esempio n. 16
0
# program

from pokemon import pokemon

p1 = pokemon("Glurak", 50, 136, 130, 185)
p2 = pokemon("Turtok", 50, 135, 152, 186)


def fight(x, y):
    schlag1 = [x.attack - y.defense]
    y.kp = y.kp - list(map(lambda x: 0 if x < 0 else x, schlag1))[0]
    schlag2 = [y.attack - x.defense]
    x.kp = x.kp - list(map(lambda x: 0 if x < 0 else x, schlag2))[0]
    buch = {x.name: x.kp, y.name: y.kp}
    return


print(p1.kp, p2.kp)

# #while True:
#
#     if p1.kp or p2.kp == 0:
#         print("END OF FIGHT")

#         break
Esempio n. 17
0
        if bs4obj.select('.RightBox .mt20')[0].get_text() == 'グッズ':
            goods.goods(bs4obj)
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == 'ポケモンのどうぐ':
            goods.goods(bs4obj)
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == 'サポート':
            suport.suport(bs4obj)
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == 'スタジアム':
            stadium.stadium(bs4obj)
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == '基本エネルギー':
            energy.energy(bs4obj)
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == '特殊エネルギー':
            energy.energy(bs4obj)
        #なぞの化石がページバグでトレーナーになっているため例外として処理
        elif bs4obj.select('.RightBox .mt20')[0].get_text() == 'トレーナー':
            goods.goods(bs4obj)
        #ポケモンだけこの要素がポケモン名になっているためelseで処理
        else:
            pokemon.pokemon(bs4obj)

        print(url_number)
        print(pack)
        print('/')

        #テキストに対応するカード画像も取得
        imgs = bs4obj.select('img')[2].get('src')
        image_url = "https://www.pokemon-card.com/" + imgs
        req = requests.get(image_url)
        path = "../picture_data/" + str(pack) + "/" + str(url_number) + ".jpg"
        with open(path, 'wb') as file:
            file.write(req.content)
Esempio n. 18
0
import pygame
from pokemon import pokemon
from moves import moves
from battlesystem import battleSystem
moveList = []
moveList.append(moves("fire", 75, 5))
moveList.append(moves("earth", 100, 0))
moveList.append(moves("wind", 50, 50))
moveList.append(moves("water", 10, 100))

pokemonA = pokemon("laaron", 200, moveList, 100)
pokemonB = pokemon("laaron", 200, moveList, 100)

while True:
    battleSystem = battleSystem()
    move = battleSystem.attackFunctions(pokemonA)
    battleSystem.attackPhase(move, pokemonA, pokemonB)
    print(pokemonB.HP)
Esempio n. 19
0
import random

random.seed("pokemon")

pokes = []
for i in range(2):
    linha = input()
    linha = linha.split()
    nome = linha[0]
    vida = float(linha[1])
    energia = float(linha[2])
    linha = input()
    linha = linha.split()
    ataque1 = ataque(linha[0], float(linha[1]), float(linha[2]))
    ataque2 = ataque(linha[3], float(linha[4]), float(linha[5]))
    poke = pokemon(nome, vida, energia, ataque1, ataque2)
    pokes.append(poke)

index1 = random.randrange(2)
index2 = (index1 + 1) % 2
primeiro = pokes[index1]
segundo = pokes[index2]

while pokes[0].vivo() and pokes[1].vivo():

    primeiro.atacar(segundo, random.randrange(2))
    for pokemon in pokes:
        print("%s:\n%.2f de vida\n%.2f de energia\n" %
              (pokemon.getNome(), pokemon.getVida(), pokemon.getEnergia()))
    if not segundo.vivo():
        vencedor = primeiro
Esempio n. 20
0
  def create(self,Sql,send,sleep,cfg,gmt):
    attacke = attacks.attacks()
    pokeID = pokemon.pokemon()
    Help = helper.Helper()
    overview = ""
    team = ""
    ex_raid = ""
    lvl_icon = ""
    clock = cfg.clockformat
    raid_level = cfg.level
    l5 = ""
    l4 = ""
    l3 = ""
    l2 = ""
    l1 = ""

    i = 0 # all found raids
    x = 0 # raids that will be send
    x_old = 0 # old raids
    id = 0

    print("####################==========\\ " + str(datetime.datetime.now()) + " /==========####################")

    try:
      for encounter in Sql.gym_id:
        name = "Unknown Area" if Sql.name[i] is None else Sql.name[i]
        level = Sql.level[i]
        zeit_start = Sql.start[i]
        zeit_end = Sql.end[i]

        zeit_start = zeit_start + datetime.timedelta(hours=gmt)
        zeit_end = zeit_end + datetime.timedelta(hours=gmt)

        if clock == 12:
          t_start = time.strptime(str(zeit_start.hour)+":"+Help.nice_time(str(zeit_start.minute)), "%H:%M")
          t_end = time.strptime(str(zeit_end.hour)+":"+Help.nice_time(str(zeit_end.minute)), "%H:%M")
          raid_start = time.strftime( "%I:%M %p", t_start )
          raid_end = time.strftime( "%I:%M %p", t_end )
        else:
          raid_start = str(zeit_start.hour) + ":" + str(Help.nice_time(str(zeit_start.minute)))
          raid_end = str(zeit_end.hour) + ":" + str(Help.nice_time(str(zeit_end.minute)))

        ex_raid = " \u274C " if Sql.ex_raid[i] == 1 else " "

        if Sql.team_id[i] == 2:
          team = "\u2764"         # red
        elif Sql.team_id[i] == 3:
          team = "\U0001F49B"     # yellow
        elif Sql.team_id[i] == 1:
          team = "\U0001F499"     # blue
        else:
          team = "\U0001F90D"     # none

        if level == 5:
          lvl_icon = "\u0035\uFE0F\u20E3"
        elif level == 4:
          lvl_icon = "\u0034\uFE0F\u20E3"
        elif level == 3:
          lvl_icon = "\u0033\uFE0F\u20E3"
        elif level == 2:
          lvl_icon = "\u0032\uFE0F\u20E3"
        elif level == 1:
          lvl_icon = "\u0031\uFE0F\u20E3"

        if Sql.pokemon_id[i] is None:
          kurzattacke = ""
          ladeattacke = ""
          move = ""
          moveV= ""
          raid = self.getText("egg",cfg.language) + " \U0001F95A "
        else:
          kurzattacke = "\n├ " + attacke.getShortAttack(Sql.move_1[i],cfg.language)
          ladeattacke = attacke.getLoadAttack(Sql.move_2[i],cfg.language)
          move = kurzattacke + "/" + ladeattacke
          moveV= "\u2694 " + attacke.getShortAttack(Sql.move_1[i],cfg.language) + "/" + attacke.getLoadAttack(Sql.move_2[i],cfg.language)
          raid = pokeID.getPokemon(Sql.pokemon_id[i],cfg.language) + " " + pokeID.getGeschlecht(Sql.gender[i]) + " "

        if Sql.level[i] in (raid_level):
          with open(cfg.areaName+"eggs.txt") as input:
            data = input.read()
            data = data.replace("[", "").replace("'", "").replace("]", "")
            data = data.split(', ')

          bolt_line = str(lvl_icon) + " " + str(raid) + raid_start + " - " + raid_end
          normal_line = str(team) + " " + str(name) + ex_raid + moveV

          if send.list_output.__contains__(encounter):
            f = open(cfg.areaName+"output.txt", "r")
              # Split the string based on space delimiter 
            list_string = f.read()
            list_string = list_string[1:len(list_string)-1]
            f.close()
            list_string = list_string.split(', ') 
            id = list_string[send.list_output.index(encounter)]

            pos = list_string.index(id)
            egg = data[pos]
            send.eggs.__contains__(encounter)
            
            print("\n" + str(name) + " (ID: " + str(id) + ", index: " + str(pos) + ")")
            print("egg: " + str(egg))

            x_old +=1

            if egg == encounter and not Sql.pokemon_id[i] == None and cfg.singlechatId:
              send.changeBossEgg(bolt_line,normal_line,encounter,Sql.latitude[i],Sql.longitude[i],id,pos)

          else:
            print("===> found [" + str(i) + "] level " + str(level) + " " + str(raid))
            if cfg.singlechatId:
              try:
                id = send.send(bolt_line,normal_line,encounter,Sql.latitude[i],Sql.longitude[i],Sql.pokemon_id[i])
              except:
                print ("Fehler beim senden... Warte 60 Sekunden")
                time.sleep(60)
                id = send.send(bolt_line,normal_line,encounter,Sql.latitude[i],Sql.longitude[i],Sql.pokemon_id[i])
          x +=1
          
          header = "\n<b>## Level " + str(lvl_icon) + " Raids</b> \U0001F44A\n"
          
          if not l5 and level == 5:
            l5 = header
            overview = overview + l5
          if not l4 and level == 4:
            l4 = header
            overview = overview + l4
          if not l3 and level == 3:
            l3 = header
            overview = overview + l3
          if not l2 and level == 2:
            l2 = header
            overview = overview + l2
          if not l1 and level == 1:
            l1 = header
            overview = overview + l1
          
          if cfg.singlechatId:
            linked = cfg.singlechatUrl + "/" + str(id)
          else:
            linked = "https://maps.google.de/?q=" + str(Sql.latitude[i]) + ", " + str(Sql.longitude[i])
            
          overview += "<b>" + str(team) + str(raid) + raid_start + " - " + raid_end + "</b>" + str(move) + "\n└ <a href='" + linked + "'>" + str(name) + "</a>" + str(ex_raid) + "\n"
        i +=1
      send.sendOverview(overview,self.getText("noRaids",cfg.language),x,x_old)
      print("\nAktuell " + str(x) + " Raids (old: " + str(x_old) + ", DB: " + str(i) + ")\n")

      # DEBUG:
      #f = open("TEST.txt", "a")
      #f.writelines("\n\n####################==========\\ " + str(datetime.datetime.now()) + " /==========####################")
      #f.writelines("len ==> " + str(len(overview)) + "\n")
      #f.writelines(str(overview))
      #f.close()
      
    except Exception as e:
        outF = open(Sql.areaName+"error.txt","w")
        ausgabe = "Passierte in der CreateMessage.py\n"
        ausgabe += "gym_id: " + str(Sql.gym_id.__len__) + "\n"
        ausgabe += "team_id: " + str(Sql.team_id.__len__) + "\n"
        ausgabe += "name: " + str(Sql.name.__len__) + "\n"
        ausgabe += "latitude: " + str(Sql.latitude.__len__) + "\n"
        ausgabe += "longitude: " + str(Sql.longitude.__len__) + "\n"
        ausgabe += "level: " + str(Sql.level.__len__) + "\n"
        ausgabe += "start: " + str(Sql.start.__len__) + "\n"
        ausgabe += "end: " + str(Sql.end.__len__) + "\n"
        ausgabe += "pokemon_id: " + str(Sql.pokemon_id.__len__) + "\n"
        ausgabe += "move_1: " + str(Sql.move_1.__len__) + "\n"
        ausgabe += "move_2: " + str(Sql.move_2.__len__) + "\n"
        ausgabe += "gender: " + str(Sql.gender.__len__) + "\n"
        ausgabe += "ex_raid: " + str(Sql.ex_raid.__len__) + "\n"
        ausgabe += "Wert i" + str(i) + "\n"
        outF.writelines(ausgabe + str(e))
        outF.close()
Esempio n. 21
0
from pokemon import pokemon

if __name__ == "__main__":
    turno = 1
    pikachu = pokemon("pikachu", 55)
    jigglypuff = pokemon("jigglypuff", 45)
    pikachu.life()
    jigglypuff.life()
    print("-------------------------------------------------------")
    while jigglypuff.vida > 0 and pikachu.vida > 0:
        if turno == 1:
            jigglypuff.vida -= pikachu.ataque
            pikachu.life()
            jigglypuff.life()
            print("-------------------------------------------------------")
            turno = 0
        else:
            pikachu.vida -= jigglypuff.ataque
            pikachu.life()
            jigglypuff.life()
            print("-------------------------------------------------------")
            turno = 1
    if pikachu.vida <= 0:
        jigglypuff.win()
        pikachu.life()
        jigglypuff.life()
    else:
        pikachu.win()
        pikachu.life()
        jigglypuff.life()