Beispiel #1
0
 def test_social_min_cap(self):
     stats = Stats()
     stats._social = 10
     stats._charisma = 5
     self.assertEqual(10, stats.reduce_social(11))
     self.assertEqual(0, stats._social)
     self.assertEqual(0, stats._charisma)
Beispiel #2
0
 def test_dexterity_base_min_cap(self):
     stats = Stats()
     stats._dexterity_base = 10
     stats._dexterity = 5
     self.assertEqual(10, stats.reduce_dexterity_base(11))
     self.assertEqual(0, stats._dexterity_base)
     self.assertEqual(0, stats._dexterity)
Beispiel #3
0
 def test_physicality_base_reduce(self):
     stats = Stats()
     stats._physicality_base = 10
     stats._physicality = 10
     self.assertEqual(4, stats.reduce_physicality_base(4))
     self.assertEqual(6, stats._physicality_base)
     self.assertEqual(6, stats._physicality)
Beispiel #4
0
 def test_constitution_reduce(self):
     stats = Stats()
     stats._constitution = 5
     stats._health = 5
     self.assertEqual(4, stats.reduce_constitution(4))
     self.assertEqual(1, stats._constitution)
     self.assertEqual(1, stats._health)
Beispiel #5
0
 def test_magic_base_reduce(self):
     stats = Stats()
     stats._magic_base = 10
     stats._mana = 10
     self.assertEqual(4, stats.reduce_magic_base(4))
     self.assertEqual(6, stats._magic_base)
     self.assertEqual(6, stats._mana)
Beispiel #6
0
 def test_magic_base_min_cap(self):
     stats = Stats()
     stats._magic_base = 10
     stats._mana = 10
     self.assertEqual(10, stats.reduce_magic_base(11))
     self.assertEqual(0, stats._magic_base)
     self.assertEqual(0, stats._mana)
Beispiel #7
0
 def test_dexterity_base_reduce(self):
     stats = Stats()
     stats._dexterity_base = 10
     stats._dexterity = 10
     self.assertEqual(4, stats.reduce_dexterity_base(4))
     self.assertEqual(6, stats._dexterity_base)
     self.assertEqual(6, stats._dexterity)
Beispiel #8
0
 def test_social_reduce(self):
     stats = Stats()
     stats._social = 10
     stats._charisma = 10
     self.assertEqual(4, stats.reduce_social(4))
     self.assertEqual(6, stats._social)
     self.assertEqual(6, stats._charisma)
Beispiel #9
0
 def create_stats_instance(self,
                           creature_class: str,
                           stat_values: Dict[str, Union[int, bool]] = None):
     """
     Create a Stats instance.
     :param creature_class: Race of the creature the Stats instance will be used in.
     :param stat_values: Optional stat values. If stat_values are not passed or are None then default values for the
     Creature's race will be used.
     :return: Stats instance.
     """
     if stat_values is None:
         stat_values = const.DEFAULT_CREATURE_STATS[creature_class]
     return Stats(**stat_values)
Beispiel #10
0
 def test_is_not_alive_below_zero(self):
     weapon = Unarmed(base_value=0,
                      dice_quantity=0,
                      dice_max=0,
                      weight=0,
                      value=0)
     creature = Creature(first_name="John",
                         second_name="Doe",
                         stats=Stats(),
                         status=Status(),
                         weapon=weapon)
     creature._stats._health = -1
     self.assertEqual(-1, creature.stats().health())
     self.assertEqual(False, creature.is_alive())
Beispiel #11
0
 def setUp(self) -> None:
     """
     Creates two goblin instances for each test. They both have all stats at 0 and a sword.
     """
     sword = Sword(base_value=0,
                   dice_quantity=0,
                   dice_max=0,
                   weight=0,
                   value=0)
     kwargs = {
         "second_name": "Goblin",
         "stats": Stats(),
         "status": Status(),
         "weapon": sword
     }
     self.attacker = Goblin(first_name="Attacker", **deepcopy(kwargs))
     self.defender = Goblin(first_name="Defender", **deepcopy(kwargs))
Beispiel #12
0
 def test_health_increase(self):
     stats = Stats()
     stats._constitution = 10
     stats._health = 5
     self.assertEqual(2, stats.increase_health(2))
     self.assertEqual(7, stats._health)
