def Snake(flr=None, loc=None): return objects.Monster(name="Snake", symbol="s", description="A snake. Not poisonous, yet.", hp=10, hp_max=10, mana=0, mana_max=0, speed=60, accuracy=80, attacks={'unarmed': 3}, defense={'melee': 30}, inventory=[], scared_at=50, brave_at=90, floor=flr, location=loc)
def Zombie(flr=None, loc=None): return objects.Monster( name="Zombie", symbol="Z", description="Your basic shambling zombie. \"Brains!\"", hp=20, hp_max=20, mana=0, mana_max=0, speed=80, accuracy=50, attacks={'unarmed': 3}, defense={'melee': 30}, inventory=[], scared_at=0, # flees at this % of HP brave_at=90, floor=flr, location=loc)
def newLevel(self): ''' makes a new level to map ''' self.num_levels = self.num_levels + 1 if self.Map.get(self.y) == None: self.Map[self.y] = {} if self.Map[self.y].get(self.x) == None: self.Map[self.y][self.x] = Level(self.h, self.w) self.Map[self.y][self.x].characters.append(self.p1) for i in range(int(self.num_levels)): self.Map[self.y][self.x].characters.append( objects.Monster(random.randint(0, self.h), random.randint(0, self.w), chr(random.randint(65, 100)), [self.h, self.w])) self.Map[self.y][self.x].characters.append( objects.SausageMonster(random.randint(0, self.h), random.randint(0, self.w), chr(random.randint(65, 100)), [self.h, self.w])) return self.Map[self.y][self.x]
def __init__(self, l_h, l_w): self.Map = {} self.Map[0] = {} self.Map[0][0] = Level(l_h, l_w) self.num_levels = 3 self.x = 0 self.y = 0 self.h = l_h self.w = l_w self.p1 = objects.Character(10, 10, "@", [l_h, l_w]) self.p1.color = 0 self.p1.Name = "You" self.p1.hp = 90 self.p1.max_hp = 90 self.Map[self.y][self.x].characters.append(self.p1) for i in range(3): self.Map[self.y][self.x].characters.append( objects.Monster(random.randint(0, self.h), random.randint(0, self.w), chr(random.randint(65, 100)), [self.h, self.w]))
#!/usr/bin/python import random import objects all_the_things = { "zombie1": objects.Monster( key="zombie1", name="Zombie", symbol="Z", description="Your basic shambling zombie. \"Brains!\"", longdesc= "This decaying corpse shuffles along slowly. Despite its constant hunger for brains, it shows a distinct lack of enthusiasm.", defense={'melee': 30}, attacks={'unarmed': objects.roll(1, 4)}, speed=80, inventory=[], scared_at=0, brave_at=90), "snake1": objects.Monster( key="snake1", name="Snake", symbol="s", description="A snake. Not poisonous, yet.", longdesc= "Why did it have to be snakes? Luckily, this one is a little green one that looks pretty harmless.", defense={'melee': 30}, attacks={'unarmed': objects.roll(1, 4)}, speed=60, accuracy=80,