yangyuan/hearthrock

Adapt

Closed this issue · 6 comments

Adapt mechanic appear in playOptions in json returned to python script?

Please, explain your question

Adapt came with playoptions and also in the choose field

I'm not sure that you mean about python, example project don't help you?

I'm new to Python language. I'm re-writing the logic for the plays, example putting values to X Card and the script preferring higher value cards for the plays. my script is working fine, but it is not able to select the mechanics to adapt. you have some example of how for example, if the adapt mechanic is the one of 3 Atk always choose it. Note I am using a separate json with the information from cards. hearthstonejson.com, Sorry for bad english.

You can check card name or id for the 3 at in the internet, and return the card rockid

If you are Russian, we can talk on Russian on Skype, or wherever you want to, write me back, I will try to help you

i'm trying to get a constant id (such as ['CardId']) from the rockId of the plays I get from ['PlayOptions'] wherever an Adapt minions is played so I could identify then
Thanks for helping.
Edit your python project help alot . the action of adapt select is a array of 3 values? [Card, Target, ChoosenOption] ?

Lemme show you my part of code with discover and adapt mechanic,

it's look like this on C#

public virtual RockAction Play(RockScene scene)
        {
            if (scene.Self.Choices.Any())
            {
                var rockCard = scene.Self.Choices.FirstOrDefault(c => c.Name == "Lightning Speed");
                if (rockCard != null)
                {
                    return RockAction.Create(new List<int>()
                    {
                        rockCard .RockId
                    });
                 }

                var card = scene.Self.Choices[new Random().Next(0, scene.Self.Choices.Count)];
                return RockAction.Create(new List<int>()
                    {
                        card.RockId
                    });

for python, I think it's look like this:
card name I took from here https://hearthstone.gamepedia.com/Adapt

def create_action(objects):
    action = {'Version': 1, 'Objects': objects, 'Slot': 0}
    return json.dumps(action, ensure_ascii=False).encode('utf8')

def do_play(scene):
    print(scene)
    if len(scene['Self']['Choices']) > 0:
        for card in scene['Self']['Choices']:
             if card['Name'] == 'Flaming Claws':
                  return create_action(card['RockId'])

Thanks for helping.