Updated to mkxp-z v2.1.1, renamed and rearranged some script files

This commit is contained in:
Maruno17
2021-04-04 16:24:46 +01:00
parent afd76503b2
commit 5b0960337a
92 changed files with 916 additions and 927 deletions

View File

@@ -1,3 +1,4 @@
# Using mkxp-z v2.1.1 - https://gitlab.com/mkxp-z/mkxp-z/-/releases/v2.1.1
$VERBOSE = nil $VERBOSE = nil
Font.default_shadow = false if Font.respond_to?(:default_shadow) Font.default_shadow = false if Font.respond_to?(:default_shadow)
Graphics.frame_rate = 40 Graphics.frame_rate = 40

View File

@@ -0,0 +1,172 @@
#===============================================================================
# This module stores events that can happen during the game. A procedure can
# subscribe to an event by adding itself to the event. It will then be called
# whenever the event occurs.
#===============================================================================
module Events
@@OnMapCreate = Event.new
@@OnMapUpdate = Event.new
@@OnMapChange = Event.new
@@OnMapChanging = Event.new
@@OnMapSceneChange = Event.new
@@OnSpritesetCreate = Event.new
@@OnAction = Event.new
@@OnStepTaken = Event.new
@@OnLeaveTile = Event.new
@@OnStepTakenFieldMovement = Event.new
@@OnStepTakenTransferPossible = Event.new
@@OnStartBattle = Event.new
@@OnEndBattle = Event.new
@@OnWildPokemonCreate = Event.new
@@OnWildBattleOverride = Event.new
@@OnWildBattleEnd = Event.new
@@OnTrainerPartyLoad = Event.new
@@OnChangeDirection = Event.new
# Fires whenever a map is created. Event handler receives two parameters: the
# map (RPG::Map) and the tileset (RPG::Tileset)
def self.onMapCreate; @@OnMapCreate; end
def self.onMapCreate=(v); @@OnMapCreate = v; end
# Fires each frame during a map update.
def self.onMapUpdate; @@OnMapUpdate; end
def self.onMapUpdate=(v); @@OnMapUpdate = v; end
# Fires whenever one map is about to change to a different one. Event handler
# receives the new map ID and the Game_Map object representing the new map.
# When the event handler is called, $game_map still refers to the old map.
def self.onMapChanging; @@OnMapChanging; end
def self.onMapChanging=(v); @@OnMapChanging = v; end
# Fires whenever the player moves to a new map. Event handler receives the old
# map ID or 0 if none. Also fires when the first map of the game is loaded
def self.onMapChange; @@OnMapChange; end
def self.onMapChange=(v); @@OnMapChange = v; end
# Fires whenever the map scene is regenerated and soon after the player moves
# to a new map.
# Parameters:
# e[0] - Scene_Map object.
# e[1] - Whether the player just moved to a new map (either true or false). If
# false, some other code had called $scene.createSpritesets to
# regenerate the map scene without transferring the player elsewhere
def self.onMapSceneChange; @@OnMapSceneChange; end
def self.onMapSceneChange=(v); @@OnMapSceneChange = v; end
# Fires whenever a spriteset is created.
# Parameters:
# e[0] - Spriteset being created. e[0].map is the map associated with the
# spriteset (not necessarily the current map).
# e[1] - Viewport used for tilemap and characters
def self.onSpritesetCreate; @@OnSpritesetCreate; end
def self.onSpritesetCreate=(v); @@OnSpritesetCreate = v; end
# Triggers when the player presses the Action button on the map.
def self.onAction; @@OnAction; end
def self.onAction=(v); @@OnAction = v; end
# Fires whenever the player takes a step.
def self.onStepTaken; @@OnStepTaken; end
def self.onStepTaken=(v); @@OnStepTaken = v; end
# Fires whenever the player or another event leaves a tile.
# Parameters:
# e[0] - Event that just left the tile.
# e[1] - Map ID where the tile is located (not necessarily
# the current map). Use "$MapFactory.getMap(e[1])" to
# get the Game_Map object corresponding to that map.
# e[2] - X-coordinate of the tile
# e[3] - Y-coordinate of the tile
def self.onLeaveTile; @@OnLeaveTile; end
def self.onLeaveTile=(v); @@OnLeaveTile = v; end
# Fires whenever the player or another event enters a tile.
# Parameters:
# e[0] - Event that just entered a tile.
def self.onStepTakenFieldMovement; @@OnStepTakenFieldMovement; end
def self.onStepTakenFieldMovement=(v); @@OnStepTakenFieldMovement = v; end
# Fires whenever the player takes a step. The event handler may possibly move
# the player elsewhere.
# Parameters:
# e[0] - Array that contains a single boolean value. If an event handler moves
# the player to a new map, it should set this value to true. Other
# event handlers should check this parameter's value.
def self.onStepTakenTransferPossible; @@OnStepTakenTransferPossible; end
def self.onStepTakenTransferPossible=(v); @@OnStepTakenTransferPossible = v; end
def self.onStartBattle; @@OnStartBattle; end
def self.onStartBattle=(v); @@OnStartBattle = v; end
def self.onEndBattle; @@OnEndBattle; end
def self.onEndBattle=(v); @@OnEndBattle = v; end
# Triggers whenever a wild Pokémon is created
# Parameters:
# e[0] - Pokémon being created
def self.onWildPokemonCreate; @@OnWildPokemonCreate; end
def self.onWildPokemonCreate=(v); @@OnWildPokemonCreate = v; end
# Triggers at the start of a wild battle. Event handlers can provide their
# own wild battle routines to override the default behavior.
def self.onWildBattleOverride; @@OnWildBattleOverride; end
def self.onWildBattleOverride=(v); @@OnWildBattleOverride = v; end
# Triggers whenever a wild Pokémon battle ends
# Parameters:
# e[0] - Pokémon species
# e[1] - Pokémon level
# e[2] - Battle result (1-win, 2-loss, 3-escaped, 4-caught, 5-draw)
def self.onWildBattleEnd; @@OnWildBattleEnd; end
def self.onWildBattleEnd=(v); @@OnWildBattleEnd = v; end
# Triggers whenever an NPC trainer's Pokémon party is loaded
# Parameters:
# e[0] - Trainer
# e[1] - Items possessed by the trainer
# e[2] - Party
def self.onTrainerPartyLoad; @@OnTrainerPartyLoad; end
def self.onTrainerPartyLoad=(v); @@OnTrainerPartyLoad = v; end
# Fires whenever the player changes direction.
def self.onChangeDirection; @@OnChangeDirection; end
def self.onChangeDirection=(v); @@OnChangeDirection = v; end
end
#===============================================================================
#
#===============================================================================
def pbOnSpritesetCreate(spriteset,viewport)
Events.onSpritesetCreate.trigger(nil,spriteset,viewport)
end
#===============================================================================
# This module stores encounter-modifying events that can happen during the game.
# A procedure can subscribe to an event by adding itself to the event. It will
# then be called whenever the event occurs.
#===============================================================================
module EncounterModifier
@@procs = []
@@procsEnd = []
def self.register(p)
@@procs.push(p)
end
def self.registerEncounterEnd(p)
@@procsEnd.push(p)
end
def self.trigger(encounter)
for prc in @@procs
encounter = prc.call(encounter)
end
return encounter
end
def self.triggerEncounterEnd()
for prc in @@procsEnd
prc.call()
end
end
end

View File

@@ -134,3 +134,21 @@ class Game_Screen
end end
end end
end end
#===============================================================================
#
#===============================================================================
def pbToneChangeAll(tone,duration)
$game_screen.start_tone_change(tone,duration*Graphics.frame_rate/20)
for picture in $game_screen.pictures
picture.start_tone_change(tone,duration*Graphics.frame_rate/20) if picture
end
end
def pbShake(power,speed,frames)
$game_screen.start_shake(power,speed,frames*Graphics.frame_rate/20)
end
def pbFlash(color,frames)
$game_screen.start_flash(color,frames*Graphics.frame_rate/20)
end

View File

@@ -439,3 +439,30 @@ class Game_Map
end end
end end
end end
#===============================================================================
#
#===============================================================================
def pbScrollMap(direction,distance,speed)
if speed==0
case direction
when 2 then $game_map.scroll_down(distance * Game_Map::REAL_RES_Y)
when 4 then $game_map.scroll_left(distance * Game_Map::REAL_RES_X)
when 6 then $game_map.scroll_right(distance * Game_Map::REAL_RES_X)
when 8 then $game_map.scroll_up(distance * Game_Map::REAL_RES_Y)
end
else
$game_map.start_scroll(direction, distance, speed)
oldx = $game_map.display_x
oldy = $game_map.display_y
loop do
Graphics.update
Input.update
break if !$game_map.scrolling?
pbUpdateSceneMap
break if $game_map.display_x==oldx && $game_map.display_y==oldy
oldx = $game_map.display_x
oldy = $game_map.display_y
end
end
end

View File

@@ -31,6 +31,10 @@ class Game_Event < Game_Character
def id; return @event.id; end def id; return @event.id; end
def name; return @event.name; end def name; return @event.name; end
def set_starting
@starting = true
end
def clear_starting def clear_starting
@starting = false @starting = false
end end

View File

@@ -48,14 +48,6 @@ end
class Game_Event
def set_starting
@starting=true
end
end
def pbTestPass(follower,x,y,_direction=nil) def pbTestPass(follower,x,y,_direction=nil)
return $MapFactory.isPassableStrict?(follower.map.map_id,x,y,follower) return $MapFactory.isPassableStrict?(follower.map.map_id,x,y,follower)
end end

View File

