コード例 #1
0
 def test_find_neutral(self):
     error = "Should have found a neutral elemental given a list"
     elementals = [
         ElementalBuilder().with_element(Elements.LIGHT).build(),
         ElementalBuilder().with_element(Elements.EARTH).build(),
         ElementalBuilder().with_element(Elements.WIND).build()
     ]
     result = Effectiveness.find_effective(elementals, Elements.FIRE)
     self.assertEqual(len(result), 1, error)
コード例 #2
0
ファイル: combat_ai.py プロジェクト: Hammerlord/Monbot
    def switch(self) -> None:
        if not self.team.eligible_bench:
            return

        effective_elementals = Effectiveness.find_effective(self.team.eligible_bench,
                                                            self.combat.get_active_enemy(self.team).element)
        if effective_elementals:
            self.team.attempt_switch(effective_elementals[0])
            return

        neutral_elementals = Effectiveness.find_neutral(self.team.eligible_bench,
                                                        self.combat.get_active_enemy(self.team).element)
        if neutral_elementals:
            self.team.attempt_switch(neutral_elementals[0])
            return

        self.team.attempt_switch(self.roll(self.team.eligible_bench))