Skip to content

Commit

Permalink
Added about half of the uncommon cards. Made allow a non-card source …
Browse files Browse the repository at this point in the history
…of Block.
  • Loading branch information
Vesper-arch committed Mar 26, 2024
1 parent 25d8ecd commit 36b3c83
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 331 deletions.
28 changes: 11 additions & 17 deletions entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ def __init__(
self.player_class: str = "Ironclad"
self.in_combat = False
self.floors = 1
self.fresh_effects: list[
str
] = [] # Shows what effects were applied after the player's turn
self.fresh_effects: list[str] = [] # Shows what effects were applied after the player's turn
self.max_health: int = health
self.energy: int = 0
self.max_energy: int = max_energy
Expand Down Expand Up @@ -104,9 +102,7 @@ def __init__(
self.shuriken_attacks = 0
self.draw_shuffles = 0 # Used for the Sundial relic
self.incense_turns = 0 # Used for the Incense Burner relic
self.girya_charges = (
3 # Stores how many times the player can gain Energy from Girya
)
self.girya_charges = 3 # Stores how many times the player can gain Energy from Girya
self.plays_this_turn = 0 # Counts how many cards the played plays each turn
self.stone_calender = 0
self.choker_cards_played = 0 # Used for the Velvet Choker relic
Expand Down Expand Up @@ -399,11 +395,12 @@ def draw_cards(self, middle_of_turn: bool, draw_cards: int = 0):
# bus.publish(Message.ON_DRAW, (pl))
break

def blocking(self, card: bool = True):
def blocking(self, card: Card = None, block=0):
"""Gains [block] Block. Cards are affected by Dexterity and Frail."""
block = card.block if card else block
bus.publish(Message.BEFORE_BLOCK, (self, card))
self.block += card.block
ansiprint(f"{self.name} gained {card.block} <blue>Block</blue> from {', '.join(card.block_affected_by).lstrip(', ')}.")
self.block += block
ansiprint(f"""{self.name} gained {block} <blue>Block</blue>{f" from {', '.join(card.block_affected_by).lstrip(', ') if card else ''}"}.""") # f-strings my beloved
bus.publish(Message.AFTER_BLOCK, (self, card))

def health_actions(self, heal: int, heal_type: str):
Expand Down Expand Up @@ -490,9 +487,9 @@ def curse_status_effects(self):
if items.cards["Burn"] in self.relics:
self.take_sourceless_dmg(2)

def attack(self, target: "Enemy", card=None, dmg=-1, ignore_block=False):
def attack(self, target: "Enemy", card: Card=None, dmg=-1, ignore_block=False):
# Check if already dead and skip if so
dmg = card.damage if card else dmg
dmg = getattr(card, 'damage', default=None) if card else dmg # noqa: B009
if target.health <= 0:
return
if card is not None and card.type not in (CardType.STATUS, CardType.CURSE):
Expand All @@ -505,9 +502,7 @@ def attack(self, target: "Enemy", card=None, dmg=-1, ignore_block=False):
dmg -= target.block
dmg = max(0, dmg)
target.health -= dmg
ansiprint(
f"You dealt {dmg} damage(<light-blue>{target.block} Blocked</light-blue>) to {target.name} with {' | '.join(card.damage_affected_by)}"
)
ansiprint(f"You dealt {dmg} damage(<light-blue>{target.block} Blocked</light-blue>) to {target.name} with {' | '.join(card.damage_affected_by)}")
target.block = 0
bus.publish(Message.AFTER_ATTACK, (self, target, card))
if target.health <= 0:
Expand Down Expand Up @@ -956,11 +951,10 @@ def attack(self, dmg: int, times: int):
elif dmg > player.block:
dmg -= player.block
dmg = max(0, dmg)
ansiprint(
f"{self.name} dealt {dmg}(<light-blue>{player.block} Blocked</light-blue>) damage to you."
)
ansiprint(f"{self.name} dealt {dmg}(<light-blue>{player.block} Blocked</light-blue>) damage to you.")
player.block = 0
player.health -= dmg
bus.publish(Message.ON_PLAYER_HEALTH_LOSS, None)
bus.publish(Message.AFTER_ATTACK, (self, dmg, player.block))
sleep(1)

Expand Down
Loading

0 comments on commit 36b3c83

Please sign in to comment.