stefan2200 / TWB

Python based bot for Tribal Wars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Farm with loses

hideth opened this issue · comments

Can you make something that will allow to skip attacking barbs with losses? Either array like for an "additional_farms": [], but doing opposite or skip attacking barb with losses for like 3 days?

attack.py

        if cache_entry and not cache_entry["safe"] and not clear:
            self.logger.debug(
                "%s will be ignored for attack because unsafe, set safe:true to override"
                % vid
            )
            return False

manager.py

                       if percentage_lost > 50 and len(num_attack) > 0:
                logger.critical("Farm seems too dangerous/ unprofitable to farm. Setting safe to false!")
                data["safe"] = False
                AttackCache.set_cache(farm, data)

I updated code like this, i hope it will prevent attacking same village if there were any loses. Can you blindly tell if this should work?

Hey is it working? Have you tried it ? @hideth

hey, nope

not sure what to tweak to adjust those farm with loses