def initialize_all(self): print('Welcome to Kafustrok. Light blesses you. ') self.__lands = [] for i in range(0, self.__D): new = [] for j in range(0, self.__D): new.append(land()) self.__lands.append(new) for i in range(0, self.__total_num): pos = self.unoccupied_position if i < self.__m: self.__lands[pos.x][pos.y].occupied_obj = monster( pos.x, pos.y, i, self) elif i < self.__m + self.__e: self.__lands[pos.x][pos.y].occupied_obj = elf( pos.x, pos.y, i - self.__m, self) elif i < self.__m + self.__e + self.__p: self.__lands[pos.x][pos.y].occupied_obj = potion( pos.x, pos.y, i - self.__m - self.__e, self) self.__teleportable_obj.append( self.__lands[pos.x][pos.y].occupied_obj) else: self.__lands[pos.x][pos.y].occupied_obj = warrior( pos.x, pos.y, i - self.__m - self.__e - self.__p, self) self.__teleportable_obj.append( self.__lands[pos.x][pos.y].occupied_obj)
def town_entrence(self): print(self.graf.basmap) print("where to go (l, h, ?, t)m?: ") mov = input(':') if mov == 'h': ##############################3 my_house self.allhouses.myhouse() elif mov == 'l': #################################### lake a = 1 print("Going to the Lake.\n") print(self.graf.atlake) while a == 1: self.playing.moved.append('l') a = self.lake.lake() if a != 0: print("At the Lake.\n") print(self.graf.atlake) print('Outside') elif mov == "?": # ? if self.playing.level >= 7: self.playing.moved.append('?') print(self.graf.question) time.sleep(2) ############################################ return 123 else: print('\nNot Level 7') print('your level', self.playing.level) time.sleep(2) m1 = monster.monster("basic", 1, 5, 2) attk = attacking.attack(self.playing, m1) while m1.health != 0 or m1.health <= 0: print('\033[1;33mMONSTER !!!!!!!!!\033[1;m') time.sleep(1) s = self.playing.health m = m1.health if m1.health >= 0: print('\033[1;36;48mYour life \033[1;m', self.playing.health) print('\033[1;31;48mmonsters life: \033[1;m', m1.health) attk.start() pass else: break m1.reward(self.playing) print("Rewarded! check level.") time.sleep(2) self.playing.showstats() time.sleep(1) pass
def battle(character): mon1 = monster.monster(character.level) while True: print("유저의 체력: ", character.hp, " 몬스터의 체력:", mon1.hp) print(" 1. 바위 \n 2. 보 \n 3. 가위 \n") choice = int(input("선택하세요: ")) while choice > 3 or choice < 1: choice = int(input("선택범위가 아닙니다....: ")) if choice == 1: choice_name = '바위' elif choice == 2: choice_name = '보' else: choice_name = '가위' print("유저의 선택: " + choice_name) comp_choice = random.randint(1, 3) while comp_choice == choice: comp_choice = random.randint(1, 3) if comp_choice == 1: comp_choice_name = '바위' elif comp_choice == 2: comp_choice_name = '보' else: comp_choice_name = '가위' print("몬스터의 선택은: " + comp_choice_name) print(choice_name + " V/s " + comp_choice_name) if ((choice == 1 and comp_choice == 2) or (choice == 2 and comp_choice == 1)): print("보 wins => ", end="") result = "보" elif ((choice == 1 and comp_choice == 3) or (choice == 3 and comp_choice == 1)): print("바위 wins =>", end="") result = "바위" else: print("가위 wins =>", end="") result = "가위" if result == choice_name: print("<== 유저 wins ==>") mon1.hp -= character.attack else: print("<== 몬스터 wins ==>") character.hp -= mon1.attack character.hp += character.armor if character.hp <= 0: print("패배하였습니다.") break if mon1.hp <= 0: print("승리하였습니다.") character.level += 1 character.hp = character.level * 100 break
def loadsprite(self): x_offset = (BRICKSIZE/2) y_offset = (BRICKSIZE/2) if self.__level == 1 : level = level01() layout = level.getLayout() img_list = level.getSprites() elif self.__level ==2 : level = level02() layout = level.getLayout() img_list = level.getSprites() self.brick_sprites = pygame.sprite.Group() self.coin_sprites = pygame.sprite.Group() self.ladder_sprites = pygame.sprite.Group() self.brokenladder_sprites = pygame.sprite.Group() for y in xrange(len(layout)): for x in xrange(len(layout[y])): centerPoint = [(x*BRICKSIZE)+x_offset,(y*BRICKSIZE+y_offset)]#calculated centerpoint becoz we have to place the center exactly on the position of matrix if layout[y][x]==level.BRICK: brick = Sprite(centerPoint, img_list[level.BRICK]) self.brick_sprites.add(brick) elif layout[y][x]==level.PLAYER: self.player = player(centerPoint,img_list[level.PLAYER]) elif layout[y][x]==level.COIN: coin = Sprite(centerPoint, img_list[level.COIN]) self.coin_sprites.add(coin) elif layout[y][x]==level.LEFT_LADDER : ladder = Sprite(centerPoint , img_list[level.LEFT_LADDER]) self.ladder_sprites.add(ladder) elif layout[y][x]==level.RIGHT_LADDER : ladder = Sprite(centerPoint , img_list[level.RIGHT_LADDER]) self.ladder_sprites.add(ladder) elif layout[y][x] == level.TANK: self.tank = Sprite(centerPoint,img_list[level.TANK]) elif layout[y][x] == level.MONSTER : self.monster = monster(centerPoint,img_list[level.MONSTER]) elif layout[y][x] == level.FIRE : self.fire = fire(centerPoint,img_list[level.FIRE]) elif layout[y][x] == level.QUEEN : self.queen = Sprite(centerPoint , img_list[level.QUEEN]) elif layout[y][x] == level.BROKENLADDERLEFT : self.broke = Sprite(centerPoint , img_list[level.BROKENLADDERLEFT]) self.brokenladder_sprites.add(self.broke) elif layout[y][x] == level.BROKENLADDERRIGHT : self.broke = Sprite(centerPoint , img_list[level.BROKENLADDERRIGHT]) self.brokenladder_sprites.add(self.broke) self.player_sprites = pygame.sprite.RenderPlain(self.player) self.monster_sprites = pygame.sprite.RenderPlain(self.monster) self.firelist.append(pygame.sprite.RenderPlain(self.fire)) self.tank_sprites = pygame.sprite.RenderPlain(self.tank) self.queen_sprites = pygame.sprite.RenderPlain(self.queen)
def create_monster(pos): # TODO: BETTER INPUT VALIDATION!!! # Name name = input( f"Enter a name for the {num2words(pos, to='ordinal')} monster: ") # Height height = int(input(f" How tall is {name} (1-10)? ")) # Weight weight = int(input(f" How much does {name} weigh (50-150)? ")) # Damage damage = int(input(f" How hard does {name} hit (1-10)? ")) # Defense defense = int( input(f" How much damage can {name} absorb at once (1-10)? ")) this_monster = monster(name, height, weight, damage, defense) return this_monster
def battle(rpg, location): rpg.battle_active = True enemy = monster(rpg) rpg.combatGUI.enemy = enemy if location == "Village": enemyList = [enemy.goblin()] random.choice(enemyList) rpg.combatGUI.background.image = pygame.image.load( 'CREATE Task Folder\Image Assets\Battle_Images\Village Forest.png') while rpg.combatGUI.battleOver == False: if whoFirst(rpg, enemy) == "Player": playerTurn(rpg, enemy) monsterTurn(rpg, enemy) checkHealths(rpg, enemy) else: monsterTurn(rpg, enemy) playerTurn(rpg, enemy) checkHealths(rpg, enemy) rpg.battle_active = False rpg.combatGUI.battleOver = False rpg.combatGUI.enemyHP.transparent = True rpg.combatGUI.enemyStamina.transparent = True rpg.combatGUI.enemyMana.transparent = True
from monster import monster from attribute import attribute import pickle as p ml = [] techID = 0 #grassland monster ml.append([]) a = attribute(2,2,2,2,2,2,3,0,0,0,0) m=monster(techID,'angry dryade','overworld',0,2,a,'hostile','dryade',1,False,True, 'attack_magic', ('Head','Body','Legs'), None, 0, 0, 'None') techID+=1 ml[0].append(m) a = attribute(1,1,1,1,10,1,3,0,0,0,0) m=monster(techID,'grassland snake','overworld',1,1,a,'hostile','animal',1,False,False, 'attack_melee', ('Legs', 'Feet'), 'poisoned', 10, 20, 'Poison runs trough your veins!') techID+=1 ml[0].append(m) a = attribute(0,0,0,0,0,1,0,0,0,0,0) m=monster(techID,'rabbit','overworld',2,0,a,'flee','animal',1,False,False, 'attack_melee', ('Feet'), None, 0, 0, 'None') techID+=1 ml[0].append(m) a = attribute(1,2,1,2,2,2,3,0,0,0,0) m=monster(techID,'green blob','overworld',3,4,a,'hostile','vanish',5,False,False, 'attack_melee', ('Head','Body','Legs','Feet'), None, 0, 0, 'None') techID+=1 ml[0].append(m) a = attribute(4,3,1,1,2,2,4,0,0,0,0) m=monster(techID,'hill orc','overworld',4,2,a,'hostile','human',2,False,True, 'attack_melee', ('Head','Body','Legs','Feet'), None, 0, 0, 'None') techID+=1 ml[0].append(m) f = file('overworld_monster.data', 'w')
from player import player from monster import monster import places import graphics import random import time import os lev1mon = monster('monster', 1, 5, 2) def starting(playing): playing.level = random.randint(1, 5) playing.strangth = random.randint(1, 5) def coolplace(playing): print("cool place!") # add the town townNtree return 1 def rand(): a = random.randint(1, 2) if a == '1': return 1 else: return 0 def intersec(playing): graf = graphics.graphic()
def outside(self): print(self.graf.basmap) print("where to go (l, h, ?, t)m?: ") mov = input(':') if mov == 'h': ##############################3 my_house self.playing.moved.append('h') a = 1 while a == 1: # house(playing) print(self.graf.bahouse) ###################### houses a = self.allhouses.myhouse() print('Outside') elif mov == 'l':#################################### lake a = 1 print("Going to the Lake.\n") print(self.graf.atlake) while a == 1: self.playing.moved.append('l') a = self.lake.lake() if a != 0: print("At the Lake.\n") print(self.graf.atlake) print('Outside') elif mov == "?": # ? if self.playing.level >= 7: self.playing.moved.append('?') print(self.graf.question) time.sleep(2) coolplace() # add something here else: print('\nNot Level 7') print('your level', self.playing.level) time.sleep(2) m1 = monster.monster("basic", 1, 5, 2) attk = attacking.attack(self.playing, m1) while m1.health != 0 or m1.health <= 0: print('\033[1;33mMONSTER !!!!!!!!!\033[1;m') time.sleep(1) s = self.playing.health m = m1.health if m1.health >= 0: print('\033[1;36;48mYour life \033[1;m', self.playing.health) print('\033[1;31;48mmonsters life: \033[1;m', m1.health) attk.start() pass else: break m1.reward(self.playing) print("Rewarded! check level.") time.sleep(2) self.playing.showstats() time.sleep(1) pass elif mov == "?q": print(self.graf.question) coolplace() time.sleep(1) elif mov == "t": # town : make print(self.graf.waytown) self.playing.moved.append('t') time.sleep(2) print(self.graf.townNtree) towninp = input("Where to: (s t ?)") # add a handeler print(towninp) return 1 elif mov == "m": # map if self.playing.level >= 7: print(self.graf.maps7) else: print(self.graf.maps) elif mov == "G": print('\033[1;32m---------Entering GOD Mode---------\033[1;31m') self.playing.strangth = 100 self.playing.health = 100000 self.playing.level = 1000 self.playing.hit = 1000 self.playing.showstats()
def __init__(self): self.mlist = {} techID = 0 #grassland monster self.mlist['overworld'] = [] m = monster(techID=techID, name='dryade', sprite_pos=(2, 2), move_border=2, attribute_prev=(0, 1, 2, 2, 1), worn_equipment=(0, 1, 0, 0, 0), AI_style='ignore', corps_style='dryade', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='talk', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The dryade smiles mysterious.', anger='tree', anger_monster=2) techID += 1 self.mlist['overworld'].append(m) m = monster(techID=techID, name='grassland snake', sprite_pos=(0, 9), move_border=1, attribute_prev=(2, 1, 0, 0, 0), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='animal', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect='poisoned', effect_duration=20, effect_probability=20, message='Poison runs trough your veins!', def_flee=20) techID += 1 self.mlist['overworld'].append(m) m = monster(techID=techID, name='rabbit', sprite_pos=(1, 4), move_border=0, attribute_prev=(0, 1, 0, 1, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='animal', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['overworld'].append(m) m = monster(techID=techID, name='green blob', sprite_pos=(1, 8), move_border=4, attribute_prev=(2, 2, 0, 1, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['overworld'].append(m) m = monster(techID=techID, name='hill orc', sprite_pos=(1, 7), move_border=2, attribute_prev=(3, 0, 0, 1, 1), worn_equipment=(1, 0, 1, 0, 0), AI_style='hostile', corps_style='human', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None', def_potion=20) techID += 1 self.mlist['overworld'].append(m) #civilians self.mlist['civilian'] = [] m = monster(techID=techID, name='dryade', sprite_pos=(2, 2), move_border=2, attribute_prev=(0, 1, 2, 2, 1), worn_equipment=(0, 1, 0, 0, 0), AI_style='ignore', corps_style='dryade', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='talk', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The dryade smiles mysterious.') techID += 1 self.mlist['civilian'].append(m) m = monster(techID=techID, name='tame orc', sprite_pos=(0, 4), move_border=2, attribute_prev=(2, 1, 0, 1, 1), worn_equipment=(1, 0, 1, 0, 0), AI_style='ignore', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='talk', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The tame orc geets you.') techID += 1 self.mlist['civilian'].append(m) m = monster(techID=techID, name='golden naga', sprite_pos=(1, 9), move_border=2, attribute_prev=(0, 1, 2, 2, 1), worn_equipment=(0, 1, 0, 1, 1), AI_style='ignore', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='talk', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The golden naga blinks.') techID += 1 self.mlist['civilian'].append(m) m = monster(techID=techID, name='wood elf', sprite_pos=(0, 0), move_border=2, attribute_prev=(0, 2, 0, 2, 1), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='talk', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The wood elf waves.') techID += 1 self.mlist['civilian'].append(m) #cave self.mlist['cave'] = [] m = monster(techID=techID, name='cave orc', sprite_pos=(2, 3), move_border=2, attribute_prev=(2, 2, 0, 1, 2), worn_equipment=(1, 0, 1, 0, 0), AI_style='hostile', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, def_potion=35, message='None.') techID += 1 self.mlist['cave'].append(m) m = monster(techID=techID, name='blue blob', sprite_pos=(2, 5), move_border=4, attribute_prev=(2, 1, 0, 0, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None.') techID += 1 self.mlist['cave'].append(m) m = monster(techID=techID, name='bat', sprite_pos=(2, 7), move_border=0, attribute_prev=(0, 2, 0, 2, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='animal', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None.') techID += 1 self.mlist['cave'].append(m) m = monster(techID=techID, name='soil spirit', sprite_pos=(1, 0), move_border=2, attribute_prev=(0, 1, 2, 1, 1), worn_equipment=(0, 1, 0, 0, 0), AI_style='hostile', corps_style='troll', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_magic', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, range_shoot=65, message='None.') techID += 1 self.mlist['cave'].append(m) m = monster(techID=techID, name='goblin', sprite_pos=(3, 7), move_border=1, attribute_prev=(2, 2, 0, 3, 2), worn_equipment=(0, 0, 1, 0, 0), AI_style='hostile', corps_style='thief', corps_lvl=0, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, close_steal=70, def_flee=80, message='None.') techID += 1 self.mlist['cave'].append(m) #mine self.mlist['orcish_mines'] = [] m = monster(techID=techID, name='orc warlord', sprite_pos=(1, 5), move_border=2, attribute_prev=(2, 2, 0, 1, 2), worn_equipment=(1, 0, 1, 0, 1), AI_style='hostile', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs'), possible_effect='bleeding', effect_duration=5, effect_probability=20, def_potion=50, message='The orc warlord tears you a bleeding wound.') techID += 1 self.mlist['orcish_mines'].append(m) m = monster(techID=techID, name='orcish hag', sprite_pos=(0, 6), move_border=2, attribute_prev=(0, 1, 2, 2, 2), worn_equipment=(0, 1, 0, 1, 1), AI_style='hostile', corps_style='scrollkeeper', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_magic', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect='hexed', effect_duration=40, effect_probability=20, range_shoot=99, def_teleport=20, message='The orcish hag puts a hex on you.') techID += 1 self.mlist['orcish_mines'].append(m) m = monster(techID=techID, name='orcish digger', sprite_pos=(1, 6), move_border=2, attribute_prev=(1, 2, 0, 1, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='miner', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['orcish_mines'].append(m) m = monster(techID=techID, name='blood snake', sprite_pos=(2, 6), move_border=2, attribute_prev=(2, 2, 0, 0, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='animal', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect='poisoned', effect_duration=60, effect_probability=45, def_flee=30, message='Poison runs trough your veins!') techID += 1 self.mlist['orcish_mines'].append(m) #elfish fortress self.mlist['elfish_fortress'] = [] m = monster(techID=techID, name='male elf', sprite_pos=(2, 0), move_border=0, attribute_prev=(2, 2, 0, 0, 2), worn_equipment=(1, 0, 1, 0, 0), AI_style='ignore', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='talk', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The male elf greets you friendly.', anger='kill', anger_monster=0) techID += 1 self.mlist['elfish_fortress'].append(m) m = monster(techID=techID, name='female elf', sprite_pos=(2, 1), move_border=0, attribute_prev=(0, 0, 2, 2, 2), worn_equipment=(0, 1, 0, 1, 1), AI_style='ignore', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='talk', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The female elf greets you friendly.', anger='kill', anger_monster=1) techID += 1 self.mlist['elfish_fortress'].append(m) #angry_monsters self.mlist['angry_monster'] = [] #0 m = monster(techID=techID, name='male elf', sprite_pos=(2, 0), move_border=0, attribute_prev=(2, 2, 0, 1, 2), worn_equipment=(1, 0, 1, 0, 0), AI_style='hostile', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['angry_monster'].append(m) #1 m = monster(techID=techID, name='female elf', sprite_pos=(2, 1), move_border=0, attribute_prev=(0, 1, 2, 2, 2), worn_equipment=(0, 1, 0, 1, 1), AI_style='hostile', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_magic', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, range_shoot=70, message='None') techID += 1 self.mlist['angry_monster'].append(m) #2 m = monster(techID=techID, name='angry dryade', sprite_pos=(2, 8), move_border=2, attribute_prev=(0, 1, 2, 2, 1), worn_equipment=(0, 1, 0, 0, 0), AI_style='hostile', corps_style='dryade', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_magic', attack_were=('Head', 'Body', 'Legs'), possible_effect=None, effect_duration=0, effect_probability=0, message='None', def_teleport=10) techID += 1 self.mlist['angry_monster'].append(m) #3 m = monster(techID=techID, name='male neko', sprite_pos=(2, 10), move_border=0, attribute_prev=(2, 2, 0, 1, 2), worn_equipment=(1, 0, 1, 0, 0), AI_style='hostile', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid', 'house'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['angry_monster'].append(m) #4 m = monster(techID=techID, name='female female', sprite_pos=(2, 9), move_border=0, attribute_prev=(0, 1, 2, 2, 2), worn_equipment=(0, 1, 0, 1, 1), AI_style='hostile', corps_style='human', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid', 'house'), behavior='attack_magic', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['angry_monster'].append(m) #grot self.mlist['grot'] = [] m = monster(techID=techID, name='blue naga', sprite_pos=(2, 4), move_border=3, attribute_prev=(0, 1, 2, 2, 2), worn_equipment=(0, 1, 0, 1, 1), AI_style='hostile', corps_style='scrollkeeper', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_magic', attack_were=('Head'), possible_effect='hexed', effect_duration=30, effect_probability=50, range_shoot=50, def_potion=20, message='The blue naga puts a hex on you.') techID += 1 self.mlist['grot'].append(m) m = monster(techID=techID, name='red naga', sprite_pos=(1, 2), move_border=3, attribute_prev=(2, 2, 0, 1, 2), worn_equipment=(1, 0, 0, 1, 1), AI_style='hostile', corps_style='human', corps_lvl=1, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect='poisoned', effect_duration=50, effect_probability=40, def_potion=20, message='Poison runs trough your veins!') techID += 1 self.mlist['grot'].append(m) m = monster(techID=techID, name='purple blob', sprite_pos=(0, 5), move_border=4, attribute_prev=(2, 2, 0, 0, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['grot'].append(m) m = monster(techID=techID, name='water spirit', sprite_pos=(0, 1), move_border=2, attribute_prev=(2, 2, 0, 1, 1), worn_equipment=(1, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=3, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect='confused', effect_duration=60, effect_probability=20, message='The water sprit confuses you.') techID += 1 self.mlist['grot'].append(m) #lava cave self.mlist['lava_cave'] = [] m = monster(techID=techID, name='lava monster', sprite_pos=(0, 8), move_border=2, attribute_prev=(2, 2, 0, 2, 2), worn_equipment=(1, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['lava_cave'].append(m) m = monster(techID=techID, name='flame spirit', sprite_pos=(0, 10), move_border=0, attribute_prev=(0, 0, 2, 2, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_magic', attack_were=('Body', 'Legs', 'Feet'), possible_effect='immobilized', effect_duration=4, effect_probability=30, range_shoot=30, close_flame=60, message='You can\'t move!') techID += 1 self.mlist['lava_cave'].append(m) m = monster(techID=techID, name='red blob', sprite_pos=(1, 3), move_border=4, attribute_prev=(2, 2, 0, 0, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['lava_cave'].append(m) m = monster(techID=techID, name='fire bat', sprite_pos=(1, 10), move_border=0, attribute_prev=(2, 2, 0, 0, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=2, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Head', 'Body'), possible_effect='confused', effect_duration=40, effect_probability=30, message='The bat\'s screen make you confused!') techID += 1 self.mlist['lava_cave'].append(m) #special self.mlist['special'] = [] #0 m = monster(techID=techID, name='vase', sprite_pos=(0, 3), move_border=10, attribute_prev=(2, 0, 2, 0, 0), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='miner', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['special'].append(m) #1 m = monster(techID=techID, name='monster vase', sprite_pos=(0, 3), move_border=10, attribute_prev=(2, 0, 2, 0, 0), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='vase', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['special'].append(m) #2 m = monster(techID=techID, name='vase monster', sprite_pos=(0, 2), move_border=1, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='miner', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_random', attack_were=('Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['special'].append(m) #3 m = monster(techID=techID, name='sleeping mimic', sprite_pos=(1, 1), move_border=10, attribute_prev=(2, 0, 2, 0, 0), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='mimic', corps_lvl=5, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['special'].append(m) #4 m = monster(techID=techID, name='mimic', sprite_pos=(0, 7), move_border=4, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=99, personal_id='None', move_groups=('soil', 'low_liquid'), behavior='attack_random', attack_were=('Head', 'Body', 'Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['special'].append(m) #5 m = monster(techID=techID, name='female neko', sprite_pos=(2, 9), move_border=0, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('house', 'house'), behavior='talk', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The female neko blinks feiendly.', anger='destroy', anger_monster=4) techID += 1 self.mlist['special'].append(m) #6 m = monster(techID=techID, name='male neko', sprite_pos=(2, 10), move_border=0, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('house', 'house'), behavior='talk', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The male neko blinks friendly.', anger='destroy', anger_monster=3) techID += 1 self.mlist['special'].append(m) #shop self.mlist['shop'] = [] #0 m = monster(techID=techID, name='elfish shopkeeper', sprite_pos=(3, 2), move_border=0, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('shop', 'shop'), behavior='talk', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The shopkeeper greets you.') techID += 1 self.mlist['shop'].append(m) #1 m = monster(techID=techID, name='orcish shopkeeper', sprite_pos=(3, 0), move_border=0, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('shop', 'shop'), behavior='talk', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The shopkeeper greets you.') techID += 1 self.mlist['shop'].append(m) #2 m = monster(techID=techID, name='naga shopkeeper', sprite_pos=(3, 1), move_border=0, attribute_prev=(2, 2, 2, 2, 2), worn_equipment=(1, 1, 1, 1, 1), AI_style='ignore', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('shop', 'shop'), behavior='talk', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='The shopkeeper greets you.') techID += 1 self.mlist['shop'].append(m) #desert monster self.mlist['desert'] = [] #0 m = monster(techID=techID, name='desert snake', sprite_pos=(3, 3), move_border=4, attribute_prev=(3, 1, 0, 0, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='animal', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect='poisoned', effect_duration=240, effect_probability=80, def_flee=40, message='Poison runs trough your veins!') techID += 1 self.mlist['desert'].append(m) #1 m = monster(techID=techID, name='yellow blob', sprite_pos=(3, 4), move_border=4, attribute_prev=(2, 2, 0, 1, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['desert'].append(m) #2 m = monster(techID=techID, name='scarab', sprite_pos=(3, 5), move_border=2, attribute_prev=(2, 2, 0, 2, 2), worn_equipment=(0, 0, 0, 0, 0), AI_style='hostile', corps_style='vanish', corps_lvl=5, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Legs', 'Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['desert'].append(m) #3 m = monster(techID=techID, name='lizard', sprite_pos=(3, 6), move_border=0, attribute_prev=(0, 1, 0, 1, 1), worn_equipment=(0, 0, 0, 0, 0), AI_style='flee', corps_style='animal', corps_lvl=1, personal_id='None', move_groups=('soil', 'soil'), behavior='attack_melee', attack_were=('Feet'), possible_effect=None, effect_duration=0, effect_probability=0, message='None') techID += 1 self.mlist['desert'].append(m) #dungeon monster self.mlist['dungeon'] = [] for a in self.mlist['grot']: self.mlist['dungeon'].append(a) for b in self.mlist['orcish_mines']: self.mlist['dungeon'].append(b)
### creates a monster, makes it move and prints the coordinates ### from numpy import * import monster N=10#size of the world: 10x10 pixels A=zeros((10,10)) A[5,5]=1 sulley=monster.monster(([5,5]),A,A) print(sulley.get_coord()) t=6 print(sulley.map) for i in range(t): sulley.move(N,N) print(sulley.get_coord()) ##list of the coordinates, to be used for the display print(sulley.get_map()) print(sulley.get_perim())
def __init__(self): self.mlist = {} techID = 0 #grassland monster self.mlist['overworld'] = [] m=monster(techID = techID, name = 'dryade', sprite_pos = (2,2), move_border = 2, attribute_prev = (0,1,2,2,1), worn_equipment = (0,1,0,0,0), AI_style = 'ignore', corps_style = 'dryade', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'talk', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The dryade smiles mysterious.', anger = 'tree', anger_monster = 2) techID+=1 self.mlist['overworld'].append(m) m=monster(techID = techID, name = 'grassland snake', sprite_pos = (0,9), move_border = 1, attribute_prev = (2,1,0,0,0), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'animal', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = 'poisoned', effect_duration = 20, effect_probability = 20, message = 'Poison runs trough your veins!', def_flee = 20) techID+=1 self.mlist['overworld'].append(m) m=monster(techID = techID, name = 'rabbit', sprite_pos = (1,4), move_border = 0, attribute_prev = (0,1,0,1,1), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'animal', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['overworld'].append(m) m=monster(techID = techID, name = 'green blob', sprite_pos = (1,8), move_border = 4, attribute_prev = (2,2,0,1,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['overworld'].append(m) m=monster(techID = techID, name = 'hill orc', sprite_pos = (1,7), move_border = 2, attribute_prev = (3,0,0,1,1), worn_equipment = (1,0,1,0,0), AI_style = 'hostile', corps_style = 'human', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None', def_potion = 20) techID+=1 self.mlist['overworld'].append(m) #civilians self.mlist['civilian'] = [] m=monster(techID = techID, name = 'dryade', sprite_pos = (2,2), move_border = 2, attribute_prev = (0,1,2,2,1), worn_equipment = (0,1,0,0,0), AI_style = 'ignore', corps_style = 'dryade', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'talk', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The dryade smiles mysterious.') techID+=1 self.mlist['civilian'].append(m) m=monster(techID = techID, name = 'tame orc', sprite_pos = (0,4), move_border = 2, attribute_prev = (2,1,0,1,1), worn_equipment = (1,0,1,0,0), AI_style = 'ignore', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'talk', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The tame orc geets you.') techID+=1 self.mlist['civilian'].append(m) m=monster(techID = techID, name = 'golden naga', sprite_pos = (1,9), move_border = 2, attribute_prev = (0,1,2,2,1), worn_equipment = (0,1,0,1,1), AI_style = 'ignore', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'talk', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The golden naga blinks.') techID+=1 self.mlist['civilian'].append(m) m=monster(techID = techID, name = 'wood elf', sprite_pos = (0,0), move_border = 2, attribute_prev = (0,2,0,2,1), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'talk', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The wood elf waves.') techID+=1 self.mlist['civilian'].append(m) #cave self.mlist['cave'] = [] m=monster(techID = techID, name = 'cave orc', sprite_pos = (2,3), move_border = 2, attribute_prev = (2,2,0,1,2), worn_equipment = (1,0,1,0,0), AI_style = 'hostile', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, def_potion = 35, message = 'None.') techID+=1 self.mlist['cave'].append(m) m=monster(techID = techID, name = 'blue blob', sprite_pos = (2,5), move_border = 4, attribute_prev = (2,1,0,0,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None.') techID+=1 self.mlist['cave'].append(m) m=monster(techID = techID, name = 'bat', sprite_pos = (2,7), move_border = 0, attribute_prev = (0,2,0,2,2), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'animal', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None.') techID+=1 self.mlist['cave'].append(m) m=monster(techID = techID, name = 'soil spirit', sprite_pos = (1,0), move_border = 2, attribute_prev = (0,1,2,1,1), worn_equipment = (0,1,0,0,0), AI_style = 'hostile', corps_style = 'troll', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_magic', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, range_shoot = 65, message = 'None.') techID+=1 self.mlist['cave'].append(m) m=monster(techID = techID, name = 'goblin', sprite_pos = (3,7), move_border = 1, attribute_prev = (2,2,0,3,2), worn_equipment = (0,0,1,0,0), AI_style = 'hostile', corps_style = 'thief', corps_lvl = 0, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, close_steal = 70, def_flee = 80, message = 'None.') techID+=1 self.mlist['cave'].append(m) #mine self.mlist['orcish_mines'] = [] m=monster(techID = techID, name = 'orc warlord', sprite_pos = (1,5), move_border = 2, attribute_prev = (2,2,0,1,2), worn_equipment = (1,0,1,0,1), AI_style = 'hostile', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs'), possible_effect = 'bleeding', effect_duration = 5, effect_probability = 20, def_potion = 50, message = 'The orc warlord tears you a bleeding wound.') techID+=1 self.mlist['orcish_mines'].append(m) m=monster(techID = techID, name = 'orcish hag', sprite_pos = (0,6), move_border = 2, attribute_prev = (0,1,2,2,2), worn_equipment = (0,1,0,1,1), AI_style = 'hostile', corps_style = 'scrollkeeper', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_magic', attack_were = ('Head','Body','Legs','Feet'), possible_effect = 'hexed', effect_duration = 40, effect_probability = 20, range_shoot = 99, def_teleport = 20, message = 'The orcish hag puts a hex on you.') techID+=1 self.mlist['orcish_mines'].append(m) m=monster(techID = techID, name = 'orcish digger', sprite_pos = (1,6), move_border = 2, attribute_prev = (1,2,0,1,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'miner', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['orcish_mines'].append(m) m=monster(techID = techID, name = 'blood snake', sprite_pos = (2,6), move_border = 2, attribute_prev = (2,2,0,0,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'animal', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = 'poisoned', effect_duration = 60, effect_probability = 45, def_flee = 30, message = 'Poison runs trough your veins!') techID+=1 self.mlist['orcish_mines'].append(m) #elfish fortress self.mlist['elfish_fortress'] = [] m=monster(techID = techID, name = 'male elf', sprite_pos = (2,0), move_border = 0, attribute_prev = (2,2,0,0,2), worn_equipment = (1,0,1,0,0), AI_style = 'ignore', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'talk', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The male elf greets you friendly.', anger = 'kill', anger_monster = 0) techID+=1 self.mlist['elfish_fortress'].append(m) m=monster(techID = techID, name = 'female elf', sprite_pos = (2,1), move_border = 0, attribute_prev = (0,0,2,2,2), worn_equipment = (0,1,0,1,1), AI_style = 'ignore', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'talk', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The female elf greets you friendly.', anger = 'kill', anger_monster = 1) techID+=1 self.mlist['elfish_fortress'].append(m) #angry_monsters self.mlist['angry_monster'] = [] #0 m=monster(techID = techID, name = 'male elf', sprite_pos = (2,0), move_border = 0, attribute_prev = (2,2,0,1,2), worn_equipment = (1,0,1,0,0), AI_style = 'hostile', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['angry_monster'].append(m) #1 m=monster(techID = techID, name = 'female elf', sprite_pos = (2,1), move_border = 0, attribute_prev = (0,1,2,2,2), worn_equipment = (0,1,0,1,1), AI_style = 'hostile', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_magic', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, range_shoot = 70, message = 'None') techID+=1 self.mlist['angry_monster'].append(m) #2 m=monster(techID = techID, name = 'angry dryade', sprite_pos = (2,8), move_border = 2, attribute_prev = (0,1,2,2,1), worn_equipment = (0,1,0,0,0), AI_style = 'hostile', corps_style = 'dryade', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_magic', attack_were = ('Head','Body','Legs'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None', def_teleport = 10) techID+=1 self.mlist['angry_monster'].append(m) #3 m=monster(techID = techID, name = 'male neko', sprite_pos = (2,10), move_border = 0, attribute_prev = (2,2,0,1,2), worn_equipment = (1,0,1,0,0), AI_style = 'hostile', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid','house'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['angry_monster'].append(m) #4 m=monster(techID = techID, name = 'female female', sprite_pos = (2,9), move_border = 0, attribute_prev = (0,1,2,2,2), worn_equipment = (0,1,0,1,1), AI_style = 'hostile', corps_style = 'human', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid','house'), behavior = 'attack_magic', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['angry_monster'].append(m) #grot self.mlist['grot'] = [] m=monster(techID = techID, name = 'blue naga', sprite_pos = (2,4), move_border = 3, attribute_prev = (0,1,2,2,2), worn_equipment = (0,1,0,1,1), AI_style = 'hostile', corps_style = 'scrollkeeper', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_magic', attack_were = ('Head'), possible_effect = 'hexed', effect_duration = 30, effect_probability = 50, range_shoot = 50, def_potion = 20, message = 'The blue naga puts a hex on you.') techID+=1 self.mlist['grot'].append(m) m=monster(techID = techID, name = 'red naga', sprite_pos = (1,2), move_border = 3, attribute_prev = (2,2,0,1,2), worn_equipment = (1,0,0,1,1), AI_style = 'hostile', corps_style = 'human', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = 'poisoned', effect_duration = 50, effect_probability = 40, def_potion = 20, message = 'Poison runs trough your veins!') techID+=1 self.mlist['grot'].append(m) m=monster(techID = techID, name = 'purple blob', sprite_pos = (0,5), move_border = 4, attribute_prev = (2,2,0,0,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['grot'].append(m) m=monster(techID = techID, name = 'water spirit', sprite_pos = (0,1), move_border = 2, attribute_prev = (2,2,0,1,1), worn_equipment = (1,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 3, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body','Legs','Feet'), possible_effect = 'confused', effect_duration = 60, effect_probability = 20, message = 'The water sprit confuses you.') techID+=1 self.mlist['grot'].append(m) #lava cave self.mlist['lava_cave'] = [] m=monster(techID = techID, name = 'lava monster', sprite_pos = (0,8), move_border = 2, attribute_prev = (2,2,0,2,2), worn_equipment = (1,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['lava_cave'].append(m) m=monster(techID = techID, name = 'flame spirit', sprite_pos = (0,10), move_border = 0, attribute_prev = (0,0,2,2,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_magic', attack_were = ('Body','Legs','Feet'), possible_effect = 'immobilized', effect_duration = 4, effect_probability = 30, range_shoot = 30, close_flame = 60, message = 'You can\'t move!') techID+=1 self.mlist['lava_cave'].append(m) m=monster(techID = techID, name = 'red blob', sprite_pos = (1,3), move_border = 4, attribute_prev = (2,2,0,0,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['lava_cave'].append(m) m=monster(techID = techID, name = 'fire bat', sprite_pos = (1,10), move_border = 0, attribute_prev = (2,2,0,0,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 2, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Head','Body'), possible_effect = 'confused', effect_duration = 40, effect_probability = 30, message = 'The bat\'s screen make you confused!') techID+=1 self.mlist['lava_cave'].append(m) #special self.mlist['special'] = [] #0 m=monster(techID = techID, name = 'vase', sprite_pos = (0,3), move_border = 10, attribute_prev = (2,0,2,0,0), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'miner', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['special'].append(m) #1 m=monster(techID = techID, name = 'monster vase', sprite_pos = (0,3), move_border = 10, attribute_prev = (2,0,2,0,0), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'vase', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['special'].append(m) #2 m=monster(techID = techID, name = 'vase monster', sprite_pos = (0,2), move_border = 1, attribute_prev = (2,2,2,2,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'miner', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_random', attack_were = ('Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['special'].append(m) #3 m=monster(techID = techID, name = 'sleeping mimic', sprite_pos = (1,1), move_border = 10, attribute_prev = (2,0,2,0,0), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'mimic', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['special'].append(m) #4 m=monster(techID = techID, name = 'mimic', sprite_pos = (0,7), move_border = 4, attribute_prev = (2,2,2,2,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 99, personal_id = 'None', move_groups = ('soil','low_liquid'), behavior = 'attack_random', attack_were = ('Head','Body','Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['special'].append(m) #5 m=monster(techID = techID, name = 'female neko', sprite_pos = (2,9), move_border = 0, attribute_prev = (2,2,2,2,2), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('house','house'), behavior = 'talk', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The female neko blinks feiendly.', anger = 'destroy', anger_monster = 4) techID+=1 self.mlist['special'].append(m) #6 m=monster(techID = techID, name = 'male neko', sprite_pos = (2,10), move_border = 0, attribute_prev = (2,2,2,2,2), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('house','house'), behavior = 'talk', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The male neko blinks friendly.', anger = 'destroy', anger_monster = 3) techID+=1 self.mlist['special'].append(m) #shop self.mlist['shop'] = [] #0 m=monster(techID = techID, name = 'elfish shopkeeper', sprite_pos = (3,2), move_border = 0, attribute_prev = (2,2,2,2,2), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('shop','shop'), behavior = 'talk', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The shopkeeper greets you.') techID+=1 self.mlist['shop'].append(m) #1 m=monster(techID = techID, name = 'orcish shopkeeper', sprite_pos = (3,0), move_border = 0, attribute_prev = (2,2,2,2,2), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('shop','shop'), behavior = 'talk', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The shopkeeper greets you.') techID+=1 self.mlist['shop'].append(m) #2 m=monster(techID = techID, name = 'naga shopkeeper', sprite_pos = (3,1), move_border = 0, attribute_prev = (2,2,2,2,2), worn_equipment = (1,1,1,1,1), AI_style = 'ignore', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('shop','shop'), behavior = 'talk', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'The shopkeeper greets you.') techID+=1 self.mlist['shop'].append(m) #desert monster self.mlist['desert'] = [] #0 m=monster(techID = techID, name = 'desert snake', sprite_pos = (3,3), move_border = 4, attribute_prev = (3,1,0,0,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'animal', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = 'poisoned', effect_duration = 240, effect_probability = 80, def_flee = 40, message = 'Poison runs trough your veins!') techID+=1 self.mlist['desert'].append(m) #1 m=monster(techID = techID, name = 'yellow blob', sprite_pos = (3,4), move_border = 4, attribute_prev = (2,2,0,1,1), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['desert'].append(m) #2 m=monster(techID = techID, name = 'scarab', sprite_pos = (3,5), move_border = 2, attribute_prev = (2,2,0,2,2), worn_equipment = (0,0,0,0,0), AI_style = 'hostile', corps_style = 'vanish', corps_lvl = 5, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Legs','Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['desert'].append(m) #3 m=monster(techID = techID, name = 'lizard', sprite_pos = (3,6), move_border = 0, attribute_prev = (0,1,0,1,1), worn_equipment = (0,0,0,0,0), AI_style = 'flee', corps_style = 'animal', corps_lvl = 1, personal_id = 'None', move_groups = ('soil','soil'), behavior = 'attack_melee', attack_were = ('Feet'), possible_effect = None, effect_duration = 0, effect_probability = 0, message = 'None') techID+=1 self.mlist['desert'].append(m) #dungeon monster self.mlist['dungeon'] = [] for a in self.mlist['grot']: self.mlist['dungeon'].append(a) for b in self.mlist['orcish_mines']: self.mlist['dungeon'].append(b)
rw = max(len(str(m.name)) for m in monst) + 12 while monst[0].alive() and monst[1].alive(): attacker = next(turn) defender = not attacker attack_data = monst[attacker].attack() status = f"{monst[0].hit_points} <> {monst[1].hit_points}".ljust(lw) if attack_data['stun']: status += f" : {monst[defender].name} stunned!".rjust(rw) else: status += "".rjust(rw) print(status, end='\r', flush=True) monst[defender].defend(**attack_data) sleep(.2) print('') print(f"{monst[0].name if monst[0].alive() else monst[1].name} wins!") if __name__ == "__main__": print('Welcome to Monster Battle!') # monster_one = create_monster(1) # monster_two = create_monster(2) monster_one = monster('a', 3, 50, 3, 3) monster_two = monster('b', 3, 50, 3, 3) print(monster_one) print(monster_two) battle(monster_one, monster_two) pass
def __init__(self, rpg): self.playerIcon = image(rpg, rpg.player.icon, rpg.player.name)#pylint: disable = anomalous-backslash-in-string self.playerIcon.iconDefault(rpg, -315) self.playerSquare = square(rpg) self.playerSquare.combatDefault(rpg, -315) self.playerAttack = Button(rpg, "Attack") self.playerAttack.combatDefault(rpg, -367.5, 0) self.playerDefend = Button(rpg, "Defend") self.playerDefend.combatDefault(rpg, -367.5, 205) self.playerRest = Button(rpg, "Rest") self.playerRest.combatDefault(rpg, -315, 0) self.playerRunAway = Button(rpg, "Run Away") self.playerRunAway.combatDefault(rpg, -315, 205) self.equipped_allies = rpg.player.equipped_allies try: if self.equipped_allies[0]: self.ally1Icon = image(rpg, rpg.player.equipped_allies[0].icon, rpg.player.equipped_allies[0].name) self.ally1Icon.iconDefault(rpg, -210) self.ally1Square = square(rpg) self.ally1Square.combatDefault(rpg, -210) self.ally1Attack = Button(rpg, "Attack") self.ally1Attack.combatDefault(rpg, -262.5, 0) self.ally1Defend = Button(rpg, "Defend") self.ally1Defend.combatDefault(rpg, -262.5, 205) self.ally1Rest = Button(rpg, "Rest") self.ally1Rest.combatDefault(rpg, -210, 0) self.ally1runAway = Button(rpg, "Run Away") self.ally1runAway.combatDefault(rpg, -210, 205) if self.equipped_allies[1]: self.ally2Icon = image(rpg, rpg.player.equipped_allies[1].icon, rpg.player.equipped_allies[1].name) self.ally2Icon.iconDefault(rpg, -105) self.ally2Square = square(rpg) self.ally2Square.combatDefault(rpg, -105) self.ally2Attack = Button(rpg, "Attack") self.ally2Attack.combatDefault(rpg, -157.5, 0) self.ally2Defend = Button(rpg, "Defend") self.ally2Defend.combatDefault(rpg, -157.5, 205) self.ally2Rest = Button(rpg, "Rest") self.ally2Rest.combatDefault(rpg, -105, 0) self.ally2runAway = Button(rpg, "Run Away") self.ally2runAway.combatDefault(rpg, -105, 205) if self.equipped_allies[2]: self.ally3Icon = image(rpg, rpg.player.equipped_allies[2].icon, rpg.player.equipped_allies[2].name) self.ally3Icon.iconDefault(rpg, 0) self.ally3Square = square(rpg) self.ally3Square.combatDefault(rpg, 0) self.ally3Attack = Button(rpg, "Attack") self.ally3Attack.combatDefault(rpg, -52.5, 0) self.ally3Defend = Button(rpg, "Defend") self.ally3Defend.combatDefault(rpg, -52.5, 205) self.ally3Rest = Button(rpg, "Rest") self.ally3Rest.combatDefault(rpg, 0, 0) self.ally3runAway = Button(rpg, "Run Away") self.ally3runAway.combatDefault(rpg, 0, 205) except: pass self.background = image(rpg, "CREATE Task Folder\Image Assets\Transparent.png", "") self.background.left, self.background.top = 0, 0 self.background.width, self.background.height = 1050, 660 self.enemy = monster(rpg) self.enemy.goblin() self.enemyImage = image(rpg, self.enemy.image, "") self.enemyImage.left, self.enemyImage.top = 250, 220 self.enemyImage.width, self.enemyImage.height = 550, 420 self.enemyImage.transparent = True self.enemyInfo = Button(rpg, "{} - Level: {}".format(self.enemy.name, self.enemy.level)) self.enemyInfo.width, self.enemyInfo.height = 550, 35 self.enemyInfo.left, self.enemyInfo.top = 250, 80 self.enemyInfo.clickable = False self.enemyHP = Button(rpg, "HP: {}/{}".format(self.enemy.hp, self.enemy.maxhp)) self.enemyHP.width, self.enemyHP.height = 275, 35 self.enemyHP.left, self.enemyHP.top = 250, 115 self.enemyHP.transparent = True self.enemyHP.clickable = False self.enemyHPbar = Button(rpg, "") self.enemyHPbar.width, self.enemyHPbar.height = 275, 35 self.enemyHPbar.left, self.enemyHPbar.top = 250, 115 self.enemyHPbar.button_color = (200, 0, 0) self.enemyHPbar.text_color = (200, 0, 0) self.enemyHPbar.clickable = False self.enemyStamina = Button(rpg, "Stamina: {}/{}".format(self.enemy.stamina, self.enemy.stamina_max)) self.enemyStamina.width, self.enemyStamina.height = 275, 35 self.enemyStamina.left, self.enemyStamina.top = 525, 115 self.enemyStamina.transparent = True self.enemyStamina.clickable = False self.enemyStaminaBar = Button(rpg, "") self.enemyStaminaBar.width, self.enemyStaminaBar.height = 275, 35 self.enemyStaminaBar.left, self.enemyStaminaBar.top = 525, 115 self.enemyStaminaBar.button_color = (0, 200, 0) self.enemyStaminaBar.text_color = (0, 200, 0) self.enemyStaminaBar.clickable = False self.enemyMana = Button(rpg, "Mana: {}/{}".format(self.enemy.mana, self.enemy.mana_max)) self.enemyMana.width, self.enemyMana.height = 550, 35 self.enemyMana.left, self.enemyMana.top = 250, 150 self.enemyMana.transparent = True self.enemyMana.clickable = False self.enemyManaBar = Button(rpg, "") self.enemyManaBar.width, self.enemyManaBar.height = 550, 35 self.enemyManaBar.left, self.enemyManaBar.top = 250, 150 self.enemyManaBar.button_color = (0, 0, 200) self.enemyManaBar.text_color = (0, 0, 200) self.enemyManaBar.clickable = False self.enemyStats = True self.attack = False self.defend = False self.rest = False self.runAway = False self.battleOver = False self.increaseMonsterDefend = False self.increasePlayerDefend = False