Skip to content

Commit

Permalink
fix 5.0 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
flick-ai committed Aug 26, 2024
1 parent 763c0c2 commit e4e69b2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
34 changes: 21 additions & 13 deletions genius_invocation/card/character/characters/KaedeharaKazuha.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ def __init__(self, from_character: 'Character'):

def on_call(self, game: 'GeniusGame'):
super().on_call(game)


self.resolve_damage(game)

self.gain_energy(game)
game.manager.invoke(EventType.AFTER_USE_SKILL, game)

class SpecialAttack(Garyuu_Bladework):
def on_call(self, game: 'GeniusGame'):
super().on_call(game)
self.from_character.from_player.prepared_skill = None


class Chihayaburu(ElementalSkill):
name = 'Chihayaburu'
Expand Down Expand Up @@ -64,6 +66,7 @@ def add_status(self, game: 'GeniusGame'):
assert self.from_character.character_zone.has_entity(Midare_Ranzan) is None
status = Midare_Ranzan(game, self.from_character.from_player, self.from_character, self.from_character.last_swirl)
self.from_character.character_zone.add_entity(status)
self.from_character.from_player.prepared_skill = status

def on_call(self, game: 'GeniusGame'):
super().on_call(game)
Expand Down Expand Up @@ -118,6 +121,7 @@ def __init__(self, game:'GeniusGame', from_player: 'GeniusPlayer', from_characte
self.element = ElementType.ANEMO
else:
self.element = element
self.prepared_skill = SpecialAttack(from_character)
self.usage = 1
self.current_usage = 1

Expand All @@ -128,21 +132,25 @@ def on_change_character(self, game:'GeniusGame'):

def infusion(self, game:'GeniusGame'):
if game.current_damage.damage_from == self.from_character:
if game.current_damage.is_plunging_attack:
if game.current_damage.damage_type == SkillType.NORMAL_ATTACK:
game.current_damage.main_damage_element = self.element

def before_any_action(self, game:'GeniusGame'):
if self.from_character.is_active:
skill = self.from_character.skills[0]
skill.before_use_skill(game)
skill.on_call(game)
if not get_opponent(game).is_pass:
game.change_active_player()
self.on_destroy(game)
# def before_any_action(self, game:'GeniusGame'):
# if self.from_character.is_active:
# skill = self.from_character.skills[0]
# skill.before_use_skill(game)
# skill.on_call(game)
# if not get_opponent(game).is_pass:
# game.change_active_player()
# self.on_destroy(game)

def on_call(self, game:'GeniusGame'):
self.prepared_skill.on_call(game)
self.on_destroy(game)

def update_listener_list(self):
self.listeners = [
(EventType.BEFORE_ANY_ACTION, ZoneType.CHARACTER_ZONE, self.before_any_action),
# (EventType.BEFORE_ANY_ACTION, ZoneType.CHARACTER_ZONE, self.before_any_action),
(EventType.INFUSION, ZoneType.CHARACTER_ZONE, self.infusion),
(EventType.AFTER_CHANGE_CHARACTER, ZoneType.CHARACTER_ZONE, self.on_change_character)
]
Expand Down
16 changes: 11 additions & 5 deletions genius_invocation/game/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,17 @@ def change_to_id(self, idx: int, type: SwitchType=SwitchType.SPECIAL_SWICH):
'''
基本行动: 切换到指定人
'''
assert self.active_idx in range(self.character_num)
self.game.current_switch = Switch(from_player=self.character_list[self.active_idx],
to_player=self.character_list[idx],
swicth_type=type)
self.game.manager.invoke(EventType.ON_CHANGE_CHARACTER, self.game)
if self.active_idx in range(self.character_num):
self.game.current_switch = Switch(from_character=self.character_list[self.active_idx],
to_character=self.character_list[idx],
swicth_type=type)
self.game.manager.invoke(EventType.ON_CHANGE_CHARACTER, self.game)
else:
self.game.current_switch = Switch(from_character=None,
to_character=self.character_list[idx],
swicth_type=type)
self.game.manager.invoke(EventType.ON_CHANGE_CHARACTER, self.game)


if self.game.current_switch != None:
if self.active_idx >= 0:
Expand Down
2 changes: 1 addition & 1 deletion genius_invocation/game/zone.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

class Switch:
def __init__(self, from_character, to_character, swicth_type) -> None:
self.from_player = from_character.from_player
self.from_player = to_character.from_player
self.from_character = from_character
self.to_character = to_character
self.type = swicth_type
Expand Down
2 changes: 1 addition & 1 deletion genius_invocation/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def code_to_deck(code):
'PaidinFull','PaidinFull','Send_Off','Starsigns','Starsigns']
}
deck2 = {
'character': ['Barbara', 'Beidou', 'Xingqiu'],
'character': ['Barbara', 'Beidou', 'KaedeharaKazuha'],
'action_card': ['Koholasaurus' for i in range(15)] + \
['Yumkasaurus' for i in range(15)]
}
Expand Down
9 changes: 5 additions & 4 deletions genius_invocation/user_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ def get_character(player: 'GeniusPlayer', idx: int):
str(character_list[idx].power),
style=color,
)
sponsor_message.add_row(
character_list[idx].character_zone.special_skill.show() if character_list[idx].character_zone.special_skill != None else "No Special Skill",
style=color,
)

if character_list[idx].character_zone.weapon_card != None:
sponsor_message.add_row(
Expand All @@ -125,6 +121,11 @@ def get_character(player: 'GeniusPlayer', idx: int):
f"Has Talent",
style=color,
)
if character_list[idx].character_zone.special_skill != None:
sponsor_message.add_row(
character_list[idx].character_zone.special_skill.show(),
style=color,
)
for status in character_list[idx].character_zone.status_list:
if isinstance(status, Shield):
col = 'yellow'
Expand Down

0 comments on commit e4e69b2

Please sign in to comment.