@@ -120,9 +120,7 @@ GameData::Evolution.register({
:id => :LevelNoWeather, :id => :LevelNoWeather,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
if pkmn.level >= parameter && $game_screen next pkmn.level >= parameter && $game_screen && $game_screen.weather_type == :None
next $game_screen.weather_type == :None
end
} }
}) })
@@ -130,9 +128,8 @@ GameData::Evolution.register({
:id => :LevelSun, :id => :LevelSun,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
if pkmn.level >= parameter && $game_screen next pkmn.level >= parameter && $game_screen &&
next GameData::Weather.get($game_screen.weather_type).category == :Sun GameData::Weather.get($game_screen.weather_type).category == :Sun
end
} }
}) })
@@ -140,9 +137,8 @@ GameData::Evolution.register({
:id => :LevelRain, :id => :LevelRain,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
if pkmn.level >= parameter && $game_screen next pkmn.level >= parameter && $game_screen &&
next [:Rain, :Fog].include?(GameData::Weather.get($game_screen.weather_type).category) [:Rain, :Fog].include?(GameData::Weather.get($game_screen.weather_type).category)
end
} }
}) })
@@ -150,9 +146,8 @@ GameData::Evolution.register({
:id => :LevelSnow, :id => :LevelSnow,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
if pkmn.level >= parameter && $game_screen next pkmn.level >= parameter && $game_screen &&
next GameData::Weather.get($game_screen.weather_type).category == :Hail GameData::Weather.get($game_screen.weather_type).category == :Hail
end
} }
}) })
@@ -160,9 +155,8 @@ GameData::Evolution.register({
:id => :LevelSandstorm, :id => :LevelSandstorm,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
if pkmn.level >= parameter && $game_screen next pkmn.level >= parameter && $game_screen &&
next GameData::Weather.get($game_screen.weather_type).category == :Sandstorm GameData::Weather.get($game_screen.weather_type).category == :Sandstorm
end
} }
}) })
@@ -203,7 +197,7 @@ GameData::Evolution.register({
:id => :LevelDarkInParty, :id => :LevelDarkInParty,
:parameter => Integer, :parameter => Integer,
:level_up_proc => proc { |pkmn, parameter| :level_up_proc => proc { |pkmn, parameter|
next $Trainer.has_pokemon_of_type?(:DARK) if pkmn.level >= parameter next pkmn.level >= parameter && $Trainer.has_pokemon_of_type?(:DARK)
} }
}) })

View File

@@ -125,7 +125,7 @@ module GameData
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 if pkmn_data[:moves] && pkmn_data[:moves].length > 0
pkmn_data[:moves].each { |move| pkmn.learn_move(move) } pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
else else
pkmn.resetMoves pkmn.reset_moves
end end
pkmn.ability_index = pkmn_data[:ability_flag] pkmn.ability_index = pkmn_data[:ability_flag]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
@@ -156,7 +156,7 @@ module GameData
pkmn.shiny = false pkmn.shiny = false
end end
pkmn.poke_ball = pbBallTypeToItem(pkmn_data[:poke_ball]).id if pkmn_data[:poke_ball] pkmn.poke_ball = pbBallTypeToItem(pkmn_data[:poke_ball]).id if pkmn_data[:poke_ball]
pkmn.calcStats pkmn.calc_stats
end end
return trainer return trainer
end end

View File

@@ -286,7 +286,7 @@ class PokeBattle_Battler
#============================================================================= #=============================================================================
def pbUpdate(fullChange=false) def pbUpdate(fullChange=false)
return if !@pokemon return if !@pokemon
@pokemon.calcStats @pokemon.calc_stats
@level = @pokemon.level @level = @pokemon.level
@hp = @pokemon.hp @hp = @pokemon.hp
@totalhp = @pokemon.totalhp @totalhp = @pokemon.totalhp

View File

@@ -94,7 +94,7 @@ class PokeBattle_Battle
growth_rate = pkmn.growth_rate growth_rate = pkmn.growth_rate
# Don't bother calculating if gainer is already at max Exp # Don't bother calculating if gainer is already at max Exp
if pkmn.exp>=growth_rate.maximum_exp if pkmn.exp>=growth_rate.maximum_exp
pkmn.calcStats # To ensure new EVs still have an effect pkmn.calc_stats # To ensure new EVs still have an effect
return return
end end
isPartic = defeatedBattler.participants.include?(idxParty) isPartic = defeatedBattler.participants.include?(idxParty)
@@ -188,7 +188,7 @@ class PokeBattle_Battle
curLevel += 1 curLevel += 1
if curLevel>newLevel if curLevel>newLevel
# Gained all the Exp now, end the animation # Gained all the Exp now, end the animation
pkmn.calcStats pkmn.calc_stats
battler.pbUpdate(false) if battler battler.pbUpdate(false) if battler
@scene.pbRefreshOne(battler.index) if battler @scene.pbRefreshOne(battler.index) if battler
break break
@@ -204,7 +204,7 @@ class PokeBattle_Battle
if battler && battler.pokemon if battler && battler.pokemon
battler.pokemon.changeHappiness("levelup") battler.pokemon.changeHappiness("levelup")
end end
pkmn.calcStats pkmn.calc_stats
battler.pbUpdate(false) if battler battler.pbUpdate(false) if battler
@scene.pbRefreshOne(battler.index) if battler @scene.pbRefreshOne(battler.index) if battler
pbDisplayPaused(_INTL("{1} grew to Lv. {2}!",pkmn.name,curLevel)) pbDisplayPaused(_INTL("{1} grew to Lv. {2}!",pkmn.name,curLevel))

View File

@@ -0,0 +1,221 @@
#===============================================================================
# Location signpost
#===============================================================================
class LocationWindow
def initialize(name)
@window = Window_AdvancedTextPokemon.new(name)
@window.resizeToFit(name,Graphics.width)
@window.x = 0
@window.y = -@window.height
@window.viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@window.viewport.z = 99999
@currentmap = $game_map.map_id
@frames = 0
end
def disposed?
@window.disposed?
end
def dispose
@window.dispose
end
def update
return if @window.disposed?
@window.update
if $game_temp.message_window_showing || @currentmap!=$game_map.map_id
@window.dispose
return
end
if @frames > Graphics.frame_rate * 2
@window.y -= 4
@window.dispose if @window.y+@window.height<0
else
@window.y += 4 if @window.y<0
@frames += 1
end
end
end
#===============================================================================
# Visibility circle in dark maps
#===============================================================================
class DarknessSprite < SpriteWrapper
attr_reader :radius
def initialize(viewport=nil)
super(viewport)
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
@radius = radiusMin
self.bitmap = @darkness
self.z = 99998
refresh
end
def dispose
@darkness.dispose
super
end
def radiusMin; return 64; end # Before using Flash
def radiusMax; return 176; end # After using Flash
def radius=(value)
@radius = value
refresh
end
def refresh
@darkness.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,255))
cx = Graphics.width/2
cy = Graphics.height/2
cradius = @radius
numfades = 5
for i in 1..numfades
for j in cx-cradius..cx+cradius
diff2 = (cradius * cradius) - ((j - cx) * (j - cx))
diff = Math.sqrt(diff2)
@darkness.fill_rect(j,cy-diff,1,diff*2,Color.new(0,0,0,255.0*(numfades-i)/numfades))
end
cradius = (cradius*0.9).floor
end
end
end
#===============================================================================
# Light effects
#===============================================================================
class LightEffect
def initialize(event,viewport=nil,map=nil,filename=nil)
@light = IconSprite.new(0,0,viewport)
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
@light.setBitmap("Graphics/Pictures/"+filename)
else
@light.setBitmap("Graphics/Pictures/LE")
end
@light.z = 1000
@event = event
@map = (map) ? map : $game_map
@disposed = false
end
def disposed?
return @disposed
end
def dispose
@light.dispose
@map = nil
@event = nil
@disposed = true
end
def update
@light.update
end
end
class LightEffect_Lamp < LightEffect
def initialize(event,viewport=nil,map=nil)
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
@light = Sprite.new(viewport)
@light.bitmap = Bitmap.new(128,64)
src_rect = Rect.new(0, 0, 64, 64)
@light.bitmap.blt(0, 0, lamp.bitmap, src_rect)
@light.bitmap.blt(20, 0, lamp.bitmap, src_rect)
@light.visible = true
@light.z = 1000
lamp.dispose
@map = (map) ? map : $game_map
@event = event
end
end
class LightEffect_Basic < LightEffect
def update
return if !@light || !@event
super
@light.opacity = 100
@light.ox = 32
@light.oy = 48
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
else
@light.x = @event.screen_x
@light.y = @event.screen_y
@light.zoom_x = 1.0
end
@light.zoom_y = @light.zoom_x
@light.tone = $game_screen.tone
end
end
class LightEffect_DayNight < LightEffect
def update
return if !@light || !@event
super
shade = PBDayNight.getShade
if shade>=144 # If light enough, call it fully day
shade = 255
elsif shade<=64 # If dark enough, call it fully night
shade = 0
else
shade = 255-(255*(144-shade)/(144-64))
end
@light.opacity = 255-shade
if @light.opacity>0
@light.ox = 32
@light.oy = 48
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
@light.zoom_y = ScreenPosHelper.pbScreenZoomY(@event)
else
@light.x = @event.screen_x
@light.y = @event.screen_y
@light.zoom_x = 1.0
@light.zoom_y = 1.0
end
@light.tone.set($game_screen.tone.red,
$game_screen.tone.green,
$game_screen.tone.blue,
$game_screen.tone.gray)
end
end
end
Events.onSpritesetCreate += proc { |_sender,e|
spriteset = e[0] # Spriteset being created
viewport = e[1] # Viewport used for tilemap and characters
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
for i in map.events.keys
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map,filename))
elsif map.events[i].name.downcase=="outdoorlight"
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map))
elsif map.events[i].name[/^light\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map,filename))
elsif map.events[i].name.downcase=="light"
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map))
end
end
spriteset.addUserSprite(Particle_Engine.new(viewport,map))
}

View File

