diff --git a/server/match.py b/server/match.py index cfca24ef..dcadfcc1 100644 --- a/server/match.py +++ b/server/match.py @@ -79,7 +79,7 @@ DamageIncreaseValue, DamageMultiplyValue, DamageDecreaseValue, ) from .struct import ( - SkillActionArguments, ObjectPosition, DiceCost + ObjectPosition, DiceCost ) from .elemental_reaction import ( check_elemental_reaction, @@ -1155,28 +1155,11 @@ def _respond_use_skill(self, response: UseSkillResponse): value = cost_value, mode = 'REAL' ) # TODO: should use original value. need test. - skill_action_args = SkillActionArguments( - player_id = response.player_id, - our_active_charactor_id = self.player_tables[ - response.player_id].active_charactor_id, - enemy_active_charactor_id = self.player_tables[ - 1 - response.player_id].active_charactor_id, - our_charactors = [ - i for i, c in enumerate(self.player_tables[ - response.player_id].charactors) - if c.is_alive - ], - enemy_charactors = [ - i for i, c in enumerate(self.player_tables[ - 1 - response.player_id].charactors) - if c.is_alive - ], - ) actions: List[Actions] = [RemoveDiceAction( player_id = response.player_id, dice_ids = response.cost_ids, )] - actions += skill.get_actions(skill_action_args) # TODO add information + actions += skill.get_actions(self) # TODO add information actions.append(SkillEndAction( player_id = response.player_id, charactor_id = request.charactor_id, diff --git a/server/object_base.py b/server/object_base.py index d48feb93..3af9b4bb 100644 --- a/server/object_base.py +++ b/server/object_base.py @@ -19,7 +19,7 @@ ) from .modifiable_values import ModifiableValueTypes, DamageValue from .struct import ( - SkillActionArguments, ObjectPosition, DiceCost, CardActionTarget + ObjectPosition, DiceCost, CardActionTarget ) from .interaction import RequestActionType @@ -96,7 +96,7 @@ def is_valid(self, hp: int, charge: int) -> bool: """ return True - def get_actions(self, args: SkillActionArguments) -> List[Actions]: + def get_actions(self, match: Any) -> List[Actions]: """ The skill is triggered, and get actions of the skill. By default, it will generate three actions: @@ -107,13 +107,13 @@ def get_actions(self, args: SkillActionArguments) -> List[Actions]: """ return [ ChargeAction( - player_id = args.player_id, - charactor_id = args.our_active_charactor_id, + player_id = self.position.player_id, + charactor_id = self.position.charactor_id, charge = 1, ), MakeDamageAction( - player_id = args.player_id, - target_id = 1 - args.player_id, + player_id = self.position.player_id, + target_id = 1 - self.position.player_id, damage_value_list = [ DamageValue( position = self.position, @@ -228,12 +228,12 @@ def is_valid(self, hp: int, charge: int) -> bool: """ return self.charge <= charge - def get_actions(self, args: SkillActionArguments) -> List[Actions]: + def get_actions(self, match: Any) -> List[Actions]: """ When using elemental burst, the charge of the active charactor will be reduced by `self.charge`. """ - actions = super().get_actions(args) + actions = super().get_actions(match) for action in actions: if isinstance(action, ChargeAction): action.charge = -self.charge diff --git a/server/struct.py b/server/struct.py index 3d698283..21e7bd8f 100644 --- a/server/struct.py +++ b/server/struct.py @@ -63,17 +63,6 @@ class DamageValue(BaseModel): target_charactor_id: int = -1 -class SkillActionArguments(BaseModel): - """ - Arguments used in getting skill actions. - """ - player_id: int - our_active_charactor_id: int - enemy_active_charactor_id: int - our_charactors: List[int] - enemy_charactors: List[int] - - class CardActionTarget(BaseModel): """ The target of a card action.