def __init__(self, observer): ''' Constructor (creates 10 random monsters) ''' self.numMonsters = 0 self.monsterList = [] for i in range(10): randMonster = random.randrange(0,4) if(randMonster == 0): self.monsterList.append(Person(self)) elif(randMonster == 1): self.monsterList.append(Zombie(self)) self.numMonsters += 1 elif(randMonster == 2): self.monsterList.append(Vampire(self)) self.numMonsters += 1 elif(randMonster == 3): self.monsterList.append(Ghoul(self)) self.numMonsters += 1 else: self.monsterList.append(Werewolf(self)) self.numMonsters += 1
def enemy_generator(listspot): global game_on global monsters monsters = [] game_on = True print (" ") print ("How many monsters dare you fight?") the_number = int(raw_input("> ")) if the_number < 30 and region_enemy == Goat_guy: number_of_enemies = 1 elif the_number < 30 and region_enemy != Goat_guy: number_of_enemies = the_number else: print("Don't be a dick") for i in range(0, number_of_enemies): if (monster_types[listspot] == "goblins"): monsters.append(Goblin()) elif (monster_types[listspot] == "vampires"): monsters.append(Vampire()) elif (monster_types[listspot] == "witches"): monsters.append(Witch()) elif (monster_types[listspot] == "Goat Guy"): monsters.append(Goat_guy())
def setList(self): for i in range(len(self.homeList)): tempList = [Zombie(), Vampire(), Ghoul(), Werewolves()] self.homeList[i] = tempList[randint(0, 3)]
import sys from Hero import Hero from Monster import Monster from Monster import Vampire from Monster import Giant from Monster import Ghoul from Script import script_dict # import pyglet # song = pyglet.media.load('thesong.ogg') # song.play() # pyglet.app.run() monsters = [] #make an empty list with variables monsters monsters.append(Ghoul()) monsters.append(Vampire()) monsters.append(Giant()) # print ("***** WELCOME TO WARRIOR DOGMA! *****") print """ __ ___ ___ ___ ___ ___ ___ ___ ___ ___ __ __ _ \ \ / /_\ | _ \ _ \_ _/ _ \| _ \ | \ / _ \ / __| \/ | /_ \ \/\/ / _ \| / /| | (_) | / | |) | (_) | (_ | |\/| |/ _ \_/\_/_/ \_\_|_\_|_\___\___/|_|_\ |___/ \___/ \___|_| |_/_/ \_ """
import time import random from Character import Character import Monster from Monster import Goblin, Vampire, Brigand, Wizard, Mermaid, Mountain_lion from Monster import Ski_bunny, Whirling_dervish, Snake, Shark, Abominable_snowman from Monster import Giant_scorpion, Sandworm, Mountain_troll, Beach_bunny, Zombie, Shadow, Medic from Companion import Knight, Bard, Thief, Companion from Item import Item from Battle import Battle from Hero import Hero hero = Hero("myhero", 40, 25, "Mountains", "Hero") a_goblin = Goblin("goblin", 10, 5, "Mountains", "Goblin") a_vampire = Vampire("vamp", 12, 8, "Mountains", "Vampire") a_brigand = Brigand("brigand", 8, 2, "Mountains", "Brigand") battle_engine = Battle() #shopping_engine = Shopping() monsters = [a_vampire, a_goblin, a_vampire, a_brigand] for monster in monsters: hero_won = battle_engine.do_battle(hero, monster) if not hero_won: print "YOU LOSE!" exit(0) # shopping_engine.do_shopping(hero) print "YOU WIN!"
global list_of_monster_types, list_of_regions game_monsters = [] # Creates a list containing 3 lists, each item is another list # w, h = 3, 11; # regional_monsters = [[]] list_of_monster_types = ["Goblin", 'Vampire', 'Brigand', "Wizard", "Mermaid", "Ski_bunny", "Whirling_dervish", "Snake", "Shark", "Giant_scorpion", "Sandworm", "Mountain_troll", "Mountain_lion", "Abominable_snowman", "Zombie", "Beach_bunny", "Shadow", "Medic", "Siren" ] num_of_monster_types = len(list_of_monster_types) list_of_regions = ["desert", "mountain", "ocean_beach"] a = "Goblin" b = exec(a + "()") # game_monsters.append(b) a = Vampire() game_monsters.append(a) a = Brigand() game_monsters.append(a) for i in range(0, 2): print game_monsters[i], "game_monsters", i # game_monsters.append(regional_monsters[i]) # RETURNS SET OF MONSTERS # END FOR # from characters import Hero, monster # instantiate a hero object from the Hero class the_hero = Hero("myhero", 40, 25, "mountain", "Hero")