@@ -0,0 +1,134 @@
#===============================================================================
# Entering/exiting cave animations
#===============================================================================
def pbCaveEntranceEx(exiting)
# Create bitmap
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
sprite.z = 100000
# Define values used for the animation
totalFrames = (Graphics.frame_rate*0.4).floor
increment = (255.0/totalFrames).ceil
totalBands = 15
bandheight = ((Graphics.height/2.0)-10)/totalBands
bandwidth = ((Graphics.width/2.0)-12)/totalBands
# Create initial array of band colors (black if exiting, white if entering)
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
# Animate bands changing color
totalFrames.times do |j|
x = 0
y = 0
# Calculate color of each band
for k in 0...totalBands
next if k>=totalBands*j/totalFrames
inc = increment
inc *= -1 if exiting
grays[k] -= inc
grays[k] = 0 if grays[k]<0
end
# Draw gray rectangles
rectwidth = Graphics.width
rectheight = Graphics.height
for i in 0...totalBands
currentGray = grays[i]
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
Color.new(currentGray,currentGray,currentGray))
x += bandwidth
y += bandheight
rectwidth -= bandwidth*2
rectheight -= bandheight*2
end
Graphics.update
Input.update
end
# Set the tone at end of band animation
if exiting
pbToneChangeAll(Tone.new(255,255,255),0)
else
pbToneChangeAll(Tone.new(-255,-255,-255),0)
end
# Animate fade to white (if exiting) or black (if entering)
for j in 0...totalFrames
if exiting
sprite.color = Color.new(255,255,255,j*increment)
else
sprite.color = Color.new(0,0,0,j*increment)
end
Graphics.update
Input.update
end
# Set the tone at end of fading animation
pbToneChangeAll(Tone.new(0,0,0),8)
# Pause briefly
(Graphics.frame_rate/10).times do
Graphics.update
Input.update
end
sprite.dispose
end
def pbCaveEntrance
pbSetEscapePoint
pbCaveEntranceEx(false)
end
def pbCaveExit
pbEraseEscapePoint
pbCaveEntranceEx(true)
end
#===============================================================================
# Blacking out animation
#===============================================================================
def pbStartOver(gameover=false)
if pbInBugContest?
pbBugContestStartOver
return
end
$Trainer.heal_party
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
if gameover
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
else
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm..."))
end
pbCancelVehicles
pbRemoveDependencies
$game_switches[Settings::STARTING_OVER_SWITCH] = true
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
$game_temp.player_new_direction = $PokemonGlobal.pokecenterDirection
$scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh
else
homedata = GameData::Metadata.get.home
if homedata && !pbRgssExists?(sprintf("Data/Map%03d.rxdata",homedata[0]))
if $DEBUG
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
end
$Trainer.heal_party
return
end
if gameover
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
else
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
end
if homedata
pbCancelVehicles
pbRemoveDependencies
$game_switches[Settings::STARTING_OVER_SWITCH] = true
$game_temp.player_new_map_id = homedata[0]
$game_temp.player_new_x = homedata[1]
$game_temp.player_new_y = homedata[2]
$game_temp.player_new_direction = homedata[3]
$scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh
else
$Trainer.heal_party
end
end
pbEraseEscapePoint
end

View File

