Skip to content

Commit

Permalink
added elixir cost for template
Browse files Browse the repository at this point in the history
  • Loading branch information
lunathanael committed Mar 12, 2024
1 parent dea1078 commit 18e8a10
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion clash_royale/envs/game_engine/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Card():
This class is created for Player class to refer to statistics of cards.
'''

def __init__(self, elixir: int) -> None:
def __init__(self, elixir: int, elixir_cost: int) -> None:
self.elixir: int = elixir
self.elixir_cost: int = elixir_cost
pass
10 changes: 4 additions & 6 deletions clash_royale/envs/game_engine/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,17 @@ def pop(self, card_index: int) -> None:

self.deck.put(self.hand[card_index], block = False)
self.hand[card_index] = self.next
self.next: Card = self.deck.get(block = False)

self.next = self.deck.get(block = False)

def play_card(self, card_index: int) -> None:

"""
Called with the index of cards in hand to update the state of available cards, next cards, and elixir.
Called with the index of cards in hand to update the state of
available cards, next cards, and elixir.
Should be called with the initial rendering of entity.
"""

assert(card_index < 4)
assert card_index >= 0 and card_index < 4
elixir_cost: float = self.hand[card_index].elixir_cost
assert(elixir_cost <= self.elixir)
self.pop(card_index)
Expand Down

0 comments on commit 18e8a10

Please sign in to comment.