diff --git a/clash_royale/envs/game_engine/game_engine.py b/clash_royale/envs/game_engine/game_engine.py index fba2054..9b8d0ea 100644 --- a/clash_royale/envs/game_engine/game_engine.py +++ b/clash_royale/envs/game_engine/game_engine.py @@ -138,7 +138,7 @@ def legal_actions(self, player_id: int) -> npt.NDArray[np.float64]: """ actions = np.zeros(shape=(32, 18, 4), dtype=np.float64) - hand: List[Card] + hand: List[int] if player_id == 0: hand = self.player1.get_pseudo_legal_cards() else: diff --git a/clash_royale/envs/game_engine/player.py b/clash_royale/envs/game_engine/player.py index 9e669b8..a897db7 100644 --- a/clash_royale/envs/game_engine/player.py +++ b/clash_royale/envs/game_engine/player.py @@ -21,7 +21,7 @@ def __init__(self, specifying the cards' names in the deck. """ - self.elixir: int = 0 + self.elixir: float = 0 self.fps: int = fps random.shuffle(deck) @@ -40,16 +40,16 @@ def reset(self, elixir: int = 5) -> None: self.elixir: float = elixir - def get_pseudo_legal_cards(self) -> List[Card]: + def get_pseudo_legal_cards(self) -> List[int]: """ This method is used to get all cards that can be played given the current amount of elixir. """ - legal_cards: list[Card] = [] - for card in self.hand: - if card.elixir <= self.elixir: - legal_cards.append(card) + legal_cards: list[int] = [] + for card_index in len(self.hand): + if self.hand[card_index].elixir <= self.elixir: + legal_cards.append(card_index) return legal_cards