jleclanche / fireplace

A Hearthstone simulator in Python
https://hearthsim.info
GNU Affero General Public License v3.0
677 stars 151 forks source link

choose one of three RandomCardPicker #483

Closed aharalabMeiji closed 4 years ago

aharalabMeiji commented 4 years ago

Hi. This is the first attempt to talk from Japan. After a player choose one of three RandomCardPicker's, GeneralChoice.choose() discards the remaining two RandomCardPicker's. But it occurs an error that 'RandomCardPicker' object has no attribute 'discard.' I'd like to know whether we are able to fix it?

Thanks for your kindness.

shinoi2 commented 4 years ago

Can you provide a reusable case?

aharalabMeiji commented 4 years ago

Thanks for your reply. I don't know whether its a reusable case, however, it may be thus. There are two cases where the player must choose one of three card , one is that the player chooses one of three concrete cards with names, the other is he/she chooses one of three Random Card Pickers like "RandomCardPicker({'collectible': True, 'card_class': <CardClass.PRIEST: 6>})." I made the following recovery:

      choice = random.choice(player.choice.cards)
      print("Choosing card %r" % (choice))
      if 'RandomCardPicker' in str(choice):
          myCardID =  random.choice(choice.find_cards())
          myCard = Card(myCardID)
          myCard.controller = player#?
          myCard.draw()
          player.choice = None
      else :
          player.choice.choose(choice)

However this is not in the way as such. Thank you for your kindness.

aharalabMeiji commented 4 years ago

This was the case we play 'Kabal Courier' and it deiscovers some cards such as

[fireplace.actions]: Player(name='username', hero=<Hero ('Gul'dan')>) choice from [RandomCardPicker({'collectible': True, 'card_class': <CardClass.MAGE: 4>}), RandomCardPicker({'collectible': True, 'card_class': <CardClass.PRIEST: 6>}), RandomCardPicker({'collectible': True, 'card_class': <CardClass.WARLOCK: 9>})]