@@ -1,179 +1,3 @@
#===============================================================================
# This module stores encounter-modifying events that can happen during the game.
# A procedure can subscribe to an event by adding itself to the event. It will
# then be called whenever the event occurs.
#===============================================================================
module EncounterModifier
@@procs = []
@@procsEnd = []
def self.register(p)
@@procs.push(p)
end
def self.registerEncounterEnd(p)
@@procsEnd.push(p)
end
def self.trigger(encounter)
for prc in @@procs
encounter = prc.call(encounter)
end
return encounter
end
def self.triggerEncounterEnd()
for prc in @@procsEnd
prc.call()
end
end
end
#===============================================================================
# This module stores events that can happen during the game. A procedure can
# subscribe to an event by adding itself to the event. It will then be called
# whenever the event occurs.
#===============================================================================
module Events
@@OnMapCreate = Event.new
@@OnMapUpdate = Event.new
@@OnMapChange = Event.new
@@OnMapChanging = Event.new
@@OnMapSceneChange = Event.new
@@OnSpritesetCreate = Event.new
@@OnAction = Event.new
@@OnStepTaken = Event.new
@@OnLeaveTile = Event.new
@@OnStepTakenFieldMovement = Event.new
@@OnStepTakenTransferPossible = Event.new
@@OnStartBattle = Event.new
@@OnEndBattle = Event.new
@@OnWildPokemonCreate = Event.new
@@OnWildBattleOverride = Event.new
@@OnWildBattleEnd = Event.new
@@OnTrainerPartyLoad = Event.new
@@OnChangeDirection = Event.new
# Fires whenever a map is created. Event handler receives two parameters: the
# map (RPG::Map) and the tileset (RPG::Tileset)
def self.onMapCreate; @@OnMapCreate; end
def self.onMapCreate=(v); @@OnMapCreate = v; end
# Fires each frame during a map update.
def self.onMapUpdate; @@OnMapUpdate; end
def self.onMapUpdate=(v); @@OnMapUpdate = v; end
# Fires whenever one map is about to change to a different one. Event handler
# receives the new map ID and the Game_Map object representing the new map.
# When the event handler is called, $game_map still refers to the old map.
def self.onMapChanging; @@OnMapChanging; end
def self.onMapChanging=(v); @@OnMapChanging = v; end
# Fires whenever the player moves to a new map. Event handler receives the old
# map ID or 0 if none. Also fires when the first map of the game is loaded
def self.onMapChange; @@OnMapChange; end
def self.onMapChange=(v); @@OnMapChange = v; end
# Fires whenever the map scene is regenerated and soon after the player moves
# to a new map.
# Parameters:
# e[0] - Scene_Map object.
# e[1] - Whether the player just moved to a new map (either true or false). If
# false, some other code had called $scene.createSpritesets to
# regenerate the map scene without transferring the player elsewhere
def self.onMapSceneChange; @@OnMapSceneChange; end
def self.onMapSceneChange=(v); @@OnMapSceneChange = v; end
# Fires whenever a spriteset is created.
# Parameters:
# e[0] - Spriteset being created. e[0].map is the map associated with the
# spriteset (not necessarily the current map).
# e[1] - Viewport used for tilemap and characters
def self.onSpritesetCreate; @@OnSpritesetCreate; end
def self.onSpritesetCreate=(v); @@OnSpritesetCreate = v; end
# Triggers when the player presses the Action button on the map.
def self.onAction; @@OnAction; end
def self.onAction=(v); @@OnAction = v; end
# Fires whenever the player takes a step.
def self.onStepTaken; @@OnStepTaken; end
def self.onStepTaken=(v); @@OnStepTaken = v; end
# Fires whenever the player or another event leaves a tile.
# Parameters:
# e[0] - Event that just left the tile.
# e[1] - Map ID where the tile is located (not necessarily
# the current map). Use "$MapFactory.getMap(e[1])" to
# get the Game_Map object corresponding to that map.
# e[2] - X-coordinate of the tile
# e[3] - Y-coordinate of the tile
def self.onLeaveTile; @@OnLeaveTile; end
def self.onLeaveTile=(v); @@OnLeaveTile = v; end
# Fires whenever the player or another event enters a tile.
# Parameters:
# e[0] - Event that just entered a tile.
def self.onStepTakenFieldMovement; @@OnStepTakenFieldMovement; end
def self.onStepTakenFieldMovement=(v); @@OnStepTakenFieldMovement = v; end
# Fires whenever the player takes a step. The event handler may possibly move
# the player elsewhere.
# Parameters:
# e[0] - Array that contains a single boolean value. If an event handler moves
# the player to a new map, it should set this value to true. Other
# event handlers should check this parameter's value.
def self.onStepTakenTransferPossible; @@OnStepTakenTransferPossible; end
def self.onStepTakenTransferPossible=(v); @@OnStepTakenTransferPossible = v; end
def self.onStartBattle; @@OnStartBattle; end
def self.onStartBattle=(v); @@OnStartBattle = v; end
def self.onEndBattle; @@OnEndBattle; end
def self.onEndBattle=(v); @@OnEndBattle = v; end
# Triggers whenever a wild Pokémon is created
# Parameters:
# e[0] - Pokémon being created
def self.onWildPokemonCreate; @@OnWildPokemonCreate; end
def self.onWildPokemonCreate=(v); @@OnWildPokemonCreate = v; end
# Triggers at the start of a wild battle. Event handlers can provide their
# own wild battle routines to override the default behavior.
def self.onWildBattleOverride; @@OnWildBattleOverride; end
def self.onWildBattleOverride=(v); @@OnWildBattleOverride = v; end
# Triggers whenever a wild Pokémon battle ends
# Parameters:
# e[0] - Pokémon species
# e[1] - Pokémon level
# e[2] - Battle result (1-win, 2-loss, 3-escaped, 4-caught, 5-draw)
def self.onWildBattleEnd; @@OnWildBattleEnd; end
def self.onWildBattleEnd=(v); @@OnWildBattleEnd = v; end
# Triggers whenever an NPC trainer's Pokémon party is loaded
# Parameters:
# e[0] - Trainer
# e[1] - Items possessed by the trainer
# e[2] - Party
def self.onTrainerPartyLoad; @@OnTrainerPartyLoad; end
def self.onTrainerPartyLoad=(v); @@OnTrainerPartyLoad = v; end
# Fires whenever the player changes direction.
def self.onChangeDirection; @@OnChangeDirection; end
def self.onChangeDirection=(v); @@OnChangeDirection = v; end
end
def pbOnSpritesetCreate(spriteset,viewport)
Events.onSpritesetCreate.trigger(nil,spriteset,viewport)
end
#=============================================================================== #===============================================================================
# Constant checks # Constant checks
#=============================================================================== #===============================================================================
@@ -809,147 +633,6 @@ end
#===============================================================================
# Fishing
#===============================================================================
def pbFishingBegin
$PokemonGlobal.fishing = true
if !pbCommonEvent(Settings::FISHING_BEGIN_COMMON_EVENT)
patternb = 2*$game_player.direction - 1
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb-pattern,true)
(Graphics.frame_rate/20).times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
end
def pbFishingEnd
if !pbCommonEvent(Settings::FISHING_END_COMMON_EVENT)
patternb = 2*($game_player.direction - 2)
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb+pattern,true)
(Graphics.frame_rate/20).times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
$PokemonGlobal.fishing = false
end
def pbFishing(hasEncounter,rodType=1)
speedup = ($Trainer.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.first_pokemon.ability_id))
biteChance = 20+(25*rodType) # 45, 70, 95
biteChance *= 1.5 if speedup # 67.5, 100, 100
hookChance = 100
oldpattern = $game_player.fullPattern
pbFishingBegin
msgWindow = pbCreateMessageWindow
ret = false
loop do
time = 5+rand(6)
time = [time,5+rand(6)].min if speedup
message = ""
time.times { message += ". " }
if pbWaitMessage(msgWindow,time)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
break
end
if hasEncounter && rand(100)<biteChance
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID,$game_player.x,$game_player.y,true,3)
frames = Graphics.frame_rate - rand(Graphics.frame_rate/2) # 0.5-1 second
if !pbWaitForInput(msgWindow,message+_INTL("\r\nOh! A bite!"),frames)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("The Pokémon got away..."))
break
end
if Settings::FISHING_AUTO_HOOK || rand(100) < hookChance
pbFishingEnd
pbMessageDisplay(msgWindow,_INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
$game_player.setDefaultCharName(nil,oldpattern)
ret = true
break
end
# biteChance += 15
# hookChance += 15
else
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
break
end
end
pbDisposeMessageWindow(msgWindow)
return ret
end
# Show waiting dots before a Pokémon bites
def pbWaitMessage(msgWindow,time)
message = ""
periodTime = Graphics.frame_rate*4/10 # 0.4 seconds, 16 frames per dot
(time+1).times do |i|
message += ". " if i>0
pbMessageDisplay(msgWindow,message,false)
periodTime.times do
Graphics.update
Input.update
pbUpdateSceneMap
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
return true
end
end
end
return false
end
# A Pokémon is biting, reflex test to reel it in
def pbWaitForInput(msgWindow,message,frames)
pbMessageDisplay(msgWindow,message,false)
numFrame = 0
twitchFrame = 0
twitchFrameTime = Graphics.frame_rate/10 # 0.1 seconds, 4 frames
loop do
Graphics.update
Input.update
pbUpdateSceneMap
# Twitch cycle: 1,0,1,0,0,0,0,0
twitchFrame = (twitchFrame+1)%(twitchFrameTime*8)
case twitchFrame%twitchFrameTime
when 0, 2
$game_player.pattern = 1
else
$game_player.pattern = 0
end
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
$game_player.pattern = 0
return true
end
break if !Settings::FISHING_AUTO_HOOK && numFrame > frames
numFrame += 1
end
return false
end
#=============================================================================== #===============================================================================
# Bridges, cave escape points, and setting the heal point # Bridges, cave escape points, and setting the heal point
#=============================================================================== #===============================================================================
@@ -1005,7 +688,7 @@ def pbRegisterPartner(tr_type, tr_name, tr_id = 0)
Events.onTrainerPartyLoad.trigger(nil, trainer) Events.onTrainerPartyLoad.trigger(nil, trainer)
for i in trainer.party for i in trainer.party
i.owner = Pokemon::Owner.new_from_trainer(trainer) i.owner = Pokemon::Owner.new_from_trainer(trainer)
i.calcStats i.calc_stats
end end
$PokemonGlobal.partner = [tr_type, tr_name, trainer.id, trainer.party] $PokemonGlobal.partner = [tr_type, tr_name, trainer.id, trainer.party]
end end

View File

@@ -1,5 +1,5 @@
#=============================================================================== #===============================================================================
# Battle start animation # Battle intro animation
#=============================================================================== #===============================================================================
def pbSceneStandby def pbSceneStandby
$scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map) $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)
@@ -125,6 +125,9 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
$game_temp.in_battle = false $game_temp.in_battle = false
end end
#===============================================================================
# Vs. battle intro animation
#===============================================================================
def pbBattleAnimationOverride(viewport,battletype=0,foe=nil) def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
##### VS. animation, by Luka S.J. ##### ##### VS. animation, by Luka S.J. #####
##### Tweaked by Maruno ##### ##### Tweaked by Maruno #####
@@ -278,6 +281,9 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
return false return false
end end
#===============================================================================
# Override battle intro animation
#===============================================================================
# If you want to add a custom battle intro animation, copy the following alias # If you want to add a custom battle intro animation, copy the following alias
# line and method into a new script section. Change the name of the alias part # line and method into a new script section. Change the name of the alias part
# ("__over1__") in your copied code in both places. Then add in your custom # ("__over1__") in your copied code in both places. Then add in your custom
@@ -302,412 +308,3 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
# animation was NOT shown. # animation was NOT shown.
return __over1__pbBattleAnimationOverride(viewport,battletype,foe) return __over1__pbBattleAnimationOverride(viewport,battletype,foe)
end end
#===============================================================================
# Location signpost
#===============================================================================
class LocationWindow
def initialize(name)
@window = Window_AdvancedTextPokemon.new(name)
@window.resizeToFit(name,Graphics.width)
@window.x = 0
@window.y = -@window.height
@window.viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@window.viewport.z = 99999
@currentmap = $game_map.map_id
@frames = 0
end
def disposed?
@window.disposed?
end
def dispose
@window.dispose
end
def update
return if @window.disposed?
@window.update
if $game_temp.message_window_showing || @currentmap!=$game_map.map_id
@window.dispose
return
end
if @frames > Graphics.frame_rate * 2
@window.y -= 4
@window.dispose if @window.y+@window.height<0
else
@window.y += 4 if @window.y<0
@frames += 1
end
end
end
#===============================================================================
# Visibility circle in dark maps
#===============================================================================
class DarknessSprite < SpriteWrapper
attr_reader :radius
def initialize(viewport=nil)
super(viewport)
@darkness = BitmapWrapper.new(Graphics.width,Graphics.height)
@radius = radiusMin
self.bitmap = @darkness
self.z = 99998
refresh
end
def dispose
@darkness.dispose
super
end
def radiusMin; return 64; end # Before using Flash
def radiusMax; return 176; end # After using Flash
def radius=(value)
@radius = value
refresh
end
def refresh
@darkness.fill_rect(0,0,Graphics.width,Graphics.height,Color.new(0,0,0,255))
cx = Graphics.width/2
cy = Graphics.height/2
cradius = @radius
numfades = 5
for i in 1..numfades
for j in cx-cradius..cx+cradius
diff2 = (cradius * cradius) - ((j - cx) * (j - cx))
diff = Math.sqrt(diff2)
@darkness.fill_rect(j,cy-diff,1,diff*2,Color.new(0,0,0,255.0*(numfades-i)/numfades))
end
cradius = (cradius*0.9).floor
end
end
end
#===============================================================================
# Lights
#===============================================================================
class LightEffect
def initialize(event,viewport=nil,map=nil,filename=nil)
@light = IconSprite.new(0,0,viewport)
if filename!=nil && filename!="" && pbResolveBitmap("Graphics/Pictures/"+filename)
@light.setBitmap("Graphics/Pictures/"+filename)
else
@light.setBitmap("Graphics/Pictures/LE")
end
@light.z = 1000
@event = event
@map = (map) ? map : $game_map
@disposed = false
end
def disposed?
return @disposed
end
def dispose
@light.dispose
@map = nil
@event = nil
@disposed = true
end
def update
@light.update
end
end
class LightEffect_Lamp < LightEffect
def initialize(event,viewport=nil,map=nil)
lamp = AnimatedBitmap.new("Graphics/Pictures/LE")
@light = Sprite.new(viewport)
@light.bitmap = Bitmap.new(128,64)
src_rect = Rect.new(0, 0, 64, 64)
@light.bitmap.blt(0, 0, lamp.bitmap, src_rect)
@light.bitmap.blt(20, 0, lamp.bitmap, src_rect)
@light.visible = true
@light.z = 1000
lamp.dispose
@map = (map) ? map : $game_map
@event = event
end
end
class LightEffect_Basic < LightEffect
def update
return if !@light || !@event
super
@light.opacity = 100
@light.ox = 32
@light.oy = 48
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
else
@light.x = @event.screen_x
@light.y = @event.screen_y
@light.zoom_x = 1.0
end
@light.zoom_y = @light.zoom_x
@light.tone = $game_screen.tone
end
end
class LightEffect_DayNight < LightEffect
def update
return if !@light || !@event
super
shade = PBDayNight.getShade
if shade>=144 # If light enough, call it fully day
shade = 255
elsif shade<=64 # If dark enough, call it fully night
shade = 0
else
shade = 255-(255*(144-shade)/(144-64))
end
@light.opacity = 255-shade
if @light.opacity>0
@light.ox = 32
@light.oy = 48
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
@light.zoom_y = ScreenPosHelper.pbScreenZoomY(@event)
else
@light.x = @event.screen_x
@light.y = @event.screen_y
@light.zoom_x = 1.0
@light.zoom_y = 1.0
end
@light.tone.set($game_screen.tone.red,
$game_screen.tone.green,
$game_screen.tone.blue,
$game_screen.tone.gray)
end
end
end
Events.onSpritesetCreate += proc { |_sender,e|
spriteset = e[0] # Spriteset being created
viewport = e[1] # Viewport used for tilemap and characters
map = spriteset.map # Map associated with the spriteset (not necessarily the current map)
for i in map.events.keys
if map.events[i].name[/^outdoorlight\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map,filename))
elsif map.events[i].name.downcase=="outdoorlight"
spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],viewport,map))
elsif map.events[i].name[/^light\((\w+)\)$/i]
filename = $~[1].to_s
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map,filename))
elsif map.events[i].name.downcase=="light"
spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],viewport,map))
end
end
spriteset.addUserSprite(Particle_Engine.new(viewport,map))
}
#===============================================================================
# Entering/exiting cave animations
#===============================================================================
def pbCaveEntranceEx(exiting)
# Create bitmap
sprite = BitmapSprite.new(Graphics.width,Graphics.height)
sprite.z = 100000
# Define values used for the animation
totalFrames = (Graphics.frame_rate*0.4).floor
increment = (255.0/totalFrames).ceil
totalBands = 15
bandheight = ((Graphics.height/2.0)-10)/totalBands
bandwidth = ((Graphics.width/2.0)-12)/totalBands
# Create initial array of band colors (black if exiting, white if entering)
grays = Array.new(totalBands) { |i| (exiting) ? 0 : 255 }
# Animate bands changing color
totalFrames.times do |j|
x = 0
y = 0
# Calculate color of each band
for k in 0...totalBands
next if k>=totalBands*j/totalFrames
inc = increment
inc *= -1 if exiting
grays[k] -= inc
grays[k] = 0 if grays[k]<0
end
# Draw gray rectangles
rectwidth = Graphics.width
rectheight = Graphics.height
for i in 0...totalBands
currentGray = grays[i]
sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),
Color.new(currentGray,currentGray,currentGray))
x += bandwidth
y += bandheight
rectwidth -= bandwidth*2
rectheight -= bandheight*2
end
Graphics.update
Input.update
end
# Set the tone at end of band animation
if exiting
pbToneChangeAll(Tone.new(255,255,255),0)
else
pbToneChangeAll(Tone.new(-255,-255,-255),0)
end
# Animate fade to white (if exiting) or black (if entering)
for j in 0...totalFrames
if exiting
sprite.color = Color.new(255,255,255,j*increment)
else
sprite.color = Color.new(0,0,0,j*increment)
end
Graphics.update
Input.update
end
# Set the tone at end of fading animation
pbToneChangeAll(Tone.new(0,0,0),8)
# Pause briefly
(Graphics.frame_rate/10).times do
Graphics.update
Input.update
end
sprite.dispose
end
def pbCaveEntrance
pbSetEscapePoint
pbCaveEntranceEx(false)
end
def pbCaveExit
pbEraseEscapePoint
pbCaveEntranceEx(true)
end
#===============================================================================
# Blacking out animation
#===============================================================================
def pbRxdataExists?(file)
return pbRgssExists?(file+".rxdata")
end
def pbStartOver(gameover=false)
if pbInBugContest?
pbBugContestStartOver
return
end
$Trainer.heal_party
if $PokemonGlobal.pokecenterMapId && $PokemonGlobal.pokecenterMapId>=0
if gameover
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back to a Pokémon Center."))
else
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back to a Pokémon Center, protecting your exhausted Pokémon from any further harm..."))
end
pbCancelVehicles
pbRemoveDependencies
$game_switches[Settings::STARTING_OVER_SWITCH] = true
$game_temp.player_new_map_id = $PokemonGlobal.pokecenterMapId
$game_temp.player_new_x = $PokemonGlobal.pokecenterX
$game_temp.player_new_y = $PokemonGlobal.pokecenterY
$game_temp.player_new_direction = $PokemonGlobal.pokecenterDirection
$scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh
else
homedata = GameData::Metadata.get.home
if homedata && !pbRxdataExists?(sprintf("Data/Map%03d",homedata[0]))
if $DEBUG
pbMessage(_ISPRINTF("Can't find the map 'Map{1:03d}' in the Data folder. The game will resume at the player's position.",homedata[0]))
end
$Trainer.heal_party
return
end
if gameover
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]After the unfortunate defeat, you scurry back home."))
else
pbMessage(_INTL("\\w[]\\wm\\c[8]\\l[3]You scurry back home, protecting your exhausted Pokémon from any further harm..."))
end
if homedata
pbCancelVehicles
pbRemoveDependencies
$game_switches[Settings::STARTING_OVER_SWITCH] = true
$game_temp.player_new_map_id = homedata[0]
$game_temp.player_new_x = homedata[1]
$game_temp.player_new_y = homedata[2]
$game_temp.player_new_direction = homedata[3]
$scene.transfer_player if $scene.is_a?(Scene_Map)
$game_map.refresh
else
$Trainer.heal_party
end
end
pbEraseEscapePoint
end
#===============================================================================
# Various other screen effects
#===============================================================================
def pbToneChangeAll(tone,duration)
$game_screen.start_tone_change(tone,duration*Graphics.frame_rate/20)
for picture in $game_screen.pictures
picture.start_tone_change(tone,duration*Graphics.frame_rate/20) if picture
end
end
def pbShake(power,speed,frames)
$game_screen.start_shake(power,speed,frames*Graphics.frame_rate/20)
end
def pbFlash(color,frames)
$game_screen.start_flash(color,frames*Graphics.frame_rate/20)
end
def pbScrollMap(direction,distance,speed)
if speed==0
case direction
when 2 then $game_map.scroll_down(distance * Game_Map::REAL_RES_Y)
when 4 then $game_map.scroll_left(distance * Game_Map::REAL_RES_X)
when 6 then $game_map.scroll_right(distance * Game_Map::REAL_RES_X)
when 8 then $game_map.scroll_up(distance * Game_Map::REAL_RES_Y)
end
else
$game_map.start_scroll(direction, distance, speed)
oldx = $game_map.display_x
oldy = $game_map.display_y
loop do
Graphics.update
Input.update
break if !$game_map.scrolling?
pbUpdateSceneMap
break if $game_map.display_x==oldx && $game_map.display_y==oldy
oldx = $game_map.display_x
oldy = $game_map.display_y
end
end
end

