-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
also fix bug in charactor defeated.
- Loading branch information
Showing
6 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from .others import OtherEventCards | ||
from .arcane_legend import ArcaneLegendCards | ||
from .resonance import NationResonanceCards | ||
|
||
|
||
EventCards = OtherEventCards | ArcaneLegendCards | ||
EventCards = OtherEventCards | ArcaneLegendCards | NationResonanceCards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
|
||
from typing import Any, List, Literal | ||
from server.action import CreateObjectAction | ||
from ...consts import ObjectPositionType | ||
|
||
from server.struct import ObjectPosition | ||
from ...object_base import CardBase | ||
from ...struct import Cost | ||
|
||
|
||
class ElementalResonanceCardBase(CardBase): | ||
... # pragma: no cover | ||
|
||
|
||
class NationResonanceCardBase(CardBase): | ||
pass | ||
|
||
|
||
class WindAndFreedom(NationResonanceCardBase): | ||
name: Literal['Wind and Freedom'] | ||
desc: str = ( | ||
'In this Round, when an opposing character is defeated during your ' | ||
'Action, you can continue to act again when that Action ends. ' | ||
'Usage(s): 1 ' | ||
'(You must have at least 2 Mondstadt characters in your deck to add ' | ||
'this card to your deck.)' | ||
) | ||
version: Literal['3.7'] = '3.7' | ||
cost: Cost = Cost(same_dice_number = 1) | ||
|
||
def get_targets(self, match: Any) -> List[ObjectPosition]: | ||
return [] | ||
|
||
def get_actions( | ||
self, target: ObjectPosition | None, match: Any | ||
) -> List[CreateObjectAction]: | ||
""" | ||
Create Wind and Freedom team status. | ||
""" | ||
assert target is None | ||
return [CreateObjectAction( | ||
object_name = 'Wind and Freedom', | ||
object_position = ObjectPosition( | ||
player_idx = self.position.player_idx, | ||
area = ObjectPositionType.TEAM_STATUS, | ||
id = -1, | ||
), | ||
object_arguments = {}, | ||
)] | ||
|
||
|
||
NationResonanceCards = WindAndFreedom | WindAndFreedom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
from .system import SystemTeamStatus | ||
from .hydro_charactors import HydroCharactorTeamStatus | ||
from .dendro_charactors import DendroTeamStatus | ||
from .event_cards import EventCardTeamStatus | ||
|
||
from .old_version import OldVersionTeamStatus | ||
|
||
|
||
TeamStatus = ( | ||
SystemTeamStatus | HydroCharactorTeamStatus | DendroTeamStatus | ||
| EventCardTeamStatus | ||
# finally, old version status | ||
| OldVersionTeamStatus | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
|
||
|
||
from typing import Any, Literal, List | ||
|
||
from ...action import Actions, RemoveObjectAction | ||
|
||
from ...event import ( | ||
CharactorDefeatedEventArguments, CombatActionEventArguments | ||
) | ||
|
||
from ...modifiable_values import CombatActionValue | ||
from .base import RoundTeamStatus | ||
|
||
|
||
class WindAndFreedom(RoundTeamStatus): | ||
name: Literal['Wind and Freedom'] = 'Wind and Freedom' | ||
desc: str = ( | ||
'In this Round, when an opposing character is defeated during your ' | ||
'Action, you can continue to act again when that Action ends. ' | ||
'Usage(s): 1 ' | ||
) | ||
version: Literal['3.7'] = '3.7' | ||
usage: int = 1 | ||
max_usage: int = 1 | ||
activated: bool = False | ||
|
||
def event_handler_CHARACTOR_DEFEATED( | ||
self, event: CharactorDefeatedEventArguments, match: Any | ||
) -> List[Actions]: | ||
""" | ||
When an enemy charactor is defeated, mark activated. | ||
""" | ||
if (self.position.player_idx != event.action.player_idx): | ||
# enemy defeated, mark activated. | ||
self.activated = True | ||
return [] | ||
|
||
def value_modifier_COMBAT_ACTION( | ||
self, value: CombatActionValue, match: Any, | ||
mode: Literal['TEST', 'REAL'] | ||
) -> CombatActionValue: | ||
""" | ||
When enemy charactor defeated, | ||
""" | ||
if not self.activated: | ||
# not activated, do nothing | ||
return value | ||
assert self.usage > 0 | ||
assert self.position.check_position_valid( | ||
value.position, match, player_idx_same = True, | ||
) | ||
# combat action end from self, if combat action, change to quick. | ||
if value.do_combat_action: | ||
value.do_combat_action = False | ||
self.usage -= 1 | ||
else: | ||
# Mona + Kaeya may trigger | ||
raise NotImplementedError('Not tested part') | ||
return value | ||
|
||
def event_handler_COMBAT_ACTION( | ||
self, event: CombatActionEventArguments, match: Any | ||
) -> List[RemoveObjectAction]: | ||
""" | ||
When combat action end, check whether to remove. | ||
""" | ||
return self.check_should_remove() | ||
|
||
|
||
EventCardTeamStatus = WindAndFreedom | WindAndFreedom |