Fixed: some items not working in battle, typo in Shell Trap's AI, Vs animation not triggering, Battle Factory Pokémon being chosen incorrectly, Battle Factory double mode being single battles, some game data not being cleared when compiling

This commit is contained in:
Maruno17
2021-06-12 15:44:13 +01:00
parent 7c3fdb9ef8
commit 63fb7aadf7
9 changed files with 19 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
#==============================================================================# #==============================================================================#
# Pokémon Essentials # # Pokémon Essentials #
# Version 19.1 # # Version 19.1.dev #
# https://github.com/Maruno17/pokemon-essentials # # https://github.com/Maruno17/pokemon-essentials #
#==============================================================================# #==============================================================================#
@@ -393,6 +393,6 @@ end
# DO NOT EDIT THESE! # DO NOT EDIT THESE!
module Essentials module Essentials
VERSION = "19.1" VERSION = "19.1.dev"
ERROR_TEXT = "" ERROR_TEXT = ""
end end

View File

@@ -411,7 +411,7 @@ class PokeBattle_Battler
def hasActiveItem?(check_item, ignore_fainted = false) def hasActiveItem?(check_item, ignore_fainted = false)
return false if !itemActive?(ignore_fainted) return false if !itemActive?(ignore_fainted)
return check_item.include?(@item_id) if check_item.is_a?(Array) return check_item.include?(@item_id) if check_item.is_a?(Array)
return check_item == self.item return self.item == check_item
end end
alias hasWorkingItem hasActiveItem? alias hasWorkingItem hasActiveItem?

View File

@@ -3022,7 +3022,7 @@ class PokeBattle_AI
elsif skill>=PBTrainerAI.highSkill && reserves==0 && foes==0 elsif skill>=PBTrainerAI.highSkill && reserves==0 && foes==0
score += 80 # want to draw score += 80 # want to draw
else else
score -= (user.total.hp-user.hp)*75/user.totalhp score -= (user.totalhp-user.hp)*75/user.totalhp
end end
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
when "171" when "171"

View File

@@ -136,7 +136,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
if tr_type if tr_type
tbargraphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil tbargraphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil
tgraphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil tgraphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
if pbResolveBitmap(tbargraphic) && pbResolveBitmap(tgraphic) if pbResolveBitmap("Graphics/Transitions/" + tbargraphic) && pbResolveBitmap("Graphics/Transitions/" + tgraphic)
player_tr_type = $Trainer.trainer_type player_tr_type = $Trainer.trainer_type
outfit = $Trainer.outfit outfit = $Trainer.outfit
# Set up # Set up
@@ -154,7 +154,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
overlay.bitmap = Bitmap.new(Graphics.width,Graphics.height) overlay.bitmap = Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(overlay.bitmap) pbSetSystemFont(overlay.bitmap)
pbargraphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil pbargraphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
if !pbResolveBitmap(pbargraphic) if !pbResolveBitmap("Graphics/Transitions/" + pbargraphic)
pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
end end
xoffset = ((Graphics.width/2)/10)*10 xoffset = ((Graphics.width/2)/10)*10
@@ -193,7 +193,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
bar2 = AnimatedPlane.new(viewopp) bar2 = AnimatedPlane.new(viewopp)
bar2.bitmap = RPG::Cache.transition(tbargraphic) bar2.bitmap = RPG::Cache.transition(tbargraphic)
pgraphic = sprintf("vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil pgraphic = sprintf("vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil
if !pbResolveBitmap(pgraphic) if !pbResolveBitmap("Graphics/Transitions/" + pgraphic)
pgraphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil pgraphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil
end end
player = Sprite.new(viewplayer) player = Sprite.new(viewplayer)

View File

@@ -170,7 +170,7 @@ class Trainer
#============================================================================= #=============================================================================
def initialize(name, trainer_type) def initialize(name, trainer_type)
@trainer_type = trainer_type @trainer_type = GameData::TrainerType.get(trainer_type).id
@name = name @name = name
@id = rand(2 ** 16) | rand(2 ** 16) << 16 @id = rand(2 ** 16) | rand(2 ** 16) << 16
@language = pbGetLanguage @language = pbGetLanguage

View File

@@ -31,6 +31,13 @@ class Player < Trainer
# @return [Array<Array>] downloaded Mystery Gift data # @return [Array<Array>] downloaded Mystery Gift data
attr_accessor :mystery_gifts attr_accessor :mystery_gifts
def trainer_type
if @trainer_type.is_a?(Integer)
@trainer_type = GameData::Metadata.get_player(@character_ID || 0)[0]
end
return @trainer_type
end
# Sets the player's money. It can not exceed {Settings::MAX_MONEY}. # Sets the player's money. It can not exceed {Settings::MAX_MONEY}.
# @param value [Integer] new money value # @param value [Integer] new money value
def money=(value) def money=(value)

View File

@@ -156,7 +156,7 @@ def pbBattleFactoryPokemon(rules, win_count, swap_count, rentals)
indvalue = (party.length < iv_threshold) ? ivs[0] : ivs[1] indvalue = (party.length < iv_threshold) ? ivs[0] : ivs[1]
party.push(rndpoke.createPokemon(level, indvalue, nil)) party.push(rndpoke.createPokemon(level, indvalue, nil))
end end
break if rules.ruleset.isValid?(party.concat(rentals)) break if rules.ruleset.isValid?([].concat(party).concat(rentals))
end end
rules.ruleset.setNumberRange(old_min, old_max) rules.ruleset.setNumberRange(old_min, old_max)
return party return party

View File

@@ -251,7 +251,7 @@ def pbBattleFactoryRules(double, openlevel)
ret.addPokemonRule(BannedSpeciesRestriction.new(:UNOWN)) ret.addPokemonRule(BannedSpeciesRestriction.new(:UNOWN))
ret.addTeamRule(ItemClause.new) ret.addTeamRule(ItemClause.new)
ret.addBattleRule(SoulDewBattleClause.new) ret.addBattleRule(SoulDewBattleClause.new)
ret.setDoubleBattle(double).setNumber(0) ret.setDoubleBattle(double)
return ret return ret
end end

View File

@@ -873,6 +873,7 @@ module Compiler
# Compile wild encounter data # Compile wild encounter data
#============================================================================= #=============================================================================
def compile_encounters(path = "PBS/encounters.txt") def compile_encounters(path = "PBS/encounters.txt")
GameData::Encounter::DATA.clear
new_format = nil new_format = nil
encounter_hash = nil encounter_hash = nil
step_chances = nil step_chances = nil
@@ -1110,6 +1111,7 @@ module Compiler
# Compile individual trainer data # Compile individual trainer data
#============================================================================= #=============================================================================
def compile_trainers(path = "PBS/trainers.txt") def compile_trainers(path = "PBS/trainers.txt")
GameData::Trainer::DATA.clear
schema = GameData::Trainer::SCHEMA schema = GameData::Trainer::SCHEMA
max_level = GameData::GrowthRate.max_level max_level = GameData::GrowthRate.max_level
trainer_names = [] trainer_names = []