View File

@@ -23,8 +23,8 @@ Events.onWildPokemonCreate += proc { |_sender, e|
new_level = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety new_level = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety
new_level = new_level.clamp(1, GameData::GrowthRate.max_level) new_level = new_level.clamp(1, GameData::GrowthRate.max_level)
pokemon.level = new_level pokemon.level = new_level
pokemon.calcStats pokemon.calc_stats
pokemon.resetMoves pokemon.reset_moves
end end
} }

View File

@@ -0,0 +1,138 @@
#===============================================================================
# Fishing
#===============================================================================
def pbFishingBegin
$PokemonGlobal.fishing = true
if !pbCommonEvent(Settings::FISHING_BEGIN_COMMON_EVENT)
patternb = 2*$game_player.direction - 1
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb-pattern,true)
(Graphics.frame_rate/20).times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
end
def pbFishingEnd
if !pbCommonEvent(Settings::FISHING_END_COMMON_EVENT)
patternb = 2*($game_player.direction - 2)
meta = GameData::Metadata.get_player($PokemonGlobal.playerID)
num = ($PokemonGlobal.surfing) ? 7 : 6
if meta && meta[num] && meta[num]!=""
charset = pbGetPlayerCharset(meta,num)
4.times do |pattern|
$game_player.setDefaultCharName(charset,patternb+pattern,true)
(Graphics.frame_rate/20).times do
Graphics.update
Input.update
pbUpdateSceneMap
end
end
end
end
$PokemonGlobal.fishing = false
end
def pbFishing(hasEncounter,rodType=1)
speedup = ($Trainer.first_pokemon && [:STICKYHOLD, :SUCTIONCUPS].include?($Trainer.first_pokemon.ability_id))
biteChance = 20+(25*rodType) # 45, 70, 95
biteChance *= 1.5 if speedup # 67.5, 100, 100
hookChance = 100
oldpattern = $game_player.fullPattern
pbFishingBegin
msgWindow = pbCreateMessageWindow
ret = false
loop do
time = 5+rand(6)
time = [time,5+rand(6)].min if speedup
message = ""
time.times { message += ". " }
if pbWaitMessage(msgWindow,time)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
break
end
if hasEncounter && rand(100)<biteChance
$scene.spriteset.addUserAnimation(Settings::EXCLAMATION_ANIMATION_ID,$game_player.x,$game_player.y,true,3)
frames = Graphics.frame_rate - rand(Graphics.frame_rate/2) # 0.5-1 second
if !pbWaitForInput(msgWindow,message+_INTL("\r\nOh! A bite!"),frames)
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("The Pokémon got away..."))
break
end
if Settings::FISHING_AUTO_HOOK || rand(100) < hookChance
pbFishingEnd
pbMessageDisplay(msgWindow,_INTL("Landed a Pokémon!")) if !Settings::FISHING_AUTO_HOOK
$game_player.setDefaultCharName(nil,oldpattern)
ret = true
break
end
# biteChance += 15
# hookChance += 15
else
pbFishingEnd
$game_player.setDefaultCharName(nil,oldpattern)
pbMessageDisplay(msgWindow,_INTL("Not even a nibble..."))
break
end
end
pbDisposeMessageWindow(msgWindow)
return ret
end
# Show waiting dots before a Pokémon bites
def pbWaitMessage(msgWindow,time)
message = ""
periodTime = Graphics.frame_rate*4/10 # 0.4 seconds, 16 frames per dot
(time+1).times do |i|
message += ". " if i>0
pbMessageDisplay(msgWindow,message,false)
periodTime.times do
Graphics.update
Input.update
pbUpdateSceneMap
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
return true
end
end
end
return false
end
# A Pokémon is biting, reflex test to reel it in
def pbWaitForInput(msgWindow,message,frames)
pbMessageDisplay(msgWindow,message,false)
numFrame = 0
twitchFrame = 0
twitchFrameTime = Graphics.frame_rate/10 # 0.1 seconds, 4 frames
loop do
Graphics.update
Input.update
pbUpdateSceneMap
# Twitch cycle: 1,0,1,0,0,0,0,0
twitchFrame = (twitchFrame+1)%(twitchFrameTime*8)
case twitchFrame%twitchFrameTime
when 0, 2
$game_player.pattern = 1
else
$game_player.pattern = 0
end
if Input.trigger?(Input::USE) || Input.trigger?(Input::BACK)
$game_player.pattern = 0
return true
end
break if !Settings::FISHING_AUTO_HOOK && numFrame > frames
numFrame += 1
end
return false
end

View File

