From d5aeeaca7bee4fe4794cfb7ca72aba045247765d Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Thu, 8 Jul 2021 23:04:21 +0100 Subject: [PATCH] Added code for Gen 8 alternate forms --- Data/Scripts/011_Battle/Gen 8 abilities.rb | 7 +- .../012_Overworld/007_Overworld_DayCare.rb | 4 +- .../001_Pokemon-related/001_FormHandlers.rb | 132 +++++++++++++++++- Data/Scripts/Gen 8 notes.txt | 34 ++--- PBS/Gen 8/pokemon_forms.txt | 1 + PBS/pokemon_forms.txt | 1 + 6 files changed, 150 insertions(+), 29 deletions(-) diff --git a/Data/Scripts/011_Battle/Gen 8 abilities.rb b/Data/Scripts/011_Battle/Gen 8 abilities.rb index cbd44d880..b611db260 100644 --- a/Data/Scripts/011_Battle/Gen 8 abilities.rb +++ b/Data/Scripts/011_Battle/Gen 8 abilities.rb @@ -271,9 +271,10 @@ Hunger Switch At the end of each round, switches the bearer's form (if it is Morpeko). Ice Face -When bearer is hit by a physical move while in its initial form, it takes no -damage and its form changes. At he end of a round in which hail weather started, -the bearer regains its initial form. +When bearer is hit by a physical move while in its initial form (including +hitting itself in confusion), it takes no damage and its form changes. At the +end of a round in which hail weather started, and immediately upon switching in +while hail weather exists, the bearer regains its initial form. Gulp Missile After using Surf/Dive, changes the bearer's form depending on its HP. If hit by diff --git a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb index 6ebb20877..4f541d39b 100644 --- a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb +++ b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb @@ -198,7 +198,9 @@ def pbDayCareGenerateEgg egg.form = newForm end # Inheriting regional form - if [:RATTATA, :SANDSHREW, :VULPIX, :DIGLETT, :MEOWTH, :GEODUDE, :GRIMER].include?(babyspecies) + if [:RATTATA, :SANDSHREW, :VULPIX, :DIGLETT, :MEOWTH, :GEODUDE, :GRIMER, + :PONYTA, :SLOWPOKE, :FARFETCHD, :ARTICUNO, :ZAPDOS, :MOLTRES, :CORSOLA, + :ZIGZAGOON, :DARUMAKA, :YAMASK, :STUNFISK].include?(babyspecies) if mother.form==1 egg.form = 1 if mother.hasItem?(:EVERSTONE) elsif father.species_data.get_baby_species(true, mother.item_id, father.item_id) == babyspecies diff --git a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb index 092278f67..a7199a22b 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon-related/001_FormHandlers.rb @@ -588,12 +588,125 @@ MultipleForms.register(:NECROZMA,{ } }) +MultipleForms.register(:CRAMORANT, { + "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| + next 0 + } +}) + +MultipleForms.register(:TOXEL, { + "getFormOnCreation" => proc { |pkmn| + next 1 if [:LONELY, :BOLD, :RELAXED, :TIMID, :SERIOUS, :MODEST, :MILD, + :QUIET, :BASHFUL, :CALM, :GENTLE, :CAREFUL].include?(pkmn.nature_id) + next 0 + } +}) + +MultipleForms.copy(:TOXEL, :TOXTRICITY) + +MultipleForms.register(:SINISTEA, { + "getFormOnCreation" => proc { |pkmn| + next 1 if rand(100) == 0 + next 0 + } +}) + +MultipleForms.copy(:SINISTEA, :POLTEAGEIST) + +# A Milcery will always have the same flavor, but it is randomly chosen. +MultipleForms.register(:MILCERY, { + "getForm" => proc { |pkmn| + num_flavors = 9 + sweets = [:STRAWBERRYSWEET, :BERRYSWEET, :LOVESWEET, :STARSWEET, + :CLOVERSWEET, :FLOWERSWEET, :RIBBONSWEET] + if sweets.include?(pkmn.item_id) + next sweets.index(pkmn.item_id) + (pkmn.personalID % num_flavors) * sweets.length + end + next 0 + } +}) + +MultipleForms.register(:ALCREMIE, { + "getFormOnCreation" => proc { |pkmn| + num_flavors = 9 + num_sweets = 7 + next rand(num_flavors * num_sweets) + } +}) + +MultipleForms.register(:EISCUE, { + "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| + next 0 if pkmn.fainted? || endBattle + } +}) + +MultipleForms.register(:INDEEDEE, { + "getForm" => proc { |pkmn| + next pkmn.gender + } +}) + +MultipleForms.register(:MORPEKO, { + "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| + next 0 if pkmn.fainted? || endBattle + } +}) + +MultipleForms.register(:ZACIAN, { + "getFormOnEnteringBattle" => proc { |pkmn, wild| + next 1 if pkmn.hasItem?(:RUSTEDSWORD) + next 0 + }, + "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| + next 0 + } +}) + +MultipleForms.register(:ZAMAZENTA, { + "getFormOnEnteringBattle" => proc { |pkmn, wild| + next 1 if pkmn.hasItem?(:RUSTEDSHIELD) + next 0 + }, + "getFormOnLeavingBattle" => proc { |pkmn, battle, usedInBattle, endBattle| + next 0 + } +}) + +MultipleForms.register(:URSHIFU, { + "getForm" => proc { |pkmn| + next rand(2) + } +}) + +MultipleForms.register(:CALYREX, { + "onSetForm" => proc { |pkmn, form, oldForm| + case form + when 0 # Normal + if pkmn.hasMove?(:GLACIALLANCE) + pkmn.forget_move(:GLACIALLANCE) + pbMessage(_INTL("{1} forgot {2}...", pkmn.name, GameData::Move.get(:GLACIALLANCE).name)) + end + if pkmn.hasMove?(:ASTRALBARRAGE) + pkmn.forget_move(:ASTRALBARRAGE) + pbMessage(_INTL("{1} forgot {2}...", pkmn.name, GameData::Move.get(:ASTRALBARRAGE).name)) + end + pbLearnMove(pkmn, :CONFUSION) if pkmn.numMoves == 0 + when 1 # Ice Rider + pbLearnMove(pkmn, :GLACIALLANCE, true) + when 2 # Shadow Rider + pbLearnMove(pkmn, :ASTRALBARRAGE, true) + end + } +}) + + #=============================================================================== # Regional forms -#=============================================================================== - # These species don't have visually different regional forms, but they need to # evolve into different forms depending on the location where they evolved. +#=============================================================================== + +# Alolan forms MultipleForms.register(:PIKACHU, { "getForm" => proc { |pkmn| next if pkmn.form_simple >= 2 @@ -607,3 +720,18 @@ MultipleForms.register(:PIKACHU, { }) MultipleForms.copy(:PIKACHU, :EXEGGCUTE, :CUBONE) + +# Galarian forms +MultipleForms.register(:KOFFING, { + "getForm" => proc { |pkmn| + next if pkmn.form_simple >= 2 + if $game_map + map_metadata = GameData::MapMetadata.try_get($game_map.map_id) + next 1 if map_metadata && map_metadata.town_map_position && + map_metadata.town_map_position[0] == 2 # Galar region + end + next 0 + } +}) + +MultipleForms.copy(:KOFFING, :MIMEJR) diff --git a/Data/Scripts/Gen 8 notes.txt b/Data/Scripts/Gen 8 notes.txt index 525591242..b87f33efb 100644 --- a/Data/Scripts/Gen 8 notes.txt +++ b/Data/Scripts/Gen 8 notes.txt @@ -82,27 +82,10 @@ New evolution methods: Add AI for new moves/items/abilities. -Code for the form differences: -- Cramorant (in battle only) -- Toxel/Toxtricity (depends on nature) -- Sinistea/Polteageist (form 1 is rare and not inheritable by breeding) -- Milcery (depends on held item and random number) -- Alcremie (random) -- Eiscue (in battle only) -- Indeedee (gender) -- Morpeko (in battle only) -- Zacian -- Zamazenta -- Kubfu (no code needed; form is manually set just before evolution) -- Urshifu -- Calyrex (fising, learns move upon fusion/defusion) -- Galarian forms (make sure breeding inherits them)(Koffing and Mime Jr. are the - same) - -I think there are some alternate forms which don't have a hidden ability while -their base forms do. I don't think the compiler supports this, and instead -treats Abilities and HiddenAbilities separately. Can work around this by setting -HiddenAbilities to be the same as Abilities. I'm not too happy with this. +Zacian/Zamazenta need code that changes their movesets upon entering/leaving +battle. Can't use "onSetForm" since that's called after the battler is +initialized and pbOnEnteringBattle doesn't have access to the battler (could +change this). #=============================================================================== # Low priority or ignorable @@ -120,14 +103,19 @@ Town Map added to the pause menu. (Don't bother adding.) Remote access to storage boxes. See the Pokémon Box Link item. New evolution methods: -- Milcery: spinning while holding an item. (Doesn't suit our control scheme, - we're not adding a way to easily spin on the spot just for this, cf. +- Milcery: spinning while holding an item. (Doesn't suit our control scheme. + We're not adding a way to easily spin on the spot just for this, cf. not having to turn your computer upside-down to evolve Inkay.) - Galarian Yamask: going to a particular spot after a battle in which it lost 49+ HP from a single attack and hasn't fainted since then; healing doesn't affect this. (Utter nonsense, find a better way.) +I think there are some alternate forms which don't have a hidden ability while +their base forms do. I don't think the compiler supports this, and instead +treats Abilities and HiddenAbilities separately. Can work around this by setting +HiddenAbilities to be the same as Abilities. I'm not too happy with this. + #=============================================================================== # Implemented #=============================================================================== diff --git a/PBS/Gen 8/pokemon_forms.txt b/PBS/Gen 8/pokemon_forms.txt index d27aa9594..98188265e 100644 --- a/PBS/Gen 8/pokemon_forms.txt +++ b/PBS/Gen 8/pokemon_forms.txt @@ -1397,6 +1397,7 @@ Moves = 1,ASTONISH,1,PROTECT,4,HAZE,8,NIGHTSHADE,12,DISABLE,16,BRUTALSWING,20,CR TutorMoves = ALLYSWITCH,ATTRACT,BRUTALSWING,CALMMIND,DARKPULSE,EARTHPOWER,EARTHQUAKE,ENDURE,ENERGYBALL,FACADE,FAKETEARS,HEX,IMPRISON,IRONDEFENSE,NASTYPLOT,PAYBACK,POLTERGEIST,PROTECT,PSYCHIC,RAINDANCE,REST,ROCKSLIDE,ROCKTOMB,ROUND,SAFEGUARD,SANDSTORM,SHADOWBALL,SLEEPTALK,SNORE,SUBSTITUTE,THIEF,TOXICSPIKES,TRICKROOM,WILLOWISP,WONDERROOM,ZENHEADBUTT Pokedex = A clay slab with cursed engravings took possession of a Yamask. The slab is said to be absorbing the Yamask's dark power. Generation = 8 +Evolutions = RUNERIGUS,Level,34 #------------------------------- [DEERLING,1] FormName = Summer Form diff --git a/PBS/pokemon_forms.txt b/PBS/pokemon_forms.txt index d27aa9594..98188265e 100644 --- a/PBS/pokemon_forms.txt +++ b/PBS/pokemon_forms.txt @@ -1397,6 +1397,7 @@ Moves = 1,ASTONISH,1,PROTECT,4,HAZE,8,NIGHTSHADE,12,DISABLE,16,BRUTALSWING,20,CR TutorMoves = ALLYSWITCH,ATTRACT,BRUTALSWING,CALMMIND,DARKPULSE,EARTHPOWER,EARTHQUAKE,ENDURE,ENERGYBALL,FACADE,FAKETEARS,HEX,IMPRISON,IRONDEFENSE,NASTYPLOT,PAYBACK,POLTERGEIST,PROTECT,PSYCHIC,RAINDANCE,REST,ROCKSLIDE,ROCKTOMB,ROUND,SAFEGUARD,SANDSTORM,SHADOWBALL,SLEEPTALK,SNORE,SUBSTITUTE,THIEF,TOXICSPIKES,TRICKROOM,WILLOWISP,WONDERROOM,ZENHEADBUTT Pokedex = A clay slab with cursed engravings took possession of a Yamask. The slab is said to be absorbing the Yamask's dark power. Generation = 8 +Evolutions = RUNERIGUS,Level,34 #------------------------------- [DEERLING,1] FormName = Summer Form