farkam135 / GoIV

https://www.reddit.com/r/goiv
Other
372 stars 138 forks source link

Support for changing scan areas for Lucky Pokemon #961

Closed FoxFireX closed 6 years ago

FoxFireX commented 6 years ago

Added an alternate version of the region scan computation which can offset vertically for lucky pokemon. Retained the existing signature for backward compatibility, as well as for use in fields unaffected by lucky status. When the first scannable area that would be affected by Lucky is encountered, if no result is returned, it will retry with the lucky offset; if this returns a value, the pokemon is assumed to be lucky, and further scans below the line will be similarly offset. Using an offset of 120% of the power up candy scan height, just as a "feels right" value. Needs testing against other devices. Works spot on for Pixel.

thearaks commented 6 years ago

Hi @FoxFireX! Looks good to me! I'll try to test it ASAP on my phones. Have you checked if something bad happens if a ScanArea gets pushed too much to the bottom and gets out of the Bitmap? (is it even possible?) There's a checkstyle issue, could you fix that?

FoxFireX commented 6 years ago

@thearaks Was trying to find where the checkstyle issue is reported; can you help me track it down? As for the scan area dropping too low, I hadn't considered that initially, but then looked into it after your comment. The getImageCrop method actually sanity checks that the areas are within the bounds of the screen image, and if not looks like it sends an exception/debug message through Timber (which I'm not familiar with) before returning null. I believe it should be safe.

thearaks commented 6 years ago

Thank you @FoxFireX for your check! I remember something like that but your double-check reassured me. I'll try to take a look to the checkstyle later to see what's wrong! Thank you!