def use_card(self, card: Card): for c in self._hand: # matching card type if c.card_id() == card.card_id(): self._hand.remove(c) self.modify_mana(-card.cost()) if self._currentMana < 0: raise InsufficientManaException(card) self.modify_health(card.my_health_change()) self._nextTurnDraw += card.card_draw()
def from_hand(self, card: Card): for c in self._hand: if c.card_id() == card.card_id(): return c assert False