Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot treats all pokemon as VIP fix #5494

Merged
merged 5 commits into from
Sep 17, 2016
Merged

Bot treats all pokemon as VIP fix #5494

merged 5 commits into from
Sep 17, 2016

Conversation

Gobberwart
Copy link
Contributor

@Gobberwart Gobberwart commented Sep 17, 2016

Short Description:

Bot treats all pokemon as VIP. Additionally, default rules always return true if not configured. For example:

    "catch": {
      "any": {"catch_above_cp": 500, "catch_above_iv": 0.65, "logic": "or"}
    },

Given example pokemon with cp 30, iv 0.2 and ncp 0.15, the bot would still always catch it because no "catch_above_ncp" rule is defined. This is incorrect behaviour, should return false if no condition matches or condition doesn't exist.

Fixes/Resolves/Closes (please use correct syntax):

@mention-bot
Copy link

@Gobberwart, thanks for your PR! By analyzing the annotation information on this pull request, we identified @DBa2016, @xc-mezcal and @pokepal to be potential reviewers

@Gobberwart
Copy link
Contributor Author

Replaces #5479

If catch_above_cp (or other rule) set to 0, was not returning true.
@julienlavergne
Copy link
Contributor

julienlavergne commented Sep 17, 2016

catch_results are initialized to False. So if the config doesn't have any rule on cp, catch_results["cp"] will be False, right ?
So with logic at and, no Pokemon will get caught, right ?

@@ -44,6 +44,7 @@
'andor': lambda x, y, z: x and y or z
}

DEBUG_ON = False

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably just a small issue, but should we introduce another debug flag here? We already have a debug flag in config now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this flag only applies to this rather than using global debug which generates a lot of garbage

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm ok noted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not unusual. A lot of other code has the same thing. It's actually really handy when debugging a single module.

@Gobberwart
Copy link
Contributor Author

@anakin5 That's correct as it stands... The bot really shouldn't use a rule if it's not defined in config. Let me take a look.

@Gobberwart
Copy link
Contributor Author

Gobberwart commented Sep 17, 2016

@anakin5 I've added some logic to handle different default values based on catch logic. It's mucky but should account for all configurations.

Having said that, the current LOGIC_TO_FUNCTION only works if there are exactly three values. Would be much better if we could only compare what's actually set in config and ignore whatever is not set.

Leaving as-is for now so we can make the bot work properly again.

@Uldiniad
Copy link

please merge these changes to master branch. I have updated every day since these commits but still have this issue on master branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants