Esempio n. 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)
Esempio n. 2
0
 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
Esempio n. 3
0
 def get_saving_throw(self, versus_attack)->bool:
     roll = Dice.twenty_sided()
     return (roll >= Fighter.SAVING_THROWS[versus_attack]), roll
Esempio n. 4
0
def make_hit(roll: int):
    return Dice.twenty_sided() > roll
Esempio n. 5
0
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
Esempio n. 6
0
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
Esempio n. 7
0
def fighter_initiative(dexterity) -> bool:
    return Dice.twenty_sided() + pu.BONUS_PENALTIES[dexterity] > GOBLIN_INITIATIVE
Esempio n. 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)