diff --git a/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb b/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb index 89e91fac0..03cec609f 100644 --- a/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb +++ b/Data/Scripts/001_Technical/001_MKXP_Compatibility.rb @@ -1,3 +1,4 @@ +# Using mkxp-z v2.1.1 - https://gitlab.com/mkxp-z/mkxp-z/-/releases/v2.1.1 $VERBOSE = nil Font.default_shadow = false if Font.respond_to?(:default_shadow) Graphics.frame_rate = 40 diff --git a/Data/Scripts/003_Game classes/000_Game.rb b/Data/Scripts/001c_Game processing/000_StartGame.rb similarity index 100% rename from Data/Scripts/003_Game classes/000_Game.rb rename to Data/Scripts/001c_Game processing/000_StartGame.rb diff --git a/Data/Scripts/006_Game processing/001_Interpreter.rb b/Data/Scripts/001c_Game processing/001_Interpreter.rb similarity index 100% rename from Data/Scripts/006_Game processing/001_Interpreter.rb rename to Data/Scripts/001c_Game processing/001_Interpreter.rb diff --git a/Data/Scripts/006_Game processing/001b_Interpreter commands.rb b/Data/Scripts/001c_Game processing/001b_Interpreter commands.rb similarity index 100% rename from Data/Scripts/006_Game processing/001b_Interpreter commands.rb rename to Data/Scripts/001c_Game processing/001b_Interpreter commands.rb diff --git a/Data/Scripts/006_Game processing/002_Scene_Map.rb b/Data/Scripts/001c_Game processing/002_Scene_Map.rb similarity index 100% rename from Data/Scripts/006_Game processing/002_Scene_Map.rb rename to Data/Scripts/001c_Game processing/002_Scene_Map.rb diff --git a/Data/Scripts/006_Game processing/003_Event_Handlers.rb b/Data/Scripts/002b_TriggeredEvents/001_Event_Handlers.rb similarity index 100% rename from Data/Scripts/006_Game processing/003_Event_Handlers.rb rename to Data/Scripts/002b_TriggeredEvents/001_Event_Handlers.rb diff --git a/Data/Scripts/002b_TriggeredEvents/002_Event_FieldEvents.rb b/Data/Scripts/002b_TriggeredEvents/002_Event_FieldEvents.rb new file mode 100644 index 000000000..b83ea0d6f --- /dev/null +++ b/Data/Scripts/002b_TriggeredEvents/002_Event_FieldEvents.rb @@ -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 diff --git a/Data/Scripts/003_Game classes/001_Game_Screen.rb b/Data/Scripts/003_Game classes/001_Game_Screen.rb index 9eca01a80..9e7e885be 100644 --- a/Data/Scripts/003_Game classes/001_Game_Screen.rb +++ b/Data/Scripts/003_Game classes/001_Game_Screen.rb @@ -134,3 +134,21 @@ class Game_Screen 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 diff --git a/Data/Scripts/003_Game classes/004_Game_Map.rb b/Data/Scripts/003_Game classes/004_Game_Map.rb index 28d415089..cac21060c 100644 --- a/Data/Scripts/003_Game classes/004_Game_Map.rb +++ b/Data/Scripts/003_Game classes/004_Game_Map.rb @@ -439,3 +439,30 @@ class Game_Map 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 diff --git a/Data/Scripts/003_Game classes/004a_Game_Map_Autoscroll.rb b/Data/Scripts/003_Game classes/005_Game_MapAutoscroll.rb similarity index 100% rename from Data/Scripts/003_Game classes/004a_Game_Map_Autoscroll.rb rename to Data/Scripts/003_Game classes/005_Game_MapAutoscroll.rb diff --git a/Data/Scripts/003_Game classes/004b_MapFactory.rb b/Data/Scripts/003_Game classes/006_Game_MapFactory.rb similarity index 100% rename from Data/Scripts/003_Game classes/004b_MapFactory.rb rename to Data/Scripts/003_Game classes/006_Game_MapFactory.rb diff --git a/Data/Scripts/003_Game classes/005_Game_Character.rb b/Data/Scripts/003_Game classes/007_Game_Character.rb similarity index 100% rename from Data/Scripts/003_Game classes/005_Game_Character.rb rename to Data/Scripts/003_Game classes/007_Game_Character.rb diff --git a/Data/Scripts/003_Game classes/006_Game_Event.rb b/Data/Scripts/003_Game classes/008_Game_Event.rb similarity index 99% rename from Data/Scripts/003_Game classes/006_Game_Event.rb rename to Data/Scripts/003_Game classes/008_Game_Event.rb index 20e83e35a..3c50e129e 100644 --- a/Data/Scripts/003_Game classes/006_Game_Event.rb +++ b/Data/Scripts/003_Game classes/008_Game_Event.rb @@ -31,6 +31,10 @@ class Game_Event < Game_Character def id; return @event.id; end def name; return @event.name; end + def set_starting + @starting = true + end + def clear_starting @starting = false end diff --git a/Data/Scripts/003_Game classes/007_Game_Player.rb b/Data/Scripts/003_Game classes/009_Game_Player.rb similarity index 100% rename from Data/Scripts/003_Game classes/007_Game_Player.rb rename to Data/Scripts/003_Game classes/009_Game_Player.rb diff --git a/Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb b/Data/Scripts/003_Game classes/010_Game_PlayerVisuals.rb similarity index 100% rename from Data/Scripts/003_Game classes/008_Game_Player_Visuals.rb rename to Data/Scripts/003_Game classes/010_Game_PlayerVisuals.rb diff --git a/Data/Scripts/003_Game classes/012_Game_CommonEvent.rb b/Data/Scripts/003_Game classes/011_Game_CommonEvent.rb similarity index 100% rename from Data/Scripts/003_Game classes/012_Game_CommonEvent.rb rename to Data/Scripts/003_Game classes/011_Game_CommonEvent.rb diff --git a/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb b/Data/Scripts/003_Game classes/012_Game_DependentEvents.rb similarity index 99% rename from Data/Scripts/013_Overworld/014_PField_DependentEvents.rb rename to Data/Scripts/003_Game classes/012_Game_DependentEvents.rb index 662a141c2..4294be256 100644 --- a/Data/Scripts/013_Overworld/014_PField_DependentEvents.rb +++ b/Data/Scripts/003_Game classes/012_Game_DependentEvents.rb @@ -48,14 +48,6 @@ end -class Game_Event - def set_starting - @starting=true - end -end - - - def pbTestPass(follower,x,y,_direction=nil) return $MapFactory.isPassableStrict?(follower.map.map_id,x,y,follower) end diff --git a/Data/Scripts/007_Events and files/001_FileTests.rb b/Data/Scripts/007_Files, translation and logs/001_FileTests.rb similarity index 100% rename from Data/Scripts/007_Events and files/001_FileTests.rb rename to Data/Scripts/007_Files, translation and logs/001_FileTests.rb diff --git a/Data/Scripts/007_Events and files/002_File_Mixins.rb b/Data/Scripts/007_Files, translation and logs/002_File_Mixins.rb similarity index 100% rename from Data/Scripts/007_Events and files/002_File_Mixins.rb rename to Data/Scripts/007_Files, translation and logs/002_File_Mixins.rb diff --git a/Data/Scripts/007_Events and files/003_Intl_Messages.rb b/Data/Scripts/007_Files, translation and logs/003_Intl_Messages.rb similarity index 100% rename from Data/Scripts/007_Events and files/003_Intl_Messages.rb rename to Data/Scripts/007_Files, translation and logs/003_Intl_Messages.rb diff --git a/Data/Scripts/007_Events and files/004_PBDebug.rb b/Data/Scripts/007_Files, translation and logs/004_PBDebug.rb similarity index 100% rename from Data/Scripts/007_Events and files/004_PBDebug.rb rename to Data/Scripts/007_Files, translation and logs/004_PBDebug.rb diff --git a/Data/Scripts/011_Data/001_Hardcoded data/007_Evolution.rb b/Data/Scripts/011_Data/001_Hardcoded data/007_Evolution.rb index 187c67182..896845700 100644 --- a/Data/Scripts/011_Data/001_Hardcoded data/007_Evolution.rb +++ b/Data/Scripts/011_Data/001_Hardcoded data/007_Evolution.rb @@ -120,9 +120,7 @@ GameData::Evolution.register({ :id => :LevelNoWeather, :parameter => Integer, :level_up_proc => proc { |pkmn, parameter| - if pkmn.level >= parameter && $game_screen - next $game_screen.weather_type == :None - end + next pkmn.level >= parameter && $game_screen && $game_screen.weather_type == :None } }) @@ -130,9 +128,8 @@ GameData::Evolution.register({ :id => :LevelSun, :parameter => Integer, :level_up_proc => proc { |pkmn, parameter| - if pkmn.level >= parameter && $game_screen - next GameData::Weather.get($game_screen.weather_type).category == :Sun - end + next pkmn.level >= parameter && $game_screen && + GameData::Weather.get($game_screen.weather_type).category == :Sun } }) @@ -140,9 +137,8 @@ GameData::Evolution.register({ :id => :LevelRain, :parameter => Integer, :level_up_proc => proc { |pkmn, parameter| - if pkmn.level >= parameter && $game_screen - next [:Rain, :Fog].include?(GameData::Weather.get($game_screen.weather_type).category) - end + next pkmn.level >= parameter && $game_screen && + [:Rain, :Fog].include?(GameData::Weather.get($game_screen.weather_type).category) } }) @@ -150,9 +146,8 @@ GameData::Evolution.register({ :id => :LevelSnow, :parameter => Integer, :level_up_proc => proc { |pkmn, parameter| - if pkmn.level >= parameter && $game_screen - next GameData::Weather.get($game_screen.weather_type).category == :Hail - end + next pkmn.level >= parameter && $game_screen && + GameData::Weather.get($game_screen.weather_type).category == :Hail } }) @@ -160,9 +155,8 @@ GameData::Evolution.register({ :id => :LevelSandstorm, :parameter => Integer, :level_up_proc => proc { |pkmn, parameter| - if pkmn.level >= parameter && $game_screen - next GameData::Weather.get($game_screen.weather_type).category == :Sandstorm - end + next pkmn.level >= parameter && $game_screen && + GameData::Weather.get($game_screen.weather_type).category == :Sandstorm } }) @@ -203,7 +197,7 @@ GameData::Evolution.register({ :id => :LevelDarkInParty, :parameter => Integer, :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) } }) diff --git a/Data/Scripts/011_Data/002_PBS data/013_Trainer.rb b/Data/Scripts/011_Data/002_PBS data/013_Trainer.rb index bd2311267..5ec0daf6f 100644 --- a/Data/Scripts/011_Data/002_PBS data/013_Trainer.rb +++ b/Data/Scripts/011_Data/002_PBS data/013_Trainer.rb @@ -125,7 +125,7 @@ module GameData if pkmn_data[:moves] && pkmn_data[:moves].length > 0 pkmn_data[:moves].each { |move| pkmn.learn_move(move) } else - pkmn.resetMoves + pkmn.reset_moves end pkmn.ability_index = pkmn_data[:ability_flag] pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1) @@ -156,7 +156,7 @@ module GameData pkmn.shiny = false end pkmn.poke_ball = pbBallTypeToItem(pkmn_data[:poke_ball]).id if pkmn_data[:poke_ball] - pkmn.calcStats + pkmn.calc_stats end return trainer end diff --git a/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb b/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb index 279791a0a..f64c1962c 100644 --- a/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb +++ b/Data/Scripts/012_Battle/001_Battler/002_Battler_Initialize.rb @@ -286,7 +286,7 @@ class PokeBattle_Battler #============================================================================= def pbUpdate(fullChange=false) return if !@pokemon - @pokemon.calcStats + @pokemon.calc_stats @level = @pokemon.level @hp = @pokemon.hp @totalhp = @pokemon.totalhp diff --git a/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb b/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb index c6bb614e0..96896e731 100644 --- a/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb +++ b/Data/Scripts/012_Battle/003_Battle/004_Battle_ExpAndMoveLearning.rb @@ -94,7 +94,7 @@ class PokeBattle_Battle growth_rate = pkmn.growth_rate # Don't bother calculating if gainer is already at max 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 end isPartic = defeatedBattler.participants.include?(idxParty) @@ -188,7 +188,7 @@ class PokeBattle_Battle curLevel += 1 if curLevel>newLevel # Gained all the Exp now, end the animation - pkmn.calcStats + pkmn.calc_stats battler.pbUpdate(false) if battler @scene.pbRefreshOne(battler.index) if battler break @@ -204,7 +204,7 @@ class PokeBattle_Battle if battler && battler.pokemon battler.pokemon.changeHappiness("levelup") end - pkmn.calcStats + pkmn.calc_stats battler.pbUpdate(false) if battler @scene.pbRefreshOne(battler.index) if battler pbDisplayPaused(_INTL("{1} grew to Lv. {2}!",pkmn.name,curLevel)) diff --git a/Data/Scripts/013_Overworld/004_PField_Weather.rb b/Data/Scripts/013_Overworld/001_Animations/001_Overworld_Weather.rb similarity index 100% rename from Data/Scripts/013_Overworld/004_PField_Weather.rb rename to Data/Scripts/013_Overworld/001_Animations/001_Overworld_Weather.rb diff --git a/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb b/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb new file mode 100644 index 000000000..c47089256 --- /dev/null +++ b/Data/Scripts/013_Overworld/001_Animations/002_Overworld_Overlays.rb @@ -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)) +} diff --git a/Data/Scripts/013_Overworld/001_Animations/003_Overworld_MapTransitionAnims.rb b/Data/Scripts/013_Overworld/001_Animations/003_Overworld_MapTransitionAnims.rb new file mode 100644 index 000000000..6f8490e23 --- /dev/null +++ b/Data/Scripts/013_Overworld/001_Animations/003_Overworld_MapTransitionAnims.rb @@ -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 diff --git a/Data/Scripts/013_Overworld/002_PField_Field.rb b/Data/Scripts/013_Overworld/001_Overworld.rb similarity index 69% rename from Data/Scripts/013_Overworld/002_PField_Field.rb rename to Data/Scripts/013_Overworld/001_Overworld.rb index 717a848d6..9dd1c73b5 100644 --- a/Data/Scripts/013_Overworld/002_PField_Field.rb +++ b/Data/Scripts/013_Overworld/001_Overworld.rb @@ -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 #=============================================================================== @@ -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)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 #=============================================================================== @@ -1005,7 +688,7 @@ def pbRegisterPartner(tr_type, tr_name, tr_id = 0) Events.onTrainerPartyLoad.trigger(nil, trainer) for i in trainer.party i.owner = Pokemon::Owner.new_from_trainer(trainer) - i.calcStats + i.calc_stats end $PokemonGlobal.partner = [tr_type, tr_name, trainer.id, trainer.party] end diff --git a/Data/Scripts/013_Overworld/006_PField_Battles.rb b/Data/Scripts/013_Overworld/002_Battles/001_Overworld_BattleStarting.rb similarity index 100% rename from Data/Scripts/013_Overworld/006_PField_Battles.rb rename to Data/Scripts/013_Overworld/002_Battles/001_Overworld_BattleStarting.rb diff --git a/Data/Scripts/013_Overworld/003_PField_Visuals.rb b/Data/Scripts/013_Overworld/002_Battles/002_Overworld_BattleIntroAnim.rb similarity index 50% rename from Data/Scripts/013_Overworld/003_PField_Visuals.rb rename to Data/Scripts/013_Overworld/002_Battles/002_Overworld_BattleIntroAnim.rb index d9a65e37d..104bb72e7 100644 --- a/Data/Scripts/013_Overworld/003_PField_Visuals.rb +++ b/Data/Scripts/013_Overworld/002_Battles/002_Overworld_BattleIntroAnim.rb @@ -1,5 +1,5 @@ #=============================================================================== -# Battle start animation +# Battle intro animation #=============================================================================== def pbSceneStandby $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 end +#=============================================================================== +# Vs. battle intro animation +#=============================================================================== def pbBattleAnimationOverride(viewport,battletype=0,foe=nil) ##### VS. animation, by Luka S.J. ##### ##### Tweaked by Maruno ##### @@ -278,6 +281,9 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil) return false end +#=============================================================================== +# Override battle intro animation +#=============================================================================== # 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 # ("__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. return __over1__pbBattleAnimationOverride(viewport,battletype,foe) 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 diff --git a/Data/Scripts/013_Overworld/007_PField_Encounters.rb b/Data/Scripts/013_Overworld/002_Battles/003_Overworld_WildEncounters.rb similarity index 100% rename from Data/Scripts/013_Overworld/007_PField_Encounters.rb rename to Data/Scripts/013_Overworld/002_Battles/003_Overworld_WildEncounters.rb diff --git a/Data/Scripts/013_Overworld/008_PField_EncounterModifiers.rb b/Data/Scripts/013_Overworld/002_Battles/004_Overworld_EncounterModifiers.rb similarity index 97% rename from Data/Scripts/013_Overworld/008_PField_EncounterModifiers.rb rename to Data/Scripts/013_Overworld/002_Battles/004_Overworld_EncounterModifiers.rb index 498ae6b20..97783165c 100644 --- a/Data/Scripts/013_Overworld/008_PField_EncounterModifiers.rb +++ b/Data/Scripts/013_Overworld/002_Battles/004_Overworld_EncounterModifiers.rb @@ -23,8 +23,8 @@ Events.onWildPokemonCreate += proc { |_sender, e| new_level = pbBalancedLevel($Trainer.party) - 4 + rand(5) # For variety new_level = new_level.clamp(1, GameData::GrowthRate.max_level) pokemon.level = new_level - pokemon.calcStats - pokemon.resetMoves + pokemon.calc_stats + pokemon.reset_moves end } diff --git a/Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb b/Data/Scripts/013_Overworld/002_Battles/005_Overworld_RoamingPokemon.rb similarity index 100% rename from Data/Scripts/013_Overworld/009_PField_RoamingPokemon.rb rename to Data/Scripts/013_Overworld/002_Battles/005_Overworld_RoamingPokemon.rb diff --git a/Data/Scripts/013_Overworld/005_PField_Metadata.rb b/Data/Scripts/013_Overworld/002_Overworld_Metadata.rb similarity index 100% rename from Data/Scripts/013_Overworld/005_PField_Metadata.rb rename to Data/Scripts/013_Overworld/002_Overworld_Metadata.rb diff --git a/Data/Scripts/013_Overworld/015_PField_Time.rb b/Data/Scripts/013_Overworld/003_Overworld_Time.rb similarity index 100% rename from Data/Scripts/013_Overworld/015_PField_Time.rb rename to Data/Scripts/013_Overworld/003_Overworld_Time.rb diff --git a/Data/Scripts/013_Overworld/011_PField_FieldMoves.rb b/Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb similarity index 100% rename from Data/Scripts/013_Overworld/011_PField_FieldMoves.rb rename to Data/Scripts/013_Overworld/004_Overworld_FieldMoves.rb diff --git a/Data/Scripts/013_Overworld/005_Overworld_Fishing.rb b/Data/Scripts/013_Overworld/005_Overworld_Fishing.rb new file mode 100644 index 000000000..4dde6e11d --- /dev/null +++ b/Data/Scripts/013_Overworld/005_Overworld_Fishing.rb @@ -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)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 diff --git a/Data/Scripts/013_Overworld/012_PField_BerryPlants.rb b/Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb similarity index 100% rename from Data/Scripts/013_Overworld/012_PField_BerryPlants.rb rename to Data/Scripts/013_Overworld/006_Overworld_BerryPlants.rb diff --git a/Data/Scripts/013_Overworld/013_PField_DayCare.rb b/Data/Scripts/013_Overworld/007_Overworld_DayCare.rb similarity index 99% rename from Data/Scripts/013_Overworld/013_PField_DayCare.rb rename to Data/Scripts/013_Overworld/007_Overworld_DayCare.rb index ce404e315..d1d94e08d 100644 --- a/Data/Scripts/013_Overworld/013_PField_DayCare.rb +++ b/Data/Scripts/013_Overworld/007_Overworld_DayCare.rb @@ -356,7 +356,7 @@ def pbDayCareGenerateEgg egg.happiness = 120 egg.iv = ivs egg.moves = finalmoves - egg.calcStats + egg.calc_stats egg.obtain_text = _INTL("Day-Care Couple") egg.name = _INTL("Egg") egg.steps_to_hatch = egg.species_data.hatch_steps @@ -394,7 +394,7 @@ Events.onStepTaken += proc { |_sender,_e| oldlevel = pkmn.level pkmn.exp += 1 # Gain Exp next if pkmn.level==oldlevel - pkmn.calcStats + pkmn.calc_stats movelist = pkmn.getMoveList for i in movelist pkmn.learn_move(i[1]) if i[0]==pkmn.level # Learned a new move diff --git a/Data/Scripts/013_Overworld/010_PField_RandomDungeons.rb b/Data/Scripts/013_Overworld/008_Overworld_RandomDungeons.rb similarity index 100% rename from Data/Scripts/013_Overworld/010_PField_RandomDungeons.rb rename to Data/Scripts/013_Overworld/008_Overworld_RandomDungeons.rb diff --git a/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb b/Data/Scripts/014_Trainers/003_Trainer_LoadAndNew.rb similarity index 70% rename from Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb rename to Data/Scripts/014_Trainers/003_Trainer_LoadAndNew.rb index cbe59a87c..8a4e703e5 100644 --- a/Data/Scripts/014_Trainers/002_PTrainer_NPCTrainers.rb +++ b/Data/Scripts/014_Trainers/003_Trainer_LoadAndNew.rb @@ -9,14 +9,6 @@ def pbLoadTrainer(tr_type, tr_name, tr_version = 0) return (trainer_data) ? trainer_data.to_trainer : nil 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) party = [] 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 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) return true if !$DEBUG return true if GameData::TrainerType.exists?(trainer_type) @@ -76,16 +76,6 @@ def pbTrainerTypeCheck(trainer_type) return false 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 def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0) return true if !$DEBUG @@ -104,6 +94,16 @@ def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0) return true 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) tr_type_data = GameData::TrainerType.try_get(tr_type) 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 return cmd 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 diff --git a/Data/Scripts/014_Trainers/004_Trainer_sprite.rb b/Data/Scripts/014_Trainers/004_Trainer_sprite.rb new file mode 100644 index 000000000..e11cc3bd2 --- /dev/null +++ b/Data/Scripts/014_Trainers/004_Trainer_sprite.rb @@ -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 diff --git a/Data/Scripts/015_Items/001_PItem_Items.rb b/Data/Scripts/015_Items/001_PItem_Items.rb index 6409b458a..88baf1a25 100644 --- a/Data/Scripts/015_Items/001_PItem_Items.rb +++ b/Data/Scripts/015_Items/001_PItem_Items.rb @@ -129,7 +129,7 @@ def pbChangeLevel(pkmn,newlevel,scene) spdefdiff = pkmn.spdef totalhpdiff = pkmn.totalhp pkmn.level = newlevel - pkmn.calcStats + pkmn.calc_stats scene.pbRefresh pbMessage(_INTL("{1} dropped to Lv. {2}!",pkmn.name,pkmn.level)) attackdiff = pkmn.attack-attackdiff @@ -151,7 +151,7 @@ def pbChangeLevel(pkmn,newlevel,scene) totalhpdiff = pkmn.totalhp pkmn.level = newlevel pkmn.changeHappiness("vitamin") - pkmn.calcStats + pkmn.calc_stats scene.pbRefresh if scene.is_a?(PokemonPartyScreen) 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) if evGain > 0 pkmn.ev[stat] += evGain - pkmn.calcStats + pkmn.calc_stats end return evGain end @@ -287,7 +287,7 @@ def pbRaiseEffortValues(pkmn, stat, evGain = 10, ev_limit = true) evGain = evGain.clamp(0, Pokemon::EV_LIMIT - evTotal) if evGain > 0 pkmn.ev[stat] += evGain - pkmn.calcStats + pkmn.calc_stats end return evGain end @@ -305,7 +305,7 @@ def pbRaiseHappinessAndLowerEV(pkmn,scene,stat,messages) if e pkmn.ev[stat] -= 10 pkmn.ev[stat] = 0 if pkmn.ev[stat]<0 - pkmn.calcStats + pkmn.calc_stats end scene.pbRefresh scene.pbDisplay(messages[2-(h ? 0 : 2)-(e ? 0 : 1)]) diff --git a/Data/Scripts/016_Pokemon/001_Pokemon-related/004_Pokemon_ShadowPokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon-related/004_Pokemon_ShadowPokemon.rb index 4259f649e..63417609a 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon-related/004_Pokemon_ShadowPokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon-related/004_Pokemon_ShadowPokemon.rb @@ -43,7 +43,7 @@ def pbPurify(pkmn, scene) end if newlevel == curlevel pkmn.exp = newexp - pkmn.calcStats + pkmn.calc_stats else pbChangeLevel(pkmn, newlevel, scene) # for convenience pkmn.exp = newexp diff --git a/Data/Scripts/016_Pokemon/001_Pokemon.rb b/Data/Scripts/016_Pokemon/001_Pokemon.rb index ff7441f79..82af08e0a 100644 --- a/Data/Scripts/016_Pokemon/001_Pokemon.rb +++ b/Data/Scripts/016_Pokemon/001_Pokemon.rb @@ -110,7 +110,7 @@ class Pokemon @forced_form = nil @level = nil # In case growth rate is different for the new species @ability = nil - calcStats + calc_stats end # @param check_species [Integer, Symbol, String] id of the species to check for @@ -138,7 +138,7 @@ class Pokemon @ability = nil yield if block_given? MultipleForms.call("onSetForm", self, value, oldForm) - calcStats + calc_stats pbSeenForm(self) end @@ -148,7 +148,7 @@ class Pokemon def form_simple=(value) @form = value - calcStats + calc_stats end #============================================================================= @@ -220,6 +220,7 @@ class Pokemon # Sets this Pokémon's status. See {GameData::Status} for all possible status effects. # @param value [Integer, Symbol, String] status to set def status=(value) + return if !able? new_status = GameData::Status.try_get(value) if !new_status raise ArgumentError, _INTL('Attempted to set {1} as Pokémon status', value.class.name) @@ -454,7 +455,7 @@ class Pokemon def nature=(value) return if value && !GameData::Nature.exists?(value) @nature = (value) ? GameData::Nature.get(value).id : value - calcStats if !@nature_for_stats + calc_stats if !@nature_for_stats end # Returns the calculated nature, taking into account things that change its @@ -474,7 +475,7 @@ class Pokemon def nature_for_stats=(value) return if value && !GameData::Nature.exists?(value) @nature_for_stats = (value) ? GameData::Nature.get(value).id : value - calcStats + calc_stats end # Returns whether this Pokémon has a particular nature. If no value is given, @@ -565,7 +566,7 @@ class Pokemon end # Sets this Pokémon's movelist to the default movelist it originally had. - def resetMoves + def reset_moves this_level = self.level # Find all level-up moves that self could have learned moveset = self.getMoveList @@ -987,7 +988,7 @@ class Pokemon end # Recalculates this Pokémon's stats. - def calcStats + def calc_stats base_stats = self.baseStats this_level = self.level this_IV = self.calcIV @@ -1065,7 +1066,7 @@ class Pokemon @item = nil @mail = nil @moves = [] - resetMoves if withMoves + reset_moves if withMoves @first_moves = [] @ribbons = [] @cool = 0 @@ -1105,12 +1106,12 @@ class Pokemon @personalID = rand(2 ** 16) | rand(2 ** 16) << 16 @hp = 1 @totalhp = 1 - calcStats + calc_stats if @form == 0 && recheck_form f = MultipleForms.call("getFormOnCreation", self) if f self.form = f - resetMoves if withMoves + reset_moves if withMoves end end end diff --git a/Data/Scripts/016_Pokemon/010_Pokemon_Deprecated.rb b/Data/Scripts/016_Pokemon/010_Pokemon_Deprecated.rb index 9e63ed2e3..c4b31b8a9 100644 --- a/Data/Scripts/016_Pokemon/010_Pokemon_Deprecated.rb +++ b/Data/Scripts/016_Pokemon/010_Pokemon_Deprecated.rb @@ -174,6 +174,7 @@ class Pokemon deprecated_method_alias :setItem, :item=, 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 :pbDeleteMove, :forget_move, 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 :pbClearFirstMoves, :clear_first_moves, removal_in: 'v20' deprecated_method_alias :pbUpdateShadowMoves, :update_shadow_moves, removal_in: 'v20' + deprecated_method_alias :calcStats, :calc_stats, removal_in: 'v20' end # (see Pokemon#initialize) diff --git a/Data/Scripts/010_Scenes/003_Scene_Intro.rb b/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb similarity index 93% rename from Data/Scripts/010_Scenes/003_Scene_Intro.rb rename to Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb index 0d3957f2f..c0d681f64 100644 --- a/Data/Scripts/010_Scenes/003_Scene_Intro.rb +++ b/Data/Scripts/017_UI/001_Animations/001_UI_SplashesAndTitleScreen.rb @@ -121,14 +121,14 @@ end class Scene_Intro - def initialize(pics, splash = nil) - @pics = pics - @splash = splash - end + # Splash screen images that appear for a few seconds and then disappear. + INTRO_SPLASHES = ['intro1'] + # The main title screen background image. + TITLE_SCREEN = 'splash' def main Graphics.transition(0) - @eventscene = IntroEventScene.new(@pics,@splash) + @eventscene = IntroEventScene.new(INTRO_SPLASHES, TITLE_SCREEN) @eventscene.main Graphics.freeze end diff --git a/Data/Scripts/010_Scenes/004_Scene_Controls.rb b/Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb similarity index 100% rename from Data/Scripts/010_Scenes/004_Scene_Controls.rb rename to Data/Scripts/017_UI/001_Animations/002_UI_Controls.rb diff --git a/Data/Scripts/010_Scenes/005_Scene_Credits.rb b/Data/Scripts/017_UI/001_Animations/003_UI_Credits.rb similarity index 98% rename from Data/Scripts/010_Scenes/005_Scene_Credits.rb rename to Data/Scripts/017_UI/001_Animations/003_UI_Credits.rb index d748d7eb4..2e60dec73 100644 --- a/Data/Scripts/010_Scenes/005_Scene_Credits.rb +++ b/Data/Scripts/017_UI/001_Animations/003_UI_Credits.rb @@ -58,6 +58,7 @@ Your credits go here. Your credits go here. {INSERTS_PLUGIN_CREDITS_DO_NOT_REMOVE} + "Pokémon Essentials" was created by: Flameguru Poccil (Peter O.) @@ -70,15 +71,13 @@ Brother1440Near Fantastica FL.PinkMan Genzai KawakamiPopper help-14Rataime -IceGod64SoundSpawn -Jacob O. Wobbrockthe__end -KitsuneKoutaVenom12 -Lisa AnthonyWachunga -Luka S.J. +IceGod64Savordez +Jacob O. WobbrockSoundSpawn +KitsuneKoutathe__end +Lisa AnthonyVenom12 +Luka S.J.Wachunga and everyone else who helped out - - "mkxp-z" by: Roza Based on MKXP by Ancurio et al. diff --git a/Data/Scripts/017_UI/020_PScreen_EggHatching.rb b/Data/Scripts/017_UI/001_Animations/020_UI_EggHatching.rb similarity index 100% rename from Data/Scripts/017_UI/020_PScreen_EggHatching.rb rename to Data/Scripts/017_UI/001_Animations/020_UI_EggHatching.rb diff --git a/Data/Scripts/017_UI/021_PScreen_Evolution.rb b/Data/Scripts/017_UI/001_Animations/021_UI_Evolution.rb similarity index 99% rename from Data/Scripts/017_UI/021_PScreen_Evolution.rb rename to Data/Scripts/017_UI/001_Animations/021_UI_Evolution.rb index 150ceb107..56d36431c 100644 --- a/Data/Scripts/017_UI/021_PScreen_Evolution.rb +++ b/Data/Scripts/017_UI/001_Animations/021_UI_Evolution.rb @@ -586,7 +586,7 @@ class PokemonEvolutionScene # Modify Pokémon to make it evolved @pokemon.species = @newspecies @pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM) - @pokemon.calcStats + @pokemon.calc_stats # See and own evolved species $Trainer.set_seen(@newspecies) $Trainer.set_owned(@newspecies) @@ -611,7 +611,7 @@ class PokemonEvolutionScene new_pkmn.poke_ball = :POKEBALL new_pkmn.item = nil new_pkmn.clearAllRibbons - new_pkmn.calcStats + new_pkmn.calc_stats new_pkmn.heal # Add duplicate Pokémon to party $Trainer.party.push(new_pkmn) diff --git a/Data/Scripts/017_UI/022_PScreen_Trading.rb b/Data/Scripts/017_UI/001_Animations/022_UI_Trading.rb similarity index 99% rename from Data/Scripts/017_UI/022_PScreen_Trading.rb rename to Data/Scripts/017_UI/001_Animations/022_UI_Trading.rb index cc44ef584..b06f8ee07 100644 --- a/Data/Scripts/017_UI/022_PScreen_Trading.rb +++ b/Data/Scripts/017_UI/001_Animations/022_UI_Trading.rb @@ -226,7 +226,7 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0) end yourPokemon.name = nickname yourPokemon.obtain_method = 2 # traded - yourPokemon.resetMoves if resetmoves + yourPokemon.reset_moves if resetmoves yourPokemon.record_first_moves $Trainer.set_seen(yourPokemon.species) $Trainer.set_owned(yourPokemon.species) diff --git a/Data/Scripts/017_UI/027_PScreen_HallOfFame.rb b/Data/Scripts/017_UI/001_Animations/027_UI_HallOfFame.rb similarity index 100% rename from Data/Scripts/017_UI/027_PScreen_HallOfFame.rb rename to Data/Scripts/017_UI/001_Animations/027_UI_HallOfFame.rb diff --git a/Data/Scripts/017_UI/001_PScreen_PauseMenu.rb b/Data/Scripts/017_UI/001_UI_PauseMenu.rb similarity index 100% rename from Data/Scripts/017_UI/001_PScreen_PauseMenu.rb rename to Data/Scripts/017_UI/001_UI_PauseMenu.rb diff --git a/Data/Scripts/017_UI/002_PScreen_PokedexMenu.rb b/Data/Scripts/017_UI/002_UI_PokedexMenu.rb similarity index 100% rename from Data/Scripts/017_UI/002_PScreen_PokedexMenu.rb rename to Data/Scripts/017_UI/002_UI_PokedexMenu.rb diff --git a/Data/Scripts/017_UI/003_PScreen_PokedexMain.rb b/Data/Scripts/017_UI/003_UI_PokedexMain.rb similarity index 100% rename from Data/Scripts/017_UI/003_PScreen_PokedexMain.rb rename to Data/Scripts/017_UI/003_UI_PokedexMain.rb diff --git a/Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb b/Data/Scripts/017_UI/004_UI_PokedexEntry.rb similarity index 100% rename from Data/Scripts/017_UI/004_PScreen_PokedexEntry.rb rename to Data/Scripts/017_UI/004_UI_PokedexEntry.rb diff --git a/Data/Scripts/017_UI/005_PScreen_Party.rb b/Data/Scripts/017_UI/005_UI_Party.rb similarity index 100% rename from Data/Scripts/017_UI/005_PScreen_Party.rb rename to Data/Scripts/017_UI/005_UI_Party.rb diff --git a/Data/Scripts/017_UI/006_PScreen_Summary.rb b/Data/Scripts/017_UI/006_UI_Summary.rb similarity index 100% rename from Data/Scripts/017_UI/006_PScreen_Summary.rb rename to Data/Scripts/017_UI/006_UI_Summary.rb diff --git a/Data/Scripts/017_UI/007_PScreen_Bag.rb b/Data/Scripts/017_UI/007_UI_Bag.rb similarity index 100% rename from Data/Scripts/017_UI/007_PScreen_Bag.rb rename to Data/Scripts/017_UI/007_UI_Bag.rb diff --git a/Data/Scripts/017_UI/008_PScreen_Pokegear.rb b/Data/Scripts/017_UI/008_UI_Pokegear.rb similarity index 100% rename from Data/Scripts/017_UI/008_PScreen_Pokegear.rb rename to Data/Scripts/017_UI/008_UI_Pokegear.rb diff --git a/Data/Scripts/017_UI/009_PScreen_RegionMap.rb b/Data/Scripts/017_UI/009_UI_RegionMap.rb similarity index 100% rename from Data/Scripts/017_UI/009_PScreen_RegionMap.rb rename to Data/Scripts/017_UI/009_UI_RegionMap.rb diff --git a/Data/Scripts/017_UI/010_PScreen_Phone.rb b/Data/Scripts/017_UI/010_UI_Phone.rb similarity index 100% rename from Data/Scripts/017_UI/010_PScreen_Phone.rb rename to Data/Scripts/017_UI/010_UI_Phone.rb diff --git a/Data/Scripts/017_UI/011_PScreen_Jukebox.rb b/Data/Scripts/017_UI/011_UI_Jukebox.rb similarity index 100% rename from Data/Scripts/017_UI/011_PScreen_Jukebox.rb rename to Data/Scripts/017_UI/011_UI_Jukebox.rb diff --git a/Data/Scripts/017_UI/012_PScreen_TrainerCard.rb b/Data/Scripts/017_UI/012_UI_TrainerCard.rb similarity index 100% rename from Data/Scripts/017_UI/012_PScreen_TrainerCard.rb rename to Data/Scripts/017_UI/012_UI_TrainerCard.rb diff --git a/Data/Scripts/017_UI/013_PScreen_Load.rb b/Data/Scripts/017_UI/013_UI_Load.rb similarity index 100% rename from Data/Scripts/017_UI/013_PScreen_Load.rb rename to Data/Scripts/017_UI/013_UI_Load.rb diff --git a/Data/Scripts/017_UI/014_PScreen_Save.rb b/Data/Scripts/017_UI/014_UI_Save.rb similarity index 100% rename from Data/Scripts/017_UI/014_PScreen_Save.rb rename to Data/Scripts/017_UI/014_UI_Save.rb diff --git a/Data/Scripts/017_UI/015_PScreen_Options.rb b/Data/Scripts/017_UI/015_UI_Options.rb similarity index 100% rename from Data/Scripts/017_UI/015_PScreen_Options.rb rename to Data/Scripts/017_UI/015_UI_Options.rb diff --git a/Data/Scripts/017_UI/016_PScreen_ReadyMenu.rb b/Data/Scripts/017_UI/016_UI_ReadyMenu.rb similarity index 100% rename from Data/Scripts/017_UI/016_PScreen_ReadyMenu.rb rename to Data/Scripts/017_UI/016_UI_ReadyMenu.rb diff --git a/Data/Scripts/017_UI/017_PScreen_PokemonStorage.rb b/Data/Scripts/017_UI/017_UI_PokemonStorage.rb similarity index 100% rename from Data/Scripts/017_UI/017_PScreen_PokemonStorage.rb rename to Data/Scripts/017_UI/017_UI_PokemonStorage.rb diff --git a/Data/Scripts/017_UI/018_PScreen_ItemStorage.rb b/Data/Scripts/017_UI/018_UI_ItemStorage.rb similarity index 100% rename from Data/Scripts/017_UI/018_PScreen_ItemStorage.rb rename to Data/Scripts/017_UI/018_UI_ItemStorage.rb diff --git a/Data/Scripts/017_UI/019_PScreen_PC.rb b/Data/Scripts/017_UI/019_UI_PC.rb similarity index 100% rename from Data/Scripts/017_UI/019_PScreen_PC.rb rename to Data/Scripts/017_UI/019_UI_PC.rb diff --git a/Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb b/Data/Scripts/017_UI/023_UI_MoveRelearner.rb similarity index 100% rename from Data/Scripts/017_UI/023_PScreen_MoveRelearner.rb rename to Data/Scripts/017_UI/023_UI_MoveRelearner.rb diff --git a/Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb b/Data/Scripts/017_UI/024_UI_PurifyChamber.rb similarity index 100% rename from Data/Scripts/017_UI/024_PScreen_PurifyChamber.rb rename to Data/Scripts/017_UI/024_UI_PurifyChamber.rb diff --git a/Data/Scripts/017_UI/025_PScreen_Mart.rb b/Data/Scripts/017_UI/025_UI_PokeMart.rb similarity index 100% rename from Data/Scripts/017_UI/025_PScreen_Mart.rb rename to Data/Scripts/017_UI/025_UI_PokeMart.rb diff --git a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb b/Data/Scripts/017_UI/026_UI_MysteryGift.rb similarity index 99% rename from Data/Scripts/017_UI/026_PScreen_MysteryGift.rb rename to Data/Scripts/017_UI/026_UI_MysteryGift.rb index d22bb8b5d..1ebd6a9c2 100644 --- a/Data/Scripts/017_UI/026_PScreen_MysteryGift.rb +++ b/Data/Scripts/017_UI/026_UI_MysteryGift.rb @@ -374,7 +374,7 @@ def pbReceiveMysteryGift(id) gift=$Trainer.mystery_gifts[index] if gift[1]==0 # Pokémon gift[2].personalID = rand(2**16) | rand(2**16) << 16 - gift[2].calcStats + gift[2].calc_stats time=pbGetTimeNow gift[2].timeReceived=time.getgm.to_i gift[2].obtain_method = 4 # Fateful encounter diff --git a/Data/Scripts/018_Minigames/001_PMinigame_Duel.rb b/Data/Scripts/018_Minigames/001_Minigame_Duel.rb similarity index 100% rename from Data/Scripts/018_Minigames/001_PMinigame_Duel.rb rename to Data/Scripts/018_Minigames/001_Minigame_Duel.rb diff --git a/Data/Scripts/018_Minigames/002_PMinigame_TripleTriad.rb b/Data/Scripts/018_Minigames/002_Minigame_TripleTriad.rb similarity index 100% rename from Data/Scripts/018_Minigames/002_PMinigame_TripleTriad.rb rename to Data/Scripts/018_Minigames/002_Minigame_TripleTriad.rb diff --git a/Data/Scripts/018_Minigames/003_PMinigame_SlotMachine.rb b/Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb similarity index 100% rename from Data/Scripts/018_Minigames/003_PMinigame_SlotMachine.rb rename to Data/Scripts/018_Minigames/003_Minigame_SlotMachine.rb diff --git a/Data/Scripts/018_Minigames/004_PMinigame_VoltorbFlip.rb b/Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb similarity index 100% rename from Data/Scripts/018_Minigames/004_PMinigame_VoltorbFlip.rb rename to Data/Scripts/018_Minigames/004_Minigame_VoltorbFlip.rb diff --git a/Data/Scripts/018_Minigames/005_PMinigame_Lottery.rb b/Data/Scripts/018_Minigames/005_Minigame_Lottery.rb similarity index 100% rename from Data/Scripts/018_Minigames/005_PMinigame_Lottery.rb rename to Data/Scripts/018_Minigames/005_Minigame_Lottery.rb diff --git a/Data/Scripts/018_Minigames/006_PMinigame_Mining.rb b/Data/Scripts/018_Minigames/006_Minigame_Mining.rb similarity index 100% rename from Data/Scripts/018_Minigames/006_PMinigame_Mining.rb rename to Data/Scripts/018_Minigames/006_Minigame_Mining.rb diff --git a/Data/Scripts/018_Minigames/007_PMinigame_TilePuzzles.rb b/Data/Scripts/018_Minigames/007_Minigame_TilePuzzles.rb similarity index 100% rename from Data/Scripts/018_Minigames/007_PMinigame_TilePuzzles.rb rename to Data/Scripts/018_Minigames/007_Minigame_TilePuzzles.rb diff --git a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb index 8a40913f8..c51f389b3 100644 --- a/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb +++ b/Data/Scripts/019_Other battles/003_PBattle_OrgBattle.rb @@ -166,7 +166,7 @@ class PBPokemon ev.each { |stat| pokemon.ev[stat] = Pokemon::EV_LIMIT / ev.length } end GameData::Stat.each_main { |s| pokemon.iv[s.id] = iv } - pokemon.calcStats + pokemon.calc_stats return pokemon end end diff --git a/Data/Scripts/019_Other battles/004_PBattle_OrgBattleRules.rb b/Data/Scripts/019_Other battles/004_PBattle_OrgBattleRules.rb index a6ab0844d..6f3d5e004 100644 --- a/Data/Scripts/019_Other battles/004_PBattle_OrgBattleRules.rb +++ b/Data/Scripts/019_Other battles/004_PBattle_OrgBattleRules.rb @@ -60,14 +60,14 @@ class LevelAdjustment exp=adjustments[0][i] if exp && team1[i].exp!=exp team1[i].exp=exp - team1[i].calcStats + team1[i].calc_stats end end for i in 0...team2.length exp=adjustments[1][i] if exp && team2[i].exp!=exp team2[i].exp=exp - team2[i].calcStats + team2[i].calc_stats end end end @@ -90,7 +90,7 @@ class LevelAdjustment for i in 0...team1.length if team1[i].level!=adj1[i] team1[i].level=adj1[i] - team1[i].calcStats + team1[i].calc_stats end end end @@ -98,7 +98,7 @@ class LevelAdjustment for i in 0...team2.length if team2[i].level!=adj2[i] team2[i].level=adj2[i] - team2[i].calcStats + team2[i].calc_stats end end end diff --git a/Data/Scripts/019_Other battles/005_PBattle_OrgBattleGenerator.rb b/Data/Scripts/019_Other battles/005_PBattle_OrgBattleGenerator.rb index 948f2930b..73a169733 100644 --- a/Data/Scripts/019_Other battles/005_PBattle_OrgBattleGenerator.rb +++ b/Data/Scripts/019_Other battles/005_PBattle_OrgBattleGenerator.rb @@ -849,7 +849,7 @@ def pbRuledBattle(team1,team2,rule) next if !p if p.level!=level p.level=level - p.calcStats + p.calc_stats end items1[i]=p.item_id trainer1.party.push(p) @@ -858,7 +858,7 @@ def pbRuledBattle(team1,team2,rule) next if !p if p.level!=level p.level=level - p.calcStats + p.calc_stats end items2[i]=p.item_id trainer2.party.push(p) diff --git a/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb b/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb index 1b691d601..826287ab6 100644 --- a/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb +++ b/Data/Scripts/020_System and utilities/004_PSystem_PokemonUtilities.rb @@ -124,7 +124,7 @@ def pbAddForeignPokemon(pkmn, level = 1, owner_name = nil, nickname = nil, owner # Set nickname pkmn.name = nickname[0, Pokemon::MAX_NAME_SIZE] # Recalculate stats - pkmn.calcStats + pkmn.calc_stats if owner_name pbMessage(_INTL("\\me[Pkmn get]{1} received a Pokémon from {2}.\1", $Trainer.name, owner_name)) else @@ -144,7 +144,7 @@ def pbGenerateEgg(pkmn, text = "") pkmn.name = _INTL("Egg") pkmn.steps_to_hatch = pkmn.species_data.hatch_steps pkmn.obtain_text = text - pkmn.calcStats + pkmn.calc_stats # Add egg to party $Trainer.party[$Trainer.party.length] = pkmn return true diff --git a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb index 555047db1..7256e3971 100644 --- a/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb +++ b/Data/Scripts/021_Debug/001_Debug menus/004_Debug_PokemonCommands.rb @@ -208,7 +208,7 @@ PokemonDebugMenuCommands.register("setlevel", { _INTL("Set the Pokémon's level (max. {1}).", params.maxNumber), params) { screen.pbUpdate } if level != pkmn.level pkmn.level = level - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) 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 } if newexp != pkmn.exp pkmn.exp = newexp - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end end @@ -290,7 +290,7 @@ PokemonDebugMenuCommands.register("hiddenvalues", { GameData::Stat.get(ev_id[cmd2]).name, upperLimit), params) { screen.pbUpdate } if f != pkmn.ev[ev_id[cmd2]] pkmn.ev[ev_id[cmd2]] = f - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end else # (Max) Randomise all @@ -309,7 +309,7 @@ PokemonDebugMenuCommands.register("hiddenvalues", { pkmn.ev[ev_id[r]] += addVal evTotalTarget -= addVal end - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end end @@ -340,18 +340,18 @@ PokemonDebugMenuCommands.register("hiddenvalues", { GameData::Stat.get(iv_id[cmd2]).name), params) { screen.pbUpdate } if f != pkmn.iv[iv_id[cmd2]] pkmn.iv[iv_id[cmd2]] = f - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end else # Randomise all GameData::Stat.each_main { |s| pkmn.iv[s.id] = rand(Pokemon::IV_STAT_LIMIT + 1) } - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end end when 2 # Randomise pID pkmn.personalID = rand(2 ** 16) | rand(2 ** 16) << 16 - pkmn.calcStats + pkmn.calc_stats screen.pbRefreshSingle(pkmnid) end end @@ -535,7 +535,7 @@ PokemonDebugMenuCommands.register("resetmoves", { "name" => _INTL("Reset moves"), "always_show" => true, "effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen| - pkmn.resetMoves + pkmn.reset_moves screen.pbDisplay(_INTL("{1}'s moves were reset.", pkmn.name)) screen.pbRefreshSingle(pkmnid) next false @@ -748,7 +748,7 @@ PokemonDebugMenuCommands.register("speciesform", { species = pbChooseSpeciesList(pkmn.species) if species && species != pkmn.species pkmn.species = species - pkmn.calcStats + pkmn.calc_stats pbSeenForm(pkmn) if !settingUpBattle screen.pbRefreshSingle(pkmnid) end @@ -984,7 +984,7 @@ PokemonDebugMenuCommands.register("setegg", { if !pkmn.egg? && (pbHasEgg?(pkmn.species) || screen.pbConfirm(_INTL("{1} cannot legally be an egg. Make egg anyway?", pkmn.speciesName))) pkmn.level = Settings::EGG_LEVEL - pkmn.calcStats + pkmn.calc_stats pkmn.name = _INTL("Egg") pkmn.steps_to_hatch = pkmn.species_data.hatch_steps pkmn.hatched_map = 0 diff --git a/Data/Scripts/999_Main/999_Main.rb b/Data/Scripts/999_Main/999_Main.rb index 5d01980d0..3ba30a299 100644 --- a/Data/Scripts/999_Main/999_Main.rb +++ b/Data/Scripts/999_Main/999_Main.rb @@ -10,10 +10,7 @@ end def pbCallTitle return Scene_DebugIntro.new if $DEBUG - # First parameter is an array of images in the Titles directory without a file - # 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') + return Scene_Intro.new end def mainFunction diff --git a/Game.exe b/Game.exe index ea260b048..e33480ddf 100644 Binary files a/Game.exe and b/Game.exe differ diff --git a/mkxp.json b/mkxp.json index 53b449963..6e450e6bc 100644 --- a/mkxp.json +++ b/mkxp.json @@ -20,21 +20,6 @@ // // "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 // OpenGL debug information to the console // (default: disabled) @@ -172,7 +157,7 @@ // Set the base path of the game to '/path/to/game' // (default: executable directory) // - // "gameFolder": "/path/to/game", + // "gameFolder": ".", // Use either right or left Alt + Enter to toggle @@ -188,20 +173,21 @@ // "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 // (default: disabled) // // "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 // name to build the directory path where mkxp // will store game specific data (eg. key bindings). @@ -307,6 +293,32 @@ // "rubyLoadpath": ["/usr/lib64/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) // (default: none)