Skip to content

Commit

Permalink
fix game bug
Browse files Browse the repository at this point in the history
  • Loading branch information
flick-ai committed Aug 26, 2024
1 parent 76d82c8 commit 4bd7017
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def on_call(self, game: 'GeniusGame'):
)
game.add_damage(damage)
game.resolve_damage()
self.check_usage()
self.check_usage(game)
game.manager.invoke(EventType.AFTER_USE_SPECIAL, game)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def on_call(self, game: 'GeniusGame'):
card = opponent.hand_zone.card[card_id]
opponent.hand_zone.remove(card_id)
self.from_player.hand_zone.add([card])
self.check_usage()
self.check_usage(game)
game.manager.invoke(EventType.AFTER_USE_SPECIAL, game)

def on_calculate_dice(self, game: 'GeniusGame'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def on_call(self, game: 'GeniusGame'):
prepare_status = PrepareMistBubbleSlimeStatus(game, self.from_character.from_player, self.from_character, Next_Skill)
self.from_character.character_zone.add_entity(prepare_status)
self.from_character.from_player.prepared_skill = prepare_status
self.check_usage()
self.check_usage(game)
game.manager.invoke(EventType.AFTER_USE_SPECIAL, game)

class PrepareMistBubbleSlime(SpecialSkill):
Expand Down
16 changes: 8 additions & 8 deletions genius_invocation/card/character/characters/Layla.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,32 +100,32 @@ def __init__(self, game, from_player: 'GeniusPlayer', from_character: 'Character
self.usage = 4
self.current_usage = 0

def gain_night_star(self, num):
def gain_night_star(self, num, game: 'GeniusGame'):
self.current_usage += num
if self.current_usage>=self.usage:
dmg = Damage.create_damage(
self.game,
game,
damage_type=SkillType.OTHER,
main_damage_element=ElementType.CRYO,
main_damage=1,
piercing_damage=0,
damage_from=self,
damage_to=get_opponent_active_character(self.game),
damage_to=get_opponent_active_character(game),
)
self.game.add_damage(dmg)
self.game.resolve_damage()
game.add_damage(dmg)
game.resolve_damage()
self.current_usage -= self.usage
if self.from_character.talent:
self.from_player.get_card(1)


def update(self):
self.gain_night_star(2)
def update(self, game: 'GeniusGame'):
self.gain_night_star(2, game)


def after_skill(self, game: 'GeniusGame'):
if game.current_skill.from_character.from_player == self.from_player:
self.gain_night_star(1)
self.gain_night_star(1, game)

def update_listener_list(self):
self.listeners = [
Expand Down
2 changes: 1 addition & 1 deletion genius_invocation/card/character/characters/Xianyun.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def on_call(self, game: 'GeniusGame'):
super().on_call(game)
self.from_character.heal(2)
self.begin_invoke = True
self.check_usage()
self.check_usage(game)
game.manager.invoke(EventType.AFTER_USE_SPECIAL, game)

def on_use_skill(self, game: 'GeniusGame'):
Expand Down
4 changes: 2 additions & 2 deletions genius_invocation/entity/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def __init__(self, game: 'GeniusGame', from_player: 'GeniusPlayer', from_charact
super().__init__(game, from_player, from_character)
self.usage = 0

def check_usage(self):
def check_usage(self, game):
self.usage -= 1
if self.usage <= 0:
self.on_destroy(self.game)
self.on_destroy(game)

def update(self, usage=1):
self.usage += usage
Expand Down

0 comments on commit 4bd7017

Please sign in to comment.