Skip to content

Commit

Permalink
Runnable version (with potential bugs)
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuai-gao committed Jun 25, 2023
1 parent f566526 commit 161ccdc
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 460 deletions.
78 changes: 54 additions & 24 deletions gisim/Status/__init__.py
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)
84 changes: 0 additions & 84 deletions gisim/Status/dendro_reaction.py

This file was deleted.

62 changes: 0 additions & 62 deletions gisim/Status/frozen_effect.py

This file was deleted.

Loading

0 comments on commit 161ccdc

Please sign in to comment.