@@ -356,7 +356,7 @@ def pbDayCareGenerateEgg
egg.happiness = 120 egg.happiness = 120
egg.iv = ivs egg.iv = ivs
egg.moves = finalmoves egg.moves = finalmoves
egg.calcStats egg.calc_stats
egg.obtain_text = _INTL("Day-Care Couple") egg.obtain_text = _INTL("Day-Care Couple")
egg.name = _INTL("Egg") egg.name = _INTL("Egg")
egg.steps_to_hatch = egg.species_data.hatch_steps egg.steps_to_hatch = egg.species_data.hatch_steps
@@ -394,7 +394,7 @@ Events.onStepTaken += proc { |_sender,_e|
oldlevel = pkmn.level oldlevel = pkmn.level
pkmn.exp += 1 # Gain Exp pkmn.exp += 1 # Gain Exp
next if pkmn.level==oldlevel next if pkmn.level==oldlevel
pkmn.calcStats pkmn.calc_stats
movelist = pkmn.getMoveList movelist = pkmn.getMoveList
for i in movelist for i in movelist
pkmn.learn_move(i[1]) if i[0]==pkmn.level # Learned a new move pkmn.learn_move(i[1]) if i[0]==pkmn.level # Learned a new move

View File

@@ -9,14 +9,6 @@ def pbLoadTrainer(tr_type, tr_name, tr_version = 0)
return (trainer_data) ? trainer_data.to_trainer : nil return (trainer_data) ? trainer_data.to_trainer : nil
end end
def pbConvertTrainerData
tr_type_names = []
GameData::TrainerType.each { |t| tr_type_names[t.id_number] = t.real_name }
MessageTypes.setMessages(MessageTypes::TrainerTypes, tr_type_names)
Compiler.write_trainer_types
Compiler.write_trainers
end
def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true) def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
party = [] party = []
for i in 0...Settings::MAX_PARTY_SIZE for i in 0...Settings::MAX_PARTY_SIZE
@@ -66,6 +58,14 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
return trainer return trainer
end end
def pbConvertTrainerData
tr_type_names = []
GameData::TrainerType.each { |t| tr_type_names[t.id_number] = t.real_name }
MessageTypes.setMessages(MessageTypes::TrainerTypes, tr_type_names)
Compiler.write_trainer_types
Compiler.write_trainers
end
def pbTrainerTypeCheck(trainer_type) def pbTrainerTypeCheck(trainer_type)
return true if !$DEBUG return true if !$DEBUG
return true if GameData::TrainerType.exists?(trainer_type) return true if GameData::TrainerType.exists?(trainer_type)
@@ -76,16 +76,6 @@ def pbTrainerTypeCheck(trainer_type)
return false return false
end end
def pbGetFreeTrainerParty(tr_type, tr_name)
tr_type_data = GameData::TrainerType.try_get(tr_type)
raise _INTL("Trainer type {1} does not exist.", tr_type) if !tr_type_data
tr_type = tr_type_data.id
for i in 0...256
return i if !GameData::Trainer.try_get(tr_type, tr_name, i)
end
return -1
end
# Called from trainer events to ensure the trainer exists # Called from trainer events to ensure the trainer exists
def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0) def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0)
return true if !$DEBUG return true if !$DEBUG
@@ -104,6 +94,16 @@ def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0)
return true return true
end end
def pbGetFreeTrainerParty(tr_type, tr_name)
tr_type_data = GameData::TrainerType.try_get(tr_type)
raise _INTL("Trainer type {1} does not exist.", tr_type) if !tr_type_data
tr_type = tr_type_data.id
for i in 0...256
return i if !GameData::Trainer.try_get(tr_type, tr_name, i)
end
return -1
end
def pbMissingTrainer(tr_type, tr_name, tr_version) def pbMissingTrainer(tr_type, tr_name, tr_version)
tr_type_data = GameData::TrainerType.try_get(tr_type) tr_type_data = GameData::TrainerType.try_get(tr_type)
raise _INTL("Trainer type {1} does not exist.", tr_type) if !tr_type_data raise _INTL("Trainer type {1} does not exist.", tr_type) if !tr_type_data
@@ -121,71 +121,3 @@ def pbMissingTrainer(tr_type, tr_name, tr_version)
pbNewTrainer(tr_type, tr_name, tr_version) if cmd == 0 pbNewTrainer(tr_type, tr_name, tr_version) if cmd == 0
return cmd return cmd
end end
#===============================================================================
# Walking charset, for use in text entry screens and load game screen
#===============================================================================
class TrainerWalkingCharSprite < SpriteWrapper
def initialize(charset,viewport=nil)
super(viewport)
@animbitmap = nil
self.charset = charset
@animframe = 0 # Current pattern
@frame = 0 # Frame counter
self.animspeed = 5 # Animation speed (frames per pattern)
end
def charset=(value)
@animbitmap.dispose if @animbitmap
@animbitmap = nil
bitmapFileName = sprintf("Graphics/Characters/%s",value)
@charset = pbResolveBitmap(bitmapFileName)
if @charset
@animbitmap = AnimatedBitmap.new(@charset)
self.bitmap = @animbitmap.bitmap
self.src_rect.set(0,0,self.bitmap.width/4,self.bitmap.height/4)
else
self.bitmap = nil
end
end
def altcharset=(value) # Used for box icon in the naming screen
@animbitmap.dispose if @animbitmap
@animbitmap = nil
@charset = pbResolveBitmap(value)
if @charset
@animbitmap = AnimatedBitmap.new(@charset)
self.bitmap = @animbitmap.bitmap
self.src_rect.set(0,0,self.bitmap.width/4,self.bitmap.height)
else
self.bitmap = nil
end
end
def animspeed=(value)
@frameskip = value*Graphics.frame_rate/40
end
def dispose
@animbitmap.dispose if @animbitmap
super
end
def update
@updating = true
super
if @animbitmap
@animbitmap.update
self.bitmap = @animbitmap.bitmap
end
@frame += 1
if @frame>=@frameskip
@animframe = (@animframe+1)%4
self.src_rect.x = @animframe*@animbitmap.bitmap.width/4
@frame -= @frameskip
end
@updating = false
end
end

View File

@@ -0,0 +1,65 @@
#===============================================================================
# Walking charset, for use in text entry screens and load game screen
#===============================================================================
class TrainerWalkingCharSprite < SpriteWrapper
def initialize(charset,viewport=nil)
super(viewport)
@animbitmap = nil
self.charset = charset
@animframe = 0 # Current pattern
@frame = 0 # Frame counter
self.animspeed = 5 # Animation speed (frames per pattern)
end
def charset=(value)
@animbitmap.dispose if @animbitmap
@animbitmap = nil
bitmapFileName = sprintf("Graphics/Characters/%s",value)
@charset = pbResolveBitmap(bitmapFileName)
if @charset
@animbitmap = AnimatedBitmap.new(@charset)
self.bitmap = @animbitmap.bitmap
self.src_rect.set(0,0,self.bitmap.width/4,self.bitmap.height/4)
else
self.bitmap = nil
end
end
def altcharset=(value) # Used for box icon in the naming screen
@animbitmap.dispose if @animbitmap
@animbitmap = nil
@charset = pbResolveBitmap(value)
if @charset
@animbitmap = AnimatedBitmap.new(@charset)
self.bitmap = @animbitmap.bitmap
self.src_rect.set(0,0,self.bitmap.width/4,self.bitmap.height)
else
self.bitmap = nil
end
end
def animspeed=(value)
@frameskip = value*Graphics.frame_rate/40
end
def dispose
@animbitmap.dispose if @animbitmap
super
end
def update
@updating = true
super
if @animbitmap
@animbitmap.update
self.bitmap = @animbitmap.bitmap
end
@frame += 1
if @frame>=@frameskip
@animframe = (@animframe+1)%4
self.src_rect.x = @animframe*@animbitmap.bitmap.width/4
@frame -= @frameskip
end
@updating = false
end
end

View File

@@ -129,7 +129,7 @@ def pbChangeLevel(pkmn,newlevel,scene)
spdefdiff = pkmn.spdef spdefdiff = pkmn.spdef
totalhpdiff = pkmn.totalhp totalhpdiff = pkmn.totalhp
pkmn.level = newlevel pkmn.level = newlevel
pkmn.calcStats pkmn.calc_stats
scene.pbRefresh scene.pbRefresh
pbMessage(_INTL("{1} dropped to Lv. {2}!",pkmn.name,pkmn.level)) pbMessage(_INTL("{1} dropped to Lv. {2}!",pkmn.name,pkmn.level))
attackdiff = pkmn.attack-attackdiff attackdiff = pkmn.attack-attackdiff
@@ -151,7 +151,7 @@ def pbChangeLevel(pkmn,newlevel,scene)
totalhpdiff = pkmn.totalhp totalhpdiff = pkmn.totalhp
pkmn.level = newlevel pkmn.level = newlevel
pkmn.changeHappiness("vitamin") pkmn.changeHappiness("vitamin")
pkmn.calcStats pkmn.calc_stats
scene.pbRefresh scene.pbRefresh
if scene.is_a?(PokemonPartyScreen) if scene.is_a?(PokemonPartyScreen)
scene.pbDisplay(_INTL("{1} grew to Lv. {2}!",pkmn.name,pkmn.level)) scene.pbDisplay(_INTL("{1} grew to Lv. {2}!",pkmn.name,pkmn.level))
@@ -272,7 +272,7 @@ def pbJustRaiseEffortValues(pkmn, stat, evGain)
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal) evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
if evGain > 0 if evGain > 0
pkmn.ev[stat] += evGain pkmn.ev[stat] += evGain
pkmn.calcStats pkmn.calc_stats
end end
return evGain return evGain
end end
@@ -287,7 +287,7 @@ def pbRaiseEffortValues(pkmn, stat, evGain = 10, ev_limit = true)
evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal) evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal)
if evGain > 0 if evGain > 0
pkmn.ev[stat] += evGain pkmn.ev[stat] += evGain
pkmn.calcStats pkmn.calc_stats
end end
return evGain return evGain
end end
@@ -305,7 +305,7 @@ def pbRaiseHappinessAndLowerEV(pkmn,scene,stat,messages)
if e if e
pkmn.ev[stat] -= 10 pkmn.ev[stat] -= 10
pkmn.ev[stat] = 0 if pkmn.ev[stat]<0 pkmn.ev[stat] = 0 if pkmn.ev[stat]<0
pkmn.calcStats pkmn.calc_stats
end end
scene.pbRefresh scene.pbRefresh
scene.pbDisplay(messages[2-(h ? 0 : 2)-(e ? 0 : 1)]) scene.pbDisplay(messages[2-(h ? 0 : 2)-(e ? 0 : 1)])

View File

@@ -43,7 +43,7 @@ def pbPurify(pkmn, scene)
end end
if newlevel == curlevel if newlevel == curlevel
pkmn.exp = newexp pkmn.exp = newexp
pkmn.calcStats pkmn.calc_stats
else else
pbChangeLevel(pkmn, newlevel, scene) # for convenience pbChangeLevel(pkmn, newlevel, scene) # for convenience
pkmn.exp = newexp pkmn.exp = newexp

View File

