示例#1
0
 def test_effect_stats(self):
     error = "Physical attack StatusEffect didn't add any physical attack"
     elemental = CombatElementalBuilder().build()
     physical_att_before = elemental.physical_att
     buff = GenericBuff()
     elemental.add_status_effect(buff)
     self.assertGreater(elemental.physical_att, physical_att_before, error)
示例#2
0
 def test_chill_freeze(self):
     error = "Target was not frozen after 5 applications of Chill"
     chill = Chill()
     elemental = CombatElementalBuilder().build()
     for i in range(5):
         elemental.add_status_effect(chill)
     self.assertEqual(elemental.num_status_effects, 2, error)
示例#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)
示例#4
0
 def test_effect_knocked_out(self):
     error = "Status effect wasn't removed when the elemental was knocked out"
     elemental = CombatElementalBuilder().build()
     buff = GenericBuff()
     elemental.add_status_effect(buff)
     elemental.receive_damage(100000, Mock())
     num_effects = elemental.num_status_effects
     self.assertEqual(num_effects, 0, error)
示例#5
0
 def test_dispellable_buff(self):
     error = "A dispellable effect could not be dispelled"
     elemental = CombatElementalBuilder().build()
     buff = GenericBuff()
     elemental.add_status_effect(buff)
     elemental.dispel_all(elemental)
     num_effects = elemental.num_status_effects
     self.assertEqual(num_effects, 0, error)
示例#6
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)
示例#7
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)
示例#8
0
 def test_defend_fade(self):
     error = "Defend didn't fade on round end"
     elemental = CombatElementalBuilder().build()
     defend = DefendEffect()
     elemental.add_status_effect(defend)
     elemental.end_round()
     num_effects = elemental.num_status_effects
     self.assertEqual(num_effects, 0, error)
示例#9
0
 def test_undispellable_buff(self):
     error = "An undispellable effect was incorrectly able to be dispelled"
     elemental = CombatElementalBuilder().build()
     buff = PermaBuff()
     elemental.add_status_effect(buff)
     elemental.dispel_all(elemental)
     num_effects = elemental.num_status_effects
     self.assertEqual(num_effects, 1, error)
示例#10
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)
示例#11
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)
示例#12
0
 def test_provoke_applier_switch(self):
     error = "Provoke didn't clear on opponent changed"
     applier = CombatElementalBuilder().build()
     provoke = ProvokeEffect()
     provoke.applier = applier
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(provoke)
     elemental.on_opponent_changed(applier)
     self.assertEqual(0, elemental.num_status_effects, error)
示例#13
0
 def test_block_damage(self):
     error = "Defend didn't block any damage"
     ability = AbilityBuilder().with_attack_power(10).build()
     target = CombatElementalBuilder().build()
     target.add_status_effect(DefendEffect())
     actor = CombatElementalBuilder().build()
     calculator = DamageCalculator(target, actor, ability)
     calculator.calculate()
     self.assertGreater(calculator.damage_blocked, 0, error)
示例#14
0
 def test_frost_barrier_chill(self):
     error = "Attackers were not chilled by Frost Barrier"
     elemental = CombatElementalBuilder().build()
     frost_barrier = FrostBarrierEffect()
     frost_barrier.applier = elemental
     elemental.add_status_effect(frost_barrier)
     attacker = CombatElementalBuilder().build()
     elemental.on_receive_ability(Claw(), attacker)
     self.assertIsInstance(attacker.status_effects[0], Chill, error)
示例#15
0
 def test_stonehide_duration(self):
     error = "Stonehide didn't fade upon four consecutive attacks"
     elemental = CombatElementalBuilder().build()
     stonehide = StonehideEffect()
     stonehide.applier = elemental
     elemental.add_status_effect(stonehide)
     for i in range(4):
         elemental.receive_damage(1, Mock())
     self.assertEqual(elemental.num_status_effects, 0, error)
示例#16
0
 def test_fireball(self):
     error = "Fireball didn't gain a damage bonus on a burning target"
     ability = Fireball()
     target = CombatElementalBuilder().build()
     target.add_status_effect(Burn())
     actor = CombatElementalBuilder().build()
     calculator = DamageCalculator(target, actor, ability)
     calculator.calculate()
     self.assertGreater(calculator.bonus_multiplier, 1, error)
示例#17
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)
示例#18
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)
示例#19
0
 def test_effect_duration_self(self):
     error = "StatusEffect duration wasn't boosted by 1 when self-applied"
     # The duration decrements on turn end, so it loses 1 duration when applied to self.
     buff = EnrageEffect()
     elemental = CombatElementalBuilder().build()
     buff.applier = elemental
     duration_before = buff.turns_remaining
     elemental.add_status_effect(buff)
     duration_after = buff.turns_remaining
     self.assertEqual(duration_after - duration_before, 1, error)
示例#20
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)
示例#21
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)
示例#22
0
 def test_unstackable_effect(self):
     error = "A !can_add_instances StatusEffect incorrectly added multiple instances"
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(GenericBuff())
     elemental.add_status_effect(GenericBuff())
     self.assertEqual(elemental.num_status_effects, 1, error)
示例#23
0
 def test_reap(self):
     error = "Reap didn't scale with debuffs on the target"
     target = CombatElementalBuilder().build()
     target.add_status_effect(RendEffect())
     bonus = Reap().get_bonus_multiplier(target, Mock())
     self.assertGreater(bonus, 1, error)
示例#24
0
 def test_add_status_effect(self):
     error = "StatusEffect couldn't be added"
     combat_elemental = CombatElementalBuilder().build()
     combat_elemental.add_status_effect(GenericBuff())
     num_effects = combat_elemental.num_status_effects
     self.assertEqual(num_effects, 1, error)
示例#25
0
 def test_chill_state(self):
     error = "A chilled target wasn't flagged as such"
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(Chill())
     self.assertTrue(elemental.is_chilled, error)
示例#26
0
 def test_switch_prevention(self):
     error = "Elemental who has been provoked wasn't flagged as such"
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(ProvokeEffect())
     self.assertFalse(elemental.can_switch, error)
示例#27
0
 def test_freeze_cast_cancel(self):
     error = "Frozen target didn't have its cast cleared"
     elemental = CombatElementalBuilder().build()
     elemental.set_channeling(Rampage())
     elemental.add_status_effect(Freeze())
     self.assertIsNone(elemental.action_queued, error)
示例#28
0
 def test_freeze_state(self):
     error = "Target who was frozen wasn't flagged as such"
     elemental = CombatElementalBuilder().build()
     elemental.add_status_effect(Freeze())
     self.assertTrue(elemental.is_frozen, error)