def test_decision_state_can_use_decision_tree(self): simulator = Simulator("solo_vs_goblins") actor = simulator.combatant_by_name('Brutus') decision_state = DecisionState(actor) decision_state.add_action( "thrust_attack", { **ATTACK_DEFAULTS, **{ 'vantage': lambda ds: self.set_message_and_return( "ran", 3) } }) decision_state.set_tactics("thrust_attack") self.messages = [] decision_state.take_turn() self.assertEqual("ran", self.messages[0])
def actor(self): simulator = Simulator(scenario=self.scenarios[0]) return simulator.combatant_by_name(self.actor_name)