Change log/v21

Essentials v21 was released on **28th June 2023**.

Essentials v21.1 was released on **30th July 2023**.

* Sped up compiling of PBS files (in addition to what the new version of mkxp-z does).
* Made Essentials fully FPS-agnostic by using seconds instead of frame counts for everything animated.
* The FPS will now match your monitor's frame rate, rather than be limited to 40. Enabled vsync to reduce screen tearing.
* Added text display speed "Inst" to the Options screen, which is instant text display. This just makes it easier for players to skip dialogue and then complain they don't know what to do.
 * Overhauled the AI code, breaking it up into more manageable chunks and adding lots of calculations for (practically) all move function codes and other move-related factors.
* Added more code to the decision of whether to switch out a Pokémon instead of attacking with it, letting the AI be able to recognise more bad situations where switching is the best choice.
* Trainers will now be able to predict whether a move will fail, and will avoid using that move.
* A Pokémon's choice of move is now less random, because it will no longer consider at all using a move that scored significantly worse than another move it knows. Previously it just had a lower chance of using the bad move.
* Only trainers with a skill level of 100 or higher will hold on to their last Pokémon until the end. These will be Gym Leaders and other top trainers, who would be expected to have an "ace"/signature Pokémon that acts as the final boss of their battle.
* Added some skill flags, most of which are automatically given to a trainer depending on their skill level. These skill flags determine whether the AI takes certain factors into account.
* Added "Legendary", "Mythical" and "UltraBeast" flags to appropriate species in pokemon.txt. Wild Pokémon with these flags have a smarter AI, if the corresponding Setting is set.
 * Overhauled how text is translated. Text is now stored in two .dat files: one for core text common to most games, and one for game-specific text.
* When text is extracted for translating, it goes into multiple files instead of just one, one per type of message. However, you can split them up further yourself for better organisation; only the contents of message files matter, not their filenames.
* Extracting and compiling text is a little more user-friendly.
* Tidied up the translatable parts of various messages.
 * Rewrote the random dungeon generator code, and added a bunch of customisation to it. It now supports cave-type maps (albeit better-designed caves than they used to be) and forest-type maps.
 * Rewrote the phone UI code to be more consistent with other UI scripts.
* Trainer contacts can now be deleted from the phone. (Actually, they're just hidden because some of their information needs to keep existing.)
* Added sorting options to the phone screen, both moving individual contacts (press the Action button just like in the Bag) and sorting all at once (choose a contact to access the sorting options).
* Added the map metadata flag "NoPhoneSignal" which prevents standard phone calls in maps with it. Added a phone signal icon to the phone screen.
* Phone call messages can now be coloured according to the gender of the trainer speaking.
* Redesigned phone.txt's contents (the old format isn't supported). Added support for defining a set of messages unique to a specific contact (and even a specific version of a specific contact, just like in trainers.txt). Added more phone message components (IntroAfternoon, BattleReminder, End).
* Added Phone.rematches\_enabled which determines whether rematches with phone contacts are possible, and added an associated Setting. In HGSS, for example, rematches are only possible after Gym 7/beating Team Rocket in the Radio Tower.
* A trainer contact can be given a Common Event ID number, which will make phone calls with that contact run the associated Common Event instead of taking random messages from phone.txt. Added the "CommonEvent" trainer comment for generating a trainer event from comments.
* Redesigned the layout of trainer events that can be registered in the phone and rebattled (the old layout still works for now but is deprecated).
* Trainers starting at a non-zero version number can now be registered in the phone properly.
 * Bug-Catching Contest maps and reception maps can now be defined using a map metadata flag instead of map numbers.
* Moves taught by a TR/TM/HM or Move Tutor will now be compatible with a Pokémon if it can learn that move via level up or as an egg move.
* Added Game Switches 36 and 37, which are whether the player is male or female respectively.
* Added support for diagonal screen scrolling with `$game_map.start_scroll`, and added `def pbScrollMapTo` and `def pbScrollMapToPlayer`.
* Tweaked the intensities of some overworld weather animations.
 * Added `NPCTrainer#version` to allow exact identification of foe trainers.
