def setUp(self): """ Sets up 2 SkillDecisionTrees for use in the test cases. """ self.default_tree = create_default_tree() self.basic_tree = self.create_basic_tree() lines = [ " [3, Caster SP > 20, MageSpecial]", " / \\", "[2, Target HP < 20, RogueAttack] [1, Caster HP < 20, MageAttack]" ] self.basic_tree_format = "\n".join(lines) bq = BattleQueue() self.caster = Rogue("Caster", bq, ManualPlaystyle(bq)) self.target = Rogue("Target", bq, ManualPlaystyle(bq))
def setUp(self): """ Sets up a Restricted Battle Queue for all of the unittests. """ self.battle_queue = RestrictedBattleQueue() playstyle = ManualPlaystyle(self.battle_queue) self.p1 = RogueConstructor("R", self.battle_queue, playstyle) self.p2 = MageConstructor("M", self.battle_queue, playstyle) self.p1.enemy = self.p2 self.p2.enemy = self.p1 self.battle_queue.add(self.p1) self.battle_queue.add(self.p2)
def setUp(self): """ Sets up a Battle Queue containing 2 Vampires for all of the unittests. """ self.battle_queue = BattleQueue() playstyle = ManualPlaystyle(self.battle_queue) self.p1 = VampireConstructor("P1", self.battle_queue, playstyle) self.p2 = VampireConstructor("P2", self.battle_queue, playstyle) self.p1.enemy = self.p2 self.p2.enemy = self.p1 self.battle_queue.add(self.p1) self.battle_queue.add(self.p2)
def setUp(self): """ Sets up a Battle Queue containing 2 a Mage and Rogue for all of the unittests. """ self.battle_queue = BattleQueue() playstyle = ManualPlaystyle(self.battle_queue) self.p1 = RogueConstructor("R", self.battle_queue, playstyle) self.p2 = MageConstructor("M", self.battle_queue, playstyle) self.p1.enemy = self.p2 self.p2.enemy = self.p1 self.battle_queue.add(self.p1) self.battle_queue.add(self.p2) self.minimax_playstyle = Minimax(self.battle_queue)
def setUp(self): """ Sets up a Battle Queue containing 2 Sorcerer for all of the unittests. """ self.battle_queue = BattleQueue() playstyle = ManualPlaystyle(self.battle_queue) self.p1 = SorcererConstructor("P1", self.battle_queue, playstyle) self.p2 = SorcererConstructor("P2", self.battle_queue, playstyle) self.p1.enemy = self.p2 self.p2.enemy = self.p1 self.p1.set_skill_decision_tree(create_default_tree()) self.p2.set_skill_decision_tree(create_default_tree()) self.battle_queue.add(self.p1) self.battle_queue.add(self.p2)
new_battle_queue.add(p1_copy) else: new_battle_queue.add(p2_copy) return new_battle_queue if __name__ == '__main__': # import python_ta # python_ta.check_all(config='a2_pyta.txt') from a2_characters import Mage, Rogue from a2_playstyle import ManualPlaystyle bq = RestrictedBattleQueue() mp = ManualPlaystyle(bq) m = Rogue("M", bq, mp) r = Rogue("R", bq, mp) m.enemy = r r.enemy = m bq.add(m) bq.add(r) bq.add(r) bq.add(m) bq.remove() bq.add(r) bq.remove() bq.add(m) bq.add(m) bq.remove() bq.add(r)