forked from yihuai-gao/genius-invokation-gym
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runnable version (with potential bugs)
- Loading branch information
1 parent
f566526
commit 161ccdc
Showing
17 changed files
with
303 additions
and
460 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,28 +1,58 @@ | ||
from ..cards import get_character_status as get_cards_character_status | ||
from ..cards import get_combat_status as get_cards_combat_status | ||
|
||
# Files need to be reorganized | ||
from .dendro_reaction import * | ||
from .frozen_effect import * | ||
from .shield import * | ||
|
||
|
||
def get_combat_status(status_name: str): | ||
status_name = status_name.replace(" ", "").replace("'", "") | ||
if not status_name.endswith("Status"): | ||
status_name += "Status" | ||
if status_name in globals(): | ||
status_class = globals()[status_name] | ||
status: CombatStatusEntity = status_class() | ||
from typing import cast | ||
|
||
### import other status from card files | ||
from gisim.cards import get_character_status as import_cards_character_status | ||
from gisim.cards import get_combat_status as import_cards_combat_status | ||
from gisim.classes.enums import CharPos, ElementType, PlayerID, StatusType | ||
from gisim.classes.status import CharacterStatusEntity, CombatStatusEntity | ||
from gisim.env import INF_INT | ||
|
||
from .reaction_status import * | ||
|
||
### | ||
|
||
|
||
def get_combat_status( | ||
name: str, player_id: PlayerID, position: CharPos, remaining_round: int | ||
): | ||
name = name.replace(" ", "").replace("'", "") | ||
if not name.endswith("Status"): | ||
name += "Status" | ||
if name in globals(): | ||
status_class = globals()[name] | ||
status: CombatStatusEntity = status_class( | ||
player_id=player_id, position=position, remaining_round=remaining_round | ||
) | ||
return status | ||
else: | ||
return get_cards_combat_status(status_name) | ||
return import_cards_combat_status(name, player_id, position, remaining_round) | ||
|
||
|
||
def get_character_status(status_name: str): | ||
status_name = status_name.replace(" ", "").replace("'", "") | ||
if not status_name.endswith("Status"): | ||
status_name += "Status" | ||
status_class = globals()[status_name] | ||
status: CharacterStatusEntity = status_class() | ||
return status | ||
def get_character_status( | ||
name: str, player_id: PlayerID, position: CharPos, remaining_round: int | ||
): | ||
name = name.replace(" ", "") | ||
if not name.endswith("Status"): | ||
name += "Status" | ||
if name.endswith("InfusionStatus"): | ||
elem_char = name.replace("InfusionStatus", "").upper() | ||
element: ElementType = eval(f"ElementType.{elem_char}") | ||
status = ElementalInfusionStatus( | ||
name=name, | ||
player_id=player_id, | ||
position=position, | ||
remaining_round=remaining_round, | ||
element=element, | ||
) | ||
status = cast(CharacterStatusEntity, status) | ||
return status | ||
|
||
if name in globals(): | ||
status_class = globals()[name] | ||
status: CharacterStatusEntity = status_class( | ||
player_id=player_id, position=position, remaining_round=remaining_round | ||
) | ||
return status | ||
|
||
else: | ||
return import_cards_character_status(name, player_id, position, remaining_round) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.