Sau1707 / ModernBot

A Bot for Grepolis
https://sau1707.github.io/ModernBot/
MIT License
22 stars 14 forks source link

AutoFarm Update #39

Closed Baymax2909 closed 4 months ago

Baymax2909 commented 4 months ago

Changed the way a town is selected to allow farming on an island with multiple towns. Modified the way the farming timer is updated.

Sau1707 commented 4 months ago

Can you explain a bit more in details the "Changed the way a town is selected to allow farming on an island with multiple towns."?

Baymax2909 commented 4 months ago

The logic before my change was:

  1. When starting the AutoFarm, push one town per island into the town list
  2. During looting, iterate over the town list and check for each town, if the maximum % is reached.
  3. Wait -> Generates town list before checking the % and only at the beginning

After my change:

  1. For each looting the town list is newly generated with the following logic:
    • Check for each town, if the maximum % is reached and add all towns, that are below the maximum to a tmp_list
    • Iterate over the tmp_list and add one town per island to the final loot list
  2. Loot the towns in the final loot list -> Generates the town list after checking the % and at each loot iteration

With this change it is now possible that when town 1 on island 1 reached the maximum % the town 2 on island 1 can be the target of looting because we select the town on each loot iteration new.

EDIT: The seconde Iteration over the tmp_list is implemented to allow a future expasion in complexity on select the town for the final loot list. In example it could be possible to randomize selection per island or select it based on ressources in this town.

Sau1707 commented 4 months ago

Ok great Idea, I was already thinking about something similar.

Just a question, if an island has only 1 town and another one has 2, if 1 town is full in both of the islands, the final list would contain only 1 town (the missing one) or still have 1 for each island?

Baymax2909 commented 4 months ago

It will only contain the missing one from the island with 2 towns.

Sau1707 commented 4 months ago

I'll merge this, but in the future we need to think about something better for here. With just the targeted towns, it's easier that the bot get caught

Thanks for the update thought!