def attackr(inp): """Checks if player can attack a bot, and attacks it if they can""" global PLAYER, BOTS, CURRENT_MAP m = ai.getPoss(PLAYER.pos) try: for i in BOTS.value(): if BOTS[i].level == CURRENT_MAP.value().id: if tuple(BOTS[i].pos) in m: combat.battle(PLAYER, BOTS[i], CURRENT_MAP.value(), False, {'printInv':utils.printInv, 'delBot':delBot, 'cls':_cls}) except: pass
def _tickBefore(): """_tick manager for Before events""" global EVENTS, BOTS, CURRENT_MAP, PLAYER, MAP_ID, GAME GAME.currentmap = CURRENT_MAP.value().id if random.randint(1,300) == 150: amount = random.randint(10,30) raw_input("You found $%s!" % (amount)) PLAYER.moneyAdd(amount) def resPos(): print "Player position is BAD. (Hackz?)" x = raw_input() if x == "skip": return None else: PLAYER.pos = [2,2] if PLAYER.health[0] < 1: print "You died! DEBUG: ", PLAYER.health raw_input("[Exit]") sys.exit() if hax(PLAYER.pos) is True: resPos() #Fire events/objects if tuple(PLAYER.pos) in CURRENT_MAP.value().obj: CURRENT_MAP.value().obj[tuple(PLAYER.pos)]['exec'](CURRENT_MAP.value().obj[tuple(PLAYER.pos)]['obj']) if tuple(PLAYER.pos) in EVENTS.value().keys(): EVENTS.e[tuple(PLAYER.pos)].fire() for i in BOTS.value(): if BOTS[i].level == CURRENT_MAP.value().id and BOTS[i].pr == True and BOTS[i].alive is True: BOTS[i].move() for i in BOTS.value(): if BOTS[i].level == CURRENT_MAP.value().id: if tuple(BOTS[i].pos) in ai.getPoss(PLAYER.pos) or BOTS[i].pos == PLAYER.pos: if BOTS[i].atk is True and BOTS[i].alive is True: combat.battle(PLAYER, BOTS[i], CURRENT_MAP.value(), True, {'printInv':utils.printInv, 'delBot':delBot, 'cls':_cls}) break #@DEV If more then one bot attacks, should we let it happen? Or ignore one like we are doing now?