def WinBattle(lp): lp.addtochat(lp.enemypokemon.name + " has fainted.") lp.CurrentGUI = 0 lp.WildBattle = False lp.BattlingPlayer = "" lp.WAITING = False MM.changeMusic(lp.mapname) lp.playingBG = False lp.TrainerWildBattle = False lp.pokemons[0].addexp(lp.enemypokemon.lvl, lp) lp.save() lp.GUIs[1].pics["apb"].visible = False
def FleeBattle(lp): if lp.WildBattle or not lp.TrainerWildBattle: if lp.enemypokemon.lvl > lp.pokemons[0].lvl: lp.addtochat("Couldn't get away!") else: lp.CurrentGUI = 0 lp.WildBattle = False lp.BattlingPlayer = "" MM.changeMusic(lp.mapname) lp.playingBG = False lp.save() lp.GUIs[1].pics["apb"].visible = False else: lp.addtochat("You cannot run from a trainer!")
def LoseBattle(lp): lp.addtochat("Your pokemon has fainted.") lp.x = 10005.0 lp.y = 10005.0 for a in lp.pokemons: a.hp = a.maxhp lp.CurrentGUI = 0 lp.WildBattle = False lp.WAITING = False MM.changeMusic(lp.mapname) lp.TrainerWildBattle = False lp.playingBG = False lp.save() lp.GUIs[1].pics["apb"].visible = False
def move(self): if (self.x % 1) or (self.y % 1): if self.moving == "up": self.y -= .125 elif self.moving == "down": self.y += .125 elif self.moving == "left": self.x -= .125 elif self.moving == "right": self.x += .125 elif self.moving == "": self.x = round(self.x) self.y = round(self.y) #self.send(self.Username+",posi,"+str(self.x)+","+str(self.y)+",") if not((self.x % 1) or (self.y % 1)): color = self.map.get_at((int(self.x),int(self.y))) if color.g > 200: if random.randint(0,10) == 0: self.wildbattle(pokelib.getWildPoke(), color.g-200) elif color.g == 100: self.wildbattle("Charmander", 100, True, "Gary") elif color.g == 101: self.wildbattle("Onyx", 12, True, "Brock") elif color.g == 102: if random.randint(0,5) == 0: self.wildbattle("Zubat", 10) elif color.g == 103: self.wildbattle("Zapdos", 100, True, "Steven") elif color.g == 104: self.wildbattle("Moltres", 100, True, "Matt") elif color.g == 105: self.wildbattle("Articuno", 100, True, "Patrick") elif color.g == 106: self.wildbattle("Togepi", 9999, True, "Mandi") elif color.b == 255: for a in self.pokemons: a.hp = a.maxhp self.addtochat("Your pokemon are back to full health!") elif color.b == 100: if PORTALS.has_key(str(self.x)+","+str(self.y)): self.x,self.y = PORTALS[str(self.x)+","+str(self.y)] self.moving = "down" elif color.r == 100: self.y += .125 if color.b == 101: self.GUIs[0].buttons["cpr"].visible = True self.GUIs[0].buttons["cpl"].visible = True else: self.GUIs[0].buttons["cpr"].visible = False self.GUIs[0].buttons["cpl"].visible = False for a in self.MapList: if a.isInside(self.x,self.y): if a.name != self.mapname: #PATRICKKKKKKKKKKKKK self.mapname = a.name MM.changeMusic(self.mapname) print self.mapname else: if (not self.movepress == "") and self.canmove(self.movepress): self.moving = self.movepress if self.moving == "up": self.y -= .125 elif self.moving == "down": self.y += .125 elif self.moving == "left": self.x -= .125 elif self.moving == "right": self.x += .125 self.send(self.Username+",posi,"+str(self.x)+","+str(self.y)+","+self.moving+",")