* Made the example wild encounter modifier that scales Pokémon levels to match the player's party depend on a map metadata flag instead of a map number.
* Changed Coaching's function code to be more accurate to how it actually works.
 * Added a BP shop script, and added BP prices for various items in items.txt.
* Moved game-specific credits into Settings, and made credits translatable.
* Added `$stats.bump_count`, which is how many times the player has walked into something.
* Tweaked the Level 101+ equations for some growth rates.
* Split old and new Black/White Flute effects into separate values for clarity.
* Removed deprecated code.
* Removed support for save files in the old save location, because they can't be updated to the latest version now anyway.
* Refactored some code relating to colours.
* Moved the male/female text colours into `module MessageConfig` for easier access.
* Tidied up usage of colour tags to make (parts of) messages a particular colour.
* `def pbDrawTextPositions` now accepts alignment values of `:left`, `:center` and `:right`. Essentials now uses these values.
* `def pbDrawTextPositions` now draws outline text when given a secondary colour effect of `:outline`. Also added a secondary colour effect of `:none` for no shadow (also achievable by not providing a secondary colour). Essentials now uses these values.
* Removed redundant "\r" from various messages.
* Added a separate message for finding/receiving multiples of a TM/TR item at once.
* `def addIf` for modules `ItemHandler` and `MultipleForms` now takes an identifier symbol.
* Changed uses of `BitmapWrapper` to `Bitmap` because they just needed to be basic bitmaps.
* Turned Town Map PBS data into a `GameData` class.
* Renamed function code "UseUserBaseDefenseInsteadOfUserBaseAttack" to "UseUserDefenseInsteadOfUserAttack" because that's more accurate.
* Renamed "base\_damage"/"baseDamage"/"baseDmg" to "power".
 * Allowed multiple PBS files per data type. They need to be named with an underscore and suffix after the base name, e.g. "moves\_dragon.txt", "map\_metadata\_hoenn.txt". The base PBS file (e.g. "moves.txt") no longer needs to exist if you don't want it.
* Added a PBS subfolder with PBS files for Shadow Pokémon data. Moved shadow\_pokemon.txt into it, and added other files containing Shadow Pokémon data. To add this Shadow Pokémon content to your game, simply move the files into the main PBS folder; they make use of the "multiple PBS files per data type" thing mentioned above to work automatically.
* Removed hardcoded lists of PBS files and .dat files when checking whether to compile and when loading all GameData class data. This makes it easier to create a new GameData class/PBS file of your own.
* Generalised code to allow a species to be defined with any number of types, not just up to 2. Note that some UI won't show 3+ type icons very nicely.
* Implemented item portion names, e.g. "bag of Soft Sand".
* Added the "ShowQuantity" property to items.txt, for Key Items that you want to show how many the player has.
* Removed Struggle from moves.txt.
* Moved Poké Radar-exclusive encounters from Settings into encounters.txt.
 * Created the folder Graphics/UI, and moved all UI graphics into it from Graphics/Pictures. Some UI graphics were renamed and/or moved into their own subfolders.
* Egg crack graphics are now found in the same way as other egg graphics.
 * Added console messages to more clearly show if/when compiling didn't happen.
