From 66b40fd18186efe881d77eb73ef99d4a55233ef4 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Sat, 15 May 2021 20:28:15 +0100 Subject: [PATCH] =?UTF-8?q?Fixed=20typo=20in=20egg=20generatio,=20fixed=20?= =?UTF-8?q?typo=20in=20battle=20code=20that=20changes=20a=20Pok=C3=A9mon's?= =?UTF-8?q?=20type,=20fixed=20bug=20in=20AI=20that=20prevents=20switching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../011_Battle/001_Battler/003_Battler_ChangeSelf.rb | 2 +- Data/Scripts/011_Battle/004_AI/003_AI_Switch.rb | 6 +++--- Data/Scripts/012_Overworld/007_Overworld_DayCare.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb index bbe2a09a5..6f61d21df 100644 --- a/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb +++ b/Data/Scripts/011_Battle/001_Battler/003_Battler_ChangeSelf.rb @@ -118,7 +118,7 @@ class PokeBattle_Battler @type2 = (newTypes.length == 1) ? newTypes[0] : newTypes[1] @effects[PBEffects::Type3] = newType3 else - newType = GameData::Item.get(newType).id + newType = GameData::Type.get(newType).id @type1 = newType @type2 = newType @effects[PBEffects::Type3] = nil diff --git a/Data/Scripts/011_Battle/004_AI/003_AI_Switch.rb b/Data/Scripts/011_Battle/004_AI/003_AI_Switch.rb index 3e1b8df7c..a980b24e2 100644 --- a/Data/Scripts/011_Battle/004_AI/003_AI_Switch.rb +++ b/Data/Scripts/011_Battle/004_AI/003_AI_Switch.rb @@ -10,7 +10,7 @@ class PokeBattle_AI return false if @battle.wildBattle? shouldSwitch = forceSwitch batonPass = -1 - moveType = -1 + moveType = nil skill = @battle.pbGetOwnerFromBattlerIndex(idxBattler).skill_level || 0 battler = @battle.battlers[idxBattler] # If Pokémon is within 6 levels of the foe, and foe's last move was @@ -107,7 +107,7 @@ class PokeBattle_AI end end # moveType is the type of the target's last used move - if moveType>=0 && Effectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler)) + if moveType && Effectiveness.ineffective?(pbCalcTypeMod(moveType,battler,battler)) weight = 65 typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true)) if Effectiveness.super_effective?(typeMod) @@ -115,7 +115,7 @@ class PokeBattle_AI weight = 85 end list.unshift(i) if pbAIRandom(100)=0 && Effectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler)) + elsif moveType && Effectiveness.resistant?(pbCalcTypeMod(moveType,battler,battler)) weight = 40 typeMod = pbCalcTypeModPokemon(pkmn,battler.pbDirectOpposing(true)) if Effectiveness.super_effective?(typeMod) diff --git a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb index d1d94e08d..ae87404ff 100644 --- a/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb +++ b/Data/Scripts/012_Overworld/007_Overworld_DayCare.rb @@ -172,7 +172,7 @@ def pbDayCareGenerateEgg babyspecies = (ditto1) ? father.species : mother.species end # Determine the egg's species - babyspecies = GameData::Species.get(babyspecies).get_bably_species(true, mother.item_id, father.item_id) + babyspecies = GameData::Species.get(babyspecies).get_baby_species(true, mother.item_id, father.item_id) case babyspecies when :MANAPHY babyspecies = :PHIONE if GameData::Species.exists?(:PHIONE)