示例#1
0
class TestFight(unittest.TestCase):
    def setUp(self):
        self.hero = Hero(health=100, mana=50,
                         name="Yamamoto", title="Samurai", mana_regeneration_rate=2)
        self.enemy = Enemy(health=100, mana=100, damage=20)
        self.weapon = Weapon.generate(self.hero)
        self.spell = Spell(name="Fireball", damage=30,
                           mana_cost=50, cast_range=2)
        self.hero.learn(self.spell)
        self.hero.equip(self.weapon)

    def test_simple_fight_in_one_cell(self):
        fight = Fight(self.hero, self.enemy)
        self.assertIs(fight.start_fight(), self.hero)

    def test_sipmle_fight_starts_with_weapon(self):
        fight = Fight(self.hero, self.enemy, "spell")
        self.assertIs(fight.start_fight(), self.hero)
        print(self.hero.__dict__)
示例#2
0
'''this is going to be a manual test'''

from src.hero import Hero
from src.enemy import Enemy
from src.spell import Spell
from src.weapon import Weapon
from src.fight import Fight
from src.fight_status_bar import FightStatusBar

h = Hero(name="Genadi", title="Gopnik")

s = Spell(name="Kwass Molotov", damage=5, manaCost=10, castRange=7)
s1 = Spell(name="Magic spit", damage=10, manaCost=25, castRange=2)

w = Weapon(name="Beer Bottle", damage=25)
w1 = Weapon(name="Bat", damage=22)

h.equip(w)
h.learn(s)
h.coordinates = (0, 7)

e = Enemy()

e.learn(s1)
e.equip(w1)
e.coordinates = (0, 0)
"""
f = Fight(h, e,)
f.initialize_fight() """