Some bug fixes

This commit is contained in:
Maruno17
2021-02-03 20:33:46 +00:00
parent e1e9706cd9
commit e9ed260277
4 changed files with 17 additions and 16 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
}
})