示例#1
0
 def test_Damage(self):
     play = Player('Greg')
     bp = play.backpack
     bp.weapons.append(Weapon('sword', 20, lambda: Dice.eight_sided(),
                              True))
     dam = play.get_damage_inflicted()
     print(str.format("Damage: {}", dam))
     self.assertTrue(1 <= dam <= 8)
示例#2
0
文件: Fighter.py 项目: gpkort/dndai
 def get_initial_hit_points(self):
     bonus = pu.BONUS_PENALTIES[self.attributes.constitution]
     bonus = bonus if bonus > 0 else 0
     return Dice.eight_sided() + bonus
示例#3
0
文件: Fighter.py 项目: gpkort/dndai
 def get_saving_throw(self, versus_attack)->bool:
     roll = Dice.twenty_sided()
     return (roll >= Fighter.SAVING_THROWS[versus_attack]), roll
示例#4
0
文件: Utilities.py 项目: gpkort/dndai
def make_hit(roll: int):
    return Dice.twenty_sided() > roll
示例#5
0
文件: Utilities.py 项目: gpkort/dndai
def make_goblin(gname: str) -> Monster:
    monster = Monster(name=gname, damage=lambda: Dice.eight_sided(), armour=6, xpvalue=1)
    monster.init_hp(6)
    monster.wallet = Wallet(gold=Dice.eight_sided())
    return monster
示例#6
0
文件: Utilities.py 项目: gpkort/dndai
def create_fighter(name: str) -> Fighter:
    fighter = Fighter(name, pu.roll_attributes(3))
    fighter.backpack.weapons.append(Weapon('sword', 20, lambda: Dice.six_sided(), True))
    fighter.backpack.armors.append(Armor("mail", 10, 5, True))

    return fighter
示例#7
0
文件: Utilities.py 项目: gpkort/dndai
def fighter_initiative(dexterity) -> bool:
    return Dice.twenty_sided() + pu.BONUS_PENALTIES[dexterity] > GOBLIN_INITIATIVE
示例#8
0
 def test_weapon(self):
     weapon = Weapon('sword', 20, lambda: Dice.eight_sided())
     print(str.format('Attack1 = {0}', weapon.get_damage()))
     print(str.format('Attack2 = {0}', weapon.get_damage()))
     self.assertIsNotNone(weapon)