Maruno17 / pokemon-essentials

A heavily modified RPG Maker XP game project that makes the game play like a Pokémon game. Not a full project in itself; this repo is to be added into an existing RMXP game project.
Other
208 stars 398 forks source link

Skill Flag "AntiConsiderSwitching" does not work as intended for High & Best Skill Trainers #229

Open Beebleborx opened 1 week ago

Beebleborx commented 1 week ago

(I found a bug detailed below. It may sound explanatory but my intent is to provide sufficient information for you to fix the bug, not to explain the code to you since I'm sure you know it much better than I.)

AI_ChooseMove lines 342-356 check if an AI is High (or Best) skill, then checks if they want to switch out due to terrible moves, and then if so, calls pbChooseToSwitchOut(true).

pbChooseToSwitchOut in AI_Switch takes true or false as input, and if no input is given, sets "terrible_moves" to false. Since it is given "true" when it is called in AI_ChooseMove, it sets "terrible_moves" to true.

Further down, pbChooseToSwitchOut/AI_Switch line 24 checks if "terrible_moves" is true or false. If true (which it is as established above), it logs a message in the debug log and skips over the "else" condition, which is where the "return false if !@trainer.has_skill_flag?("ConsiderSwitching")" line is.

In this manner, any trainer with skill >=48 would bypass the "AntiConsiderSwitching" check. I've resolved this in my game by moving the "return false if !@trainer.has_skill_flag?("ConsiderSwitching")" line up above the "if terrible_moves" check, but I'm not sure about the remainder of the else criteria that gets skipped for the High & Best skill AI's. Something to be looked into for the next hotfixes, or next version of Essentials perhaps?