Skip to content

Commit

Permalink
fix pangxie bug
Browse files Browse the repository at this point in the history
  • Loading branch information
flick-ai committed Aug 17, 2024
1 parent df5495a commit f0d0755
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
8 changes: 4 additions & 4 deletions genius_invocation/card/character/characters/Beidou.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ class TidecallerSurfEmbrace(Status):
name_ch = "捉浪·涛拥之守"
id = 140521
def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_character: 'Character', Next_Skill: 'CharacterSkill'):
assert self.from_character.character_zone.has_entity(ShieldTidecallerSurfEmbrace) is None
assert from_character.character_zone.has_entity(ShieldTidecallerSurfEmbrace) is None
shield = ShieldTidecallerSurfEmbrace(game, from_player, from_character, self)
self.from_character.character_zone.add_entity(shield) # add shield before the status
from_character.character_zone.add_entity(shield) # add shield before the status

super().__init__(game, from_player, from_character)
self.skill = Next_Skill


def on_call(self, game: 'GeniusGame'):
self.skill.on_call(game)
Expand All @@ -95,7 +95,7 @@ def update_listener_list(self):
self.listeners = [
(EventType.AFTER_CHANGE_CHARACTER, ZoneType.CHARACTER_ZONE, self.after_change)
]

def on_destroy(self, game: 'GeniusGame'):
shield = self.from_character.character_zone.has_entity(ShieldTidecallerSurfEmbrace)
if shield is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ def __init__(self, game:'GeniusGame', from_player: 'GeniusPlayer', from_characte
super().__init__(game, from_player, from_character)
self.current_usage = usage

def copy(self, game: 'GeniusGame'):
return ArmoredCrabCarapace(game, self.from_player, self.from_character, self.current_usage)

def update(self, add_usage=2):
self.current_usage += add_usage

Expand Down Expand Up @@ -221,14 +224,20 @@ def after_any_action(self, game: 'GeniusGame'):
if isinstance(status, Shield) and not isinstance(status, ArmoredCrabCarapace):
add_usage += 1
status.on_destroy(game)
# 方案二: 使用将螃蟹盾移除并继承可用次数
if isinstance(status, Shield) and isinstance(status, ArmoredCrabCarapace):
add_usage += status.current_usage
status.on_destroy(game)
# 检查天赋
if self.talent and add_usage>0:
if self.talent_usage_round != game.round:
self.talent_usage_round = game.round
add_usage += 2
# 更新状态:重置盾的结算顺序至最后
self.from_character.character_zone.add_entity(
ArmoredCrabCarapace(game, self.from_player, self, add_usage), replace_update=True, add_usage=add_usage
# 方案一: 使用replace_update=True
# 方案二: 使用将螃蟹盾移除并继承可用次数
self.character_zone.add_entity(
ArmoredCrabCarapace(game, self.from_player, self, add_usage), replace_update=False, add_usage=add_usage
)

def update_listener_list(self):
Expand Down
4 changes: 2 additions & 2 deletions genius_invocation/game/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ def add_entity(self, entity: 'Status', independent=False, replace_update=False,
self.has_entity(entity.__class__).update(**kwargs)
if replace_update:
old_entity = self.has_entity(entity.__class__)
new_entity = copy.deepcopy(old_entity)
new_entity = old_entity.copy(self.game)
old_entity.on_destroy(self.game)
self.status_list.appendd(new_entity)
self.status_list.append(new_entity)


def clear(self, game:'GeniusGame'):
Expand Down
4 changes: 2 additions & 2 deletions genius_invocation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def code_to_deck(code):
'PaidinFull','PaidinFull','Send_Off','Starsigns','Starsigns']
}
deck2 = {
'character': ['KaedeharaKazuha', 'Xingqiu', 'EmperorofFireandIron'],
'action_card': ['Chef_Mao' for i in range(15)] + ['Sweet_Madame' for _ in range(15)]
'character': ['EmperorofFireandIron', 'Beidou', 'Xingqiu'],
'action_card': ['Lotus_Flower_Crisp' for i in range(30)]
}
# deck2 = {
# 'character': ['Arataki_Itto', 'Dehya', 'Noelle'],
Expand Down

0 comments on commit f0d0755

Please sign in to comment.