Skip to content

Commit

Permalink
Add Combust, DarkEmbrace, Evolve, FeelNoPain, FireBreathing, and Flam…
Browse files Browse the repository at this point in the history
…e Barrier effects
  • Loading branch information
miketwo committed Sep 3, 2024
1 parent 961d66f commit 1dfa0db
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 7 deletions.
2 changes: 1 addition & 1 deletion entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def use_card(self, card, exhaust, pile, enemies, target: "Enemy"=None) -> None:
card.apply(origin=self, enemies=enemies)
elif card.target == TargetType.YOURSELF:
card.apply(origin=self)
bus.publish(Message.ON_CARD_PLAY, (self, card, target))
bus.publish(Message.ON_CARD_PLAY, (self, card, target, enemies))
if (card.type == CardType.STATUS and items.relics["Medical Kit"] in self.player.relics):
exhaust = True
elif (card.type == CardType.CURSE and items.relics["Blue Candle"] in self.player.relics):
Expand Down
73 changes: 71 additions & 2 deletions helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def __init__(self, host, amount):

def callback(self, message, data):
if message == Message.ON_CARD_PLAY:
origin, card, target = data
origin, card, target, enemies = data
if card.type == CardType.SKILL:
ei.apply_effect(origin, None, Strength, self.amount)

Expand All @@ -452,7 +452,7 @@ def __init__(self, host, amount):

def callback(self, message, data):
if message == Message.ON_CARD_PLAY:
origin, card, target = data
origin, card, target, enemies = data
if card.type == CardType.SKILL:
# TODO: Exhaust the card
pass
Expand All @@ -463,6 +463,75 @@ class NoDraw(Effect):
def __init__(self, host, _):
super().__init__(host, "No Draw", StackType.NONE, EffectType.DEBUFF, "You may not draw any more cards this turn.")

class Combust(Effect):
registers = [Message.END_OF_TURN]
def __init__(self, host, amount):
super().__init__(host, "Combust", StackType.INTENSITY, EffectType.BUFF, "At the end of your turn, deals X damage to ALL enemies.", amount)

def callback(self, message, data: tuple[Player, list[Enemy]]):
if message == Message.END_OF_TURN:
player, enemies = data
for enemy in enemies:
enemy.health -= self.amount

class DarkEmbrace(Effect):
registers = [Message.ON_EXHAUST]
def __init__(self, target, amount=1):
# "Whenever a card is <keyword>Exhausted</keyword>, draw 1 card
super().__init__(None, name="Dark Embrace", stack_type=StackType.NONE, effect_type=EffectType.BUFF, info="Whenever a card is <keyword>Exhausted</keyword>, draw 1 card.", amount=amount)

def callback(self, message, data: tuple[Player, Card]):
if message == Message.END_OF_TURN:
player, card = data
player.draw_cards(self.amount)

class Evolve(Effect):
registers = [Message.ON_CARD_PLAY]
def __init__(self, host, amount):
super().__init__(host, "Evolve", StackType.NONE, EffectType.BUFF, "Whenever you play a Status or Curse, draw 1 card.", amount)

def callback(self, message, data: tuple[Player, Card, Enemy]):
if message == Message.ON_CARD_PLAY:
origin, card, target, enemies = data
if card.type in (CardType.STATUS, CardType.CURSE):
origin.draw_cards(1)

class FeelNoPain(Effect):
registers = [Message.ON_CARD_PLAY]
def __init__(self, host, amount):
super().__init__(host, "Feel No Pain", StackType.INTENSITY, EffectType.BUFF, "Whenever you play a Skill, gain X <keyword>Block</keyword>.", amount)

def callback(self, message, data):
if message == Message.ON_CARD_PLAY:
origin, card, target, enemies = data
if card.type == CardType.SKILL:
origin.blocking(block=self.amount, context=self.name)

class FireBreathing(Effect):
registers = [Message.ON_CARD_PLAY]
def __init__(self, host, amount):
super().__init__(host, "Fire Breathing", StackType.INTENSITY, EffectType.BUFF, "Whenever you play an Attack, deal X damage to ALL enemies.", amount)

def callback(self, message, data: tuple[Player, Card, Enemy, list[Enemy]]):
if message == Message.ON_CARD_PLAY:
player, card, target, enemies = data
if card.type == CardType.ATTACK:
for enemy in enemies:
enemy.health -= self.amount

class FlameBarrier(Effect):
# "Gain 12 <keyword>Block</keyword>. Whenever you're attacked this turn, deal 4 damage back."
registers = [Message.ON_ATTACKED]

def __init__(self, host, amount):
super().__init__(host, "Flame Barrier", StackType.NONE, EffectType.BUFF, "Gain 12 <keyword>Block</keyword>. Whenever you're attacked this turn, deal 4 damage back.", amount)

def callback(self, message, data):
if message == Message.ON_ATTACKED:
target = data
target.health -= 4


class EffectInterface:
"""Responsible for applying effects, creating buff/debuff dictionaries, and counting down certain effects"""
def __init__(self):
Expand Down
8 changes: 4 additions & 4 deletions items.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,15 +535,15 @@ def apply(self, origin):

class DarkEmbrace(Card):
def __init__(self):
super().__init__("Dark Embrace", "Whenever a card is <keyword>Exhausted</keyword>, draw 1 card.", Rarity.UNCOMMON, PlayerClass.IRONCLAD, CardType.POWER, TargetType.YOURSELF, energy_cost=2)
super().__init__(name="Dark Embrace", info="Whenever a card is <keyword>Exhausted</keyword>, draw 1 card.", rarity=Rarity.UNCOMMON, player_class=PlayerClass.IRONCLAD, card_type=CardType.POWER, target=TargetType.YOURSELF, energy_cost=2)
self.upgrade_preview += f"<light-red>{self.energy_cost} Energy</light-red> -> <light-red><green>1</green> Energy</light-red>"

def upgrade(self):
self.upgrade_markers()
self.energy_cost = 1

def apply(self, origin):
ei.apply_effect(origin, None, "Dark Embrace")
ei.apply_effect(origin, None, "DarkEmbrace")

class Disarm(Card):
def __init__(self):
Expand Down Expand Up @@ -642,7 +642,7 @@ def upgrade(self):
self.info = "Whenever a card is <keyword>Exhausted</keyword>, gain 4 <keyword>Block</keyword>."

def apply(self, origin):
ei.apply_effect(origin, None, "Feel No Pain", self.feel_no_pain)
ei.apply_effect(origin, None, "FeelNoPain", self.feel_no_pain)

class FireBreathing(Card):
def __init__(self):
Expand All @@ -656,7 +656,7 @@ def upgrade(self):
self.info = "Whenever you draw a <status>Status</status> or <curse>Curse</curse> card, deal 10 damage to ALL enemies."

def apply(self, origin):
ei.apply_effect(origin, None, "Fire Breathing", self.fire_breathing)
ei.apply_effect(origin, None, "FireBreathing", self.fire_breathing)

class FlameBarrier(Card):
def __init__(self):
Expand Down

0 comments on commit 1dfa0db

Please sign in to comment.