* The compiler no longer reloads the system cache. This speeds it up by a couple of seconds.
* Logging battle messages now also echoes them to the console.
* Improved the choices for how to end a battle in Debug mode when holding Ctrl and choosing to Run.
* Holding Ctrl in Debug mode and choosing Call in a battle now lets you choose to end the battle instead of calling at a Pokémon.
* Rearranged the options in the main Debug menu.
* Added Debug function to edit Repel steps, Flash/Strength usage and Black/White Flute effects.
* Added Debug functions to toggle possession of the Snag Machine and access to the Purification Chamber.
* Added Debug function to edit the steps/time remaining and Poké Balls possessed in a Safari Zone game/Bug-Catching Contest.
* Added a more extensive Debug menu function for editing properties of the phone and contacts therein.
* Somewhat improved the appearance and handling of the Terrain Tag Editor.
* You can now reset a Pokémon's form to 0 in the Pokémon Debug menu if that Pokémon only has one defined form but its form is not 0.
* Added PBS schema symbol "^" for properties that are repeated in multiple lines within a section. It's similar to "\*" which is when a property can have multiple copies of its contents in its line.
* Added compiler schema letter "m" which makes the value a symbol.
* Removed support for old PBS file formats/properties.
* Refactored many PBS file compilers to separate out the validation code.
 * Replaced all choices in example map events that used \ch with Show Choices commands.
* Tweaked example map NPCs in the player's house that talk about messages and choices.
* The example Battle Frontier now awards BP instead of Rare Candies. Added an example BP shop to the Poké Mart map in the Battle Frontier.
* Updated the Poké Center nurse events with more comments and less usage of scripts.

### Bug fixes

* Fixed priority 1 tiles appearing below the player at larger screen sizes.
* Fixed the rendering of some tiles for certain sizes of tilesets.
* Fixed a scrolled screen snapping back to centre on the player as soon as they move.
* Fixed the camera lagging behind while sliding on ice.
* Fixed screen positioning bug when jumping over ledges near the top or left of a map.
* The player now animates when walking into something.
* The player now dismounts the Bicycle after various map transfers.
* Fixed being unable to set the player's movement speed during a move route.
* Fixed being unable to interact with diving water, or surface while underwater, if there is an event in front of the player.
* Fixed error when getting terrain tag when the player moves between connected maps.
* Fixed being able to interact with a follower that is beneath the player.
* A follower will no longer follow the player if the follower has been given its own move route.
* Fixed events remaining frozen to the screen if the player is moved elsewhere on the same map in some cases.
* Fixed the slight pause after an event reaches the end of its repeating move route.
* Fixed large events in random dungeon maps potentially overlapping a wall.
* Fixed fully grown berry plants looking like sprouts upon entering the map they're on.
* Fixed some messages in berry planting that could say "a Oran Berry".
* Fixed SystemStackError when two events on connected maps have their backs to the other map.
* Fixed crash when ending a Bug-Catching Contest.
 * Fixed Safari/Bug Contest/roaming battles generating Pokémon while ignoring that Pokémon's defined form (from encounters.txt or elsewhere).
