def _side_start(self, side, condition): if side[:2] == self._player_role: conditions = self.side_conditions else: conditions = self.opponent_side_conditions condition = SideCondition.from_showdown_message(condition) conditions.add(condition)
def _side_start(self, side, condition): if side[:2] == self._player_role: conditions = self.side_conditions else: conditions = self.opponent_side_conditions condition = SideCondition.from_showdown_message(condition) if condition not in conditions: conditions[condition] = self.turn
def _side_end(self, side, condition): if side[:2] == self._player_role: conditions = self.side_conditions else: conditions = self.opponent_side_conditions condition = SideCondition.from_showdown_message(condition) if condition is not SideCondition._UNKNOWN: conditions.pop(condition)
def _side_start(self, side, condition): if side[:2] == self._player_role: conditions = self.side_conditions else: conditions = self.opponent_side_conditions try: condition = SideCondition.from_showdown_message(condition) conditions.add(condition) except Exception: self.logger.warning("Condition %s unknown", condition)
def _side_start(self, side, condition): if side[:2] == self._player_role: conditions = self.side_conditions else: conditions = self.opponent_side_conditions condition = SideCondition.from_showdown_message(condition) if condition in STACKABLE_CONDITIONS: conditions[condition] = conditions.get(condition, 0) + 1 elif condition not in conditions: conditions[condition] = self.turn
def test_side_condition_build(): assert SideCondition["SPIKES"] == SideCondition.from_showdown_message( "spikes") assert SideCondition["_UNKNOWN"] == SideCondition.from_showdown_message( "whatever")