@@ -110,7 +110,7 @@ class Pokemon
@forced_form = nil @forced_form = nil
@level = nil # In case growth rate is different for the new species @level = nil # In case growth rate is different for the new species
@ability = nil @ability = nil
calcStats calc_stats
end end
# @param check_species [Integer, Symbol, String] id of the species to check for # @param check_species [Integer, Symbol, String] id of the species to check for
@@ -138,7 +138,7 @@ class Pokemon
@ability = nil @ability = nil
yield if block_given? yield if block_given?
MultipleForms.call("onSetForm", self, value, oldForm) MultipleForms.call("onSetForm", self, value, oldForm)
calcStats calc_stats
pbSeenForm(self) pbSeenForm(self)
end end
@@ -148,7 +148,7 @@ class Pokemon
def form_simple=(value) def form_simple=(value)
@form = value @form = value
calcStats calc_stats
end end
#============================================================================= #=============================================================================
@@ -220,6 +220,7 @@ class Pokemon
# Sets this Pokémon's status. See {GameData::Status} for all possible status effects. # Sets this Pokémon's status. See {GameData::Status} for all possible status effects.
# @param value [Integer, Symbol, String] status to set # @param value [Integer, Symbol, String] status to set
def status=(value) def status=(value)
return if !able?
new_status = GameData::Status.try_get(value) new_status = GameData::Status.try_get(value)
if !new_status if !new_status
raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name) raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name)
@@ -454,7 +455,7 @@ class Pokemon
def nature=(value) def nature=(value)
return if value && !GameData::Nature.exists?(value) return if value && !GameData::Nature.exists?(value)
@nature = (value) ? GameData::Nature.get(value).id : value @nature = (value) ? GameData::Nature.get(value).id : value
calcStats if !@nature_for_stats calc_stats if !@nature_for_stats
end end
# Returns the calculated nature, taking into account things that change its # Returns the calculated nature, taking into account things that change its
@@ -474,7 +475,7 @@ class Pokemon
def nature_for_stats=(value) def nature_for_stats=(value)
return if value && !GameData::Nature.exists?(value) return if value && !GameData::Nature.exists?(value)
@nature_for_stats = (value) ? GameData::Nature.get(value).id : value @nature_for_stats = (value) ? GameData::Nature.get(value).id : value
calcStats calc_stats
end end
# Returns whether this Pokémon has a particular nature. If no value is given, # Returns whether this Pokémon has a particular nature. If no value is given,
@@ -565,7 +566,7 @@ class Pokemon
end end
# Sets this Pokémon's movelist to the default movelist it originally had. # Sets this Pokémon's movelist to the default movelist it originally had.
def resetMoves def reset_moves
this_level = self.level this_level = self.level
# Find all level-up moves that self could have learned # Find all level-up moves that self could have learned
moveset = self.getMoveList moveset = self.getMoveList
@@ -987,7 +988,7 @@ class Pokemon
end end
# Recalculates this Pokémon's stats. # Recalculates this Pokémon's stats.
def calcStats def calc_stats
base_stats = self.baseStats base_stats = self.baseStats
this_level = self.level this_level = self.level
this_IV = self.calcIV this_IV = self.calcIV
@@ -1065,7 +1066,7 @@ class Pokemon
@item = nil @item = nil
@mail = nil @mail = nil
@moves = [] @moves = []
resetMoves if withMoves reset_moves if withMoves
@first_moves = [] @first_moves = []
@ribbons = [] @ribbons = []
@cool = 0 @cool = 0
@@ -1105,12 +1106,12 @@ class Pokemon
@personalID = rand(2 ** 16) | rand(2 ** 16) << 16 @personalID = rand(2 ** 16) | rand(2 ** 16) << 16
@hp = 1 @hp = 1
@totalhp = 1 @totalhp = 1
calcStats calc_stats
if @form == 0 && recheck_form if @form == 0 && recheck_form
f = MultipleForms.call("getFormOnCreation", self) f = MultipleForms.call("getFormOnCreation", self)
if f if f
self.form = f self.form = f
resetMoves if withMoves reset_moves if withMoves
end end
end end
end end

View File

@@ -174,6 +174,7 @@ class Pokemon
deprecated_method_alias :setItem, :item=, removal_in: 'v20' deprecated_method_alias :setItem, :item=, removal_in: 'v20'
deprecated_method_alias :healStatus, :heal_status, removal_in: 'v20' deprecated_method_alias :healStatus, :heal_status, removal_in: 'v20'
deprecated_method_alias :resetMoves, :reset_moves, removal_in: 'v20'
deprecated_method_alias :pbLearnMove, :learn_move, removal_in: 'v20' deprecated_method_alias :pbLearnMove, :learn_move, removal_in: 'v20'
deprecated_method_alias :pbDeleteMove, :forget_move, removal_in: 'v20' deprecated_method_alias :pbDeleteMove, :forget_move, removal_in: 'v20'
deprecated_method_alias :pbDeleteMoveAtIndex, :forget_move_at_index, removal_in: 'v20' deprecated_method_alias :pbDeleteMoveAtIndex, :forget_move_at_index, removal_in: 'v20'
@@ -182,6 +183,7 @@ class Pokemon
deprecated_method_alias :pbRemoveFirstMove, :remove_first_move, removal_in: 'v20' deprecated_method_alias :pbRemoveFirstMove, :remove_first_move, removal_in: 'v20'
deprecated_method_alias :pbClearFirstMoves, :clear_first_moves, removal_in: 'v20' deprecated_method_alias :pbClearFirstMoves, :clear_first_moves, removal_in: 'v20'
deprecated_method_alias :pbUpdateShadowMoves, :update_shadow_moves, removal_in: 'v20' deprecated_method_alias :pbUpdateShadowMoves, :update_shadow_moves, removal_in: 'v20'
deprecated_method_alias :calcStats, :calc_stats, removal_in: 'v20'
end end
# (see Pokemon#initialize) # (see Pokemon#initialize)

View File

@@ -121,14 +121,14 @@ end
class Scene_Intro class Scene_Intro
def initialize(pics, splash = nil) # Splash screen images that appear for a few seconds and then disappear.
@pics = pics INTRO_SPLASHES = ['intro1']
@splash = splash # The main title screen background image.
end TITLE_SCREEN = 'splash'
def main def main
Graphics.transition(0) Graphics.transition(0)
@eventscene = IntroEventScene.new(@pics,@splash) @eventscene = IntroEventScene.new(INTRO_SPLASHES, TITLE_SCREEN)
@eventscene.main @eventscene.main
Graphics.freeze Graphics.freeze
end end

View File

@@ -58,6 +58,7 @@ Your credits go here.
Your credits go here. Your credits go here.
{INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE} {INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE}
"Pokémon Essentials" was created by: "Pokémon Essentials" was created by:
Flameguru Flameguru
Poccil (Peter O.) Poccil (Peter O.)
@@ -70,15 +71,13 @@ Brother1440<s>Near Fantastica
FL.<s>PinkMan FL.<s>PinkMan
Genzai Kawakami<s>Popper Genzai Kawakami<s>Popper
help-14<s>Rataime help-14<s>Rataime
IceGod64<s>SoundSpawn IceGod64<s>Savordez
Jacob O. Wobbrock<s>the__end Jacob O. Wobbrock<s>SoundSpawn
KitsuneKouta<s>Venom12 KitsuneKouta<s>the__end
Lisa Anthony<s>Wachunga Lisa Anthony<s>Venom12
Luka S.J.<s> Luka S.J.<s>Wachunga
and everyone else who helped out and everyone else who helped out
"mkxp-z" by: "mkxp-z" by:
Roza Roza
Based on MKXP by Ancurio et al. Based on MKXP by Ancurio et al.

View File

@@ -586,7 +586,7 @@ class PokemonEvolutionScene
# Modify Pokémon to make it evolved # Modify Pokémon to make it evolved
@pokemon.species = @newspecies @pokemon.species = @newspecies
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM) @pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
@pokemon.calcStats @pokemon.calc_stats
# See and own evolved species # See and own evolved species
$Trainer.set_seen(@newspecies) $Trainer.set_seen(@newspecies)
$Trainer.set_owned(@newspecies) $Trainer.set_owned(@newspecies)
@@ -611,7 +611,7 @@ class PokemonEvolutionScene
new_pkmn.poke_ball = :POKEBALL new_pkmn.poke_ball = :POKEBALL
new_pkmn.item = nil new_pkmn.item = nil
new_pkmn.clearAllRibbons new_pkmn.clearAllRibbons
new_pkmn.calcStats new_pkmn.calc_stats
new_pkmn.heal new_pkmn.heal
# Add duplicate Pokémon to party # Add duplicate Pokémon to party
$Trainer.party.push(new_pkmn) $Trainer.party.push(new_pkmn)

View File

@@ -226,7 +226,7 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0)
end end
yourPokemon.name = nickname yourPokemon.name = nickname
yourPokemon.obtain_method = 2 # traded yourPokemon.obtain_method = 2 # traded
yourPokemon.resetMoves if resetmoves yourPokemon.reset_moves if resetmoves
yourPokemon.record_first_moves yourPokemon.record_first_moves
$Trainer.set_seen(yourPokemon.species) $Trainer.set_seen(yourPokemon.species)
$Trainer.set_owned(yourPokemon.species) $Trainer.set_owned(yourPokemon.species)

View File

@@ -374,7 +374,7 @@ def pbReceiveMysteryGift(id)
gift=$Trainer.mystery_gifts[index] gift=$Trainer.mystery_gifts[index]
if gift[1]==0 # Pokémon if gift[1]==0 # Pokémon
gift[2].personalID = rand(2**16) | rand(2**16) << 16 gift[2].personalID = rand(2**16) | rand(2**16) << 16
gift[2].calcStats gift[2].calc_stats
time=pbGetTimeNow time=pbGetTimeNow
gift[2].timeReceived=time.getgm.to_i gift[2].timeReceived=time.getgm.to_i
gift[2].obtain_method = 4 # Fateful encounter gift[2].obtain_method = 4 # Fateful encounter

View File

@@ -166,7 +166,7 @@ class PBPokemon
ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length } ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length }
end end
GameData::Stat.each_main { |s| pokemon.iv[s.id] = iv } GameData::Stat.each_main { |s| pokemon.iv[s.id] = iv }
pokemon.calcStats pokemon.calc_stats
return pokemon return pokemon
end end
end end

View File

@@ -60,14 +60,14 @@ class LevelAdjustment
exp=adjustments[0][i] exp=adjustments[0][i]
if exp && team1[i].exp!=exp if exp && team1[i].exp!=exp
team1[i].exp=exp team1[i].exp=exp
team1[i].calcStats team1[i].calc_stats
end end
end end
for i in 0...team2.length for i in 0...team2.length
exp=adjustments[1][i] exp=adjustments[1][i]
if exp && team2[i].exp!=exp if exp && team2[i].exp!=exp
team2[i].exp=exp team2[i].exp=exp
team2[i].calcStats team2[i].calc_stats
end end
end end
end end
@@ -90,7 +90,7 @@ class LevelAdjustment
for i in 0...team1.length for i in 0...team1.length
if team1[i].level!=adj1[i] if team1[i].level!=adj1[i]
team1[i].level=adj1[i] team1[i].level=adj1[i]
team1[i].calcStats team1[i].calc_stats
end end
end end
end end
@@ -98,7 +98,7 @@ class LevelAdjustment
for i in 0...team2.length for i in 0...team2.length
if team2[i].level!=adj2[i] if team2[i].level!=adj2[i]
team2[i].level=adj2[i] team2[i].level=adj2[i]
team2[i].calcStats team2[i].calc_stats
end end
end end
end end