* Fixed some special battle intro animations not playing when they should.
* Fixed the default terrain not being set properly if there is none and weather doesn't set it.
* Errors in the AI no longer cause it to do nothing and give the player a free turn.
* Fixed the AI locking itself out of Mega Evolution if it decides it wants to attack but then changes its mind.
* Fixed AI accuracy calculation for OHKO moves.
* After sending out a Pokémon in battle, the command menu's cursor for it will now be on the "Fight" option.
* Fixed error in battle's fight menu when not using graphics for it.
* Added Obstruct to the blacklists of Assist and Copycat.
* Fixed Bug Bite/Pluck not triggering Symbiosis after it consumes a berry.
* Fixed a target of Bug Bite/Pluck consuming its healing berry even though Bug Bite/Pluck should have consumed it instead.
* Fixed Bug Bite/Pluck and Fling not enabling Belch when a berry is consumed.
* Fixed Chip Away/Darkest Lariat/Sacred Sword not ignoring the target's evasion stat stage.
* Fixed being able to Counter/Mirror Coat an attack whose damage was absorbed by a substitute.
* Fixed Decorate showing the stat-raising animation twice.
* Fixed Eerie Spell's effect working like a status move.
* Corrected slight potential irregularity in additional effect chances for Fire/Ice/Thunder Fangs.
* Fixed clash between using Future Sight and being locked into using a particular move.
* Fixed typo in Grassy Glide's effect.
* Fixed Gulp Missile paralysing the wrong Pokémon.
* Fixed Incinerate being able to destroy a held berry/gem if the holder has Sticky Hold.
* Fixed incorrect move usability check when Instructing a move.
* Fixed Jaw Lock having an effect chance when it shouldn't.
* Fixed error when Powder causes a Pokémon's Fire move to backfire.
* Rollout/Ice Ball no longer hit twice per turn because of Parental Bond.
* Fixed Sea of Fire effect lasting forever.
* Fixed Sheer Force not negating Secret Power's additional effect.
* Fixed Shadow End dealing an incorrect amount of recoil damage.
* Fixed Shadow Sky not powering up Shadow moves and not making Weather Ball typeless.
* Fixed Shell Side Arm causing an error if there are no targets when used.
* Fixed Torment preventing multi-turn moves from being used fully.
* Fixed moves that deal fixed damage showing an effectiveness message.
* Fixed two-turn moves being used in one turn charging up after failing instead of before.
* Fixed move disruption affecting recharge moves (e.g. Hyper Beam) even though it shouldn't.
* Fixed irregularities in the effects of moves that can end a battle.
* Fixed Aroma Veil not working properly.
* Fixed As One not having the effect of Unnerve.
* Fixed damage multiplier that Aura Break causes Dark/Fairy Aura to have.
* Fixed Cotton Down also lowering the bearer's Speed.
* Fixed Liquid Ooze not oozing drained HP if the bearer fainted from that draining.
* Fixed Pastel Veil not providing poison immunity to allies, and not healing the bearer if it becomes poisoned anyway.
* Fixed Quick Draw's message and effect triggering independently of each other.
* Fixed Minior's Shields Down showing too many messages.
* Fixed error when a status problem being Synchronized is blocked by Safeguard.
* Fixed recharging after using Hyper Beam not also counting as a truanting turn.
* Fixed non-ignorable abilities in damage calculation actually being ignorable.
* Fixed Flame Orb/Toxic Orb being able to replace an existing status problem.
* Fixed incorrect variable use for Jaboca/Rowap Berries' effects.
* Fixed back-to-back changes to backgrounds in battle animations not finishing properly before the next one starts.
* Fixed Heavy Ball's catch rate calculation being inaccurate.
* Fixed error caused by throwing a Lure Ball in a battle started from the Debug menu.
* Fixed the battle rule "forceCatchIntoParty" being circumventable.
* Fixed wrong message when sending a party Pokémon to storage and replacing it with a caught Pokémon.
* Fixed damage from Shadow Sky weather, Spiky Shield, Dry Skin and Solar Power not checking whether the Pokémon is immune to indirect damage.
* All battle weather types now have a message at the end of each round to say they're still in effect.
 * Fixed misalignment of text in the Pokédex's list of Regional Dexes when there are a lot of Regional Dexes.
* Fixed positionings of text in the Pokédex main list and in the naming screen.
* The Pokédex no longer lets you look at separate male and female sprites of a species if it doesn't have gender differences.
* Fixed having no Pokémon in your party making the cursor not work as expected in the party screen.
* Fixed a Pokémon's sprite not refreshing when changing its held item in its summary screen.
* The Pokémon summary screen now uses only the first unlocked Regional Dex to determine the displayed Dex No. if the National Dex is locked.
* The obtain and hatch times of a Pokémon are now real world time rather than in-game time.
* Fixed the "See ya!" option in the PC menu not working properly.
* Fixed Pokémon icons sometimes disappearing in Pokémon storage screen.
* Fixed party Pokémon icons overlapping the marking window in Pokémon storage.
* Fixed item sell prices being 25% of the buy prices rather than 50%.
* Fixed the elapsed time shown in the Hall of Fame using the wrong time source.
* Fixed playing the credits/changing $scene leaving a ghost image of the old map behind.
* Made the credits fade out properly if you skip them halfway through.
 * Fixed typo in checking whether a Pokémon has any nature.
