Esempio n. 1
0
 def test_effect_end(self):
     error = "StatusEffect wasn't removed upon duration end"
     buff = GenericBuff()
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(buff)
     for i in range(buff.turns_remaining):
         elemental.end_turn()
     self.assertEqual(elemental.num_status_effects, 0, error)
Esempio n. 2
0
 def test_defend_duration(self):
     error = "Defend ended prematurely"
     elemental = CombatElementalBuilder().build()
     defend = DefendEffect()
     elemental.add_status_effect(defend)
     elemental.end_turn()
     num_effects = elemental.num_status_effects
     self.assertEqual(num_effects, 1, error)
Esempio n. 3
0
 def test_effect_duration_decrement(self):
     error = "StatusEffect duration didn't decrement on turn end"
     buff = EnrageEffect()
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(buff)
     duration_before = buff.turns_remaining
     elemental.end_turn()
     self.assertLess(buff.turns_remaining, duration_before, error)
Esempio n. 4
0
 def test_perma_buff(self):
     error = "A StatusEffect with no duration could incorrectly be decremented"
     elemental = CombatElementalBuilder().build()
     buff = PermaBuff()
     elemental.add_status_effect(buff)
     duration_before = buff.turns_remaining
     elemental.end_turn()  # Remove the effect via duration end
     duration_after = buff.turns_remaining
     self.assertEqual(duration_after, duration_before, error)
Esempio n. 5
0
 def test_effect_stats_consistency(self):
     error = "Stats gained from a buff incorrectly changed across its duration"
     elemental = CombatElementalBuilder().build()
     buff = GenericBuff()
     elemental.add_status_effect(buff)
     physical_att_before = elemental.physical_att
     elemental.end_turn()  # Remove the effect via duration end
     physical_att_after = elemental.physical_att
     self.assertEqual(physical_att_before, physical_att_after, error)
Esempio n. 6
0
 def test_unstackable_effect_refresh(self):
     error = "A !can_add_instances StatusEffect didn't refresh its effect's duration when reapplied"
     buff = GenericBuff()
     same_buff = GenericBuff()
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(buff)
     duration_before = buff.turns_remaining
     elemental.end_turn()
     elemental.add_status_effect(same_buff)
     self.assertEqual(duration_before, buff.turns_remaining, error)
Esempio n. 7
0
 def test_effect_stats_end(self):
     error = "Stats change persisted even after the effect ended"
     elemental = CombatElementalBuilder().build()
     physical_att_before = elemental.physical_att
     buff = GenericBuff()
     elemental.add_status_effect(buff)
     for i in range(buff.turns_remaining):
         elemental.end_turn()  # Remove the effect via duration end
     physical_att_after = elemental.physical_att
     self.assertEqual(physical_att_before, physical_att_after, error)
Esempio n. 8
0
 def test_stonehide_debuff_duration(self):
     error = "Stonehide charge didn't decrement upon receiving damage from a debuff"
     elemental = CombatElementalBuilder().build()
     stonehide = StonehideEffect()
     stonehide.applier = elemental
     elemental.add_status_effect(stonehide)
     rend = RendEffect()
     rend.applier = CombatElementalBuilder().build()
     elemental.add_status_effect(rend)
     elemental.end_turn()
     self.assertEqual(stonehide.charges, 3, error)
Esempio n. 9
0
 def test_enrage(self):
     error = "Enrage didn't increase damage output"
     elemental = CombatElementalBuilder().build()
     combat = get_mocked_combat()
     combat.get_target = MagicMock(
         return_value=CombatElementalBuilder().build())
     before_buff = ElementalAction(elemental, Claw(), combat)
     before_buff._refresh_target()
     before_buff.execute()
     elemental.add_status_effect(EnrageEffect())
     elemental.end_turn()
     after_buff = ElementalAction(elemental, Claw(), combat)
     after_buff._refresh_target()
     after_buff.execute()
     self.assertGreater(after_buff.final_damage, before_buff.final_damage,
                        error)