コード例 #1
0
def barbarian_fight(player, enemy):
    while (player.hp > 0 and enemy.hp > 0):
        attack_type = input("Unarmed or Armed? ")
        if (attack_type.lower() == 'armed'):
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.heavyWeaponAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        else:
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.unarmedAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        print('Your Health ', player.hp)
        print('Enemy Health ', enemy.hp)
コード例 #2
0
def arcane_fight(player, enemy):
    while (player.hp > 0 and enemy.hp > 0):
        attack_type = input("Unarmed or Fireball? ")
        if (attack_type.lower() == 'ball' or attack_type.lower() == 'fireball'
                or attack_type.lower() == 'magic'):
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - \
                player.fireball(hit, evade, enemy.dexMod)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        else:
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.unarmedAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        print('Your Health ', player.hp)
        print('Enemy Health ', enemy.hp)
コード例 #3
0
def storm_fight(player, enemy):
    while (player.hp > 0 and enemy.hp > 0):
        attack_type = input("Unarmed or Lightning Bolt? ")
        if (attack_type.lower() == 'bolt' or attack_type.lower() == 'lightning'
                or attack_type.lower() == 'magic'):
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - \
                player.lightning_bolt(hit, evade, enemy.dexMod)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        else:
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.unarmedAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        print('Your Health ', player.hp)
        print('Enemy Health ', enemy.hp)
コード例 #4
0
def assasin_fight(player, enemy):
    while (player.hp > 0 and enemy.hp > 0):

        if (player.stealth_flag == True):
            print('Stealth Attack First Strike!')
            enemy.hp -= player.stealth_attack()
            print(enemy.hp)
        attack_type = input("Unarmed or Armed? ")
        if (attack_type.lower() == 'armed'):
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.finesseWeaponAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        else:
            hit = funcs.d20(1)
            evade = funcs.d20(1) + enemy.dexMod
            enemy.hp = enemy.hp - player.unarmedAttack(hit, evade)
            hit = funcs.d20(1)
            evade = funcs.d20(1) + player.dexMod
            player.hp = player.hp - enemy.unarmedAttack(hit, evade)
        print('Your Health ', player.hp)
        print('Enemy Health ', enemy.hp)
コード例 #5
0
from rogue import Rogue, Assasin, Thief
from wizard import Wizard, Storms, Arcanum

# Checks if a saved character already exists###################################
load = 'no'

if (path.exists("savedcharacter.obj") is True):
    load = input('Would you like to load your last saved character? ')
# Load Previously Saved Character##############################################
if (load == 'yes'):
    file = open('savedcharacter.obj', 'rb')
    save_data(file)

# Initial Character Creation with Random stats#################################
elif ((path.exists("savedcharacter.obj") is False) or (load != 'yes')):
    strength = funcs.d20(8)
    constitution = funcs.d20(10)
    dexterity = funcs.d20(8)
    wisdom = funcs.d20(8)
    intelligence = funcs.d20(8)
    charisma = funcs.d20(8)

    player = Character(strength, constitution, dexterity, intelligence, wisdom,
                       charisma)
    print(player.getStats())

    # Allows user to choose what class their character is and resets character#####
    characterClass = None
    while characterClass not in ('bard', 'wizard', 'fighter', 'rogue',
                                 'barbarian'):
        characterClass = input('What Class Do You Want'