* Fixed error when the happiness soft cap is active and trying to gain more when already above that cap.
* Fixed Shadow Pokémon still knowing some of their original moves after being created.
* Fixed roaming Pokémon not remembering whether they have been caught.
* Fixed Giratina's form code crashing if the current map doesn't have metadata.
* Fixed Rare Candy not reviving a fainted Shedinja.
* Fixed fainted Pokémon reviving if they evolve.
 * Fixed some move accuracies.
* Fixed Thousand Waves using an inappropriate function code.
* Updated all pokemon.txt and pokemon\_forms.txt with more accurate movesets. Also added more move compatibilities based on TMs and Move Tutors from previous generations.
* shadow\_pokemon.txt now supports sections for individual forms of a species, just like other PBS files.
 * Removed some testing console messages.
* Holding Ctrl in Debug mode now lets you freely move across ice and waterfalls.
* Fixed mispositioning of text in the Debug functions that edit Game Switches and Game Variables.
* Fixed error messages appearing in the console because of some script switches in the "Switches" Debug function.
* The advanced battle-starting Debug functions now run encounter/trainer modifier code on the Pokémon/trainers.
* Fixed crash when pressing the Action button in the Debug function "Roaming Pokémon".
* Fixed the "Edit Pokémon Sprite Positions" Debug function not prompting you to save changes if you only changed the size of a shadow.
* Fixed crash when trying to change a battle animation's foreground image.
 * Fixed play time carrying over to new games.
* Fixed the Interpreter not resetting if the game was saved in the middle of an event and then you start a new game.
* Fixed the Setting `HEAL_STORED_POKEMON` being the wrong value by default for the mechanics generation.
* Fixed typo in registration of the Puddle environment.
* Fixed `GameData::Species#minimum_level` sometimes giving incorrect levels.
* Fixed `def pbShowCommandsWithHelp` not properly deactivating showing a message window if it created one.
* Fixed text underline/strikethrough lines being mispositioned. Also added shadows to them.
* Fixed some file-choosing methods producing filenames that include the file extension unnecessarily.
* Fixed some autotiles not blending into each other when they should.

## Essentials v21.1

### Feature changes and additions

* Rewrote and slimmed down "mkxp.json".
* Renamed the folders in the PBS folder to make it clearer they contain backup files only.
* Added more sound effects.
* `&m;` and `&f;` in event text now become ♂ and ♀ respectively.
* Added some graphics filenames to the core messages.
* Decapitalised some text in the Debug menus.
* If exactly one language is defined in `Settings::LANGUAGES`, its language files are loaded automatically if they exist.
* `class Sprite` can now be made to use floats instead of integers for its coordinates, for added precision.
* Added `Settings::DISABLE_IVS_AND_EVS` which treats them as 0 when calculating stats. This doesn't affect their other uses, and doesn't disable effects that modify them.
* Added the battle rule "cannotSwitch" which prevents everyone in the battle choosing to switch out their Pokémon.

### Bug fixes

* Fixed the first frame of animations from RMXP's Database not playing.
* Fixed text appearing faster after being paused by a text command, e.g. `\wt`.
* Fixed overworld weather fading out and reappearing when walking between two maps with the same weather.
* Fixed the follower teleporting behind the player when they turn to the side and bump into something.
* Fixed Sky Drop failing in the second turn causing the target to remain stuck in the air forever.
* Fixed incorrect AI code for considering Sticky Web when switching.
* Fixed some players experiencing super-fast cursor movement in lists.
* The Pokédex entry of a newly obtained species now only shows if that species is in an unlocked Dex list.
* Fixed incorrect positioning of text in some menus in the Battle Factory.