From e9ed260277491698843cb039ce1a72f68e6d7b33 Mon Sep 17 00:00:00 2001 From: Maruno17 Date: Wed, 3 Feb 2021 20:33:46 +0000 Subject: [PATCH] Some bug fixes --- .../004_AI/006_AI_Move_Utilities.rb | 4 ++-- .../005_PokeBattle_SceneMenus.rb | 4 ++-- Data/Scripts/014_Trainers/001_Trainer.rb | 2 +- .../001_Debug menus/002_Debug_MenuCommands.rb | 23 ++++++++++--------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb b/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb index 0bd4b8a58..7a3d57866 100644 --- a/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb +++ b/Data/Scripts/012_Battle/004_AI/006_AI_Move_Utilities.rb @@ -56,7 +56,7 @@ class PokeBattle_AI end def pbCalcTypeMod(moveType,user,target) - return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType<0 + return PBTypeEffectiveness::NORMAL_EFFECTIVE if !moveType return PBTypeEffectiveness::NORMAL_EFFECTIVE if moveType == :GROUND && target.pbHasType?(:FLYING) && target.hasActiveItem?(:IRONBALL) # Determine types @@ -93,7 +93,7 @@ class PokeBattle_AI return true if PBTypeEffectiveness.ineffective?(typeMod) || score<=0 # Immunity due to ability/item/other effects if skill>=PBTrainerAI.mediumSkill - case move.type + case type when :GROUND return true if target.airborne? && !move.hitsFlyingTargets? when :FIRE diff --git a/Data/Scripts/012_Battle/005_Battle scene/005_PokeBattle_SceneMenus.rb b/Data/Scripts/012_Battle/005_Battle scene/005_PokeBattle_SceneMenus.rb index 8dfb6de47..b8db1c960 100644 --- a/Data/Scripts/012_Battle/005_Battle scene/005_PokeBattle_SceneMenus.rb +++ b/Data/Scripts/012_Battle/005_Battle scene/005_PokeBattle_SceneMenus.rb @@ -350,7 +350,7 @@ class FightMenuDisplay < BattleMenuBase x = button.x-self.x+button.src_rect.width/2 y = button.y-self.y+8 moveNameBase = TEXT_BASE_COLOR - if moves[i].type>=0 + if moves[i].type # NOTE: This takes a colour from a particular pixel in the button # graphic and makes the move name's base colour that same colour. # The pixel is at coordinates 10,34 in the button box. If you @@ -374,7 +374,7 @@ class FightMenuDisplay < BattleMenuBase end @visibility["button_#{i}"] = true button.src_rect.x = (i==@index) ? @buttonBitmap.width/2 : 0 - button.src_rect.y = moves[i].type*BUTTON_HEIGHT + button.src_rect.y = GameData::Type.get(moves[i].type).id_number * BUTTON_HEIGHT button.z = self.z + ((i==@index) ? 4 : 3) end end diff --git a/Data/Scripts/014_Trainers/001_Trainer.rb b/Data/Scripts/014_Trainers/001_Trainer.rb index a56128b34..7e7dab3d4 100644 --- a/Data/Scripts/014_Trainers/001_Trainer.rb +++ b/Data/Scripts/014_Trainers/001_Trainer.rb @@ -183,7 +183,7 @@ class NPCTrainer < Trainer def initialize(name, trainer_type) super @items = [] - @lose_text = GameData::TrainerType.get(@trainer_type).lose_text + @lose_text = nil end end diff --git a/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb b/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb index fe8a05da0..8cf9c782d 100644 --- a/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb +++ b/Data/Scripts/021_Debug/001_Debug menus/002_Debug_MenuCommands.rb @@ -205,6 +205,7 @@ DebugMenuCommands.register("testwildbattle", { pbWildBattle(species, level) end end + next false } }) @@ -268,6 +269,7 @@ DebugMenuCommands.register("testwildbattleadvanced", { end end end + next false } }) @@ -276,11 +278,11 @@ DebugMenuCommands.register("testtrainerbattle", { "name" => _INTL("Test Trainer Battle"), "description" => _INTL("Start a single battle against a trainer of your choice."), "effect" => proc { - battle = pbListScreen(_INTL("SINGLE TRAINER"), TrainerBattleLister.new(0, false)) - if battle - trainerdata = battle[1] + trainerdata = pbListScreen(_INTL("SINGLE TRAINER"), TrainerBattleLister.new(0, false)) + if trainerdata pbTrainerBattle(trainerdata[0], trainerdata[1], nil, false, trainerdata[2], true) end + next false } }) @@ -350,20 +352,18 @@ DebugMenuCommands.register("testtrainerbattleadvanced", { _INTL("Choose the number of battlers on the player's side (max. {1}).", maxVal), params) size0 = newSize if newSize > 0 elsif trainerCmd == trainerCmds.length - 4 # Add trainer - battle = pbListScreen(_INTL("CHOOSE A TRAINER"), TrainerBattleLister.new(0, false)) - if battle - trainerdata = battle[1] + trainerdata = pbListScreen(_INTL("CHOOSE A TRAINER"), TrainerBattleLister.new(0, false)) + if trainerdata tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2]) - trainers.push([battle[0], tr]) + trainers.push([0, tr]) end else # Edit a trainer if pbConfirmMessage(_INTL("Change this trainer?")) - battle = pbListScreen(_INTL("CHOOSE A TRAINER"), + trainerdata = pbListScreen(_INTL("CHOOSE A TRAINER"), TrainerBattleLister.new(trainers[trainerCmd][0], false)) - if battle - trainerdata = battle[1] + if trainerdata tr = pbLoadTrainer(trainerdata[0], trainerdata[1], trainerdata[2]) - trainers[trainerCmd] = [battle[0], tr] + trainers[trainerCmd] = [0, tr] end elsif pbConfirmMessage(_INTL("Delete this trainer?")) trainers[trainerCmd] = nil @@ -371,6 +371,7 @@ DebugMenuCommands.register("testtrainerbattleadvanced", { end end end + next false } })