示例#1
0
    def test_casting(self):
        time = SimulatedTime(20000)
        status = ActionStatus(self.character)
        spell = DamageSpell("Test Spell", 1, 0, 0, 0)

        self.assertFalse(status.is_casting())

        status.set_new_action(spell, time)

        self.assertTrue(status.is_casting())
示例#2
0
    def test_instant_cast_and_auto_shot(self):
        time = SimulatedTime(20000)
        status = ActionStatus(self.character)
        spell = DamageSpell("Test Spell", 0, 0, 0, 0)
        shot = AutoShot(0, 0)

        self.assertFalse(status.is_casting())

        status.set_new_action(shot, time)
        status.action_done(time)

        self.assertFalse(status.is_casting())

        status.set_new_action(spell, time)

        self.assertTrue(status.is_casting())

        time.tick()
        status.update(time)

        self.assertFalse(status.is_casting())

        status.action_done(time)

        status.set_new_action(shot, time)

        self.assertTrue(status.is_casting())
示例#3
0
    def test_auto_shot(self):
        time = SimulatedTime(20000)
        status = ActionStatus(self.character)
        shot = AutoShot(0, 0)

        self.assertFalse(status.is_casting())

        status.set_new_action(shot, time)

        self.assertFalse(status.is_casting())

        status.action_done(time)
        status.set_new_action(shot, time)

        self.assertTrue(status.is_casting())
示例#4
0
    def test_instant_and_cast(self):
        time = SimulatedTime(20000)
        status = ActionStatus(self.character)
        instant_spell = DamageSpell("Test Spell", 0, 0, 0, 0)
        cast_spell = DamageSpell("Test Spell", 500, 0, 0, 0)

        self.assertFalse(status.is_casting())

        status.set_new_action(instant_spell, time)

        self.assertFalse(status.is_casting())

        status.action_done(time)
        status.set_new_action(cast_spell, time)

        self.assertTrue(status.is_casting())

        while time.get_time() < status.globalcd + 500:
            self.assertTrue(status.is_casting())
            time.tick()
            status.update(time)

        # one extra for latency
        time.tick()
        status.update(time)

        self.assertFalse(status.is_casting())

        status.action_done(time)
示例#5
0
    def test_long_spell(self):
        time = SimulatedTime(20000)
        status = ActionStatus(self.character)
        long_spell = DamageSpell("Test Spell", 2000, 0, 0, 0)

        self.assertFalse(status.is_casting())

        status.set_new_action(long_spell, time)

        self.assertTrue(status.is_casting())

        while time.get_time() < 2000:
            self.assertTrue(status.is_casting())
            time.tick()
            status.update(time)

        self.assertFalse(status.is_casting())

        status.action_done(time)