def __init__(self, flags=None): global mp mp = gen.init() if flags == 'debug': for y in range(gui.MAPHEIGHT): for x in range(gui.MAPWIDTH): mp[x][y].explored = True debug_mode = True gui.message('You hear zombies all around you.', pygame.Color(0,0,255)) gen.render_all() mainloop()
def die(self): global game_state if self.status == 'alive': self.owner.send_to_back() self.owner.char = '%' self.owner.color = pygame.Color(100,0,0) self.owner.blocks = False self.status = 'dead' if self.owner.name == 'player': game_state = 'dead' gui.message('You have died.', pygame.Color(150,0,0)) else: self.ai = None
def mel_attack(self, target): damage = ((self.pwr * 2) + (round(.5 * self.stg))) dice = random.randint(0, 100) if dice == 100: gui.message('The ' + self.owner.name.capitalize() + ' misses ' + target.name + '.', pygame.Color(255,255,0)) elif dice <= target.cognitive.agi: gui.message('The ' + target.name.capitalize() + ' dodges the ' + self.owner.name.capitalize() + '\'s attack!', pygame.Color(0,0,255)) else: gui.message('The ' + self.owner.name.capitalize() + ' hits the ' + target.name + ' for ' + str(damage) + ' damage.', pygame.Color(255,0,0)) target.cognitive.take_damage(damage)
def victory_check(): global victory if len(gen.all_enemies) == 0 and victory == False: gui.message('It is quiet.', pygame.Color(255,255,0)) victory = True