def test_player_executing_fireIV(self): clock = Clock() player = Player('John', clock) player.receive_buff(buffs.EnochianBuff()) dummy = TargetDummy() self.assertTrue(player.cast('Fire IV', dummy)) self.assertFalse(player.cast('Fire IV', dummy))
def test_skill_apply_buff_after_gcd_casted(self): clock = Clock() player = Player('John', clock) dummy = TargetDummy() player.cast('Blizzard I', dummy) tick_to_complete = Clock(player.skills['Blizzard I'].cast_time).ticks for _ in range(tick_to_complete): clock.tick() self.assertFalse('Umbral Ice' in player.buffs) clock.tick() self.assertTrue('Umbral Ice' in player.buffs)
def test_player_gcd(self): clock = Clock() player = Player('John', clock) dummy = TargetDummy() self.assertTrue(player.cast('Blizzard I', dummy)) self.assertTrue(player.casting) tick_to_complete = Clock(player.skills['Blizzard I'].cast_time).ticks for _ in range(tick_to_complete): clock.tick() self.assertTrue(player.casting) clock.tick() self.assertFalse(player.casting)
def test_observe_damage(self): dummy = TargetDummy() observer = TargetObserver() observer.eyes_on(dummy) for _ in range(10): dummy.take_damage(10) dummy.take_potency(10) self.assertEqual(observer.observe_total_damage_taken(), 100) self.assertEqual(observer.observe_total_potency_taken(), 100)
def test_player_use_swiftcast(self): clock = Clock() player = Player('John', clock) dummy = TargetDummy() self.assertTrue(player.cast('Swiftcast', player)) self.assertTrue(player.casting) tick_to_complete = Clock(player.skills['Swiftcast'].cast_time).ticks self.assertEqual(len(player.buffs), 1) self.assertEqual(player.buffed['cast_time_multiplier'], 0) for _ in range(tick_to_complete): clock.tick() clock.tick() player.cast('Blizzard I', dummy) clock.tick() # trigger cast Blizzard I self.assertFalse('Swiftcast' in player.buffs) self.assertNotEqual(player.buffed['cast_time_multiplier'], 0)
def main(): """ main """ clock = Clock() player = Player('Tomoyo', clock) dummy = TargetDummy() observer = TargetObserver() observer.eyes_on(dummy) rotation = Rotation(['b1', 'Enochian'], ['b1', 'sc', 'b1']) while clock < Time(20): if not player.casting: next_skill = player.skills[rotation.next()] if isinstance(next_skill, skillmeta.GCD): while not player.gcd.is_zero(): clock.tick() player.cast(next_skill.name, dummy) print(f"Total damage: {observer.observe_total_damage_taken()}") else: if next_skill.clock.is_zero(): player.cast(next_skill.name, player) clock.tick()
def test_player_foul_and_polyglot(self): clock = Clock() player = Player('John', clock) dummy = TargetDummy() player.receive_buff(buffs.AstralFireBuff(1)) self.assertTrue(player.cast('Enochian', player)) clock.tick() player.casting_time.set_time(0) self.assertTrue('Polyglot' in player.buffs) self.assertEqual(player.buffs['Polyglot'].charge, 0) self.assertFalse(player.cast('Foul', dummy)) player.buffs['Polyglot'].gain_charge_timer.set_time(0) clock.tick() self.assertEqual(player.buffs['Polyglot'].charge, 1) self.assertTrue(player.cast('Foul', dummy)) clock.tick() tick_to_complete = Clock(player.skills['Foul'].cast_time).ticks for _ in range(tick_to_complete): clock.tick() self.assertEqual(player.buffs['Polyglot'].charge, 0) self.assertTrue('Polyglot' in player.buffs)
def test_dummy_damage_taken(self): dummy = TargetDummy() dummy.take_damage(20) dummy.take_potency(20) self.assertEqual(dummy.damage_taken, 20) self.assertEqual(dummy.potency_taken, 20)