Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from characterCreation import *
- from beings import Enemy
- import random
- playerHP = 0
- playerMP= 0
- playerStrength = 0
- enemyStrength = 0
- enemyHP =0
- enemyMP=0
- enemyStrength=0
- enemyDexterity=0
- enemyVitality=0
- enemyAgility=0
- enemyInteligence=0
- enemyMind=0
- enemyCharisma =0
- #Check Player stats
- """Creates Player stats based on race, mainjob and level"""
- def playerStats():
- print('NOW IN PLAYERSTATS()')
- playerHP = player.race['stats']['hp'] + player.mainjob['hp'] + int ((player.level/100)*100)
- playerMP = player.race['stats']['mp'] + player.mainjob['mp'] + int ((player.level/100)*100)
- playerStrength = player.race['stats']['strength'] + int ((player.level/100)*100)
- playerDexterity = player.race['stats']['dexterity'] + int ((player.level/100)*100)
- playerVitality = player.race['stats']['vitality'] + int ((player.level/100)*100)
- playerAgility = player.race['stats']['agility'] + int ((player.level/100)*100)
- playerInteligence = player.race['stats']['intelligence'] + int ((player.level/100)*100)
- playerMind = player.race['stats']['mind'] + int ((player.level/100)*100)
- playerCharisma = player.race['stats']['charisma'] + int ((player.level/100)*100)
- print("playerStrength = ",playerStrength)
- print(player.mainjob['name'])
- print("playerHP = ",playerHP)
- print("playerMP = ",playerMP)
- return playerHP,playerMP,playerStrength,playerDexterity,playerVitality,playerAgility,playerInteligence,playerMind,playerCharisma
- #Enemy - race, name, level, mainjob, support job, gold, inventory
- enemy1 = Enemy(elf,"Goblin", 25,white_mage, "Warrior",52,inventory = [('Matted Fur',70),('High Quality Fur',10)])
- enemy2 = Enemy(dwarf,"Orc", 25,warrior, "Warrior",52,inventory = [('Matted Fur',70),('High Quality Fur',10)])
- #Check Enemy stats
- def enemyStats(enemy):
- """Creates Enemy stats based on race, mainjob and level"""
- print('NOW IN ENEMYSTATS()')
- enemyHP = enemy.race['stats']['hp'] + enemy.mainjob['hp'] + int ((enemy.level/100)*100)
- enemyMP = enemy.race['stats']['mp'] + enemy.mainjob['mp'] + int ((enemy.level/100)*100)
- enemyStrength = enemy.race['stats']['strength'] + int ((enemy.level/100)*100)
- enemyDexterity = enemy.race['stats']['dexterity'] + int ((enemy.level/100)*100)
- enemyVitality = enemy.race['stats']['vitality'] + int ((enemy.level/100)*100)
- enemyAgility = enemy.race['stats']['agility'] + int ((enemy.level/100)*100)
- enemyInteligence = enemy.race['stats']['intelligence'] + int ((enemy.level/100)*100)
- enemyMind = enemy.race['stats']['mind'] + int ((enemy.level/100)*100)
- enemyCharisma = enemy.race['stats']['charisma'] + int ((enemy.level/100)*100)
- print("enemyStrength = ",enemyStrength)
- return enemyHP,enemyMP,enemyStrength,enemyDexterity,enemyVitality,enemyAgility,enemyInteligence,enemyMind,enemyCharisma
- #Enemy Encounter
- def enemyEncounter(enemy):
- """Not currently called"""
- """Reads in enemy instantiation and checks playerStrength against enemyStrength"""
- print('NOW IN ENEMYENCOUNTER()')
- print("a wild ", enemy.name, "has appeared")
- playerStats()
- enemyStats(enemy)
- if playerStrength >= enemyStrength:
- print(player.name, " Wins!")
- print(playerHP)
- print(playerMP)
- elif enemyStrength >= playerStrength:
- print(enemy.name, " Wins!")
- #Display Actions
- """Not currently called"""
- def display_actions():
- """Will display list of actions taken from player.mainjob spell list"""
- print('NOW IN DISPLAY_ACTIONS()')
- print("Which action will you take?")
- for i in player.mainjob['spelllist']:
- print(i)
- #display_actions()
- #enemyEncounter(enemy2)
- playerStats()
- enemyStats(enemy1)
- ### -- BATTLE -- ###
- '''
- • Read enemy
- • Decide who turn initially
- ○ While playerHP >0 and enemyHP >0:
- § Turn = turn + 1
- § Display actions
- § Choose action
- § Calculate actions numbers
- § Update relevant numbers
- '''
- print('NOW IN BATTLE')
- number = random.randint(1,2)
- if number == 1:
- player_turn = True
- else:
- player_turn = False
- while playerHP >= 0 or enemyHP >= 0: #FOR SOME REASON ITS READING PLAYER HP AS 0
- if player_turn == True:
- print("Which action will you take?")
- for i in player.mainjob['spelllist']:
- print(i)
- action = input()
- if action in (player.mainjob['spelllist']):
- action = player.mainjob['spelllist'][action]
- if action['effect'] == 'damage':
- enemyHP = enemyHP - action['amount']
- print("PlayerHP = ",playerHP)
- print('EnemyHP = ', enemyHP)
- elif action['effect'] == 'healing':
- playerHP = playerHP + action['amount']
- print("PlayerHP = ",playerHP)
- print('EnemyHP = ', enemyHP)
- player_turn = False
- elif player_turn == False:
- print("Enemy attacks")
- player_turn = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement