Deopster / Mercenaries-Hearthstone-game-bot

bot for hearthstone mercenaries mode
Apache License 2.0
57 stars 15 forks source link

Second run #15

Open asakurato opened 3 years ago

asakurato commented 3 years ago

So, I know that finishok button is bugged right now, but if you move the mouse, the bot continues like normal. Except, when it starts the loop again, it gets stuck in the level selection menu. I have selected level 5 heroic in Barrens, but after the first run, bot gets stuck in the loop, just looking for "fir" and "ser" buttons and clicking them nonstop, resulting in an infinite loop. Relaunching the bot makes it continue like normal. This is on 1920x1080 res. Edit: Looks like the problem is that the bot can't select the level that is already selected. The log says it can't find the level button, level 5 in my case.

Efemache commented 3 years ago

Hi, I had the same problem with some levels. It's related to the image used which show too much thing. When the level is already selected, the blue halo isn't find on the picture. It's easy to get it right :

Or You can use the branch "ForDeveloppement" (from the actual repo) which is newer (I put a lot of code which is not in "main")

My fork : https://github.com/Efemache/Mercenaries-Hearthstone-game-bot ('ill create a new branch like "improvement" for next commits) I'll be back on this repo when Deopster will be available.

[Edit][new-url] https://github.com/Efemache/Mercenaries-Farm-bot

Efemache commented 3 years ago

Better support for The Barrens and Felwood (normal and heroic) added : https://github.com/Efemache/Mercenaries-Hearthstone-game-bot/tree/improve2 [Edit][new-url] https://github.com/Efemache/Mercenaries-Farm-bot

asakurato commented 3 years ago

So, I tried your version, but it seems to be stuck on prize selection. When I look at cmd window, it seems to fail to find "presents" in UI_ellements. Granted, I'm trying Level 5 heroic from barrens, and only "presents" picture has 4 presents in them, so it probably fails because of that. I could try farming default level 27 felwood, but the bot is definitely not ready to for high-level bounties, because 1. The logic behind it lacks, often resulting in bad decisions, which results in a loss. 2. Most of the time, bot can't use moves (usually it's the middle one, in my case Samuro).

All I'm saying, that the bot is still not ready.

Efemache commented 3 years ago

Hi, I use the bot at level 27 (with only 3 heroes at level 30) and it beats the boss most of the time. But you're right, the bot is not ready for each Heroes. It doesn't have any logic except "turn 1, do this; turn 2, do this" for some heroes and for others it's only "use the first button". And I think we are far far far away from this point.

There is a lot of bugs (i'm trying to solve them and each day I find new ones). So I'm trying to solve these bugs before to go for new features.

I'll try to look at this bug you're talking. The "present" image isn't needed.

asakurato commented 3 years ago

Hi, I use the bot at level 27 (with only 3 heroes at level 30) and it beats the boss most of the time. But you're right, the bot is not ready for each Heroes. It doesn't have any logic except "turn 1, do this; turn 2, do this" for some heroes and for others it's only "use the first button". And I think we are far far far away from this point.

There is a lot of bugs (i'm trying to solve them and each day I find new ones). So I'm trying to solve these bugs before to go for new features.

I'll try to look at this bug you're talking. The "present" image isn't needed.

Honestly, even just working bot without logic and just using 1 button would be fine to farm low level bounties for coins.

Efemache commented 3 years ago

Hello,

That's fine now : https://github.com/Efemache/Mercenaries-Hearthstone-game-bot/tree/improve2 [Edit][new-url] https://github.com/Efemache/Mercenaries-Farm-bot I did a lot of tests with Barrens/heroic/level5 and Felwood/normal/level27 and it's working.

I changed a lot of code (not related to your bug) so I couldn't test everything (like Boon, Mysterious Encounter, group creation,...) but for rewards, battle, treasure, level selection, ... everything is fine. With the previous code, bot was getting stuck a lot of time on the "road" (battle / encounter selection). With my 5-6 runs with this new code, I had 0 problem.

ps : I support only 1920x1080 and English language (for now)

asakurato commented 3 years ago

Tried it again. Now it did choose all the rewards, but after that, it went to the main menu and kept looking for back button and pressing it, resulting in loop.

Efemache commented 3 years ago

Tried it again. Now it did choose all the rewards, but after that, it went to the main menu and kept looking for back button and pressing it, resulting in loop.

Hi, Yes I saw it and it's already fixed in a new version.

asakurato commented 3 years ago

ok, I think it works now. The remaining problem I have is, sometimes bot doesn't use on of my heroes (I run Xyrella, Samuro and Cariele). I think it's because it tries to use second ability, but Samuro has that ability on cooldown.

Efemache commented 3 years ago

ok, I think it works now. The remaining problem I have is, sometimes bot doesn't use on of my heroes (I run Xyrella, Samuro and Cariele). I think it's because it tries to use second ability, but Samuro has that ability on cooldown.

It's weird, the bot only uses 2 (or 3) abilities for 3 heroes. For the other ones, it only uses the first ability. So for Samuro, it should use the first one.

I remember, I already saw the bot to doesn't use one of my hero. It's from the previous code. I didn't touch this part for now (I already had a lot of things to make it work for full run and loop) On this part, I only worked on two bugs :

You can open a new bug; We'll see if somebody can look at it. I already changed a lot of code and made it easier (to read and modify), so I would like to work on this part for now.

I'll look into battle code latter.

asakurato commented 3 years ago

Looks like I still can't get consistent second runs. I have two thing happening:

  1. The bot is either going back to main menu (reason unknown)
  2. The bot is works well until it goes to boss selection, but it gets stuck, because it keeps searching for "Botwork" party name, instead of choosing the boss.
Efemache commented 3 years ago

Looks like I still can't get consistent second runs. I have two thing happening:

  1. The bot is either going back to main menu (reason unknown)
  2. The bot is works well until it goes to boss selection, but it gets stuck, because it keeps searching for "Botwork" party name, instead of choosing the boss.

Hi, Yes I just found this one this morning. I thing it's related to "tempo" (time.sleep()). If I bring a quick patch, we'll find another one. I need more time to test / change how the bot is waiting and how long.

Efemache commented 3 years ago

I pushed a quick/dirty patch but not tested. I'll do better later.

Efemache commented 3 years ago

A new version is available. I tested it with 3 runs and it works well. I added new features, more information here : https://github.com/Deopster/Mercenaries-Hearthstone-game-bot/issues/40#issuecomment-976008622

asakurato commented 3 years ago

I'll test it today, thanks.

Efemache commented 3 years ago

Sometimes the second run doesn't start and I know why. When the "mercenaries menu" (where you can choose to see tasks, go to battle, see your mercenaries, etc...) is loaded, it takes some seconds before to be clickable. I think you can add after line 954 a time.sleep(3) (or more if you want). It should be someting like this : waitForItOrPass(chekers[21], 6) # chekers 21: 'menu' time.sleep(3) travelToLevel()

Try different values (3, 4, 5, 6 ...). I'll change the code so the bot can resume wherever it is.

Efemache commented 3 years ago

@asakurato since you are the only one to ask / answer :) , do you need the feature to (auto) create group ? I think it's unnecessary, so maybe I'll delete this from a future version to make the file smaller and delete unwanted/unnecessary code.

asakurato commented 3 years ago

@asakurato since you are the only one to ask / answer :) , do you need the feature to (auto) create group ? I think it's unnecessary, so maybe I'll delete this from a future version to make the file smaller and delete unwanted/unnecessary code.

Actually no, I don't need it, I mainly want the bot to farm coins, not level up.

Efemache commented 3 years ago

Hi, I decide to start a "new" project : https://github.com/Efemache/Mercenaries-Farm-bot I continued with my fork and I decided to create a new project because :

Efemache commented 3 years ago

fixed here : https://github.com/Efemache/Mercenaries-Farm-bot

asakurato commented 3 years ago

That's what I would like, I guess we continue there.