From feb9e3b2dedf55d3fb6574b26a9ba804e44f5c87 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 23 Jun 2021 23:15:15 +0100 Subject: [PATCH] Added some Gen 8 item effects, added super shininess --- Data/Scripts/001_Settings.rb | 2 + .../010_Data/002_PBS data/013_Trainer.rb | 1 + .../001_Battler/001_PokeBattle_Battler.rb | 4 + .../002_Move/006_Move_Effects_080-0FF.rb | 42 ++- .../004_Battle_ExpAndMoveLearning.rb | 2 + .../003_Battle/006_Battle_Action_Switching.rb | 8 +- Data/Scripts/011_Battle/004_AI/002_AI_Item.rb | 2 +- .../011_Battle/004_BattleHandlers_Items.rb | 6 +- .../005_Battle scene/009_Scene_Animations.rb | 12 +- .../002_PokeBattle_SafariZone.rb | 21 +- .../008_PokeBattle_BattlePeer.rb | 2 +- Data/Scripts/011_Battle/Gen 8 abilities.rb | 20 +- Data/Scripts/011_Battle/Gen 8 items.rb | 341 +++++++++++++++--- Data/Scripts/013_Items/001_Item_Utilities.rb | 184 +++++++--- Data/Scripts/013_Items/002_Item_Effects.rb | 56 +-- .../013_Items/003_Item_BattleEffects.rb | 4 +- Data/Scripts/014_Pokemon/001_Pokemon.rb | 18 + .../003_UI_EggHatching.rb | 2 +- Data/Scripts/016_UI/005_UI_Party.rb | 4 + Data/Scripts/Gen 8 notes.txt | 26 +- 20 files changed, 586 insertions(+), 171 deletions(-) diff --git a/Data/Scripts/001_Settings.rb b/Data/Scripts/001_Settings.rb index b459d24c6..0ce14074c 100644 --- a/Data/Scripts/001_Settings.rb +++ b/Data/Scripts/001_Settings.rb @@ -33,6 +33,8 @@ module Settings EGG_LEVEL = 1 # The odds of a newly generated Pokémon being shiny (out of 65536). SHINY_POKEMON_CHANCE = (MECHANICS_GENERATION >= 6) ? 16 : 8 + # Whether super shininess is enabled (uses a different shiny animation). + SUPER_SHINY = (MECHANICS_GENERATION >= 8) # The odds of a wild Pokémon/bred egg having Pokérus (out of 65536). POKERUS_CHANCE = 3 # Whether a bred baby Pokémon can inherit any TM/HM moves from its father. It diff --git a/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb b/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb index ff9253f4f..ad5cd0fe4 100644 --- a/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb +++ b/Data/Scripts/010_Data/002_PBS data/013_Trainer.rb @@ -130,6 +130,7 @@ module GameData pkmn.ability = pkmn_data[:ability] pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) pkmn.shiny = (pkmn_data[:shininess]) ? true : false + pkmn.super_shiny = false if pkmn_data[:nature] pkmn.nature = pkmn_data[:nature] else # Make the nature random but consistent for the same species used by the same trainer type diff --git a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb index 33bf48f8b..9b0704a20 100644 --- a/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb +++ b/Data/Scripts/011_Battle/001_Battler/001_PokeBattle_Battler.rb @@ -184,6 +184,10 @@ class PokeBattle_Battler return @pokemon && @pokemon.shiny? end + def super_shiny? + return @pokemon && @pokemon.super_shiny? + end + def owned? return false if !@battle.wildBattle? return $Trainer.owned?(displaySpecies) diff --git a/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb b/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb index 347abdb4e..83561735b 100644 --- a/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb +++ b/Data/Scripts/011_Battle/002_Move/006_Move_Effects_080-0FF.rb @@ -3432,10 +3432,10 @@ class PokeBattle_Move_0F7 < PokeBattle_Move :PIXIEPLATE,:SKYPLATE,:SPLASHPLATE,:SPOOKYPLATE,:STONEPLATE, :TOXICPLATE,:ZAPPLATE ], - 80 => [:ASSAULTVEST,:DAWNSTONE,:DUSKSTONE,:ELECTIRIZER,:MAGMARIZER, - :ODDKEYSTONE,:OVALSTONE,:PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SACHET, - :SAFETYGOGGLES,:SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY, - :WHIPPEDDREAM + 80 => [:ASSAULTVEST,:CHIPPEDPOT,:CRACKEDPOT,:DAWNSTONE,:DUSKSTONE, + :ELECTIRIZER,:HEAVYDUTYBOOTS,:MAGMARIZER,:ODDKEYSTONE,:OVALSTONE, + :PROTECTOR,:QUICKCLAW,:RAZORCLAW,:SACHET,:SAFETYGOGGLES, + :SHINYSTONE,:STICKYBARB,:WEAKNESSPOLICY,:WHIPPEDDREAM ], 70 => [:DRAGONFANG,:POISONBARB, # EV-training items (Macho Brace is 60) @@ -3444,7 +3444,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move # Drives :BURNDRIVE,:CHILLDRIVE,:DOUSEDRIVE,:SHOCKDRIVE ], - 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LUSTROUSORB, + 60 => [:ADAMANTORB,:DAMPROCK,:GRISEOUSORB,:HEATROCK,:LEEK,:LUSTROUSORB, :MACHOBRACE,:ROCKYHELMET,:STICK,:TERRAINEXTENDER ], 50 => [:DUBIOUSDISC,:SHARPBEAK, @@ -3471,7 +3471,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move :BURNHEAL,:CASTELIACONE,:ELIXIR,:ENERGYPOWDER,:ENERGYROOT,:ETHER, :FRESHWATER,:FULLHEAL,:FULLRESTORE,:HEALPOWDER,:HYPERPOTION, :ICEHEAL,:LAVACOOKIE,:LEMONADE,:LUMIOSEGALETTE,:MAXELIXIR, - :MAXETHER,:MAXPOTION,:MAXREVIVE,:MOOMOOMILK,:OLDGATEAU, + :MAXETHER,:MAXHONEY,:MAXPOTION,:MAXREVIVE,:MOOMOOMILK,:OLDGATEAU, :PARALYZEHEAL,:PARLYZHEAL,:PEWTERCRUNCHIES,:POTION,:RAGECANDYBAR, :REDFLUTE,:REVIVALHERB,:REVIVE,:SHALOURSABLE,:SODAPOP, :SUPERPOTION,:SWEETHEART,:YELLOWFLUTE, @@ -3486,12 +3486,14 @@ class PokeBattle_Move_0F7 < PokeBattle_Move :XSPEED,:XSPEED2,:XSPEED3,:XSPEED6, :DIREHIT,:DIREHIT2,:DIREHIT3, :ABILITYURGE,:GUARDSPEC,:ITEMDROP,:ITEMURGE,:RESETURGE, + :MAXMUSHROOMS, # Vitamins :CALCIUM,:CARBOS,:HPUP,:IRON,:PPUP,:PPMAX,:PROTEIN,:ZINC, :RARECANDY, # Most evolution stones (see also 80) :EVERSTONE,:FIRESTONE,:ICESTONE,:LEAFSTONE,:MOONSTONE,:SUNSTONE, - :THUNDERSTONE,:WATERSTONE, + :THUNDERSTONE,:WATERSTONE,:SWEETAPPLE,:TARTAPPLE, :GALARICACUFF, + :GALARICAWREATH, # Repels :MAXREPEL,:REPEL,:SUPERREPEL, # Mulches @@ -3503,9 +3505,13 @@ class PokeBattle_Move_0F7 < PokeBattle_Move :BALMMUSHROOM,:BIGMUSHROOM,:BIGNUGGET,:BIGPEARL,:COMETSHARD, :NUGGET,:PEARL,:PEARLSTRING,:RELICBAND,:RELICCOPPER,:RELICCROWN, :RELICGOLD,:RELICSILVER,:RELICSTATUE,:RELICVASE,:STARDUST, - :STARPIECE,:STRANGESOUVENIR,:TINYMUSHROOM + :STARPIECE,:STRANGESOUVENIR,:TINYMUSHROOM, + # Exp Candies + :EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL ], - 20 => [# Wings + 20 => [# Feathers + :CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER, + :PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER, :CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING, :RESISTWING,:SWIFTWING ], @@ -3523,7 +3529,16 @@ class PokeBattle_Move_0F7 < PokeBattle_Move :FULLINCENSE,:LAXINCENSE,:LUCKINCENSE,:ODDINCENSE,:PUREINCENSE, :ROCKINCENSE,:ROSEINCENSE,:SEAINCENSE,:WAVEINCENSE, # Scarves - :BLUESCARF,:GREENSCARF,:PINKSCARF,:REDSCARF,:YELLOWSCARF + :BLUESCARF,:GREENSCARF,:PINKSCARF,:REDSCARF,:YELLOWSCARF, + # Mints + :LONELYMINT, :ADAMANTMINT, :NAUGHTYMINT, :BRAVEMINT, :BOLDMINT, + :IMPISHMINT, :LAXMINT, :RELAXEDMINT, :MODESTMINT, :MILDMINT, + :RASHMINT, :QUIETMINT, :CALMMINT, :GENTLEMINT, :CAREFULMINT, + :SASSYMINT, :TIMIDMINT, :HASTYMINT, :JOLLYMINT, :NAIVEMINT, + :SERIOUSMINT, + # Sweets + :STRAWBERRYSWEET, :LOVESWEET, :BERRYSWEET, :CLOVERSWEET, + :FLOWERSWEET, :STARSWEET, :RIBBONSWEET ] } end @@ -3534,7 +3549,7 @@ class PokeBattle_Move_0F7 < PokeBattle_Move return if @willFail @willFail = true if user.item.is_berry? && !user.canConsumeBerry? return if @willFail - return if user.item.is_mega_stone? + return if user.item.is_mega_stone? || user.item.is_TR? flingableItem = false @flingPowers.each do |_power, items| next if !items.include?(user.item_id) @@ -3565,6 +3580,11 @@ class PokeBattle_Move_0F7 < PokeBattle_Move def pbBaseDamage(baseDmg,user,target) return 10 if user.item && user.item.is_berry? return 80 if user.item && user.item.is_mega_stone? + if user.item.is_TR? + ret = GameData::Move.get(user.item.move).base_damage + ret = 10 if ret < 10 + return ret + end @flingPowers.each do |power,items| return power if items.include?(user.item_id) end diff --git a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb index d36553e75..a1ec33985 100644 --- a/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/011_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb @@ -144,6 +144,8 @@ class PokeBattle_Battle exp = (exp*1.5).floor end end + # Exp. Charm increases Exp gained + exp = exp * 3 / 2 if GameData::Item.exists?(:EXPCHARM) && $PokemonBag.pbHasItem?(:EXPCHARM) # Modify Exp gain based on pkmn's held item i = BattleHandlers.triggerExpGainModifierItem(pkmn.item,pkmn,exp) if i<0 diff --git a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb index 006f7c55b..87bc6bfb3 100644 --- a/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb +++ b/Data/Scripts/011_Battle/003_Battle/006_Battle_Action_Switching.rb @@ -350,7 +350,7 @@ class PokeBattle_Battle # Entry hazards # Stealth Rock if battler.pbOwnSide.effects[PBEffects::StealthRock] && battler.takesIndirectDamage? && - GameData::Type.exists?(:ROCK) + GameData::Type.exists?(:ROCK) && !battler.hasActiveItem?(:HEAVYDUTYBOOTS) bTypes = battler.pbTypes(true) eff = Effectiveness.calculate(:ROCK, bTypes[0], bTypes[1], bTypes[2]) if !Effectiveness.ineffective?(eff) @@ -366,7 +366,7 @@ class PokeBattle_Battle end # Spikes if battler.pbOwnSide.effects[PBEffects::Spikes]>0 && battler.takesIndirectDamage? && - !battler.airborne? + !battler.airborne? && !battler.hasActiveItem?(:HEAVYDUTYBOOTS) spikesDiv = [8,6,4][battler.pbOwnSide.effects[PBEffects::Spikes]-1] oldHP = battler.hp battler.pbReduceHP(battler.totalhp/spikesDiv,false) @@ -382,7 +382,7 @@ class PokeBattle_Battle if battler.pbHasType?(:POISON) battler.pbOwnSide.effects[PBEffects::ToxicSpikes] = 0 pbDisplay(_INTL("{1} absorbed the poison spikes!",battler.pbThis)) - elsif battler.pbCanPoison?(nil,false) + elsif battler.pbCanPoison?(nil,false) && !battler.hasActiveItem?(:HEAVYDUTYBOOTS) if battler.pbOwnSide.effects[PBEffects::ToxicSpikes]==2 battler.pbPoison(nil,_INTL("{1} was badly poisoned by the poison spikes!",battler.pbThis),true) else @@ -392,7 +392,7 @@ class PokeBattle_Battle end # Sticky Web if battler.pbOwnSide.effects[PBEffects::StickyWeb] && !battler.fainted? && - !battler.airborne? + !battler.airborne? && !battler.hasActiveItem?(:HEAVYDUTYBOOTS) pbDisplay(_INTL("{1} was caught in a sticky web!",battler.pbThis)) if battler.pbCanLowerStatStage?(:SPEED) battler.pbLowerStatStage(:SPEED,1,nil) diff --git a/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb b/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb index b7ec5f9a0..ebc64d0c0 100644 --- a/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb +++ b/Data/Scripts/011_Battle/004_AI/002_AI_Item.rb @@ -57,7 +57,7 @@ class PokeBattle_AI ] allStatusItems = [ :FULLHEAL, :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE, - :SHALOURSABLE, :BIGMALASADA, :LUMBERRY, :HEALPOWDER + :SHALOURSABLE, :BIGMALASADA, :PEWTERCRUNCHIES, :LUMBERRY, :HEALPOWDER ] allStatusItems.push(:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS xItems = { diff --git a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb index 3056211e9..0462bec9b 100644 --- a/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb +++ b/Data/Scripts/011_Battle/004_BattleHandlers_Items.rb @@ -975,12 +975,14 @@ BattleHandlers::CriticalCalcUserItem.add(:RAZORCLAW, BattleHandlers::CriticalCalcUserItem.copy(:RAZORCLAW,:SCOPELENS) -BattleHandlers::CriticalCalcUserItem.add(:STICK, +BattleHandlers::CriticalCalcUserItem.add(:LEEK, proc { |item,user,target,c| - next c+2 if user.isSpecies?(:FARFETCHD) + next c+2 if user.isSpecies?(:FARFETCHD) || user.isSpecies?(:SIRFETCHD) } ) +BattleHandlers::CriticalCalcUserItem.copy(:LEEK, :STICK) + #=============================================================================== # CriticalCalcTargetItem handlers #=============================================================================== diff --git a/Data/Scripts/011_Battle/005_Battle scene/009_Scene_Animations.rb b/Data/Scripts/011_Battle/005_Battle scene/009_Scene_Animations.rb index 50c6e47e2..086b78ada 100644 --- a/Data/Scripts/011_Battle/005_Battle scene/009_Scene_Animations.rb +++ b/Data/Scripts/011_Battle/005_Battle scene/009_Scene_Animations.rb @@ -43,7 +43,11 @@ class PokeBattle_Scene for i in 0...@battle.sideSizes[1] idxBattler = 2*i+1 next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny? - pbCommonAnimation("Shiny",@battle.battlers[idxBattler]) + if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny? + pbCommonAnimation("SuperShiny", @battle.battlers[idxBattler]) + else + pbCommonAnimation("Shiny", @battle.battlers[idxBattler]) + end end end end @@ -130,7 +134,11 @@ class PokeBattle_Scene # Play shininess animations for shiny Pokémon sendOuts.each do |b| next if !@battle.showAnims || !@battle.battlers[b[0]].shiny? - pbCommonAnimation("Shiny",@battle.battlers[b[0]]) + if Settings::SUPER_SHINY && @battle.battlers[b[0]].super_shiny? + pbCommonAnimation("SuperShiny", @battle.battlers[b[0]]) + else + pbCommonAnimation("Shiny", @battle.battlers[b[0]]) + end end end diff --git a/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb b/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb index 3016e44e5..9cbb99927 100644 --- a/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb +++ b/Data/Scripts/011_Battle/006_Other battle types/002_PokeBattle_SafariZone.rb @@ -13,16 +13,17 @@ class PokeBattle_FakeBattler @index = index end - def pokemonIndex; return 0; end - def species; return @pokemon.species; end - def gender; return @pokemon.gender; end - def status; return @pokemon.status; end - def hp; return @pokemon.hp; end - def level; return @pokemon.level; end - def name; return @pokemon.name; end - def totalhp; return @pokemon.totalhp; end - def displayGender; return @pokemon.gender; end - def shiny?; return @pokemon.shiny?; end + def pokemonIndex; return 0; end + def species; return @pokemon.species; end + def gender; return @pokemon.gender; end + def status; return @pokemon.status; end + def hp; return @pokemon.hp; end + def level; return @pokemon.level; end + def name; return @pokemon.name; end + def totalhp; return @pokemon.totalhp; end + def displayGender; return @pokemon.gender; end + def shiny?; return @pokemon.shiny?; end + def super_shiny?; return @pokemon.super_shiny?; end def isSpecies?(check_species) return @pokemon && @pokemon.isSpecies?(check_species) diff --git a/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb b/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb index bba19ef75..8f1c4eff6 100644 --- a/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb +++ b/Data/Scripts/011_Battle/006_Other battle types/008_PokeBattle_BattlePeer.rb @@ -27,7 +27,7 @@ class PokeBattle_RealBattlePeer player.party[player.party.length] = pkmn return -1 end - pkmn.heal + pkmn.heal if Settings::HEAL_STORED_POKEMON oldCurBox = pbCurrentBox storedBox = $PokemonStorage.pbStoreCaught(pkmn) if storedBox<0 diff --git a/Data/Scripts/011_Battle/Gen 8 abilities.rb b/Data/Scripts/011_Battle/Gen 8 abilities.rb index 37094141f..cbd44d880 100644 --- a/Data/Scripts/011_Battle/Gen 8 abilities.rb +++ b/Data/Scripts/011_Battle/Gen 8 abilities.rb @@ -270,6 +270,16 @@ BattleHandlers::PriorityBracketUseAbility.add(:QUICKDRAW, 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. + +Gulp Missile +After using Surf/Dive, changes the bearer's form depending on its HP. If hit by +an attack while in one of these forms, damages the attacker and causes an effect +depending on the form. + Ball Fetch At the end of a round in which a thrown Poké Ball fails to catch a Pokémon, bearer picks up that Poké Ball. Applies only to the first thrown Poké Ball, and @@ -280,11 +290,6 @@ When bearer is hit by a Fire- or Water-type move, bearer gets +6 Speed (after the effect of that move is applied). Outside of battle, makes eggs hatch twice as fast (doesn't stack with other such abilities). -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. - As One (Chilling) Combination of Unnerve and Chilling Neigh. Message upon entering battle says it has two abilities; other triggers use the name of the appropriate ability rather @@ -323,9 +328,4 @@ The bearer's type changes depending on the terrain. Triggers upon entering battle and when terrain changes (and not when bearer's type is changed, e.g. with Soak). -Gulp Missile -After using Surf/Dive, changes the bearer's form depending on its HP. If hit by -an attack while in one of these forms, damages the attacker and causes an effect -depending on the form. - =end diff --git a/Data/Scripts/011_Battle/Gen 8 items.rb b/Data/Scripts/011_Battle/Gen 8 items.rb index 8b047338e..a5036e76f 100644 --- a/Data/Scripts/011_Battle/Gen 8 items.rb +++ b/Data/Scripts/011_Battle/Gen 8 items.rb @@ -1,12 +1,290 @@ +ItemHandlers::UseOnPokemon.add(:EXPCANDYXS, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + gain_amount = 100 + maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil + qty = scene.scene.pbChooseNumber( + _INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum) + next false if qty = 0 + pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene) + $PokemonBag.pbDeleteItem(item, qty - 1) + scene.pbHardRefresh + next true +}) + +ItemHandlers::UseOnPokemon.add(:EXPCANDYS, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + gain_amount = 800 + maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil + qty = scene.scene.pbChooseNumber( + _INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum) + next false if qty = 0 + pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene) + $PokemonBag.pbDeleteItem(item, qty - 1) + scene.pbHardRefresh + next true +}) + +ItemHandlers::UseOnPokemon.add(:EXPCANDYM, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + gain_amount = 3_000 + maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil + qty = scene.scene.pbChooseNumber( + _INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum) + next false if qty = 0 + pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene) + $PokemonBag.pbDeleteItem(item, qty - 1) + scene.pbHardRefresh + next true +}) + +ItemHandlers::UseOnPokemon.add(:EXPCANDYL, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + gain_amount = 10_000 + maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil + qty = scene.scene.pbChooseNumber( + _INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum) + next false if qty = 0 + pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene) + $PokemonBag.pbDeleteItem(item, qty - 1) + scene.pbHardRefresh + next true +}) + +ItemHandlers::UseOnPokemon.add(:EXPCANDYXL, proc { |item, pkmn, scene| + if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + gain_amount = 30_000 + maximum = ((pkmn.growth_rate.maximum_exp - pkmn.exp) / gain_amount.to_f).ceil + qty = scene.scene.pbChooseNumber( + _INTL("How many {1} do you want to use?", GameData::Item.get(item).name), maximum) + next false if qty = 0 + pbChangeExp(pkmn, pkmn.exp + gain_amount * qty, scene) + $PokemonBag.pbDeleteItem(item, qty - 1) + scene.pbHardRefresh + next true +}) + +def pbNatureChangingMint(new_nature, item, pkmn, scene) + if pkmn.nature_for_stats == new_nature + scene.pbDisplay(_INTL("It won't have any effect.")) + return false + end + if !scene.pbConfirm(_INTL("It might affect {1}'s stats. Are you sure you want to use it?", pkmn.name)) + return false + end + pkmn.nature_for_stats = new_nature + pkmn.calc_stats + scene.pbRefresh + scene.pbDisplay(_INTL("{1}'s stats may have changed due to the effects of the {2}!", + pkmn.name, GameData::Item.get(item).name)) + return true +end + +ItemHandlers::UseOnPokemon.add(:LONELYMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:LONELY, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:ADAMANTMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:ADAMANT, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:NAUGHTYMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:NAUGHTY, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:BRAVEMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:BRAVE, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:BOLDMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:BOLD, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:IMPISHMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:IMPISH, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:LAXMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:LAX, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:RELAXEDMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:RELAXED, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:MODESTMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:MODEST, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:MILDMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:MILD, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:RASHMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:RASH, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:QUIETMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:QUIET, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:CALMMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:CALM, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:GENTLEMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:GENTLE, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:CAREFULMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:CAREFUL, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:SASSYMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:SASSY, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:TIMIDMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:TIMID, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:HASTYMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:HASTY, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:JOLLYMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:JOLLY, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:NAIVEMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:NAIVE, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.add(:SERIOUSMINT, proc { |item, pkmn, scene| + pbNatureChangingMint(:SERIOUS, item, pkmn, scene) +}) + +ItemHandlers::UseOnPokemon.copy(:MAXREVIVE, :MAXHONEY) + +ItemHandlers::CanUseInBattle.copy(:REVIVE, :MAXHONEY) + +ItemHandlers::BattleUseOnPokemon.copy(:MAXREVIVE, :MAXHONEY) + +ItemHandlers::CanUseInBattle.add(:MAXMUSHROOMS, proc { |item, pokemon, battler, move, firstAction, battle, scene, showMessages| + if !pbBattleItemCanRaiseStat?(:ATTACK, battler, scene, false) && + !pbBattleItemCanRaiseStat?(:DEFENSE, battler, scene, false) && + !pbBattleItemCanRaiseStat?(:SPECIAL_ATTACK, battler, scene, false) && + !pbBattleItemCanRaiseStat?(:SPECIAL_DEFENSE, battler, scene, false) && + !pbBattleItemCanRaiseStat?(:SPEED, battler, scene, false) + scene.pbDisplay(_INTL("It won't have any effect.")) if showMessages + next false + end + next true +}) + +ItemHandlers::BattleUseOnBattler.add(:MAXMUSHROOMS,proc { |item, battler, scene| + battler.pbRaiseStatStage(:ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:ATTACK, battler) + battler.pbRaiseStatStage(:DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:DEFENSE, battler) + battler.pbRaiseStatStage(:SPECIAL_ATTACK, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_ATTACK, battler) + battler.pbRaiseStatStage(:SPECIAL_DEFENSE, 1, battler) if battler.pbCanRaiseStatStage?(:SPECIAL_DEFENSE, battler) + battler.pbRaiseStatStage(:SPEED, 1, battler) if battler.pbCanRaiseStatStage?(:SPEED, battler) + battler.pokemon.changeHappiness("battleitem") +}) + +ItemHandlers::UseOnPokemon.add(:REINSOFUNITY, proc { |item, pkmn, scene| + if !pkmn.isSpecies?(:CALYREX) + scene.pbDisplay(_INTL("It had no effect.")) + next false + end + if pkmn.fainted? + scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon.")) + next false + end + # Fusing + if pkmn.fused.nil? + chosen = scene.pbChoosePokemon(_INTL("Fuse with which Pokémon?")) + next false if chosen < 0 + other_pkmn = $Trainer.party[chosen] + if pkmn == other_pkmn + scene.pbDisplay(_INTL("It cannot be fused with itself.")) + next false + elsif other_pkmn.egg? + scene.pbDisplay(_INTL("It cannot be fused with an Egg.")) + next false + elsif other_pkmn.fainted? + scene.pbDisplay(_INTL("It cannot be fused with that fainted Pokémon.")) + next false + elsif !other_pkmn.isSpecies?(:GLASTRIER) && + !other_pkmn.isSpecies?(:SPECTRIER) + scene.pbDisplay(_INTL("It cannot be fused with that Pokémon.")) + next false + end + newForm = 0 + newForm = 1 if other_pkmn.isSpecies?(:GLASTRIER) + newForm = 2 if other_pkmn.isSpecies?(:SPECTRIER) + pkmn.setForm(newForm) { + pkmn.fused = other_pkmn + $Trainer.remove_pokemon_at_index(chosen) + scene.pbHardRefresh + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) + } + next true + end + # Unfusing + if $Trainer.party_full? + scene.pbDisplay(_INTL("You have no room to separate the Pokémon.")) + next false + end + pkmn.setForm(0) { + $Trainer.party[$Trainer.party.length] = pkmn.fused + pkmn.fused = nil + scene.pbHardRefresh + scene.pbDisplay(_INTL("{1} changed Forme!", pkmn.name)) + } + next true +}) + +ItemHandlers::UseOnPokemon.add(:ABILITYPATCH, proc { |item, pkmn, scene| + if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name)) + abils = pkmn.getAbilityList + new_ability_id = nil + abils.each { |a| new_ability_id = a[0] if a[1] == 2 } + if !new_ability_id || pkmn.hasHiddenAbility? + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + new_ability_name = GameData::Ability.get(new_ability_id).name + pkmn.ability_index = 2 + scene.pbRefresh + scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", + pkmn.name, new_ability_name)) + next true + end + next false +}) + =begin -Leek (rename of Stick, works for Sirfetch'd too) -Feathers (rename of Wings) -Pewter Crunchies (Full Heal clone) +#=============================================================================== Pokémon Box Link -Key item, gives access to Pokémon storage (except at certain times, perhaps when -a Game Switch is on). +Key item, unusable. Enables pressing a button while in the party screen to open +the "Organise Boxes" mode of Pokémon storage. This is disabled at certain times, +perhaps when a Game Switch is on. Rusted Sword Changes form of Zacian holding it. In battle, changes Zacian's Iron Head to @@ -16,20 +294,8 @@ Rusted Shield Changes form of Zamazenta holding it. In battle, changes Zamazenta's Iron Head to Behemoth Bash. -Fossils -No effect themselves, but can be combined and revived. - -Sweets -Milcery evolution item (spin while holding). - -Sweet Apple, Tart Apple -Evolution stone for Applin. - -Cracked Pot, Chipped Pot -Evolution stone for Sinistea. - Throat Spray -After holder uses a sound-based move, consume item and holders gets +1 Special +After holder uses a sound-based move, consume item and holder gets +1 Special Attack (unless battle ends). Eject Pack @@ -37,14 +303,10 @@ When holder's stat(s) is lowered, consume item and holder switches out. Not triggered by Parting Shot, or if a faster mon's Eject Button/Eject Pack triggers. -Heavy-Duty Boots -Holder is immune to entry hazards. Poison-type holder will still remove Toxic -Spikes. - Blunder Policy If holder's move fails its accuracy check, consume item and holder gets +2 -Speed. Doesn't trigger if move was a OHKO move, or Triple Kick that hit at least -once. +Speed. Doesn't trigger if move was an OHKO move, or Triple Kick that hit at +least once. Room Service If Trick Room is used, or if holder switches in while Trick Room applies, @@ -53,40 +315,13 @@ consume item and holder gets -1 Speed. Utility Umbrella Holder is unaffected by sun and rain weathers. -Exp. Candies -Gives a fixed number of Exp points. - -TRs - -Mints -Overrides a Pokémon's nature effect. - Catching Charm -Increases the chance of a critical catch. +Increases the chance of a critical catch. By how much? Rotom Catalog Changes Rotom's form (choosable). -Max Honey -Max Revive clone. - -Max Mushrooms -Use from Bag: Raise a Pokémon's Attack, Defense, Speed, Special Attack and -Special Defence by 1 stage each. - -Galarica Cuff, Galarica Wreath -Evolution stone for Galarian Slowpoke. - -Exp. Charm -Boosts experience gained from battles by 50%. - Mark Charm -Increases the chance of a wild Pokémon having a mark - -Reins of Unity -Fuses Calyrex with either Glastrier or Spectrier, or unfuses them. - -Ability Patch -Changes a Pokémon's ability to its hidden ability. +Increases the chance of a wild Pokémon having a mark. =end diff --git a/Data/Scripts/013_Items/001_Item_Utilities.rb b/Data/Scripts/013_Items/001_Item_Utilities.rb index be1e11ec8..11fab3d3a 100644 --- a/Data/Scripts/013_Items/001_Item_Utilities.rb +++ b/Data/Scripts/013_Items/001_Item_Utilities.rb @@ -117,69 +117,73 @@ end #=============================================================================== # Change a Pokémon's level #=============================================================================== -def pbChangeLevel(pkmn,newlevel,scene) - newlevel = newlevel.clamp(1, GameData::GrowthRate.max_level) - if pkmn.level==newlevel - pbMessage(_INTL("{1}'s level remained unchanged.",pkmn.name)) - elsif pkmn.level>newlevel - attackdiff = pkmn.attack - defensediff = pkmn.defense - speeddiff = pkmn.speed - spatkdiff = pkmn.spatk - spdefdiff = pkmn.spdef - totalhpdiff = pkmn.totalhp - pkmn.level = newlevel +def pbChangeLevel(pkmn, new_level, scene) + new_level = new_level.clamp(1, GameData::GrowthRate.max_level) + if pkmn.level == new_level + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1}'s level remained unchanged.", pkmn.name)) + else + pbMessage(_INTL("{1}'s level remained unchanged.", pkmn.name)) + end + return + end + old_total_hp = pkmn.totalhp + old_attack = pkmn.attack + old_defense = pkmn.defense + old_special_attack = pkmn.spatk + old_special_defense = pkmn.spdef + old_speed = pkmn.speed + if pkmn.level > new_level + pkmn.level = new_level pkmn.calc_stats scene.pbRefresh - pbMessage(_INTL("{1} dropped to Lv. {2}!",pkmn.name,pkmn.level)) - attackdiff = pkmn.attack-attackdiff - defensediff = pkmn.defense-defensediff - speeddiff = pkmn.speed-speeddiff - spatkdiff = pkmn.spatk-spatkdiff - spdefdiff = pkmn.spdef-spdefdiff - totalhpdiff = pkmn.totalhp-totalhpdiff + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level)) + else + pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level)) + end + total_hp_diff = pkmn.totalhp - old_total_hp + attack_diff = pkmn.attack - old_attack + defense_diff = pkmn.defense - old_defense + special_attack_diff = pkmn.spatk - old_special_attack + special_defense_diff = pkmn.spdef - old_special_defense + speed_diff = pkmn.speed - old_speed pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", - totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff)) + total_hp_diff, attack_diff, defense_diff, special_attack_diff, special_defense_diff, speed_diff), scene) pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", - pkmn.totalhp,pkmn.attack,pkmn.defense,pkmn.spatk,pkmn.spdef,pkmn.speed)) + pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene) else - attackdiff = pkmn.attack - defensediff = pkmn.defense - speeddiff = pkmn.speed - spatkdiff = pkmn.spatk - spdefdiff = pkmn.spdef - totalhpdiff = pkmn.totalhp - pkmn.level = newlevel + pkmn.level = new_level pkmn.changeHappiness("vitamin") pkmn.calc_stats scene.pbRefresh if scene.is_a?(PokemonPartyScreen) - scene.pbDisplay(_INTL("{1} grew to Lv. {2}!",pkmn.name,pkmn.level)) + scene.pbDisplay(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level)) else - pbMessage(_INTL("{1} grew to Lv. {2}!",pkmn.name,pkmn.level)) + pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level)) end - attackdiff = pkmn.attack-attackdiff - defensediff = pkmn.defense-defensediff - speeddiff = pkmn.speed-speeddiff - spatkdiff = pkmn.spatk-spatkdiff - spdefdiff = pkmn.spdef-spdefdiff - totalhpdiff = pkmn.totalhp-totalhpdiff + total_hp_diff = pkmn.totalhp - old_total_hp + attack_diff = pkmn.attack - old_attack + defense_diff = pkmn.defense - old_defense + special_attack_diff = pkmn.spatk - old_special_attack + special_defense_diff = pkmn.spdef - old_special_defense + speed_diff = pkmn.speed - old_speed pbTopRightWindow(_INTL("Max. HP+{1}\r\nAttack+{2}\r\nDefense+{3}\r\nSp. Atk+{4}\r\nSp. Def+{5}\r\nSpeed+{6}", - totalhpdiff,attackdiff,defensediff,spatkdiff,spdefdiff,speeddiff),scene) + total_hp_diff, attack_diff, defense_diff, special_attack_diff, special_defense_diff, speed_diff), scene) pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", - pkmn.totalhp,pkmn.attack,pkmn.defense,pkmn.spatk,pkmn.spdef,pkmn.speed),scene) + pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene) # Learn new moves upon level up movelist = pkmn.getMoveList for i in movelist - next if i[0]!=pkmn.level - pbLearnMove(pkmn,i[1],true) { scene.pbUpdate } + next if i[0] != pkmn.level + pbLearnMove(pkmn, i[1], true) { scene.pbUpdate } end # Check for evolution - newspecies = pkmn.check_evolution_on_level_up - if newspecies + new_species = pkmn.check_evolution_on_level_up + if new_species pbFadeOutInWithMusic { evo = PokemonEvolutionScene.new - evo.pbStartScreen(pkmn,newspecies) + evo.pbStartScreen(pkmn, new_species) evo.pbEvolution evo.pbEndScreen scene.pbRefresh if scene.is_a?(PokemonPartyScreen) @@ -191,7 +195,7 @@ end def pbTopRightWindow(text, scene = nil) window = Window_AdvancedTextPokemon.new(text) window.width = 198 - window.x = Graphics.width-window.width + window.x = Graphics.width - window.width window.y = 0 window.z = 99999 pbPlayDecisionSE @@ -205,6 +209,98 @@ def pbTopRightWindow(text, scene = nil) window.dispose end +def pbChangeExp(pkmn, new_exp, scene) + new_exp = new_exp.clamp(0, pkmn.growth_rate.maximum_exp) + if pkmn.exp == new_exp + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name)) + else + pbMessage(_INTL("{1}'s Exp. Points remained unchanged.", pkmn.name)) + end + return + end + old_level = pkmn.level + old_total_hp = pkmn.totalhp + old_attack = pkmn.attack + old_defense = pkmn.defense + old_special_attack = pkmn.spatk + old_special_defense = pkmn.spdef + old_speed = pkmn.speed + if pkmn.exp > new_exp # Loses Exp + difference = pkmn.exp - new_exp + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference)) + else + pbMessage(_INTL("{1} lost {2} Exp. Points!", pkmn.name, difference)) + end + pkmn.exp = new_exp + pkmn.calc_stats + scene.pbRefresh + return if pkmn.level == old_level + # Level changed + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level)) + else + pbMessage(_INTL("{1} dropped to Lv. {2}!", pkmn.name, pkmn.level)) + end + total_hp_diff = pkmn.totalhp - old_total_hp + attack_diff = pkmn.attack - old_attack + defense_diff = pkmn.defense - old_defense + special_attack_diff = pkmn.spatk - old_special_attack + special_defense_diff = pkmn.spdef - old_special_defense + speed_diff = pkmn.speed - old_speed + pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", + total_hp_diff, attack_diff, defense_diff, special_attack_diff, special_defense_diff, speed_diff), scene) + pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", + pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene) + else # Gains Exp + difference = new_exp - pkmn.exp + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference)) + else + pbMessage(_INTL("{1} gained {2} Exp. Points!", pkmn.name, difference)) + end + pkmn.exp = new_exp + pkmn.changeHappiness("vitamin") + pkmn.calc_stats + scene.pbRefresh + return if pkmn.level == old_level + # Level changed + if scene.is_a?(PokemonPartyScreen) + scene.pbDisplay(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level)) + else + pbMessage(_INTL("{1} grew to Lv. {2}!", pkmn.name, pkmn.level)) + end + total_hp_diff = pkmn.totalhp - old_total_hp + attack_diff = pkmn.attack - old_attack + defense_diff = pkmn.defense - old_defense + special_attack_diff = pkmn.spatk - old_special_attack + special_defense_diff = pkmn.spdef - old_special_defense + speed_diff = pkmn.speed - old_speed + pbTopRightWindow(_INTL("Max. HP+{1}\r\nAttack+{2}\r\nDefense+{3}\r\nSp. Atk+{4}\r\nSp. Def+{5}\r\nSpeed+{6}", + total_hp_diff, attack_diff, defense_diff, special_attack_diff, special_defense_diff, speed_diff), scene) + pbTopRightWindow(_INTL("Max. HP{1}\r\nAttack{2}\r\nDefense{3}\r\nSp. Atk{4}\r\nSp. Def{5}\r\nSpeed{6}", + pkmn.totalhp, pkmn.attack, pkmn.defense, pkmn.spatk, pkmn.spdef, pkmn.speed), scene) + # Learn new moves upon level up + movelist = pkmn.getMoveList + for i in movelist + next if i[0] <= old_level || i[0] > pkmn.level + pbLearnMove(pkmn, i[1], true) { scene.pbUpdate } + end + # Check for evolution + new_species = pkmn.check_evolution_on_level_up + if new_species + pbFadeOutInWithMusic { + evo = PokemonEvolutionScene.new + evo.pbStartScreen(pkmn, new_species) + evo.pbEvolution + evo.pbEndScreen + scene.pbRefresh if scene.is_a?(PokemonPartyScreen) + } + end + end +end + #=============================================================================== # Restore HP #=============================================================================== diff --git a/Data/Scripts/013_Items/002_Item_Effects.rb b/Data/Scripts/013_Items/002_Item_Effects.rb index 00b9ebd65..11b3e9961 100644 --- a/Data/Scripts/013_Items/002_Item_Effects.rb +++ b/Data/Scripts/013_Items/002_Item_Effects.rb @@ -479,7 +479,7 @@ ItemHandlers::UseOnPokemon.add(:FULLHEAL,proc { |item,pkmn,scene| ItemHandlers::UseOnPokemon.copy(:FULLHEAL, :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMIOSEGALETTE,:SHALOURSABLE, - :BIGMALASADA,:LUMBERRY) + :BIGMALASADA,:PEWTERCRUNCHIES,:LUMBERRY) ItemHandlers::UseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::UseOnPokemon.add(:FULLRESTORE,proc { |item,pkmn,scene| @@ -705,7 +705,7 @@ ItemHandlers::UseOnPokemon.add(:CARBOS,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.add(:HEALTHFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:HP,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -716,7 +716,9 @@ ItemHandlers::UseOnPokemon.add(:HEALTHWING,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.copy(:HEALTHFEATHER,:HEALTHWING) + +ItemHandlers::UseOnPokemon.add(:MUSCLEFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:ATTACK,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -726,7 +728,9 @@ ItemHandlers::UseOnPokemon.add(:MUSCLEWING,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:RESISTWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.copy(:MUSCLEFEATHER,:MUSCLEWING) + +ItemHandlers::UseOnPokemon.add(:RESISTFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:DEFENSE,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -736,7 +740,9 @@ ItemHandlers::UseOnPokemon.add(:RESISTWING,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.copy(:RESISTFEATHER,:RESISTWING) + +ItemHandlers::UseOnPokemon.add(:GENIUSFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:SPECIAL_ATTACK,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -746,7 +752,9 @@ ItemHandlers::UseOnPokemon.add(:GENIUSWING,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.copy(:GENIUSFEATHER,:GENIUSWING) + +ItemHandlers::UseOnPokemon.add(:CLEVERFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:SPECIAL_DEFENSE,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -756,7 +764,9 @@ ItemHandlers::UseOnPokemon.add(:CLEVERWING,proc { |item,pkmn,scene| next true }) -ItemHandlers::UseOnPokemon.add(:SWIFTWING,proc { |item,pkmn,scene| +ItemHandlers::UseOnPokemon.copy(:CLEVERFEATHER,:CLEVERWING) + +ItemHandlers::UseOnPokemon.add(:SWIFTFEATHER,proc { |item,pkmn,scene| if pbRaiseEffortValues(pkmn,:SPEED,1,false)==0 scene.pbDisplay(_INTL("It won't have any effect.")) next false @@ -766,6 +776,8 @@ ItemHandlers::UseOnPokemon.add(:SWIFTWING,proc { |item,pkmn,scene| next true }) +ItemHandlers::UseOnPokemon.copy(:SWIFTFEATHER,:SWIFTWING) + ItemHandlers::UseOnPokemon.add(:RARECANDY,proc { |item,pkmn,scene| if pkmn.level>=GameData::GrowthRate.max_level || pkmn.shadowPokemon? scene.pbDisplay(_INTL("It won't have any effect.")) @@ -1088,23 +1100,23 @@ ItemHandlers::UseOnPokemon.add(:NLUNARIZER,proc { |item,pkmn,scene| }) ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE,proc { |item,pkmn,scene| - abils = pkmn.getAbilityList - abil1 = nil; abil2 = nil - for i in abils - abil1 = i[0] if i[1]==0 - abil2 = i[0] if i[1]==1 - end - if abil1.nil? || abil2.nil? || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE) - scene.pbDisplay(_INTL("It won't have any effect.")) - next false - end - newabil = (pkmn.ability_index + 1) % 2 - newabilname = GameData::Ability.get((newabil==0) ? abil1 : abil2).name - if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?", - pkmn.name,newabilname)) + if scene.pbConfirm(_INTL("Do you want to change {1}'s Ability?", pkmn.name)) + abils = pkmn.getAbilityList + abil1 = nil + abil2 = nil + for i in abils + abil1 = i[0] if i[1] == 0 + abil2 = i[0] if i[1] == 1 + end + if abil1.nil? || abil2.nil? || pkmn.hasHiddenAbility? || pkmn.isSpecies?(:ZYGARDE) + scene.pbDisplay(_INTL("It won't have any effect.")) + next false + end + newabil = (pkmn.ability_index + 1) % 2 + newabilname = GameData::Ability.get((newabil == 0) ? abil1 : abil2).name pkmn.ability_index = newabil scene.pbRefresh - scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!",pkmn.name,newabilname)) + scene.pbDisplay(_INTL("{1}'s Ability changed! Its Ability is now {2}!", pkmn.name, newabilname)) next true end next false diff --git a/Data/Scripts/013_Items/003_Item_BattleEffects.rb b/Data/Scripts/013_Items/003_Item_BattleEffects.rb index 582535d68..d7ec0616b 100644 --- a/Data/Scripts/013_Items/003_Item_BattleEffects.rb +++ b/Data/Scripts/013_Items/003_Item_BattleEffects.rb @@ -122,7 +122,7 @@ ItemHandlers::CanUseInBattle.add(:FULLHEAL,proc { |item,pokemon,battler,move,fir ItemHandlers::CanUseInBattle.copy(:FULLHEAL, :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMIOSEGALETTE,:SHALOURSABLE, - :BIGMALASADA,:LUMBERRY,:HEALPOWDER) + :BIGMALASADA,:PEWTERCRUNCHIES,:LUMBERRY,:HEALPOWDER) ItemHandlers::CanUseInBattle.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::CanUseInBattle.add(:FULLRESTORE,proc { |item,pokemon,battler,move,firstAction,battle,scene,showMessages| @@ -419,7 +419,7 @@ ItemHandlers::BattleUseOnPokemon.add(:FULLHEAL,proc { |item,pokemon,battler,choi ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL, :LAVACOOKIE,:OLDGATEAU,:CASTELIACONE,:LUMIOSEGALETTE,:SHALOURSABLE, - :BIGMALASADA,:LUMBERRY) + :BIGMALASADA,:PEWTERCRUNCHIES,:LUMBERRY) ItemHandlers::BattleUseOnPokemon.copy(:FULLHEAL,:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS ItemHandlers::BattleUseOnPokemon.add(:FULLRESTORE,proc { |item,pokemon,battler,choices,scene| diff --git a/Data/Scripts/014_Pokemon/001_Pokemon.rb b/Data/Scripts/014_Pokemon/001_Pokemon.rb index c7ca19e1a..c16b8868f 100644 --- a/Data/Scripts/014_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/014_Pokemon/001_Pokemon.rb @@ -388,6 +388,24 @@ class Pokemon return @shiny end + # @return [Boolean] whether this Pokémon is super shiny (differently colored, + # square sparkles) + def super_shiny? + if @super_shiny.nil? + a = @personalID ^ @owner.id + b = a & 0xFFFF + c = (a >> 16) & 0xFFFF + d = b ^ c + @super_shiny = (d == 0) + end + return @super_shiny + end + + def super_shiny=(value) + @super_shiny = value + @shiny = true if @super_shiny + end + #============================================================================= # Ability #============================================================================= diff --git a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb index 3a9cac03e..35731ccee 100644 --- a/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb +++ b/Data/Scripts/016_UI/001_Non-interactive UI/003_UI_EggHatching.rb @@ -217,7 +217,7 @@ Events.onStepTaken += proc { |_sender,_e| next if egg.steps_to_hatch <= 0 egg.steps_to_hatch -= 1 for i in $Trainer.pokemon_party - next if !i.hasAbility?(:FLAMEBODY) && !i.hasAbility?(:MAGMAARMOR) + next if ![:FLAMEBODY, :MAGMAARMOR, :STEAMENGINE].include?(i.ability_id) egg.steps_to_hatch -= 1 break end diff --git a/Data/Scripts/016_UI/005_UI_Party.rb b/Data/Scripts/016_UI/005_UI_Party.rb index 9b6ebd758..c8a9e7695 100644 --- a/Data/Scripts/016_UI/005_UI_Party.rb +++ b/Data/Scripts/016_UI/005_UI_Party.rb @@ -564,6 +564,10 @@ class PokemonParty_Scene return ret end + def pbChooseNumber(helptext, maximum, initnum = 1) + return UIHelper.pbChooseNumber(@sprites["helpwindow"], helptext, maximum, initnum) { pbUpdate } + end + def pbSetHelpText(helptext) helpwindow = @sprites["helpwindow"] pbBottomLeftLines(helpwindow,1) diff --git a/Data/Scripts/Gen 8 notes.txt b/Data/Scripts/Gen 8 notes.txt index a8fb90970..c0cabfc07 100644 --- a/Data/Scripts/Gen 8 notes.txt +++ b/Data/Scripts/Gen 8 notes.txt @@ -5,18 +5,11 @@ its name when sent out in battle. A Pokémon can only have 0 or 1 marks. The title can be toggled. Ribbons also provide a title, and can similarly be toggled. (Probably don't bother implementing.) -Super shininess. Only difference is an alternate shiny common animation with -square sparkles; a mon is super shiny if the calculated number that is compared -to Settings::SHINY_POKEMON_CHANCE is exactly 0. - The game records, for each species, how many have been caught or defeated (counts both wild and trainer battles), and the shiny chance increases for that species because of this. This value is also shown in the Pokédex entry screen. -"Pokémon no longer lose access to moves by evolving." I'm not sure what this -means. Maybe evolving causes the first_moves to be cleared (in the GF games; it -isn't cleared in Essentials)? In Gen 8+, a taught TR should be added to the -first_moves array. +In Gen 8+, a taught TR should be added to the Pokémon's first_moves array. Some moves have changed properties/effects. @@ -32,6 +25,17 @@ the Town Map if possible (good QoL, add if possible). Remote access to storage boxes. Add an option to the pause screen for this unless Settings::HEAL_STORED_POKEMON? +Example event that combines the Gen 8 fossils. + +New evolution methods: +- Milcery (spinning while holding an item) +- Galarian Farfetch'd (performing 3 critical hits in a single battle) +- 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) +- Kubfu (triggered by an event; Kubfu's form can be set beforehand by the event, + so don't worry about the multiple forms it can evolve into) + # PBS file data: # - Form differences. # - Moveset changes. @@ -42,10 +46,16 @@ unless Settings::HEAL_STORED_POKEMON? # - Vice Grip becomes Vise Grip. # - Some items change names (Stick -> Leek, etc.). +Add AI for new moves/items/abilities. + #=============================================================================== # Implemented #=============================================================================== Pokémon sent to storage aren't healed - see Settings::HEAL_STORED_POKEMON. +Super shininess. Only difference is an alternate shiny common animation with +square sparkles; a mon is super shiny if the calculated number that is compared +to Settings::SHINY_POKEMON_CHANCE is exactly 0 - see Settings::SUPER_SHINY. + =end