Beispiel #13
0
 def test_physicality_min_cap(self):
     stats = Stats()
     stats._physicality = 5
     self.assertEqual(5, stats.reduce_physicality(11))
     self.assertEqual(0, stats._physicality)
Beispiel #14
0
 def test_physicality_base_increase(self):
     stats = Stats()
     stats._physicality_base = 10
     self.assertEqual(6, stats.increase_physicality_base(6))
     self.assertEqual(16, stats.physicality_base())
Beispiel #15
0
 def test_magic_base_increase(self):
     stats = Stats()
     stats._magic_base = 10
     self.assertEqual(6, stats.increase_magic_base(6))
     self.assertEqual(16, stats._magic_base)
Beispiel #16
0
 def test_mana_min_cap(self):
     stats = Stats()
     stats._mana = 5
     self.assertEqual(5, stats.reduce_mana(11))
     self.assertEqual(0, stats._mana)
Beispiel #17
0
 def test_dexterity_base_increase(self):
     stats = Stats()
     stats._dexterity_base = 10
     self.assertEqual(6, stats.increase_dexterity_base(6))
     self.assertEqual(16, stats._dexterity_base)
Beispiel #18
0
 def test_physicality_max_cap(self):
     stats = Stats()
     stats._physicality_base = 10
     stats._physicality = 5
     self.assertEqual(5, stats.increase_physicality(6))
     self.assertEqual(10, stats._physicality)
Beispiel #19
0
 def test_mana_increase(self):
     stats = Stats()
     stats._magic_base = 10
     stats._mana = 5
     self.assertEqual(2, stats.increase_mana(2))
     self.assertEqual(7, stats._mana)
Beispiel #20
0
 def test_constitution_min_cap(self):
     stats = Stats()
     stats._constitution = 5
     self.assertEqual(5, stats.reduce_constitution(6))
     self.assertEqual(0, stats._constitution)
     self.assertEqual(0, stats._health)
Beispiel #21
0
 def test_dexterity_increase(self):
     stats = Stats()
     stats._dexterity_base = 10
     stats._dexterity = 5
     self.assertEqual(2, stats.increase_dexterity(2))
     self.assertEqual(7, stats._dexterity)
Beispiel #22
0
 def test_dexterity_reduce(self):
     stats = Stats()
     stats._dexterity = 5
     self.assertEqual(2, stats.reduce_dexterity(2))
     self.assertEqual(3, stats._dexterity)
Beispiel #23
0
 def test_increase_experience(self):
     stats = Stats()
     stats._experience = 10
     self.assertEqual(5, stats.increase_experience(5))
     self.assertEqual(15, stats._experience)
Beispiel #24
0
 def test_dexterity_max_cap(self):
     stats = Stats()
     stats._dexterity_base = 10
     stats._dexterity = 5
     self.assertEqual(5, stats.increase_dexterity(6))
     self.assertEqual(10, stats._dexterity)
Beispiel #25
0
 def test_dexterity_min_cap(self):
     stats = Stats()
     stats._dexterity = 5
     self.assertEqual(5, stats.reduce_dexterity(11))
     self.assertEqual(0, stats._dexterity)
Beispiel #26
0
 def test_charisma_increase(self):
     stats = Stats()
     stats._social = 10
     stats._charisma = 5
     self.assertEqual(2, stats.increase_charisma(2))
     self.assertEqual(7, stats._charisma)
Beispiel #27
0
 def test_mana_reduce(self):
     stats = Stats()
     stats._mana = 5
     self.assertEqual(2, stats.reduce_mana(2))
     self.assertEqual(3, stats._mana)
Beispiel #28
0
 def test_mana_max_cap(self):
     stats = Stats()
     stats._magic_base = 10
     stats._mana = 5
     self.assertEqual(5, stats.increase_mana(6))
     self.assertEqual(10, stats._mana)
Beispiel #29
0
 def test_constitution_increase(self):
     stats = Stats()
     stats._constitution = 5
     self.assertEqual(6, stats.increase_constitution(6))
     self.assertEqual(11, stats._constitution)
Beispiel #30
0
 def test_health_max_cap(self):
     stats = Stats(constitution=10)
     stats._health = 5
     self.assertEqual(stats.increase_health(6), 5)
     self.assertEqual(10, stats._health)