View File

@@ -849,7 +849,7 @@ def pbRuledBattle(team1,team2,rule)
next if !p next if !p
if p.level!=level if p.level!=level
p.level=level p.level=level
p.calcStats p.calc_stats
end end
items1[i]=p.item_id items1[i]=p.item_id
trainer1.party.push(p) trainer1.party.push(p)
@@ -858,7 +858,7 @@ def pbRuledBattle(team1,team2,rule)
next if !p next if !p
if p.level!=level if p.level!=level
p.level=level p.level=level
p.calcStats p.calc_stats
end end
items2[i]=p.item_id items2[i]=p.item_id
trainer2.party.push(p) trainer2.party.push(p)

View File

@@ -124,7 +124,7 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner
# Set nickname # Set nickname
pkmn.name = nickname[0, Pokemon::MAX_NAME_SIZE] pkmn.name = nickname[0, Pokemon::MAX_NAME_SIZE]
# Recalculate stats # Recalculate stats
pkmn.calcStats pkmn.calc_stats
if owner_name if owner_name
pbMessage(_INTL("\\me[Pkmn get]{1} received a Pokémon from {2}.\1", $Trainer.name, owner_name)) pbMessage(_INTL("\\me[Pkmn get]{1} received a Pokémon from {2}.\1", $Trainer.name, owner_name))
else else
@@ -144,7 +144,7 @@ def pbGenerateEgg(pkmn, text = "")
pkmn.name = _INTL("Egg") pkmn.name = _INTL("Egg")
pkmn.steps_to_hatch = pkmn.species_data.hatch_steps pkmn.steps_to_hatch = pkmn.species_data.hatch_steps
pkmn.obtain_text = text pkmn.obtain_text = text
pkmn.calcStats pkmn.calc_stats
# Add egg to party # Add egg to party
$Trainer.party[$Trainer.party.length] = pkmn $Trainer.party[$Trainer.party.length] = pkmn
return true return true

View File

@@ -208,7 +208,7 @@ PokemonDebugMenuCommands.register("setlevel", {
_INTL("Set the Pokémon's level (max. {1}).", params.maxNumber), params) { screen.pbUpdate } _INTL("Set the Pokémon's level (max. {1}).", params.maxNumber), params) { screen.pbUpdate }
if level != pkmn.level if level != pkmn.level
pkmn.level = level pkmn.level = level
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
@@ -236,7 +236,7 @@ PokemonDebugMenuCommands.register("setexp", {
_INTL("Set the Pokémon's Exp (range {1}-{2}).", minxp, maxxp - 1), params) { screen.pbUpdate } _INTL("Set the Pokémon's Exp (range {1}-{2}).", minxp, maxxp - 1), params) { screen.pbUpdate }
if newexp != pkmn.exp if newexp != pkmn.exp
pkmn.exp = newexp pkmn.exp = newexp
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
@@ -290,7 +290,7 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
GameData::Stat.get(ev_id[cmd2]).name, upperLimit), params) { screen.pbUpdate } GameData::Stat.get(ev_id[cmd2]).name, upperLimit), params) { screen.pbUpdate }
if f != pkmn.ev[ev_id[cmd2]] if f != pkmn.ev[ev_id[cmd2]]
pkmn.ev[ev_id[cmd2]] = f pkmn.ev[ev_id[cmd2]] = f
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
else # (Max) Randomise all else # (Max) Randomise all
@@ -309,7 +309,7 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
pkmn.ev[ev_id[r]] += addVal pkmn.ev[ev_id[r]] += addVal
evTotalTarget -= addVal evTotalTarget -= addVal
end end
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
@@ -340,18 +340,18 @@ PokemonDebugMenuCommands.register("hiddenvalues", {
GameData::Stat.get(iv_id[cmd2]).name), params) { screen.pbUpdate } GameData::Stat.get(iv_id[cmd2]).name), params) { screen.pbUpdate }
if f != pkmn.iv[iv_id[cmd2]] if f != pkmn.iv[iv_id[cmd2]]
pkmn.iv[iv_id[cmd2]] = f pkmn.iv[iv_id[cmd2]] = f
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
else # Randomise all else # Randomise all
GameData::Stat.each_main { |s| pkmn.iv[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) } GameData::Stat.each_main { |s| pkmn.iv[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) }
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
when 2 # Randomise pID when 2 # Randomise pID
pkmn.personalID = rand(2 ** 16) | rand(2 ** 16) << 16 pkmn.personalID = rand(2 ** 16) | rand(2 ** 16) << 16
pkmn.calcStats pkmn.calc_stats
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
end end
@@ -535,7 +535,7 @@ PokemonDebugMenuCommands.register("resetmoves", {
"name" => _INTL("Reset moves"), "name" => _INTL("Reset moves"),
"always_show" => true, "always_show" => true,
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
pkmn.resetMoves pkmn.reset_moves
screen.pbDisplay(_INTL("{1}'s moves were reset.", pkmn.name)) screen.pbDisplay(_INTL("{1}'s moves were reset.", pkmn.name))
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
next false next false
@@ -748,7 +748,7 @@ PokemonDebugMenuCommands.register("speciesform", {
species = pbChooseSpeciesList(pkmn.species) species = pbChooseSpeciesList(pkmn.species)
if species && species != pkmn.species if species && species != pkmn.species
pkmn.species = species pkmn.species = species
pkmn.calcStats pkmn.calc_stats
pbSeenForm(pkmn) if !settingUpBattle pbSeenForm(pkmn) if !settingUpBattle
screen.pbRefreshSingle(pkmnid) screen.pbRefreshSingle(pkmnid)
end end
@@ -984,7 +984,7 @@ PokemonDebugMenuCommands.register("setegg", {
if !pkmn.egg? && (pbHasEgg?(pkmn.species) || if !pkmn.egg? && (pbHasEgg?(pkmn.species) ||
screen.pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName))) screen.pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName)))
pkmn.level = Settings::EGG_LEVEL pkmn.level = Settings::EGG_LEVEL
pkmn.calcStats pkmn.calc_stats
pkmn.name = _INTL("Egg") pkmn.name = _INTL("Egg")
pkmn.steps_to_hatch = pkmn.species_data.hatch_steps pkmn.steps_to_hatch = pkmn.species_data.hatch_steps
pkmn.hatched_map = 0 pkmn.hatched_map = 0

View File

@@ -10,10 +10,7 @@ end
def pbCallTitle def pbCallTitle
return Scene_DebugIntro.new if $DEBUG return Scene_DebugIntro.new if $DEBUG
# First parameter is an array of images in the Titles directory without a file return Scene_Intro.new
# extension, to show before the actual title screen. Second parameter is the
# actual title screen filename, also in Titles with no extension.
return Scene_Intro.new(['intro1'], 'splash')
end end
def mainFunction def mainFunction

BIN
Game.exe

Binary file not shown.

View File

@@ -20,21 +20,6 @@
// //
// "rgssVersion": 1, // "rgssVersion": 1,
// Request an OpenGL 4.1 context. This
// introduces these minimum requirements
// for GPUs:
//
// + NVIDIA 400 Series+
// + AMD Radeon HD 5000+
// + Intel HD Graphics 4000+
//
// If disabled, OpenGL 3.3 is used instead.
// (default: disabled)
//
// "openGL4": false,
// Create a debug context and log // Create a debug context and log
// OpenGL debug information to the console // OpenGL debug information to the console
// (default: disabled) // (default: disabled)
@@ -172,7 +157,7 @@
// Set the base path of the game to '/path/to/game' // Set the base path of the game to '/path/to/game'
// (default: executable directory) // (default: executable directory)
// //
// "gameFolder": "/path/to/game", // "gameFolder": ".",
// Use either right or left Alt + Enter to toggle // Use either right or left Alt + Enter to toggle
@@ -188,20 +173,21 @@
// "enableReset": true, // "enableReset": true,
// Names of the input buttons in the F1 key bindings
// window. This only affects the names displayed
// there, and won't enable those names as Input
// constants in the scripts.
"bindingNames": {"c": "Use",
"b": "Back",
"a": "Special"},
// Allow symlinks for game assets to be followed // Allow symlinks for game assets to be followed
// (default: disabled) // (default: disabled)
// //
// "allowSymlinks": false, // "allowSymlinks": false,
// Names of the input buttons in the F1 key bindings
// window. This only affects the names displayed
// there, and won't enable those names as Input
// constants in the scripts.
"bindingNames": {"c": "Use",
"b": "Back",
"a": "Special"},
// Organisation / company and application / game // Organisation / company and application / game
// name to build the directory path where mkxp // name to build the directory path where mkxp
// will store game specific data (eg. key bindings). // will store game specific data (eg. key bindings).
@@ -307,6 +293,32 @@
// "rubyLoadpath": ["/usr/lib64/ruby/", // "rubyLoadpath": ["/usr/lib64/ruby/",
// "/usr/local/share/ruby/site_ruby"], // "/usr/local/share/ruby/site_ruby"],
// Determines whether JIT is enabled. This probably
// won't work unless you also have the header file
// that it needs. Only works with Ruby 2.6 or higher.
// (default: false)
//
// "JITEnable": false,
// Determines what level of verbosity to use when
// logging JIT events. Starts at 0, which is next
// to nothing. Set it higher to see more.
// (default: 0)
//
// "JITVerboseLevel": 0,
// Determines how many compiled methods that Ruby
// will keep in its cache.
// (default: 100)
//
// "JITMaxCache": 100,
// Determines how many times a function has to be
// called before it is compiled.
// (default: 10000)
//
// "JITMinCalls": 10000,
// SoundFont to use for midi playback (via fluidsynth) // SoundFont to use for midi playback (via fluidsynth)
// (default: none) // (default: none)