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 #
# Version 19.1 #
# Version 19.1.dev #
# https://github.com/Maruno17/pokemon-essentials #
#==============================================================================#
@@ -393,6 +393,6 @@ end
# DO NOT EDIT THESE!
module Essentials
VERSION = "19.1"
VERSION = "19.1.dev"
ERROR_TEXT = ""
end

View File

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

View File

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

View File

@@ -136,7 +136,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
if tr_type
tbargraphic = sprintf("vsBar_%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
outfit = $Trainer.outfit
# Set up
@@ -154,7 +154,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
overlay.bitmap = Bitmap.new(Graphics.width,Graphics.height)
pbSetSystemFont(overlay.bitmap)
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
end
xoffset = ((Graphics.width/2)/10)*10
@@ -193,7 +193,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
bar2 = AnimatedPlane.new(viewopp)
bar2.bitmap = RPG::Cache.transition(tbargraphic)
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
end
player = Sprite.new(viewplayer)

View File

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

View File

@@ -31,6 +31,13 @@ class Player < Trainer
# @return [Array<Array>] downloaded Mystery Gift data
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}.
# @param value [Integer] new 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]
party.push(rndpoke.createPokemon(level, indvalue, nil))
end
break if rules.ruleset.isValid?(party.concat(rentals))
break if rules.ruleset.isValid?([].concat(party).concat(rentals))
end
rules.ruleset.setNumberRange(old_min, old_max)
return party

View File

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

View File

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