Updating Berry data for Studio 2.6.2
[!NOTE] To read this file the intended way, open this file using Visual Studio Code (VSCode) and type CTRL+K, then V. It will open the preview of this file. You can also read it on the official GitLab repository of PSDK. Enjoy your reading!
This file explains how to use the new way of handling Berry-related data with the 2.7.0 update of Pokémon Studio. This update comes with PSDK modifications that are breaking changes if you had custom Berries handled from the code in your project.
Newly added data from Studio
A new parameter has been added to items to define which ones are Berries. You can access this information from the is_berry attribute on items.
Items that have this parameter set to true also have new data separated in two categories: berry_data and cooking_data
New attributes linked to berry_data:
- size
- firmness
- min_yield
- max_yield
- growth
- drain_rate
- natural_gift_power
- natural_gift_type
Here's an example of how to access the Berry data of an item:
growth = data_item(:your_item).berry_data.growth
New attributes linked to cooking_data:
- pokeblock_color
- better_pokeblock_chance
- smoothness
- spicy_flavor
- dry_flavor
- sweet_flavor
- bitter_flavor
- sour_flavor
Here's an example of how to access the cooking data of an item:
sour_flavor = data_item(:your_item).cooking_data.sour_flavor
Note: You'll probably need to ensure the item you're trying to get these new information from is indeed a Berry, you can do that with the following code:
data_item(:your_item).is_berry
Breaking changes
Natural Gift
The move Natural Gift has been changed to directly fetch its power and type information from the held item of the user, if it is a Berry.
To know if you have monkey-patches related to this, look for lines like Battle::Move::NaturalGift.register(:db_symbol, 80, :normal).
If you have monkey-patches for Natural Gift on Berry items, you can remove these and directly set-up your Berries data in Studio by:
- Giving it the new
is a Berryparameter (in the same editor where you define if an item is limited, battle-usable etc...) - Modifying the Natural Gift data in the "Berries" editor
In case you registered non-Berry items in NaturalGift, you will need to monkey-patch the new NaturalGift class in order to keep your custom functionality.
Berry system
The Berry system has been updated to avoid hardcoding the Berries' data but rather fetch it directly from the items.
To know if you have monkey-patches related to this, look for lines like Yuki::Berries::BERRY_DATA[:db_symbol] = Data.new(12, 2, 5, 15, spicy: 10).
If you have monkey-patches for the Berry system, you can remove these lines and directly set-up your Berries data in Studio by:
- Giving it the new
is a Berryparameter (in the same editor where you define if an item is limited, battle-usable etc...) - Modifying the Berries yield, growth time and drying time data in the "Berries" editor
If you were previously using the Berry module to access the Berries' flavor information, you will need to update your monkey-patches to modify the way you fetch them. See above for the new way to get a Berry's data.
Non-breaking changes
Socket checking
Some parts of the code were previously verifying if an item was stored in the socket n°4 in order to guess whether it's a Berry. These instances have been changed to use the is_berry attribute instead. This change will not make your project crash, but it may change the way some of your items react to certain mechanics.
To make sure these changes do not affect your project, make sure all your custom items you set in the Berries item socket in Studio correctly have the is a Berry parameter.
To check if you made a monkey-patches on a modified part of the code, look for changes made to the abilities CudChew and Harvest and to the method hold_berry of the PokemonBattler class and replace the code parts data_item(db_symbol)&.socket == 4 for data_item(db_symbol)&.is_berry