-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Unlike moves, passive effects like abilities and held items do not seem to have a specific piece of code that implements them. Instead, they are just flags in an entity that the code checks when performing certain actions. Abilities like Klutz are all over the place, because whenever the effect of a held item needs to be applied the code also checks for Klutz. On the other hand, others are checked only in a specific instance, for example those which can only activate at the end of a turn (like Speed Boost or Shed Skin). There are also some which do have their own functions, both very simple (like Truant which just tries to apply the pause status) and very complex (like Forecast which has to manage multiple form changes).
Given these inconsistencies I feel like the best course of action would be to search for calls to AbilityIsActive, IqSkillEnabled and CanUseHeldItem (this is a name I decided for the function at 0x022E3CBC which checks for Klutz and then calls HasHeldItem) to see where the code checks for skills, abilities, and items, and then start reversing the functions containing those calls. This is what I'm currently trying to do, at least for abilities.
Relevant addresses
All of these have been found in the EU version of the game.
- 0x022E3CBC
bool CanUseHeldItem(entity*, item_id): Checks if the entity holds an item and does not have Klutz. Also at 0x022EECC8, 0x022F6350 and 0x02311A94 - 0x022E9FA4
bool EntityIsNotNull(entity*): Returns true if the entity is notENTITY_NOTHING. Used in many different places before checking parameters of an entity. Also at 0x022F7D1C,0x022FA12C,0x0230248C, 0x0235FB8, 0x02308924, and 0x02311A70 - 0x022EBB28
TrySwitchPlace(entity* user, entity* target): Attemps to switch places between user and target, checks for Suction Cups and Mold Breaker - 0x022ED08C: Probably the function that applies the effect of Plus and Minus
- 0x022F9C48: Function that triggers Slow Start, takes no parameters and returns nothing. Probably called at the start of the floor and checks all pokémon
- 0x022F9CE4: Function that triggers abilities that change the weather. Also returns nothing and takes no parameters
- 0x022FA0D8: Returns the result of
AbilityIsActiveon an entity if another entity does not have Mold Breaker, otherwise returns false - 0x022FA1FC
TryAbilityTruant(entity*): Tries to inflict the pause status if the entity has truant - 0x022FEEDC: Long function that checks for Mobile Scarf and the Absolute Mover skill, might be related to checking the type of tile an entity is moving into
- 0x02300988: A function that checks for Unburden, Chlorophyll and Swift Swim and returns 1 or 2, which I assume is the number of times a move has to be used
- 0x02302844
bool IsLevitating(entity*): Checks if an entity is levitating (has Levitate and there is no gravity) - 0x02310604: A function that checks for the No-Slip Cap and probably tries to make a random item sticky
- 0x02310698: Another long function. This one seems to check for many items and abilities that would trigger at the end of a turn, such as the Warp Scarf, things related to belly drain, abilities triggered by weather like Sand Veil, abilities connected to status effects like Poison Heal and Magic Guard, and also Speed Boost. I think it also does many other things unrelated to abilities/skills/items
- 0x02311A38: A function that checks regen-related effects like the Heal Ribbon and the Quick Healer skill. Probably modifies the amount of HP regenerated per turn.
- 0x02335BB0: Probably the function that applies the effect of Forecast and changes Castform's forms
For now the information I've found is very incomplete, so I decided to open this issue before making any contributions. I'm new to reversing this game and I don't know if there is a better way to research this, let me know if I'm missing something.