mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 13:15:01 +00:00
@@ -6,7 +6,7 @@
|
||||
module Settings
|
||||
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
|
||||
GAME_VERSION = '5.0.0'
|
||||
GAME_VERSION_NUMBER = "6.0"
|
||||
GAME_VERSION_NUMBER = "5.3.1.3"
|
||||
|
||||
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
|
||||
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
|
||||
@@ -20,7 +20,7 @@ module Settings
|
||||
FUSION_ICON_SPRITE_OFFSET = 10
|
||||
|
||||
#Infinite fusion settings
|
||||
NB_POKEMON = 465
|
||||
NB_POKEMON = 420
|
||||
CUSTOM_BASE_SPRITES_FOLDER = "Graphics/CustomBattlers/customBaseSprites/"
|
||||
CUSTOM_BATTLERS_FOLDER = "Graphics/CustomBattlers/"
|
||||
CUSTOM_BATTLERS_FOLDER_INDEXED = "Graphics/CustomBattlers/indexed/"
|
||||
@@ -32,12 +32,11 @@ module Settings
|
||||
CUSTOM_SPRITES_FILE_PATH = "Data/CUSTOM_SPRITES"
|
||||
|
||||
HTTP_CONFIGS_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/Scripts/RemoteUrls.rb"
|
||||
HTTP_CONFIGS_FILE_PATH = "Data/Scripts/DownloadedSettings.rb"
|
||||
|
||||
LEVEL_CAPS=[12,22,26,35,38,45,51,54,58,62,63,64,64,65,67,68]
|
||||
HTTP_CONFIGS_FILE_PATH = "Data/Scripts/RemoteUrls.rb"
|
||||
|
||||
FRONTSPRITE_POSITION_OFFSET = 20
|
||||
FRONTSPRITE_SCALE = 0.6666666666666666
|
||||
FRONTSPRITE_SCALE = 0.6666666666
|
||||
BACKRPSPRITE_SCALE = 1
|
||||
EGGSPRITE_SCALE = 1
|
||||
BACKSPRITE_POSITION_OFFSET = 20
|
||||
@@ -57,13 +56,12 @@ module Settings
|
||||
OVERRIDE_BATTLE_LEVEL_VALUE_VAR = 240
|
||||
HARD_MODE_LEVEL_MODIFIER = 1.1
|
||||
|
||||
ZAPMOLCUNO_NB = 999999#176821
|
||||
ZAPMOLCUNO_NB = 176821
|
||||
MAPS_WITHOUT_SURF_MUSIC = [762]
|
||||
|
||||
WONDERTRADE_BASE_URL = "http://localhost:8080"
|
||||
WONDERTRADE_PUBLIC_KEY = "http://localhost:8080"
|
||||
|
||||
MAX_NB_OUTFITS=99
|
||||
# The generation that the battle system follows. Used throughout the battle
|
||||
# scripts, and also by some other settings which are used in and out of battle
|
||||
# (you can of course change those settings to suit your game).
|
||||
@@ -93,7 +91,6 @@ module Settings
|
||||
NB_BADGES = 16
|
||||
# The odds of a newly generated Pokémon being shiny (out of 65536).
|
||||
SHINY_POKEMON_CHANCE = 16#(MECHANICS_GENERATION >= 6) ? 16 : 8
|
||||
|
||||
# The odds of a wild Pokémon/bred egg having Pokérus (out of 65536).
|
||||
POKERUS_CHANCE = 3
|
||||
# Whether a bred baby Pokémon can inherit any TM/HM moves from its father. It
|
||||
@@ -220,7 +217,7 @@ module Settings
|
||||
end
|
||||
|
||||
# The number of boxes in Pokémon storage.
|
||||
NUM_STORAGE_BOXES = 40
|
||||
NUM_STORAGE_BOXES = 30
|
||||
|
||||
#=============================================================================
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ module Mouse
|
||||
|
||||
# Returns the position of the mouse relative to the game window.
|
||||
def getMousePos(catch_anywhere = false)
|
||||
return nil unless Input.mouse_in_window || catch_anywhere
|
||||
return nil unless System.mouse_in_window || catch_anywhere
|
||||
return Input.mouse_x, Input.mouse_y
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,12 +47,8 @@ module Game
|
||||
for pokemon in box.pokemon
|
||||
if pokemon != nil
|
||||
if !pokemon.egg?
|
||||
pokemon.exp_when_fused_head=nil
|
||||
pokemon.exp_when_fused_body=nil
|
||||
pokemon.exp_gained_since_fused=nil
|
||||
pokemon.level = 5
|
||||
pokemon.owner.id = $Trainer.id
|
||||
pokemon.ot=$Trainer.name
|
||||
pokemon.species = GameData::Species.get(pokemon.species).get_baby_species(false)
|
||||
pokemon.reset_moves
|
||||
pokemon.calc_stats
|
||||
|
||||
@@ -55,7 +55,6 @@ class Scene_Map
|
||||
def autofade(mapid)
|
||||
playingBGM = $game_system.playing_bgm
|
||||
playingBGS = $game_system.playing_bgs
|
||||
return if playingBGM && playingBGM.name == "ultra_metropolis" && darknessEffectOnMap(mapid)
|
||||
return if !playingBGM && !playingBGS
|
||||
map = load_data(sprintf("Data/Map%03d.rxdata", mapid))
|
||||
if playingBGM && map.autoplay_bgm
|
||||
|
||||
@@ -6,35 +6,35 @@
|
||||
#==============================================================================
|
||||
class Game_Map
|
||||
attr_accessor :map_id
|
||||
attr_accessor :tileset_name # tileset file name
|
||||
attr_accessor :autotile_names # autotile file name
|
||||
attr_reader :passages # passage table
|
||||
attr_reader :priorities # priority table
|
||||
attr_reader :terrain_tags # terrain tag table
|
||||
attr_reader :events # events
|
||||
attr_accessor :panorama_name # panorama file name
|
||||
attr_accessor :panorama_hue # panorama hue
|
||||
attr_accessor :fog_name # fog file name
|
||||
attr_accessor :fog_hue # fog hue
|
||||
attr_accessor :fog_opacity # fog opacity level
|
||||
attr_accessor :fog_blend_type # fog blending method
|
||||
attr_accessor :fog_zoom # fog zoom rate
|
||||
attr_accessor :fog_sx # fog sx
|
||||
attr_accessor :fog_sy # fog sy
|
||||
attr_reader :fog_ox # fog x-coordinate starting point
|
||||
attr_reader :fog_oy # fog y-coordinate starting point
|
||||
attr_reader :fog_tone # fog color tone
|
||||
attr_accessor :battleback_name # battleback file name
|
||||
attr_reader :display_x # display x-coordinate * 128
|
||||
attr_reader :display_y # display y-coordinate * 128
|
||||
attr_accessor :need_refresh # refresh request flag
|
||||
attr_accessor :tileset_name # tileset file name
|
||||
attr_accessor :autotile_names # autotile file name
|
||||
attr_reader :passages # passage table
|
||||
attr_reader :priorities # priority table
|
||||
attr_reader :terrain_tags # terrain tag table
|
||||
attr_reader :events # events
|
||||
attr_accessor :panorama_name # panorama file name
|
||||
attr_accessor :panorama_hue # panorama hue
|
||||
attr_accessor :fog_name # fog file name
|
||||
attr_accessor :fog_hue # fog hue
|
||||
attr_accessor :fog_opacity # fog opacity level
|
||||
attr_accessor :fog_blend_type # fog blending method
|
||||
attr_accessor :fog_zoom # fog zoom rate
|
||||
attr_accessor :fog_sx # fog sx
|
||||
attr_accessor :fog_sy # fog sy
|
||||
attr_reader :fog_ox # fog x-coordinate starting point
|
||||
attr_reader :fog_oy # fog y-coordinate starting point
|
||||
attr_reader :fog_tone # fog color tone
|
||||
attr_accessor :battleback_name # battleback file name
|
||||
attr_reader :display_x # display x-coordinate * 128
|
||||
attr_reader :display_y # display y-coordinate * 128
|
||||
attr_accessor :need_refresh # refresh request flag
|
||||
|
||||
TILE_WIDTH = 32
|
||||
TILE_WIDTH = 32
|
||||
TILE_HEIGHT = 32
|
||||
X_SUBPIXELS = 4
|
||||
Y_SUBPIXELS = 4
|
||||
REAL_RES_X = TILE_WIDTH * X_SUBPIXELS
|
||||
REAL_RES_Y = TILE_HEIGHT * Y_SUBPIXELS
|
||||
REAL_RES_X = TILE_WIDTH * X_SUBPIXELS
|
||||
REAL_RES_Y = TILE_HEIGHT * Y_SUBPIXELS
|
||||
|
||||
def initialize
|
||||
@map_id = 0
|
||||
@@ -43,104 +43,88 @@ class Game_Map
|
||||
end
|
||||
|
||||
def setup(map_id)
|
||||
@map_id = map_id
|
||||
@map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
|
||||
@map_id = map_id
|
||||
@map = load_data(sprintf("Data/Map%03d.rxdata",map_id))
|
||||
tileset = $data_tilesets[@map.tileset_id]
|
||||
updateTileset
|
||||
@fog_ox = 0
|
||||
@fog_oy = 0
|
||||
@fog_tone = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_target = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_duration = 0
|
||||
@fog_ox = 0
|
||||
@fog_oy = 0
|
||||
@fog_tone = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_target = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_duration = 0
|
||||
@fog_opacity_duration = 0
|
||||
@fog_opacity_target = 0
|
||||
self.display_x = 0
|
||||
self.display_y = 0
|
||||
@need_refresh = false
|
||||
Events.onMapCreate.trigger(self, map_id, @map, tileset)
|
||||
@events = {}
|
||||
@fog_opacity_target = 0
|
||||
self.display_x = 0
|
||||
self.display_y = 0
|
||||
@need_refresh = false
|
||||
Events.onMapCreate.trigger(self,map_id,@map,tileset)
|
||||
@events = {}
|
||||
for i in @map.events.keys
|
||||
@events[i] = Game_Event.new(@map_id, @map.events[i], self)
|
||||
@events[i] = Game_Event.new(@map_id, @map.events[i],self)
|
||||
end
|
||||
@common_events = {}
|
||||
@common_events = {}
|
||||
for i in 1...$data_common_events.size
|
||||
@common_events[i] = Game_CommonEvent.new(i)
|
||||
@common_events[i] = Game_CommonEvent.new(i)
|
||||
end
|
||||
@scroll_direction = 2
|
||||
@scroll_rest = 0
|
||||
@scroll_speed = 4
|
||||
@scroll_direction = 2
|
||||
@scroll_rest = 0
|
||||
@scroll_speed = 4
|
||||
end
|
||||
|
||||
def updateTileset
|
||||
tileset = $data_tilesets[@map.tileset_id]
|
||||
@tileset_name = tileset.tileset_name
|
||||
@autotile_names = tileset.autotile_names
|
||||
@panorama_name = tileset.panorama_name
|
||||
@panorama_hue = tileset.panorama_hue
|
||||
@fog_name = tileset.fog_name
|
||||
@fog_hue = tileset.fog_hue
|
||||
@fog_opacity = tileset.fog_opacity
|
||||
@fog_blend_type = tileset.fog_blend_type
|
||||
@fog_zoom = tileset.fog_zoom
|
||||
@fog_sx = tileset.fog_sx
|
||||
@fog_sy = tileset.fog_sy
|
||||
@tileset_name = tileset.tileset_name
|
||||
@autotile_names = tileset.autotile_names
|
||||
@panorama_name = tileset.panorama_name
|
||||
@panorama_hue = tileset.panorama_hue
|
||||
@fog_name = tileset.fog_name
|
||||
@fog_hue = tileset.fog_hue
|
||||
@fog_opacity = tileset.fog_opacity
|
||||
@fog_blend_type = tileset.fog_blend_type
|
||||
@fog_zoom = tileset.fog_zoom
|
||||
@fog_sx = tileset.fog_sx
|
||||
@fog_sy = tileset.fog_sy
|
||||
@battleback_name = tileset.battleback_name
|
||||
@passages = tileset.passages
|
||||
@priorities = tileset.priorities
|
||||
@terrain_tags = tileset.terrain_tags
|
||||
@passages = tileset.passages
|
||||
@priorities = tileset.priorities
|
||||
@terrain_tags = tileset.terrain_tags
|
||||
end
|
||||
|
||||
def width
|
||||
return @map.width;
|
||||
end
|
||||
|
||||
def height
|
||||
return @map.height;
|
||||
end
|
||||
|
||||
def encounter_list
|
||||
return @map.encounter_list;
|
||||
end
|
||||
|
||||
def encounter_step
|
||||
return @map.encounter_step;
|
||||
end
|
||||
|
||||
def data
|
||||
return @map.data;
|
||||
end
|
||||
def width; return @map.width; end
|
||||
def height; return @map.height; end
|
||||
def encounter_list; return @map.encounter_list; end
|
||||
def encounter_step; return @map.encounter_step; end
|
||||
def data; return @map.data; end
|
||||
|
||||
def name
|
||||
ret = pbGetMessage(MessageTypes::MapNames, @map_id)
|
||||
ret.gsub!(/\\PN/, $Trainer.name) if $Trainer
|
||||
ret = pbGetMessage(MessageTypes::MapNames,@map_id)
|
||||
ret.gsub!(/\\PN/,$Trainer.name) if $Trainer
|
||||
return ret
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Autoplays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplayAsCue
|
||||
if @map.autoplay_bgm
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
pbCueBGM(@map.bgm.name + "_n", 1.0, @map.bgm.volume, @map.bgm.pitch)
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "_n")
|
||||
pbCueBGM(@map.bgm.name+"_n",1.0,@map.bgm.volume,@map.bgm.pitch)
|
||||
else
|
||||
pbCueBGM(@map.bgm, 1.0)
|
||||
pbCueBGM(@map.bgm,1.0)
|
||||
end
|
||||
end
|
||||
if @map.autoplay_bgs
|
||||
pbBGSPlay(@map.bgs)
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Plays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
#-----------------------------------------------------------------------------
|
||||
def autoplay
|
||||
if @map.autoplay_bgm
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/" + @map.bgm.name + "_n")
|
||||
pbBGMPlay(@map.bgm.name + "_n", @map.bgm.volume, @map.bgm.pitch)
|
||||
if PBDayNight.isNight? && FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "_n")
|
||||
pbBGMPlay(@map.bgm.name+"_n",@map.bgm.volume,@map.bgm.pitch)
|
||||
else
|
||||
pbBGMPlay(@map.bgm)
|
||||
end
|
||||
@@ -151,11 +135,11 @@ class Game_Map
|
||||
end
|
||||
|
||||
def valid?(x, y)
|
||||
return x >= 0 && x < width && y >= 0 && y < height
|
||||
return x>=0 && x<width && y>=0 && y<height
|
||||
end
|
||||
|
||||
def validLax?(x, y)
|
||||
return x >= -10 && x <= width + 10 && y >= -10 && y <= height + 10
|
||||
return x>=-10 && x<=width+10 && y>=-10 && y<=height+10
|
||||
end
|
||||
|
||||
def passable?(x, y, d, self_event = nil)
|
||||
@@ -172,7 +156,7 @@ class Game_Map
|
||||
return false if passage & 0x0f == 0x0f
|
||||
return true if @priorities[event.tile_id] == 0
|
||||
end
|
||||
return playerPassable?(x, y, d, self_event) if self_event == $game_player
|
||||
return playerPassable?(x, y, d, self_event) if self_event==$game_player
|
||||
# All other events
|
||||
newx = x
|
||||
newy = y
|
||||
@@ -213,10 +197,10 @@ class Game_Map
|
||||
end
|
||||
end
|
||||
return false
|
||||
# Can't walk onto ice
|
||||
# removed for mahogany gym. idk if this will cause problems, hopefully not
|
||||
# elsif terrain.ice
|
||||
# return false
|
||||
# Can't walk onto ice
|
||||
# removed for mahogany gym. idk if this will cause problems, hopefully not
|
||||
# elsif terrain.ice
|
||||
# return false
|
||||
elsif self_event != nil && self_event.x == x && self_event.y == y
|
||||
# Can't walk onto ledges
|
||||
for j in [2, 1, 0]
|
||||
@@ -284,17 +268,17 @@ class Game_Map
|
||||
return true
|
||||
end
|
||||
|
||||
def bush?(x, y)
|
||||
def bush?(x,y)
|
||||
for i in [2, 1, 0]
|
||||
tile_id = data[x, y, i]
|
||||
return false if GameData::TerrainTag.try_get(@terrain_tags[tile_id]).bridge &&
|
||||
$PokemonGlobal.bridge > 0
|
||||
$PokemonGlobal.bridge > 0
|
||||
return true if @passages[tile_id] & 0x40 == 0x40
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def deepBush?(x, y)
|
||||
def deepBush?(x,y)
|
||||
for i in [2, 1, 0]
|
||||
tile_id = data[x, y, i]
|
||||
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
|
||||
@@ -304,7 +288,7 @@ class Game_Map
|
||||
return false
|
||||
end
|
||||
|
||||
def counter?(x, y)
|
||||
def counter?(x,y)
|
||||
for i in [2, 1, 0]
|
||||
tile_id = data[x, y, i]
|
||||
passage = @passages[tile_id]
|
||||
@@ -313,7 +297,7 @@ class Game_Map
|
||||
return false
|
||||
end
|
||||
|
||||
def terrain_tag(x, y, countBridge = false)
|
||||
def terrain_tag(x,y,countBridge=false)
|
||||
if valid?(x, y)
|
||||
for i in [2, 1, 0]
|
||||
tile_id = data[x, y, i]
|
||||
@@ -327,32 +311,17 @@ class Game_Map
|
||||
end
|
||||
|
||||
# Unused.
|
||||
def check_event(x, y)
|
||||
def check_event(x,y)
|
||||
for event in self.events.values
|
||||
return event.id if event.at_coordinate?(x, y)
|
||||
end
|
||||
end
|
||||
|
||||
def event_at_position(x, y)
|
||||
for event in self.events.values
|
||||
return true if event.at_coordinate?(x, y)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def get_event_at_position(x, y, excluding_IDs = [])
|
||||
for event in self.events.values
|
||||
next if excluding_IDs.include?(event.id)
|
||||
return event if event.at_coordinate?(x, y)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def display_x=(value)
|
||||
return if @display_x == value
|
||||
@display_x = value
|
||||
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
|
||||
max_x = (self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X
|
||||
max_x = (self.width - Graphics.width*1.0/TILE_WIDTH) * REAL_RES_X
|
||||
@display_x = [0, [@display_x, max_x].min].max
|
||||
end
|
||||
$MapFactory.setMapsInRange if $MapFactory
|
||||
@@ -362,7 +331,7 @@ class Game_Map
|
||||
return if @display_y == value
|
||||
@display_y = value
|
||||
if GameData::MapMetadata.exists?(self.map_id) && GameData::MapMetadata.get(self.map_id).snap_edges
|
||||
max_y = (self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y
|
||||
max_y = (self.height - Graphics.height*1.0/TILE_HEIGHT) * REAL_RES_Y
|
||||
@display_y = [0, [@display_y, max_y].min].max
|
||||
end
|
||||
$MapFactory.setMapsInRange if $MapFactory
|
||||
@@ -386,7 +355,7 @@ class Game_Map
|
||||
|
||||
def start_scroll(direction, distance, speed)
|
||||
@scroll_direction = direction
|
||||
if direction == 2 || direction == 8 # down or up
|
||||
if direction==2 || direction==8 # down or up
|
||||
@scroll_rest = distance * REAL_RES_Y
|
||||
else
|
||||
@scroll_rest = distance * REAL_RES_X
|
||||
@@ -398,7 +367,7 @@ class Game_Map
|
||||
return @scroll_rest > 0
|
||||
end
|
||||
|
||||
def start_fog_tone_change(tone, duration)
|
||||
def start_fog_tone_change(tone,duration)
|
||||
@fog_tone_target = tone.clone
|
||||
@fog_tone_duration = duration
|
||||
if @fog_tone_duration == 0
|
||||
@@ -406,10 +375,10 @@ class Game_Map
|
||||
end
|
||||
end
|
||||
|
||||
def start_fog_opacity_change(opacity, duration)
|
||||
@fog_opacity_target = opacity * 1.0
|
||||
def start_fog_opacity_change(opacity,duration)
|
||||
@fog_opacity_target = opacity*1.0
|
||||
@fog_opacity_duration = duration
|
||||
if @fog_opacity_duration == 0
|
||||
if @fog_opacity_duration==0
|
||||
@fog_opacity = @fog_opacity_target
|
||||
end
|
||||
end
|
||||
@@ -433,18 +402,14 @@ class Game_Map
|
||||
$MapFactory.setCurrentMap
|
||||
end
|
||||
# If scrolling
|
||||
if @scroll_rest > 0
|
||||
distance = (1 << @scroll_speed) * 40.0 / Graphics.frame_rate
|
||||
distance = @scroll_rest if distance > @scroll_rest
|
||||
if @scroll_rest>0
|
||||
distance = (1<<@scroll_speed)*40.0/Graphics.frame_rate
|
||||
distance = @scroll_rest if distance>@scroll_rest
|
||||
case @scroll_direction
|
||||
when 2 then
|
||||
scroll_down(distance)
|
||||
when 4 then
|
||||
scroll_left(distance)
|
||||
when 6 then
|
||||
scroll_right(distance)
|
||||
when 8 then
|
||||
scroll_up(distance)
|
||||
when 2 then scroll_down(distance)
|
||||
when 4 then scroll_left(distance)
|
||||
when 6 then scroll_right(distance)
|
||||
when 8 then scroll_up(distance)
|
||||
end
|
||||
@scroll_rest -= distance
|
||||
end
|
||||
@@ -457,15 +422,15 @@ class Game_Map
|
||||
common_event.update
|
||||
end
|
||||
# Update fog
|
||||
@fog_ox -= @fog_sx / 8.0
|
||||
@fog_oy -= @fog_sy / 8.0
|
||||
if @fog_tone_duration >= 1
|
||||
@fog_ox -= @fog_sx/8.0
|
||||
@fog_oy -= @fog_sy/8.0
|
||||
if @fog_tone_duration>=1
|
||||
d = @fog_tone_duration
|
||||
target = @fog_tone_target
|
||||
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
|
||||
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
|
||||
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
|
||||
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
|
||||
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
|
||||
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
|
||||
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
|
||||
@fog_tone_duration -= 1
|
||||
end
|
||||
if @fog_opacity_duration >= 1
|
||||
@@ -479,17 +444,13 @@ end
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
def pbScrollMap(direction, distance, speed)
|
||||
if speed == 0
|
||||
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)
|
||||
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)
|
||||
@@ -500,7 +461,7 @@ def pbScrollMap(direction, distance, speed)
|
||||
Input.update
|
||||
break if !$game_map.scrolling?
|
||||
pbUpdateSceneMap
|
||||
break if $game_map.display_x == oldx && $game_map.display_y == oldy
|
||||
break if $game_map.display_x==oldx && $game_map.display_y==oldy
|
||||
oldx = $game_map.display_x
|
||||
oldy = $game_map.display_y
|
||||
end
|
||||
|
||||
@@ -234,11 +234,7 @@ class Game_Character
|
||||
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
|
||||
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
|
||||
return false unless self.map.valid?(new_x, new_y)
|
||||
if self.character_name == "SHARPEDO"
|
||||
return false if pbFacingTerrainTag().id==:SharpedoObstacle
|
||||
end
|
||||
return true if @through
|
||||
|
||||
if strict
|
||||
return false unless self.map.passableStrict?(x, y, d, self)
|
||||
return false unless self.map.passableStrict?(new_x, new_y, 10 - d, self)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class BushBitmap
|
||||
def initialize(bitmap, isTile, depth)
|
||||
@bitmaps = []
|
||||
@bitmap = bitmap
|
||||
@isTile = isTile
|
||||
@bitmaps = []
|
||||
@bitmap = bitmap
|
||||
@isTile = isTile
|
||||
@isBitmap = @bitmap.is_a?(Bitmap)
|
||||
@depth = depth
|
||||
@depth = depth
|
||||
end
|
||||
|
||||
def dispose
|
||||
@@ -53,23 +53,14 @@ class BushBitmap
|
||||
end
|
||||
end
|
||||
|
||||
def event_is_trainer(event)
|
||||
return $game_map.events[event.id] && event.name[/trainer\((\d+)\)/i]
|
||||
end
|
||||
|
||||
|
||||
class Sprite_Character < RPG::Sprite
|
||||
attr_accessor :character
|
||||
|
||||
def initialize(viewport, character = nil)
|
||||
super(viewport)
|
||||
@character = character
|
||||
|
||||
if darknessEffectOnCurrentMap()
|
||||
if @character.is_a?(Game_Event)
|
||||
$game_map.events[@character.id].erase if event_is_trainer(@character)
|
||||
end
|
||||
end
|
||||
|
||||
@character = character
|
||||
@oldbushdepth = 0
|
||||
@spriteoffset = false
|
||||
if !character || character == $game_player || (character.name[/reflection/i] rescue false)
|
||||
@@ -104,13 +95,13 @@ class Sprite_Character < RPG::Sprite
|
||||
return if @character.is_a?(Game_Event) && !@character.should_update?
|
||||
super
|
||||
if @tile_id != @character.tile_id ||
|
||||
@character_name != @character.character_name ||
|
||||
@character_hue != @character.character_hue ||
|
||||
@oldbushdepth != @character.bush_depth
|
||||
@tile_id = @character.tile_id
|
||||
@character_name != @character.character_name ||
|
||||
@character_hue != @character.character_hue ||
|
||||
@oldbushdepth != @character.bush_depth
|
||||
@tile_id = @character.tile_id
|
||||
@character_name = @character.character_name
|
||||
@character_hue = @character.character_hue
|
||||
@oldbushdepth = @character.bush_depth
|
||||
@character_hue = @character.character_hue
|
||||
@oldbushdepth = @character.bush_depth
|
||||
if @tile_id >= 384
|
||||
@charbitmap.dispose if @charbitmap
|
||||
@charbitmap = pbGetTileBitmap(@character.map.tileset_name, @tile_id,
|
||||
@@ -128,7 +119,7 @@ class Sprite_Character < RPG::Sprite
|
||||
else
|
||||
@charbitmap.dispose if @charbitmap
|
||||
@charbitmap = AnimatedBitmap.new(
|
||||
'Graphics/Characters/' + @character_name, @character_hue)
|
||||
'Graphics/Characters/' + @character_name, @character_hue)
|
||||
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player
|
||||
@charbitmapAnimated = true
|
||||
@bushbitmap.dispose if @bushbitmap
|
||||
@@ -163,14 +154,14 @@ class Sprite_Character < RPG::Sprite
|
||||
pbDayNightTint(self)
|
||||
end
|
||||
end
|
||||
self.x = @character.screen_x
|
||||
self.y = @character.screen_y
|
||||
self.z = @character.screen_z(@ch)
|
||||
# self.zoom_x = Game_Map::TILE_WIDTH / 32.0
|
||||
# self.zoom_y = Game_Map::TILE_HEIGHT / 32.0
|
||||
self.opacity = @character.opacity
|
||||
self.x = @character.screen_x
|
||||
self.y = @character.screen_y
|
||||
self.z = @character.screen_z(@ch)
|
||||
# self.zoom_x = Game_Map::TILE_WIDTH / 32.0
|
||||
# self.zoom_y = Game_Map::TILE_HEIGHT / 32.0
|
||||
self.opacity = @character.opacity
|
||||
self.blend_type = @character.blend_type
|
||||
# self.bush_depth = @character.bush_depth
|
||||
# self.bush_depth = @character.bush_depth
|
||||
if @character.animation_id != 0
|
||||
animation = $data_animations[@character.animation_id]
|
||||
animation(animation, true)
|
||||
|
||||
@@ -52,7 +52,6 @@ end
|
||||
def pbBGMPlay(param,volume=nil,pitch=nil)
|
||||
return if !param
|
||||
param=pbResolveAudioFile(param,volume,pitch)
|
||||
param = pbResolveAudioFile("ultra_metropolis", volume, pitch) if darknessEffectOnCurrentMap() && !$PokemonTemp.during_battle
|
||||
if param.name && param.name!=""
|
||||
if $game_system && $game_system.respond_to?("bgm_play")
|
||||
$game_system.bgm_play(param)
|
||||
|
||||
@@ -24,33 +24,12 @@ module GameData
|
||||
# @return [self]
|
||||
def get(other)
|
||||
validate other => [Symbol, self, String, Integer]
|
||||
|
||||
return other if other.is_a?(self)
|
||||
other = other.to_sym if other.is_a?(String)
|
||||
|
||||
if other.to_s.match?(/\AB\d+H\d+\z/)
|
||||
species = GameData::FusedSpecies.new(other)
|
||||
return species
|
||||
end
|
||||
|
||||
if other.is_a?(Integer) && self == GameData::Species
|
||||
if other > NB_POKEMON
|
||||
body_id = getBodyID(other)
|
||||
head_id = getHeadID(other, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
return GameData::FusedSpecies.new(pokemon_id)
|
||||
end
|
||||
end
|
||||
|
||||
if !self::DATA.has_key?(other)
|
||||
echo _INTL("Unknown ID {1}.", other)
|
||||
return self::get(:PIKACHU)
|
||||
end
|
||||
|
||||
#if other == :Species
|
||||
|
||||
# end
|
||||
|
||||
# if other.is_a?(Integer)
|
||||
# p "Please switch to symbols, thanks."
|
||||
# end
|
||||
raise "Unknown ID #{other}." unless self::DATA.has_key?(other)
|
||||
return self::DATA[other]
|
||||
end
|
||||
|
||||
@@ -61,23 +40,9 @@ module GameData
|
||||
validate other => [Symbol, self, String, Integer]
|
||||
return other if other.is_a?(self)
|
||||
other = other.to_sym if other.is_a?(String)
|
||||
|
||||
if other.to_s.match?(/\AB\d+H\d+\z/)
|
||||
species = GameData::FusedSpecies.new(other)
|
||||
return species
|
||||
end
|
||||
if other.is_a?(Integer) && self == GameData::Species
|
||||
if other > NB_POKEMON
|
||||
body_id = getBodyID(other)
|
||||
head_id = getHeadID(other, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
return GameData::FusedSpecies.new(pokemon_id)
|
||||
end
|
||||
end
|
||||
|
||||
# if other.is_a?(Integer)
|
||||
# p "Please switch to symbols, thanks."
|
||||
# end
|
||||
# if other.is_a?(Integer)
|
||||
# p "Please switch to symbols, thanks."
|
||||
# end
|
||||
return (self::DATA.has_key?(other)) ? self::DATA[other] : nil
|
||||
end
|
||||
|
||||
|
||||
@@ -21,15 +21,6 @@ module GameData
|
||||
attr_reader :must_walk
|
||||
attr_reader :ignore_passability
|
||||
|
||||
#oricorio
|
||||
attr_reader :flowerRed
|
||||
attr_reader :flowerPink
|
||||
attr_reader :flowerYellow
|
||||
attr_reader :flowerBlue
|
||||
attr_reader :flower
|
||||
attr_reader :trashcan
|
||||
attr_reader :sharpedoObstacle
|
||||
|
||||
DATA = {}
|
||||
|
||||
extend ClassMethods
|
||||
@@ -70,15 +61,6 @@ module GameData
|
||||
@shows_reflections = false #= hash[:shows_reflections] || false
|
||||
@must_walk = hash[:must_walk] || false
|
||||
@ignore_passability = hash[:ignore_passability] || false
|
||||
|
||||
@flowerRed = hash[:flowerRed] || false
|
||||
@flowerYellow = hash[:flowerYellow] || false
|
||||
@flowerPink = hash[:flowerPink] || false
|
||||
@flowerBlue = hash[:flowerBlue] || false
|
||||
@flower = hash[:flower] || false
|
||||
@trashcan = hash[:trashcan] || false
|
||||
@sharpedoObstacle = hash[:sharpedoObstacle] || false
|
||||
|
||||
end
|
||||
|
||||
def can_surf_freely
|
||||
@@ -220,46 +202,5 @@ GameData::TerrainTag.register({
|
||||
:id => :Puddle,
|
||||
:id_number => 16,
|
||||
:battle_environment => :Puddle,
|
||||
:shows_reflections => true
|
||||
:shows_reflections => false
|
||||
})
|
||||
|
||||
GameData::TerrainTag.register({
|
||||
:id => :FlowerRed,
|
||||
:id_number => 17,
|
||||
:flowerRed => true,
|
||||
:flower => true
|
||||
})
|
||||
GameData::TerrainTag.register({
|
||||
:id => :FlowerYellow,
|
||||
:id_number => 18,
|
||||
:flowerYellow => true,
|
||||
:flower => true
|
||||
})
|
||||
GameData::TerrainTag.register({
|
||||
:id => :FlowerPink,
|
||||
:id_number => 19,
|
||||
:flowerPink => true,
|
||||
:flower => true
|
||||
})
|
||||
GameData::TerrainTag.register({
|
||||
:id => :FlowerBlue,
|
||||
:id_number => 20,
|
||||
:flowerBlue => true,
|
||||
:flower => true
|
||||
})
|
||||
GameData::TerrainTag.register({
|
||||
:id => :FlowerOther,
|
||||
:id_number => 21,
|
||||
:flower => true
|
||||
})
|
||||
GameData::TerrainTag.register({
|
||||
:id => :Trashcan,
|
||||
:id_number => 22,
|
||||
:trashcan => true
|
||||
})
|
||||
|
||||
GameData::TerrainTag.register({
|
||||
:id => :SharpedoObstacle,
|
||||
:id_number => 23,
|
||||
:sharpedoObstacle => true
|
||||
})
|
||||
@@ -59,19 +59,18 @@ module GameData
|
||||
# @param form [Integer]
|
||||
# @return [self, nil]
|
||||
def self.get_species_form(species, form)
|
||||
return GameData::Species.get(species) rescue nil
|
||||
# return nil if !species || !form
|
||||
# validate species => [Symbol, self, String, Integer]
|
||||
# validate form => Integer
|
||||
# # if other.is_a?(Integer)
|
||||
# # p "Please switch to symbols, thanks."
|
||||
# # end
|
||||
# species = species.species if species.is_a?(self)
|
||||
# species = DATA[species].species if species.is_a?(Integer)
|
||||
# species = species.to_sym if species.is_a?(String)
|
||||
# trial = sprintf("%s_%d", species, form).to_sym
|
||||
# species_form = (DATA[trial].nil?) ? species : trial
|
||||
# return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
return nil if !species || !form
|
||||
validate species => [Symbol, self, String, Integer]
|
||||
validate form => Integer
|
||||
# if other.is_a?(Integer)
|
||||
# p "Please switch to symbols, thanks."
|
||||
# end
|
||||
species = species.species if species.is_a?(self)
|
||||
species = DATA[species].species if species.is_a?(Integer)
|
||||
species = species.to_sym if species.is_a?(String)
|
||||
trial = sprintf("%s_%d", species, form).to_sym
|
||||
species_form = (DATA[trial].nil?) ? species : trial
|
||||
return (DATA.has_key?(species_form)) ? DATA[species_form] : nil
|
||||
end
|
||||
|
||||
def self.schema(compiling_forms = false)
|
||||
@@ -192,26 +191,22 @@ module GameData
|
||||
end
|
||||
# @return [String] the translated name of this species
|
||||
def name
|
||||
return @real_name
|
||||
#return pbGetMessage(MessageTypes::Species, @id_number)
|
||||
return pbGetMessage(MessageTypes::Species, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated name of this form of this species
|
||||
def form_name
|
||||
return @real_form_name
|
||||
#return pbGetMessage(MessageTypes::FormNames, @id_number)
|
||||
return pbGetMessage(MessageTypes::FormNames, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex category of this species
|
||||
def category
|
||||
return @real_category
|
||||
#return pbGetMessage(MessageTypes::Kinds, @id_number)
|
||||
return pbGetMessage(MessageTypes::Kinds, @id_number)
|
||||
end
|
||||
|
||||
# @return [String] the translated Pokédex entry of this species
|
||||
def pokedex_entry
|
||||
return @real_pokedex_entry
|
||||
#return pbGetMessage(MessageTypes::Entries, @id_number)
|
||||
return pbGetMessage(MessageTypes::Entries, @id_number)
|
||||
end
|
||||
|
||||
def is_fusion
|
||||
@@ -250,8 +245,8 @@ module GameData
|
||||
end
|
||||
|
||||
def shows_shadow?
|
||||
return true
|
||||
# return @front_sprite_altitude > 0
|
||||
#return true
|
||||
return @front_sprite_altitude > 0
|
||||
end
|
||||
|
||||
def get_evolutions(exclude_invalid = false)
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
module GameData
|
||||
class Species
|
||||
def self.check_graphic_file(path, species, form = "", gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||
def self.check_graphic_file(path, species, form = 0, gender = 0, shiny = false, shadow = false, subfolder = "")
|
||||
try_subfolder = sprintf("%s/", subfolder)
|
||||
try_species = species
|
||||
|
||||
try_form = form ? sprintf("_%s", form) : ""
|
||||
try_form = (form > 0) ? sprintf("_%d", form) : ""
|
||||
try_gender = (gender == 1) ? "_female" : ""
|
||||
try_shadow = (shadow) ? "_shadow" : ""
|
||||
factors = []
|
||||
factors.push([4, sprintf("%s shiny/", subfolder), try_subfolder]) if shiny
|
||||
factors.push([3, try_shadow, ""]) if shadow
|
||||
factors.push([2, try_gender, ""]) if gender == 1
|
||||
factors.push([1, try_form, ""]) if form
|
||||
factors.push([1, try_form, ""]) if form > 0
|
||||
factors.push([0, try_species, "000"])
|
||||
# Go through each combination of parameters in turn to find an existing sprite
|
||||
for i in 0...2 ** factors.length
|
||||
@@ -132,17 +131,17 @@ module GameData
|
||||
return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000_icon")
|
||||
end
|
||||
|
||||
def self.icon_filename(species, spriteform= nil, gender=nil, shiny = false, shadow = false, egg = false)
|
||||
return self.egg_icon_filename(species, 0) if egg
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, spriteform, gender, shiny, shadow, "Icons")
|
||||
def self.icon_filename(species, form = 0, gender = 0, shiny = false, shadow = false, egg = false)
|
||||
return self.egg_icon_filename(species, form) if egg
|
||||
return self.check_graphic_file("Graphics/Pokemon/", species, form, gender, shiny, shadow, "Icons")
|
||||
end
|
||||
|
||||
def self.icon_filename_from_pokemon(pkmn)
|
||||
return pbResolveBitmap(sprintf("Graphics/Icons/iconEgg")) if pkmn.egg?
|
||||
if pkmn.isFusion?
|
||||
return pbResolveBitmap(sprintf("Graphics/Icons/iconDNA"))
|
||||
end
|
||||
return self.icon_filename(pkmn.species, pkmn.spriteform_head, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
|
||||
return self.icon_filename(pkmn.species, pkmn.form, pkmn.gender, pkmn.shiny?, pkmn.shadowPokemon?, pkmn.egg?)
|
||||
end
|
||||
|
||||
def self.icon_filename_from_species(species)
|
||||
@@ -211,10 +210,10 @@ module GameData
|
||||
species_data = GameData::Species.get(getHeadID(species_data))
|
||||
end
|
||||
|
||||
# if form > 0
|
||||
# ret = sprintf("Cries/%s_%d", species_data.species, form)
|
||||
# return ret if pbResolveAudioSE(ret)
|
||||
# end
|
||||
if form > 0
|
||||
ret = sprintf("Cries/%s_%d", species_data.species, form)
|
||||
return ret if pbResolveAudioSE(ret)
|
||||
end
|
||||
ret = sprintf("Cries/%s", species_data.species)
|
||||
return (pbResolveAudioSE(ret)) ? ret : nil
|
||||
end
|
||||
|
||||
@@ -61,7 +61,7 @@ module GameData
|
||||
end
|
||||
|
||||
def self.player_back_sprite_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.outfit : 0 rescue 0
|
||||
outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
|
||||
end
|
||||
|
||||
|
||||
@@ -322,7 +322,6 @@ class PokeBattle_Battler
|
||||
return @pokemon.isFusion?()
|
||||
end
|
||||
|
||||
|
||||
# Returns the active types of this Pokémon. The array should not include the
|
||||
# same type more than once, and should not include any invalid type numbers
|
||||
# (e.g. -1).
|
||||
|
||||
@@ -2,45 +2,45 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
# Turn processing
|
||||
#=============================================================================
|
||||
def pbProcessTurn(choice, tryFlee = true)
|
||||
def pbProcessTurn(choice,tryFlee=true)
|
||||
return false if fainted?
|
||||
# Wild roaming Pokémon always flee if possible
|
||||
if tryFlee && @battle.wildBattle? && opposes? &&
|
||||
@battle.rules["alwaysflee"] && @battle.pbCanRun?(@index)
|
||||
@battle.rules["alwaysflee"] && @battle.pbCanRun?(@index)
|
||||
pbBeginTurn(choice)
|
||||
pbSEPlay("Battle flee")
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!", pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} fled from battle!",pbThis))
|
||||
@battle.decision = 3
|
||||
pbEndTurn(choice)
|
||||
return true
|
||||
end
|
||||
# Shift with the battler next to this one
|
||||
if choice[0] == :Shift
|
||||
if choice[0]==:Shift
|
||||
idxOther = -1
|
||||
case @battle.pbSideSize(@index)
|
||||
when 2
|
||||
idxOther = (@index + 2) % 4
|
||||
idxOther = (@index+2)%4
|
||||
when 3
|
||||
if @index != 2 && @index != 3 # If not in middle spot already
|
||||
idxOther = ((@index % 2) == 0) ? 2 : 3
|
||||
if @index!=2 && @index!=3 # If not in middle spot already
|
||||
idxOther = ((@index%2)==0) ? 2 : 3
|
||||
end
|
||||
end
|
||||
if idxOther >= 0
|
||||
@battle.pbSwapBattlers(@index, idxOther)
|
||||
if idxOther>=0
|
||||
@battle.pbSwapBattlers(@index,idxOther)
|
||||
case @battle.pbSideSize(@index)
|
||||
when 2
|
||||
@battle.pbDisplay(_INTL("{1} moved across!", pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} moved across!",pbThis))
|
||||
when 3
|
||||
@battle.pbDisplay(_INTL("{1} moved to the center!", pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} moved to the center!",pbThis))
|
||||
end
|
||||
end
|
||||
pbBeginTurn(choice)
|
||||
pbCancelMoves
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
return true
|
||||
end
|
||||
# If this battler's action for this round wasn't "use a move"
|
||||
if choice[0] != :UseMove
|
||||
if choice[0]!=:UseMove
|
||||
# Clean up effects that end at battler's turn
|
||||
pbBeginTurn(choice)
|
||||
pbEndTurn(choice)
|
||||
@@ -56,8 +56,8 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Use the move
|
||||
PBDebug.log("[Move usage] #{pbThis} started using #{choice[2].name}")
|
||||
PBDebug.logonerr {
|
||||
pbUseMove(choice, choice[2] == @battle.struggle)
|
||||
PBDebug.logonerr{
|
||||
pbUseMove(choice,choice[2]==@battle.struggle)
|
||||
}
|
||||
@battle.pbJudge
|
||||
# Update priority order
|
||||
@@ -70,15 +70,15 @@ class PokeBattle_Battler
|
||||
#=============================================================================
|
||||
def pbBeginTurn(_choice)
|
||||
# Cancel some lingering effects which only apply until the user next moves
|
||||
@effects[PBEffects::BeakBlast] = false
|
||||
@effects[PBEffects::BeakBlast] = false
|
||||
@effects[PBEffects::DestinyBondPrevious] = @effects[PBEffects::DestinyBond]
|
||||
@effects[PBEffects::DestinyBond] = false
|
||||
@effects[PBEffects::Grudge] = false
|
||||
@effects[PBEffects::MoveNext] = false
|
||||
@effects[PBEffects::Quash] = 0
|
||||
@effects[PBEffects::DestinyBond] = false
|
||||
@effects[PBEffects::Grudge] = false
|
||||
@effects[PBEffects::MoveNext] = false
|
||||
@effects[PBEffects::Quash] = 0
|
||||
# Encore's effect ends if the encored move is no longer available
|
||||
if @effects[PBEffects::Encore] > 0 && pbEncoredMoveIndex < 0
|
||||
@effects[PBEffects::Encore] = 0
|
||||
if @effects[PBEffects::Encore]>0 && pbEncoredMoveIndex<0
|
||||
@effects[PBEffects::Encore] = 0
|
||||
@effects[PBEffects::EncoreMove] = nil
|
||||
end
|
||||
end
|
||||
@@ -91,50 +91,50 @@ class PokeBattle_Battler
|
||||
def pbCancelMoves(full_cancel = false)
|
||||
# Outragers get confused anyway if they are disrupted during their final
|
||||
# turn of using the move
|
||||
if @effects[PBEffects::Outrage] == 1 && pbCanConfuseSelf?(false) && !full_cancel
|
||||
pbConfuse(_INTL("{1} became confused due to fatigue!", pbThis))
|
||||
if @effects[PBEffects::Outrage]==1 && pbCanConfuseSelf?(false) && !full_cancel
|
||||
pbConfuse(_INTL("{1} became confused due to fatigue!",pbThis))
|
||||
end
|
||||
# Cancel usage of most multi-turn moves
|
||||
@effects[PBEffects::TwoTurnAttack] = nil
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::Bide] = 0
|
||||
@effects[PBEffects::Rollout] = 0
|
||||
@effects[PBEffects::Outrage] = 0
|
||||
@effects[PBEffects::Uproar] = 0
|
||||
@effects[PBEffects::Bide] = 0
|
||||
@currentMove = nil
|
||||
# Reset counters for moves which increase them when used in succession
|
||||
@effects[PBEffects::FuryCutter] = 0
|
||||
@effects[PBEffects::FuryCutter] = 0
|
||||
end
|
||||
|
||||
def pbEndTurn(_choice)
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
@lastRoundMoved = @battle.turnCount # Done something this round
|
||||
if !@effects[PBEffects::ChoiceBand] &&
|
||||
hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
|
||||
hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
|
||||
if @lastMoveUsed && pbHasMove?(@lastMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastMoveUsed
|
||||
elsif @lastRegularMoveUsed && pbHasMove?(@lastRegularMoveUsed)
|
||||
@effects[PBEffects::ChoiceBand] = @lastRegularMoveUsed
|
||||
end
|
||||
end
|
||||
@effects[PBEffects::BeakBlast] = false
|
||||
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge] == 1
|
||||
@effects[PBEffects::BeakBlast] = false
|
||||
@effects[PBEffects::Charge] = 0 if @effects[PBEffects::Charge]==1
|
||||
@effects[PBEffects::GemConsumed] = nil
|
||||
@effects[PBEffects::ShellTrap] = false
|
||||
@battle.eachBattler { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers
|
||||
@effects[PBEffects::ShellTrap] = false
|
||||
@battle.eachBattler { |b| b.pbContinualAbilityChecks } # Trace, end primordial weathers
|
||||
end
|
||||
|
||||
def pbConfusionDamage(msg)
|
||||
@damageState.reset
|
||||
@damageState.initialHP = @hp
|
||||
confusionMove = PokeBattle_Confusion.new(@battle, nil)
|
||||
confusionMove.calcType = confusionMove.pbCalcType(self) # nil
|
||||
@damageState.typeMod = confusionMove.pbCalcTypeMod(confusionMove.calcType, self, self) # 8
|
||||
confusionMove.pbCheckDamageAbsorption(self, self)
|
||||
confusionMove.pbCalcDamage(self, self)
|
||||
confusionMove.pbReduceDamage(self, self)
|
||||
confusionMove = PokeBattle_Confusion.new(@battle,nil)
|
||||
confusionMove.calcType = confusionMove.pbCalcType(self) # nil
|
||||
@damageState.typeMod = confusionMove.pbCalcTypeMod(confusionMove.calcType,self,self) # 8
|
||||
confusionMove.pbCheckDamageAbsorption(self,self)
|
||||
confusionMove.pbCalcDamage(self,self)
|
||||
confusionMove.pbReduceDamage(self,self)
|
||||
self.hp -= @damageState.hpLost
|
||||
confusionMove.pbAnimateHitAndHPLost(self, [self])
|
||||
@battle.pbDisplay(msg) # "It hurt itself in its confusion!"
|
||||
confusionMove.pbRecordDamageLost(self, self)
|
||||
confusionMove.pbAnimateHitAndHPLost(self,[self])
|
||||
@battle.pbDisplay(msg) # "It hurt itself in its confusion!"
|
||||
confusionMove.pbRecordDamageLost(self,self)
|
||||
confusionMove.pbEndureKOMessage(self)
|
||||
pbFaint if fainted?
|
||||
pbItemHPHealCheck
|
||||
@@ -144,74 +144,74 @@ class PokeBattle_Battler
|
||||
# Simple "use move" method, used when a move calls another move and for Future
|
||||
# Sight's attack
|
||||
#=============================================================================
|
||||
def pbUseMoveSimple(moveID, target = -1, idxMove = -1, specialUsage = true)
|
||||
def pbUseMoveSimple(moveID,target=-1,idxMove=-1,specialUsage=true)
|
||||
choice = []
|
||||
choice[0] = :UseMove # "Use move"
|
||||
choice[1] = idxMove # Index of move to be used in user's moveset
|
||||
if idxMove >= 0
|
||||
choice[0] = :UseMove # "Use move"
|
||||
choice[1] = idxMove # Index of move to be used in user's moveset
|
||||
if idxMove>=0
|
||||
choice[2] = @moves[idxMove]
|
||||
else
|
||||
choice[2] = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(moveID))
|
||||
choice[2].pp = -1
|
||||
end
|
||||
choice[3] = target # Target (-1 means no target yet)
|
||||
choice[3] = target # Target (-1 means no target yet)
|
||||
PBDebug.log("[Move usage] #{pbThis} started using the called/simple move #{choice[2].name}")
|
||||
pbUseMove(choice, specialUsage)
|
||||
pbUseMove(choice,specialUsage)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Master "use move" method
|
||||
#=============================================================================
|
||||
def pbUseMove(choice, specialUsage = false)
|
||||
def pbUseMove(choice,specialUsage=false)
|
||||
# NOTE: This is intentionally determined before a multi-turn attack can
|
||||
# set specialUsage to true.
|
||||
skipAccuracyCheck = (specialUsage && choice[2] != @battle.struggle)
|
||||
skipAccuracyCheck = (specialUsage && choice[2]!=@battle.struggle)
|
||||
# Start using the move
|
||||
pbBeginTurn(choice)
|
||||
# Force the use of certain moves if they're already being used
|
||||
if usingMultiTurnAttack?
|
||||
choice[2] = PokeBattle_Move.from_pokemon_move(@battle, Pokemon::Move.new(@currentMove))
|
||||
specialUsage = true
|
||||
elsif @effects[PBEffects::Encore] > 0 && choice[1] >= 0 &&
|
||||
@battle.pbCanShowCommands?(@index)
|
||||
elsif @effects[PBEffects::Encore]>0 && choice[1]>=0 &&
|
||||
@battle.pbCanShowCommands?(@index)
|
||||
idxEncoredMove = pbEncoredMoveIndex
|
||||
if idxEncoredMove >= 0 && @battle.pbCanChooseMove?(@index, idxEncoredMove, false)
|
||||
if choice[1] != idxEncoredMove # Change move if battler was Encored mid-round
|
||||
if idxEncoredMove>=0 && @battle.pbCanChooseMove?(@index,idxEncoredMove,false)
|
||||
if choice[1]!=idxEncoredMove # Change move if battler was Encored mid-round
|
||||
choice[1] = idxEncoredMove
|
||||
choice[2] = @moves[idxEncoredMove]
|
||||
choice[3] = -1 # No target chosen
|
||||
choice[3] = -1 # No target chosen
|
||||
end
|
||||
end
|
||||
end
|
||||
# Labels the move being used as "move"
|
||||
move = choice[2]
|
||||
return if !move # if move was not chosen somehow
|
||||
return if !move # if move was not chosen somehow
|
||||
# Try to use the move (inc. disobedience)
|
||||
@lastMoveFailed = false
|
||||
if !pbTryUseMove(choice, move, specialUsage, skipAccuracyCheck)
|
||||
@lastMoveUsed = nil
|
||||
if !pbTryUseMove(choice,move,specialUsage,skipAccuracyCheck)
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = nil
|
||||
if !specialUsage
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
end
|
||||
@battle.pbGainExp # In case self is KO'd due to confusion
|
||||
@battle.pbGainExp # In case self is KO'd due to confusion
|
||||
pbCancelMoves
|
||||
pbEndTurn(choice)
|
||||
return
|
||||
end
|
||||
move = choice[2] # In case disobedience changed the move to be used
|
||||
return if !move # if move was not chosen somehow
|
||||
move = choice[2] # In case disobedience changed the move to be used
|
||||
return if !move # if move was not chosen somehow
|
||||
# Subtract PP
|
||||
if !specialUsage
|
||||
if !pbReducePP(move)
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!", pbThis, move.name))
|
||||
@battle.pbDisplay(_INTL("{1} used {2}!",pbThis,move.name))
|
||||
@battle.pbDisplay(_INTL("But there was no PP left for the move!"))
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastMoveUsed = nil
|
||||
@lastMoveUsedType = nil
|
||||
@lastRegularMoveUsed = nil
|
||||
@lastRegularMoveTarget = -1
|
||||
@lastMoveFailed = true
|
||||
@lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
pbEndTurn(choice)
|
||||
return
|
||||
@@ -220,11 +220,11 @@ class PokeBattle_Battler
|
||||
# Stance Change
|
||||
if self.ability == :STANCECHANGE
|
||||
if move.damagingMove?
|
||||
user = pbFindUser(choice, move)
|
||||
stanceChangeEffect(user, true)
|
||||
user = pbFindUser(choice,move)
|
||||
stanceChangeEffect(user,true)
|
||||
elsif move.id == :KINGSSHIELD
|
||||
user = pbFindUser(choice, move)
|
||||
stanceChangeEffect(user, false)
|
||||
user = pbFindUser(choice,move)
|
||||
stanceChangeEffect(user,false)
|
||||
end
|
||||
end
|
||||
# Calculate the move's type during this usage
|
||||
@@ -237,34 +237,34 @@ class PokeBattle_Battler
|
||||
@effects[PBEffects::TwoTurnAttack] = move.id
|
||||
@currentMove = move.id
|
||||
else
|
||||
@effects[PBEffects::TwoTurnAttack] = nil # Cancel use of two-turn attack
|
||||
@effects[PBEffects::TwoTurnAttack] = nil # Cancel use of two-turn attack
|
||||
end
|
||||
# Add to counters for moves which increase them when used in succession
|
||||
move.pbChangeUsageCounters(self, specialUsage)
|
||||
move.pbChangeUsageCounters(self,specialUsage)
|
||||
# Charge up Metronome item
|
||||
if hasActiveItem?(:METRONOME) && !move.callsAnotherMove?
|
||||
if @lastMoveUsed && @lastMoveUsed == move.id && !@lastMoveFailed
|
||||
if @lastMoveUsed && @lastMoveUsed==move.id && !@lastMoveFailed
|
||||
@effects[PBEffects::Metronome] += 1
|
||||
else
|
||||
@effects[PBEffects::Metronome] = 0
|
||||
end
|
||||
end
|
||||
# Record move as having been used
|
||||
@lastMoveUsed = move.id
|
||||
@lastMoveUsedType = move.calcType # For Conversion 2
|
||||
@lastMoveUsed = move.id
|
||||
@lastMoveUsedType = move.calcType # For Conversion 2
|
||||
if !specialUsage
|
||||
@lastRegularMoveUsed = move.id # For Disable, Encore, Instruct, Mimic, Mirror Move, Sketch, Spite
|
||||
@lastRegularMoveTarget = choice[3] # For Instruct (remembering original target is fine)
|
||||
@movesUsed.push(move.id) if !@movesUsed.include?(move.id) # For Last Resort
|
||||
@lastRegularMoveUsed = move.id # For Disable, Encore, Instruct, Mimic, Mirror Move, Sketch, Spite
|
||||
@lastRegularMoveTarget = choice[3] # For Instruct (remembering original target is fine)
|
||||
@movesUsed.push(move.id) if !@movesUsed.include?(move.id) # For Last Resort
|
||||
end
|
||||
@battle.lastMoveUsed = move.id # For Copycat
|
||||
@battle.lastMoveUser = @index # For "self KO" battle clause to avoid draws
|
||||
@battle.successStates[@index].useState = 1 # Battle Arena - assume failure
|
||||
@battle.lastMoveUsed = move.id # For Copycat
|
||||
@battle.lastMoveUser = @index # For "self KO" battle clause to avoid draws
|
||||
@battle.successStates[@index].useState = 1 # Battle Arena - assume failure
|
||||
# Find the default user (self or Snatcher) and target(s)
|
||||
user = pbFindUser(choice, move)
|
||||
user = pbChangeUser(choice, move, user)
|
||||
targets = pbFindTargets(choice, move, user)
|
||||
targets = pbChangeTargets(move, user, targets)
|
||||
user = pbFindUser(choice,move)
|
||||
user = pbChangeUser(choice,move,user)
|
||||
targets = pbFindTargets(choice,move,user)
|
||||
targets = pbChangeTargets(move,user,targets)
|
||||
# Pressure
|
||||
if !specialUsage
|
||||
targets.each do |b|
|
||||
@@ -283,10 +283,10 @@ class PokeBattle_Battler
|
||||
# Dazzling/Queenly Majesty make the move fail here
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if !b || !b.abilityActive?
|
||||
if BattleHandlers.triggerMoveBlockingAbility(b.ability, b, user, targets, move, @battle)
|
||||
@battle.pbDisplayBrief(_INTL("{1} used {2}!", user.pbThis, move.name))
|
||||
if BattleHandlers.triggerMoveBlockingAbility(b.ability,b,user,targets,move,@battle)
|
||||
@battle.pbDisplayBrief(_INTL("{1} used {2}!",user.pbThis,move.name))
|
||||
@battle.pbShowAbilitySplash(b)
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2}!", user.pbThis, move.name))
|
||||
@battle.pbDisplay(_INTL("{1} cannot use {2}!",user.pbThis,move.name))
|
||||
@battle.pbHideAbilitySplash(b)
|
||||
user.lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
@@ -302,12 +302,12 @@ class PokeBattle_Battler
|
||||
move.pbDisplayUseMessage(self)
|
||||
# Snatch's message (user is the new user, self is the original user)
|
||||
if move.snatched
|
||||
@lastMoveFailed = true # Intentionally applies to self, not user
|
||||
@battle.pbDisplay(_INTL("{1} snatched {2}'s move!", user.pbThis, pbThis(true)))
|
||||
@lastMoveFailed = true # Intentionally applies to self, not user
|
||||
@battle.pbDisplay(_INTL("{1} snatched {2}'s move!",user.pbThis,pbThis(true)))
|
||||
end
|
||||
# "But it failed!" checks
|
||||
if move.pbMoveFailed?(user, targets)
|
||||
PBDebug.log(sprintf("[Move failed] In function code %s's def pbMoveFailed?", move.function))
|
||||
if move.pbMoveFailed?(user,targets)
|
||||
PBDebug.log(sprintf("[Move failed] In function code %s's def pbMoveFailed?",move.function))
|
||||
user.lastMoveFailed = true
|
||||
pbCancelMoves
|
||||
pbEndTurn(choice)
|
||||
@@ -315,22 +315,22 @@ class PokeBattle_Battler
|
||||
end
|
||||
# Perform set-up actions and display messages
|
||||
# Messages include Magnitude's number and Pledge moves' "it's a combo!"
|
||||
move.pbOnStartUse(user, targets)
|
||||
move.pbOnStartUse(user,targets)
|
||||
# Self-thawing due to the move
|
||||
if user.status == :FROZEN && move.thawsUser?
|
||||
user.pbCureStatus(false)
|
||||
@battle.pbDisplay(_INTL("{1} melted the ice!", user.pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} melted the ice!",user.pbThis))
|
||||
end
|
||||
# Powder
|
||||
if user.effects[PBEffects::Powder] && move.calcType == :FIRE
|
||||
@battle.pbCommonAnimation("Powder", user)
|
||||
@battle.pbCommonAnimation("Powder",user)
|
||||
@battle.pbDisplay(_INTL("When the flame touched the powder on the Pokémon, it exploded!"))
|
||||
user.lastMoveFailed = true
|
||||
if ![:Rain, :HeavyRain].include?(@battle.pbWeather) && user.takesIndirectDamage?
|
||||
oldHP = user.hp
|
||||
user.pbReduceHP((user.totalhp / 4.0).round, false)
|
||||
user.pbReduceHP((user.totalhp/4.0).round,false)
|
||||
user.pbFaint if user.fainted?
|
||||
@battle.pbGainExp # In case user is KO'd by this
|
||||
@battle.pbGainExp # In case user is KO'd by this
|
||||
user.pbItemHPHealCheck
|
||||
if user.pbAbilitiesOnDamageTaken(oldHP)
|
||||
user.pbEffectsOnSwitchIn(true)
|
||||
@@ -367,20 +367,20 @@ class PokeBattle_Battler
|
||||
@battle.pbShowAbilitySplash(user)
|
||||
user.pbChangeTypes(move.calcType)
|
||||
typeName = GameData::Type.get(move.calcType).name
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!", user.pbThis, typeName))
|
||||
@battle.pbDisplay(_INTL("{1} transformed into the {2} type!",user.pbThis,typeName))
|
||||
@battle.pbHideAbilitySplash(user)
|
||||
# NOTE: The GF games say that if Curse is used by a non-Ghost-type
|
||||
# Pokémon which becomes Ghost-type because of Protean, it should
|
||||
# target and curse itself. I think this is silly, so I'm making it
|
||||
# choose a random opponent to curse instead.
|
||||
if move.function == "10D" && targets.length == 0 # Curse
|
||||
if move.function=="10D" && targets.length==0 # Curse
|
||||
choice[3] = -1
|
||||
targets = pbFindTargets(choice, move, user)
|
||||
targets = pbFindTargets(choice,move,user)
|
||||
end
|
||||
end
|
||||
end
|
||||
#---------------------------------------------------------------------------
|
||||
magicCoater = -1
|
||||
magicCoater = -1
|
||||
magicBouncer = -1
|
||||
if targets.length == 0 && move.pbTarget(user).num_targets > 0 && !move.worksWithNoTargets?
|
||||
# def pbFindTargets should have found a target(s), but it didn't because
|
||||
@@ -388,19 +388,18 @@ class PokeBattle_Battler
|
||||
# All target types except: None, User, UserSide, FoeSide, BothSides
|
||||
@battle.pbDisplay(_INTL("But there was no target..."))
|
||||
user.lastMoveFailed = true
|
||||
else
|
||||
# We have targets, or move doesn't use targets
|
||||
else # We have targets, or move doesn't use targets
|
||||
# Reset whole damage state, perform various success checks (not accuracy)
|
||||
user.initialHP = user.hp
|
||||
targets.each do |b|
|
||||
b.damageState.reset
|
||||
b.damageState.initialHP = b.hp
|
||||
if !pbSuccessCheckAgainstTarget(move, user, b)
|
||||
if !pbSuccessCheckAgainstTarget(move,user,b)
|
||||
b.damageState.unaffected = true
|
||||
end
|
||||
end
|
||||
# Magic Coat/Magic Bounce checks (for moves which don't target Pokémon)
|
||||
if targets.length == 0 && move.canMagicCoat?
|
||||
if targets.length==0 && move.canMagicCoat?
|
||||
@battle.pbPriority(true).each do |b|
|
||||
next if b.fainted? || !b.opposes?(user)
|
||||
next if b.semiInvulnerable?
|
||||
@@ -409,7 +408,7 @@ class PokeBattle_Battler
|
||||
b.effects[PBEffects::MagicCoat] = false
|
||||
break
|
||||
elsif b.hasActiveAbility?(:MAGICBOUNCE) && !@battle.moldBreaker &&
|
||||
!b.effects[PBEffects::MagicBounce]
|
||||
!b.effects[PBEffects::MagicBounce]
|
||||
magicBouncer = b.index
|
||||
b.effects[PBEffects::MagicBounce] = true
|
||||
break
|
||||
@@ -417,14 +416,14 @@ class PokeBattle_Battler
|
||||
end
|
||||
end
|
||||
# Get the number of hits
|
||||
numHits = move.pbNumHits(user, targets)
|
||||
numHits = move.pbNumHits(user,targets)
|
||||
# Process each hit in turn
|
||||
realNumHits = 0
|
||||
for i in 0...numHits
|
||||
break if magicCoater >= 0 || magicBouncer >= 0
|
||||
success = pbProcessMoveHit(move, user, targets, i, skipAccuracyCheck)
|
||||
break if magicCoater>=0 || magicBouncer>=0
|
||||
success = pbProcessMoveHit(move,user,targets,i,skipAccuracyCheck)
|
||||
if !success
|
||||
if i == 0 && targets.length > 0
|
||||
if i==0 && targets.length>0
|
||||
hasFailed = false
|
||||
targets.each do |t|
|
||||
next if t.damageState.protected
|
||||
@@ -441,11 +440,11 @@ class PokeBattle_Battler
|
||||
# NOTE: If a multi-hit move becomes disabled partway through doing those
|
||||
# hits (e.g. by Cursed Body), the rest of the hits continue as
|
||||
# normal.
|
||||
break if !targets.any? { |t| !t.fainted? } # All targets are fainted
|
||||
break if !targets.any? { |t| !t.fainted? } # All targets are fainted
|
||||
end
|
||||
# Battle Arena only - attack is successful
|
||||
@battle.successStates[user.index].useState = 2
|
||||
if targets.length > 0
|
||||
if targets.length>0
|
||||
@battle.successStates[user.index].typeMod = 0
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
@@ -455,17 +454,17 @@ class PokeBattle_Battler
|
||||
# Effectiveness message for multi-hit moves
|
||||
# NOTE: No move is both multi-hit and multi-target, and the messages below
|
||||
# aren't quite right for such a hypothetical move.
|
||||
if numHits > 1
|
||||
if numHits>1
|
||||
if move.damagingMove?
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected || b.damageState.substitute
|
||||
move.pbEffectivenessMessage(user, b, targets.length)
|
||||
move.pbEffectivenessMessage(user,b,targets.length)
|
||||
end
|
||||
end
|
||||
if realNumHits == 1
|
||||
if realNumHits==1
|
||||
@battle.pbDisplay(_INTL("Hit 1 time!"))
|
||||
elsif realNumHits > 1
|
||||
@battle.pbDisplay(_INTL("Hit {1} times!", realNumHits))
|
||||
elsif realNumHits>1
|
||||
@battle.pbDisplay(_INTL("Hit {1} times!",realNumHits))
|
||||
end
|
||||
end
|
||||
# Magic Coat's bouncing back (move has targets)
|
||||
@@ -473,38 +472,38 @@ class PokeBattle_Battler
|
||||
next if b.fainted?
|
||||
next if !b.damageState.magicCoat && !b.damageState.magicBounce
|
||||
@battle.pbShowAbilitySplash(b) if b.damageState.magicBounce
|
||||
@battle.pbDisplay(_INTL("{1} bounced the {2} back!", b.pbThis, move.name))
|
||||
@battle.pbDisplay(_INTL("{1} bounced the {2} back!",b.pbThis,move.name))
|
||||
@battle.pbHideAbilitySplash(b) if b.damageState.magicBounce
|
||||
newChoice = choice.clone
|
||||
newChoice[3] = user.index
|
||||
newTargets = pbFindTargets(newChoice, move, b)
|
||||
newTargets = pbChangeTargets(move, b, newTargets)
|
||||
success = pbProcessMoveHit(move, b, newTargets, 0, false)
|
||||
newTargets = pbFindTargets(newChoice,move,b)
|
||||
newTargets = pbChangeTargets(move,b,newTargets)
|
||||
success = pbProcessMoveHit(move,b,newTargets,0,false)
|
||||
b.lastMoveFailed = true if !success
|
||||
targets.each { |otherB| otherB.pbFaint if otherB && otherB.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
# Magic Coat's bouncing back (move has no targets)
|
||||
if magicCoater >= 0 || magicBouncer >= 0
|
||||
mc = @battle.battlers[(magicCoater >= 0) ? magicCoater : magicBouncer]
|
||||
if magicCoater>=0 || magicBouncer>=0
|
||||
mc = @battle.battlers[(magicCoater>=0) ? magicCoater : magicBouncer]
|
||||
if !mc.fainted?
|
||||
user.lastMoveFailed = true
|
||||
@battle.pbShowAbilitySplash(mc) if magicBouncer >= 0
|
||||
@battle.pbDisplay(_INTL("{1} bounced the {2} back!", mc.pbThis, move.name))
|
||||
@battle.pbHideAbilitySplash(mc) if magicBouncer >= 0
|
||||
success = pbProcessMoveHit(move, mc, [], 0, false)
|
||||
@battle.pbShowAbilitySplash(mc) if magicBouncer>=0
|
||||
@battle.pbDisplay(_INTL("{1} bounced the {2} back!",mc.pbThis,move.name))
|
||||
@battle.pbHideAbilitySplash(mc) if magicBouncer>=0
|
||||
success = pbProcessMoveHit(move,mc,[],0,false)
|
||||
mc.lastMoveFailed = true if !success
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
end
|
||||
end
|
||||
# Move-specific effects after all hits
|
||||
targets.each { |b| move.pbEffectAfterAllHits(user, b) }
|
||||
targets.each { |b| move.pbEffectAfterAllHits(user,b) }
|
||||
# Faint if 0 HP
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
user.pbFaint if user.fainted?
|
||||
# External/general effects after all hits. Eject Button, Shell Bell, etc.
|
||||
pbEffectsAfterMove(user, targets, move, realNumHits)
|
||||
pbEffectsAfterMove(user,targets,move,realNumHits)
|
||||
end
|
||||
# End effect of Mold Breaker
|
||||
@battle.moldBreaker = false
|
||||
@@ -513,7 +512,7 @@ class PokeBattle_Battler
|
||||
# Battle Arena only - update skills
|
||||
@battle.eachBattler { |b| @battle.successStates[b.index].updateSkill }
|
||||
# Shadow Pokémon triggering Hyper Mode
|
||||
pbHyperMode if @battle.choices[@index][0] != :None # Not if self is replaced
|
||||
pbHyperMode if @battle.choices[@index][0]!=:None # Not if self is replaced
|
||||
# End of move usage
|
||||
pbEndTurn(choice)
|
||||
# Instruct
|
||||
@@ -521,129 +520,102 @@ class PokeBattle_Battler
|
||||
next if !b.effects[PBEffects::Instruct] || !b.lastMoveUsed
|
||||
b.effects[PBEffects::Instruct] = false
|
||||
idxMove = -1
|
||||
b.eachMoveWithIndex { |m, i| idxMove = i if m.id == b.lastMoveUsed }
|
||||
next if idxMove < 0
|
||||
b.eachMoveWithIndex { |m,i| idxMove = i if m.id==b.lastMoveUsed }
|
||||
next if idxMove<0
|
||||
oldLastRoundMoved = b.lastRoundMoved
|
||||
@battle.pbDisplay(_INTL("{1} used the move instructed by {2}!", b.pbThis, user.pbThis(true)))
|
||||
PBDebug.logonerr {
|
||||
@battle.pbDisplay(_INTL("{1} used the move instructed by {2}!",b.pbThis,user.pbThis(true)))
|
||||
PBDebug.logonerr{
|
||||
b.effects[PBEffects::Instructed] = true
|
||||
b.pbUseMoveSimple(b.lastMoveUsed, b.lastRegularMoveTarget, idxMove, false)
|
||||
b.pbUseMoveSimple(b.lastMoveUsed,b.lastRegularMoveTarget,idxMove,false)
|
||||
b.effects[PBEffects::Instructed] = false
|
||||
}
|
||||
b.lastRoundMoved = oldLastRoundMoved
|
||||
@battle.pbJudge
|
||||
return if @battle.decision > 0
|
||||
return if @battle.decision>0
|
||||
end
|
||||
# Dancer
|
||||
if !@effects[PBEffects::Dancer] && !user.lastMoveFailed && realNumHits > 0 &&
|
||||
!move.snatched && magicCoater < 0 && @battle.pbCheckGlobalAbility(:DANCER) &&
|
||||
move.danceMove?
|
||||
if !@effects[PBEffects::Dancer] && !user.lastMoveFailed && realNumHits>0 &&
|
||||
!move.snatched && magicCoater<0 && @battle.pbCheckGlobalAbility(:DANCER) &&
|
||||
move.danceMove?
|
||||
dancers = []
|
||||
@battle.pbPriority(true).each do |b|
|
||||
dancers.push(b) if b.index != user.index && b.hasActiveAbility?(:DANCER)
|
||||
dancers.push(b) if b.index!=user.index && b.hasActiveAbility?(:DANCER)
|
||||
end
|
||||
while dancers.length > 0
|
||||
while dancers.length>0
|
||||
nextUser = dancers.pop
|
||||
oldLastRoundMoved = nextUser.lastRoundMoved
|
||||
# NOTE: Petal Dance being used because of Dancer shouldn't lock the
|
||||
# Dancer into using that move, and shouldn't contribute to its
|
||||
# turn counter if it's already locked into Petal Dance.
|
||||
oldOutrage = nextUser.effects[PBEffects::Outrage]
|
||||
nextUser.effects[PBEffects::Outrage] += 1 if nextUser.effects[PBEffects::Outrage] > 0
|
||||
nextUser.effects[PBEffects::Outrage] += 1 if nextUser.effects[PBEffects::Outrage]>0
|
||||
oldCurrentMove = nextUser.currentMove
|
||||
preTarget = choice[3]
|
||||
preTarget = user.index if nextUser.opposes?(user) || !nextUser.opposes?(preTarget)
|
||||
@battle.pbShowAbilitySplash(nextUser, true)
|
||||
@battle.pbShowAbilitySplash(nextUser,true)
|
||||
@battle.pbHideAbilitySplash(nextUser)
|
||||
if !PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@battle.pbDisplay(_INTL("{1} kept the dance going with {2}!",
|
||||
nextUser.pbThis, nextUser.abilityName))
|
||||
nextUser.pbThis,nextUser.abilityName))
|
||||
end
|
||||
PBDebug.logonerr {
|
||||
PBDebug.logonerr{
|
||||
nextUser.effects[PBEffects::Dancer] = true
|
||||
nextUser.pbUseMoveSimple(move.id, preTarget)
|
||||
nextUser.pbUseMoveSimple(move.id,preTarget)
|
||||
nextUser.effects[PBEffects::Dancer] = false
|
||||
}
|
||||
nextUser.lastRoundMoved = oldLastRoundMoved
|
||||
nextUser.effects[PBEffects::Outrage] = oldOutrage
|
||||
nextUser.currentMove = oldCurrentMove
|
||||
@battle.pbJudge
|
||||
return if @battle.decision > 0
|
||||
return if @battle.decision>0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def stanceChangeEffect(user, attacking = false)
|
||||
inSwordForm = user.effects[PBEffects::PowerTrick]
|
||||
|
||||
def stanceChangeEffect(user,attacking=false)
|
||||
inSwordForm = user.effects[PBEffects::PowerTrick]
|
||||
if !inSwordForm && attacking
|
||||
user.effects[PBEffects::PowerTrick] = true
|
||||
user.attack, user.defense = user.defense, user.attack
|
||||
user.spatk, user.spdef = user.spdef, user.spatk
|
||||
user.attack,user.defense = user.defense,user.attack
|
||||
user.spatk,user.spdef = user.spdef,user.spatk
|
||||
|
||||
|
||||
#changeForm(1,:AEGISLASH)
|
||||
|
||||
@battle.pbDisplay(_INTL("{1} changed to Sword Mode!", pbThis))
|
||||
@battle.pbDisplay(_INTL("{1} changed to Sword Mode!",pbThis))
|
||||
elsif inSwordForm && !attacking
|
||||
user.effects[PBEffects::PowerTrick] = false
|
||||
user.attack, user.defense = user.defense, user.attack
|
||||
user.spatk, user.spdef = user.spdef, user.spatk
|
||||
|
||||
#user.changeForm(nil,:AEGISLASH)
|
||||
|
||||
@battle.pbDisplay(_INTL("{1} changed to Shield Mode!", pbThis))
|
||||
user.effects[PBEffects::PowerTrick] = false
|
||||
user.attack,user.defense = user.defense,user.attack
|
||||
user.spatk,user.spdef = user.spdef,user.spatk
|
||||
@battle.pbDisplay(_INTL("{1} changed to Shield Mode!",pbThis))
|
||||
end
|
||||
end
|
||||
|
||||
def changeForm(newForm, formChangingSpecies, animation = "UltraBurst2")
|
||||
spriteform_body = newForm if @pokemon.hasBodyOf?(formChangingSpecies)
|
||||
spriteform_head = newForm if @pokemon.hasHeadOf?(formChangingSpecies)
|
||||
|
||||
if self.isFusion?
|
||||
current_form_has_custom = customSpriteExists(@pokemon.species)
|
||||
new_form_has_custom = customSpriteExistsForm(@pokemon.species, spriteform_head, spriteform_body)
|
||||
should_change_sprite = (current_form_has_custom && new_form_has_custom) || !current_form_has_custom
|
||||
else
|
||||
should_change_sprite=true
|
||||
end
|
||||
|
||||
|
||||
if should_change_sprite
|
||||
@pokemon.spriteform_body = spriteform_body
|
||||
@pokemon.spriteform_head = spriteform_head
|
||||
end
|
||||
@battle.scene.pbChangePokemon(self, @pokemon)
|
||||
@battle.scene.pbCommonAnimation(animation, self)
|
||||
@battle.scene.pbRefreshOne(@index)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
# Attack a single target
|
||||
#=============================================================================
|
||||
def pbProcessMoveHit(move, user, targets, hitNum, skipAccuracyCheck)
|
||||
def pbProcessMoveHit(move,user,targets,hitNum,skipAccuracyCheck)
|
||||
return false if user.fainted?
|
||||
# For two-turn attacks being used in a single turn
|
||||
move.pbInitialEffect(user, targets, hitNum)
|
||||
numTargets = 0 # Number of targets that are affected by this hit
|
||||
move.pbInitialEffect(user,targets,hitNum)
|
||||
numTargets = 0 # Number of targets that are affected by this hit
|
||||
targets.each { |b| b.damageState.resetPerHit }
|
||||
# Count a hit for Parental Bond (if it applies)
|
||||
user.effects[PBEffects::ParentalBond] -= 1 if user.effects[PBEffects::ParentalBond] > 0
|
||||
user.effects[PBEffects::ParentalBond] -= 1 if user.effects[PBEffects::ParentalBond]>0
|
||||
# Accuracy check (accuracy/evasion calc)
|
||||
if hitNum == 0 || move.successCheckPerHit?
|
||||
if hitNum==0 || move.successCheckPerHit?
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
if pbSuccessCheckPerHit(move, user, b, skipAccuracyCheck)
|
||||
if pbSuccessCheckPerHit(move,user,b,skipAccuracyCheck)
|
||||
numTargets += 1
|
||||
else
|
||||
b.damageState.missed = true
|
||||
b.damageState.missed = true
|
||||
b.damageState.unaffected = true
|
||||
end
|
||||
end
|
||||
# If failed against all targets
|
||||
if targets.length > 0 && numTargets == 0 && !move.worksWithNoTargets?
|
||||
if targets.length>0 && numTargets==0 && !move.worksWithNoTargets?
|
||||
targets.each do |b|
|
||||
next if !b.damageState.missed || b.damageState.magicCoat
|
||||
pbMissMessage(move, user, b)
|
||||
pbMissMessage(move,user,b)
|
||||
end
|
||||
move.pbCrashDamage(user)
|
||||
user.pbItemHPHealCheck
|
||||
@@ -658,30 +630,30 @@ class PokeBattle_Battler
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
# Check whether Substitute/Disguise will absorb the damage
|
||||
move.pbCheckDamageAbsorption(user, b)
|
||||
move.pbCheckDamageAbsorption(user,b)
|
||||
# Calculate the damage against b
|
||||
# pbCalcDamage shows the "eat berry" animation for SE-weakening
|
||||
# berries, although the message about it comes after the additional
|
||||
# effect below
|
||||
move.pbCalcDamage(user, b, targets.length) # Stored in damageState.calcDamage
|
||||
move.pbCalcDamage(user,b,targets.length) # Stored in damageState.calcDamage
|
||||
# Lessen damage dealt because of False Swipe/Endure/etc.
|
||||
move.pbReduceDamage(user, b) # Stored in damageState.hpLost
|
||||
move.pbReduceDamage(user,b) # Stored in damageState.hpLost
|
||||
end
|
||||
end
|
||||
# Show move animation (for this hit)
|
||||
move.pbShowAnimation(move.id, user, targets, hitNum)
|
||||
move.pbShowAnimation(move.id,user,targets,hitNum)
|
||||
# Type-boosting Gem consume animation/message
|
||||
if user.effects[PBEffects::GemConsumed] && hitNum == 0
|
||||
if user.effects[PBEffects::GemConsumed] && hitNum==0
|
||||
# NOTE: The consume animation and message for Gems are shown now, but the
|
||||
# actual removal of the item happens in def pbEffectsAfterMove.
|
||||
@battle.pbCommonAnimation("UseItem", user)
|
||||
@battle.pbCommonAnimation("UseItem",user)
|
||||
@battle.pbDisplay(_INTL("The {1} strengthened {2}'s power!",
|
||||
GameData::Item.get(user.effects[PBEffects::GemConsumed]).name, move.name))
|
||||
GameData::Item.get(user.effects[PBEffects::GemConsumed]).name,move.name))
|
||||
end
|
||||
# Messages about missed target(s) (relevant for multi-target moves only)
|
||||
targets.each do |b|
|
||||
next if !b.damageState.missed
|
||||
pbMissMessage(move, user, b)
|
||||
pbMissMessage(move,user,b)
|
||||
end
|
||||
# Deal the damage (to all allies first simultaneously, then all foes
|
||||
# simultaneously)
|
||||
@@ -692,29 +664,29 @@ class PokeBattle_Battler
|
||||
move.pbInflictHPDamage(b)
|
||||
end
|
||||
# Animate the hit flashing and HP bar changes
|
||||
move.pbAnimateHitAndHPLost(user, targets)
|
||||
move.pbAnimateHitAndHPLost(user,targets)
|
||||
end
|
||||
# Self-Destruct/Explosion's damaging and fainting of user
|
||||
move.pbSelfKO(user) if hitNum == 0
|
||||
move.pbSelfKO(user) if hitNum==0
|
||||
user.pbFaint if user.fainted?
|
||||
if move.pbDamagingMove?
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
# NOTE: This method is also used for the OKHO special message.
|
||||
move.pbHitEffectivenessMessages(user, b, targets.length)
|
||||
move.pbHitEffectivenessMessages(user,b,targets.length)
|
||||
# Record data about the hit for various effects' purposes
|
||||
move.pbRecordDamageLost(user, b)
|
||||
move.pbRecordDamageLost(user,b)
|
||||
end
|
||||
# Close Combat/Superpower's stat-lowering, Flame Burst's splash damage,
|
||||
# and Incinerate's berry destruction
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
move.pbEffectWhenDealingDamage(user, b)
|
||||
move.pbEffectWhenDealingDamage(user,b)
|
||||
end
|
||||
# Ability/item effects such as Static/Rocky Helmet, and Grudge, etc.
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
pbEffectsOnMakingHit(move, user, b)
|
||||
pbEffectsOnMakingHit(move,user,b)
|
||||
end
|
||||
# Disguise/Endure/Sturdy/Focus Sash/Focus Band messages
|
||||
targets.each do |b|
|
||||
@@ -728,11 +700,11 @@ class PokeBattle_Battler
|
||||
# because Flame Burst's splash damage affects non-targets)
|
||||
@battle.pbPriority(true).each { |b| b.pbFaint if b && b.fainted? }
|
||||
end
|
||||
@battle.pbJudgeCheckpoint(user, move)
|
||||
@battle.pbJudgeCheckpoint(user,move)
|
||||
# Main effect (recoil/drain, etc.)
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
move.pbEffectAgainstTarget(user, b)
|
||||
move.pbEffectAgainstTarget(user,b)
|
||||
end
|
||||
move.pbEffectGeneral(user)
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
@@ -740,21 +712,21 @@ class PokeBattle_Battler
|
||||
# Additional effect
|
||||
if !user.hasActiveAbility?(:SHEERFORCE)
|
||||
targets.each do |b|
|
||||
next if b.damageState.calcDamage == 0
|
||||
chance = move.pbAdditionalEffectChance(user, b)
|
||||
next if chance <= 0
|
||||
if @battle.pbRandom(100) < chance
|
||||
move.pbAdditionalEffect(user, b)
|
||||
next if b.damageState.calcDamage==0
|
||||
chance = move.pbAdditionalEffectChance(user,b)
|
||||
next if chance<=0
|
||||
if @battle.pbRandom(100)<chance
|
||||
move.pbAdditionalEffect(user,b)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Make the target flinch (because of an item/ability)
|
||||
targets.each do |b|
|
||||
next if b.fainted?
|
||||
next if b.damageState.calcDamage == 0 || b.damageState.substitute
|
||||
chance = move.pbFlinchChance(user, b)
|
||||
next if chance <= 0
|
||||
if @battle.pbRandom(100) < chance
|
||||
next if b.damageState.calcDamage==0 || b.damageState.substitute
|
||||
chance = move.pbFlinchChance(user,b)
|
||||
next if chance<=0
|
||||
if @battle.pbRandom(100)<chance
|
||||
PBDebug.log("[Item/ability triggered] #{user.pbThis}'s King's Rock/Razor Fang or Stench")
|
||||
b.pbFlinch(user)
|
||||
end
|
||||
@@ -766,7 +738,7 @@ class PokeBattle_Battler
|
||||
targets.each do |b|
|
||||
next if b.damageState.unaffected
|
||||
next if !b.damageState.berryWeakened
|
||||
@battle.pbDisplay(_INTL("The {1} weakened the damage to {2}!", b.itemName, b.pbThis(true)))
|
||||
@battle.pbDisplay(_INTL("The {1} weakened the damage to {2}!",b.itemName,b.pbThis(true)))
|
||||
b.pbConsumeItem
|
||||
end
|
||||
targets.each { |b| b.pbFaint if b && b.fainted? }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -515,8 +515,6 @@ class PokeBattle_Battle
|
||||
next if !pkmn
|
||||
@peer.pbOnLeavingBattle(self,pkmn,@usedInBattle[0][i],true) # Reset form
|
||||
pkmn.item = @initialItems[0][i]
|
||||
pkmn.spriteform_head=nil
|
||||
pkmn.spriteform_body=nil
|
||||
end
|
||||
return @decision
|
||||
end
|
||||
|
||||
@@ -89,7 +89,6 @@ class PokeBattle_Battle
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def pbGainExpOne(idxParty, defeatedBattler, numPartic, expShare, expAll, showMessages = true)
|
||||
pkmn = pbParty(0)[idxParty] # The Pokémon gaining EVs from defeatedBattler
|
||||
growth_rate = pkmn.growth_rate
|
||||
@@ -154,15 +153,8 @@ class PokeBattle_Battle
|
||||
end
|
||||
exp = i if i >= 0
|
||||
# Make sure Exp doesn't exceed the maximum
|
||||
|
||||
exp = 0 if $PokemonSystem.level_caps==1 && pokemonExceedsLevelCap(pkmn)
|
||||
|
||||
expFinal = growth_rate.add_exp(pkmn.exp, exp)
|
||||
expGained = expFinal - pkmn.exp
|
||||
|
||||
|
||||
|
||||
|
||||
return if expGained <= 0
|
||||
# "Exp gained" message
|
||||
if showMessages
|
||||
@@ -174,14 +166,11 @@ class PokeBattle_Battle
|
||||
end
|
||||
curLevel = pkmn.level
|
||||
newLevel = growth_rate.level_from_exp(expFinal)
|
||||
dontAnimate=false
|
||||
if newLevel < curLevel
|
||||
dontAnimate = true
|
||||
# debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
|
||||
# raise RuntimeError.new(
|
||||
# echoln _INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
|
||||
# pkmn.name, debugInfo)
|
||||
pbDisplayPaused(_INTL("{1}'s growth rate has changed to '{2}''. Its level will be adjusted to reflect its current exp.", pkmn.name, pkmn.growth_rate.real_name))
|
||||
debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
|
||||
raise RuntimeError.new(
|
||||
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
|
||||
pkmn.name, debugInfo))
|
||||
end
|
||||
# Give Exp
|
||||
if pkmn.shadowPokemon?
|
||||
@@ -198,8 +187,6 @@ class PokeBattle_Battle
|
||||
tempExp2 = (levelMaxExp < expFinal) ? levelMaxExp : expFinal
|
||||
pkmn.exp = tempExp2
|
||||
|
||||
|
||||
|
||||
if pkmn.isFusion?
|
||||
if pkmn.exp_gained_since_fused == nil
|
||||
pkmn.exp_gained_since_fused = expGained
|
||||
@@ -208,9 +195,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
|
||||
end
|
||||
@scene.pbEXPBar(battler, levelMinExp, levelMaxExp, tempExp1, tempExp2) if !dontAnimate
|
||||
|
||||
|
||||
@scene.pbEXPBar(battler, levelMinExp, levelMaxExp, tempExp1, tempExp2)
|
||||
tempExp1 = tempExp2
|
||||
curLevel += 1
|
||||
if curLevel > newLevel
|
||||
@@ -240,8 +225,6 @@ class PokeBattle_Battle
|
||||
oldSpAtk, oldSpDef, oldSpeed)
|
||||
end
|
||||
|
||||
echoln "256"
|
||||
|
||||
# Learn all moves learned at this level
|
||||
moveList = pkmn.getMoveList
|
||||
moveList.each { |m| pbLearnMove(idxParty, m[1]) if m[0] == curLevel }
|
||||
|
||||
@@ -79,12 +79,12 @@ class PokeBattle_AI
|
||||
|
||||
# For switching. Determines the effectiveness of a potential switch-in against
|
||||
# an opposing battler.
|
||||
def pbCalcTypeModPokemon(battlerThis,target)
|
||||
def pbCalcTypeModPokemon(battlerThis,_battlerOther)
|
||||
mod1 = Effectiveness.calculate(battlerThis.type1,target.type1,target.type2)
|
||||
mod2 = Effectiveness::NORMAL_EFFECTIVE
|
||||
if battlerThis.type1!=battlerThis.type2
|
||||
mod2 = Effectiveness.calculate(battlerThis.type2,target.type1,target.type2)
|
||||
mod2 = mod2.to_f / Effectiveness::NORMAL_EFFECTIVE
|
||||
mod2 = mod2.to_f / Effectivenesss::NORMAL_EFFECTIVE
|
||||
end
|
||||
return mod1*mod2
|
||||
end
|
||||
|
||||
@@ -90,7 +90,6 @@ module PokeBattle_BallAnimationMixin
|
||||
if !pbResolveBitmap(file_path)
|
||||
file_path = sprintf("Graphics/Battle animations/ball_%02d", pbGetBallType(poke_ball).id_number)
|
||||
end
|
||||
echoln file_path
|
||||
ball = addNewSprite(ballX, ballY, file_path, PictureOrigin::Center)
|
||||
@ballSprite = @pictureSprites.last
|
||||
if @ballSprite.bitmap.width >= @ballSprite.bitmap.height
|
||||
|
||||
@@ -324,7 +324,7 @@ class PokeBattle_Scene
|
||||
pkmnSprite.setPokemonBitmap(pkmn,back)
|
||||
pkmnSprite.mirror=true if back
|
||||
# Set visibility of battler's shadow
|
||||
shadowSprite.visible = true#pkmn.species_data.shows_shadow? if shadowSprite #&& !back
|
||||
shadowSprite.visible = pkmn.species_data.shows_shadow? if shadowSprite && !back
|
||||
end
|
||||
|
||||
def pbResetMoveIndex(idxBattler)
|
||||
|
||||
@@ -3,21 +3,21 @@ class PokeBattle_Scene
|
||||
# Create the battle scene and its elements
|
||||
#=============================================================================
|
||||
def initialize
|
||||
@battle = nil
|
||||
@abortable = false
|
||||
@aborted = false
|
||||
@battleEnd = false
|
||||
@animations = []
|
||||
@battle = nil
|
||||
@abortable = false
|
||||
@aborted = false
|
||||
@battleEnd = false
|
||||
@animations = []
|
||||
@frameCounter = 0
|
||||
end
|
||||
|
||||
# Called whenever the battle begins.
|
||||
def pbStartBattle(battle)
|
||||
@battle = battle
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@battle = battle
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@lastCmd = Array.new(@battle.battlers.length, 0)
|
||||
@lastMove = Array.new(@battle.battlers.length, 0)
|
||||
@lastCmd = Array.new(@battle.battlers.length,0)
|
||||
@lastMove = Array.new(@battle.battlers.length,0)
|
||||
pbInitSprites
|
||||
pbBattleIntroAnimation
|
||||
end
|
||||
@@ -27,186 +27,178 @@ class PokeBattle_Scene
|
||||
# The background image and each side's base graphic
|
||||
pbCreateBackdropSprites
|
||||
# Create message box graphic
|
||||
messageBox = pbAddSprite("messageBox", 0, Graphics.height - 96,
|
||||
"Graphics/Pictures/Battle/overlay_message", @viewport)
|
||||
messageBox = pbAddSprite("messageBox",0,Graphics.height-96,
|
||||
"Graphics/Pictures/Battle/overlay_message",@viewport)
|
||||
messageBox.z = 195
|
||||
# Create message window (displays the message)
|
||||
msgWindow = Window_AdvancedTextPokemon.newWithSize("",
|
||||
16, Graphics.height - 96 + 2, Graphics.width - 32, 96, @viewport)
|
||||
msgWindow.z = 200
|
||||
msgWindow.opacity = 0
|
||||
msgWindow.baseColor = PokeBattle_SceneConstants::MESSAGE_BASE_COLOR
|
||||
msgWindow.shadowColor = PokeBattle_SceneConstants::MESSAGE_SHADOW_COLOR
|
||||
16,Graphics.height-96+2,Graphics.width-32,96,@viewport)
|
||||
msgWindow.z = 200
|
||||
msgWindow.opacity = 0
|
||||
msgWindow.baseColor = PokeBattle_SceneConstants::MESSAGE_BASE_COLOR
|
||||
msgWindow.shadowColor = PokeBattle_SceneConstants::MESSAGE_SHADOW_COLOR
|
||||
msgWindow.letterbyletter = true
|
||||
@sprites["messageWindow"] = msgWindow
|
||||
# Create command window
|
||||
@sprites["commandWindow"] = CommandMenuDisplay.new(@viewport, 200)
|
||||
@sprites["commandWindow"] = CommandMenuDisplay.new(@viewport,200)
|
||||
# Create fight window
|
||||
@sprites["fightWindow"] = FightMenuDisplay.new(@viewport, 200)
|
||||
@sprites["fightWindow"] = FightMenuDisplay.new(@viewport,200)
|
||||
# Create targeting window
|
||||
@sprites["targetWindow"] = TargetMenuDisplay.new(@viewport, 200, @battle.sideSizes)
|
||||
@sprites["targetWindow"] = TargetMenuDisplay.new(@viewport,200,@battle.sideSizes)
|
||||
pbShowWindow(MESSAGE_BOX)
|
||||
# The party lineup graphics (bar and balls) for both sides
|
||||
for side in 0...2
|
||||
partyBar = pbAddSprite("partyBar_#{side}", 0, 0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup", @viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.mirror = true if side == 0 # Player's lineup bar only
|
||||
partyBar = pbAddSprite("partyBar_#{side}",0,0,
|
||||
"Graphics/Pictures/Battle/overlay_lineup",@viewport)
|
||||
partyBar.z = 120
|
||||
partyBar.mirror = true if side==0 # Player's lineup bar only
|
||||
partyBar.visible = false
|
||||
for i in 0...PokeBattle_SceneConstants::NUM_BALLS
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}", 0, 0, nil, @viewport)
|
||||
ball.z = 121
|
||||
ball = pbAddSprite("partyBall_#{side}_#{i}",0,0,nil,@viewport)
|
||||
ball.z = 121
|
||||
ball.visible = false
|
||||
end
|
||||
# Ability splash bars
|
||||
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
|
||||
@sprites["abilityBar_#{side}"] = AbilitySplashBar.new(side, @viewport)
|
||||
@sprites["abilityBar_#{side}"] = AbilitySplashBar.new(side,@viewport)
|
||||
if $game_switches[SWITCH_DOUBLE_ABILITIES]
|
||||
@sprites["ability2Bar_#{side}"] = AbilitySplashBar.new(side, @viewport, true)
|
||||
@sprites["ability2Bar_#{side}"].y = @sprites["ability2Bar_#{side}"].y + 30
|
||||
@sprites["ability2Bar_#{side}"] = AbilitySplashBar.new(side,@viewport,true)
|
||||
@sprites["ability2Bar_#{side}"].y = @sprites["ability2Bar_#{side}"].y+30
|
||||
end
|
||||
end
|
||||
end
|
||||
# Player's and partner trainer's back sprite
|
||||
@battle.player.each_with_index do |p, i|
|
||||
pbCreateTrainerBackSprite(i, p.trainer_type, @battle.player.length)
|
||||
@battle.player.each_with_index do |p,i|
|
||||
pbCreateTrainerBackSprite(i,p.trainer_type,@battle.player.length)
|
||||
end
|
||||
# Opposing trainer(s) sprites
|
||||
if @battle.trainerBattle?
|
||||
@battle.opponent.each_with_index do |p, i|
|
||||
pbCreateTrainerFrontSprite(i, p.trainer_type, @battle.opponent.length, p.sprite_override)
|
||||
@battle.opponent.each_with_index do |p,i|
|
||||
pbCreateTrainerFrontSprite(i,p.trainer_type,@battle.opponent.length,p.sprite_override)
|
||||
end
|
||||
end
|
||||
# Data boxes and Pokémon sprites
|
||||
@battle.battlers.each_with_index do |b, i|
|
||||
@battle.battlers.each_with_index do |b,i|
|
||||
next if !b
|
||||
@sprites["dataBox_#{i}"] = PokemonDataBox.new(b, @battle.pbSideSize(i), @viewport)
|
||||
@sprites["dataBox_#{i}"] = PokemonDataBox.new(b,@battle.pbSideSize(i),@viewport)
|
||||
pbCreatePokemonSprite(i)
|
||||
end
|
||||
# Wild battle, so set up the Pokémon sprite(s) accordingly
|
||||
if @battle.wildBattle?
|
||||
@battle.pbParty(1).each_with_index do |pkmn, i|
|
||||
index = i * 2 + 1
|
||||
pbChangePokemon(index, pkmn)
|
||||
@battle.pbParty(1).each_with_index do |pkmn,i|
|
||||
index = i*2+1
|
||||
pbChangePokemon(index,pkmn)
|
||||
pkmnSprite = @sprites["pokemon_#{index}"]
|
||||
pkmnSprite.tone = Tone.new(-80, -80, -80)
|
||||
pkmnSprite.tone = Tone.new(-80,-80,-80)
|
||||
pkmnSprite.visible = true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def getBackdropTimeSuffix()
|
||||
@battle.time = 2 if darknessEffectOnCurrentMap()
|
||||
def pbCreateBackdropSprites
|
||||
case @battle.time
|
||||
when 1 then
|
||||
time = "eve"
|
||||
when 2 then
|
||||
time = "night"
|
||||
when 1 then time = "eve"
|
||||
when 2 then time = "night"
|
||||
end
|
||||
return time
|
||||
end
|
||||
|
||||
def getBackdropBasePath(type)
|
||||
case type
|
||||
when :BACKGROUND then
|
||||
base_path = "Graphics/Battlebacks/battlebg/"
|
||||
when :ENEMYBASE then
|
||||
base_path = "Graphics/Battlebacks/enemybase/"
|
||||
when :PLAYERBASE then
|
||||
base_path = "Graphics/Battlebacks/playerbase/"
|
||||
when :MESSAGE then
|
||||
base_path = "Graphics/Battlebacks/"
|
||||
end
|
||||
return base_path
|
||||
end
|
||||
|
||||
def getBackdropSpriteFullPath(filename, backdrop_type)
|
||||
time = getBackdropTimeSuffix()
|
||||
base_path = getBackdropBasePath(backdrop_type)
|
||||
default_name = base_path + filename
|
||||
time_adjusted_name = _INTL("{1}{2}_{3}",base_path,filename,time)
|
||||
if pbResolveBitmap(time_adjusted_name)
|
||||
return time_adjusted_name
|
||||
end
|
||||
return default_name
|
||||
end
|
||||
|
||||
|
||||
def apply_backdrop_graphics(battleBG,playerBase,enemyBase,messageBG)
|
||||
bg = pbAddSprite("battle_bg", 0, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg = pbAddSprite("battle_bg2", -Graphics.width, 0, battleBG, @viewport)
|
||||
bg.z = 0
|
||||
bg.mirror = true
|
||||
for side in 0...2
|
||||
baseX, baseY = PokeBattle_SceneConstants.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}", baseX, baseY,
|
||||
(side == 0) ? playerBase : enemyBase, @viewport)
|
||||
base.z = 1
|
||||
if base.bitmap
|
||||
base.ox = base.bitmap.width / 2
|
||||
base.oy = (side == 0) ? base.bitmap.height : base.bitmap.height / 2
|
||||
# Put everything together into backdrop, bases and message bar filenames
|
||||
backdropFilename = @battle.backdrop.downcase
|
||||
baseFilename = @battle.backdrop.downcase
|
||||
baseFilename = sprintf("%s_%s",baseFilename,@battle.backdropBase).downcase if @battle.backdropBase
|
||||
messageFilename = @battle.backdrop.downcase
|
||||
if time
|
||||
trialName = sprintf("%s_%s",backdropFilename,time).downcase
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_bg"))
|
||||
backdropFilename = trialName
|
||||
end
|
||||
trialName = sprintf("%s_%s",baseFilename,time).downcase
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_base0"))
|
||||
baseFilename = trialName
|
||||
end
|
||||
trialName = sprintf("%s_%s",messageFilename,time).downcase
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_message"))
|
||||
messageFilename = trialName
|
||||
end
|
||||
end
|
||||
cmdBarBG = pbAddSprite("cmdBar_bg", 0, Graphics.height - 96, messageBG, @viewport)
|
||||
cmdBarBG.z = 180
|
||||
end
|
||||
if !pbResolveBitmap(sprintf("Graphics/Battlebacks/"+baseFilename+"_base0")) &&
|
||||
@battle.backdropBase
|
||||
baseFilename = @battle.backdropBase
|
||||
if time
|
||||
trialName = sprintf("%s_%s",baseFilename,time).downcase
|
||||
if pbResolveBitmap(sprintf("Graphics/Battlebacks/"+trialName+"_base0"))
|
||||
baseFilename = trialName
|
||||
end
|
||||
end
|
||||
end
|
||||
# Finalise filenames
|
||||
# battleBG = "Graphics/Battlebacks/"+backdropFilename+"_bg"
|
||||
# playerBase = "Graphics/Battlebacks/"+baseFilename+"_base0"
|
||||
# enemyBase = "Graphics/Battlebacks/"+baseFilename+"_base1"
|
||||
# messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
|
||||
|
||||
DEFAULT_BACKGROUND_NAME = "indoora"
|
||||
DEFAULT_MESSAGE_NAME = "default_message"
|
||||
def pbCreateBackdropSprites
|
||||
background_name = @battle.backdrop ? @battle.backdrop.downcase : DEFAULT_BACKGROUND_NAME
|
||||
battlebase_name = @battle.backdropBase ? @battle.backdropBase.downcase : background_name
|
||||
message_name = background_name + "_message"
|
||||
|
||||
battleBG =getBackdropSpriteFullPath(background_name, :BACKGROUND)
|
||||
playerBase =getBackdropSpriteFullPath(battlebase_name, :PLAYERBASE)
|
||||
enemyBase =getBackdropSpriteFullPath(battlebase_name, :ENEMYBASE)
|
||||
messageBG =getBackdropSpriteFullPath(message_name, :MESSAGE)
|
||||
battleBG = "Graphics/Battlebacks/battlebg/"+backdropFilename
|
||||
playerBase = "Graphics/Battlebacks/playerbase/"+baseFilename
|
||||
enemyBase = "Graphics/Battlebacks/enemybase/"+baseFilename
|
||||
messageBG = "Graphics/Battlebacks/"+messageFilename+"_message"
|
||||
if !pbResolveBitmap(messageBG)
|
||||
messageBG = "Graphics/Battlebacks/default_message"
|
||||
end
|
||||
apply_backdrop_graphics(battleBG,playerBase,enemyBase,messageBG)
|
||||
# Apply graphics
|
||||
bg = pbAddSprite("battle_bg",0,0,battleBG,@viewport)
|
||||
bg.z = 0
|
||||
bg = pbAddSprite("battle_bg2",-Graphics.width,0,battleBG,@viewport)
|
||||
bg.z = 0
|
||||
bg.mirror = true
|
||||
for side in 0...2
|
||||
baseX, baseY = PokeBattle_SceneConstants.pbBattlerPosition(side)
|
||||
base = pbAddSprite("base_#{side}",baseX,baseY,
|
||||
(side==0) ? playerBase : enemyBase,@viewport)
|
||||
base.z = 1
|
||||
if base.bitmap
|
||||
base.ox = base.bitmap.width/2
|
||||
base.oy = (side==0) ? base.bitmap.height : base.bitmap.height/2
|
||||
end
|
||||
end
|
||||
cmdBarBG = pbAddSprite("cmdBar_bg",0,Graphics.height-96,messageBG,@viewport)
|
||||
cmdBarBG.z = 180
|
||||
end
|
||||
|
||||
def pbCreateTrainerBackSprite(idxTrainer, trainerType, numTrainers = 1)
|
||||
if idxTrainer == 0 # Player's sprite
|
||||
def pbCreateTrainerBackSprite(idxTrainer,trainerType,numTrainers=1)
|
||||
if idxTrainer==0 # Player's sprite
|
||||
trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
|
||||
else
|
||||
# Partner trainer's sprite
|
||||
else # Partner trainer's sprite
|
||||
trainerFile = GameData::TrainerType.back_sprite_filename(trainerType)
|
||||
end
|
||||
spriteX, spriteY = PokeBattle_SceneConstants.pbTrainerPosition(0, idxTrainer, numTrainers)
|
||||
trainer = pbAddSprite("player_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
spriteX, spriteY = PokeBattle_SceneConstants.pbTrainerPosition(0,idxTrainer,numTrainers)
|
||||
trainer = pbAddSprite("player_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 30 + idxTrainer
|
||||
if trainer.bitmap.width > trainer.bitmap.height * 2
|
||||
trainer.src_rect.x = 0
|
||||
trainer.src_rect.width = trainer.bitmap.width / 5
|
||||
trainer.z = 30+idxTrainer
|
||||
if trainer.bitmap.width>trainer.bitmap.height*2
|
||||
trainer.src_rect.x = 0
|
||||
trainer.src_rect.width = trainer.bitmap.width/5
|
||||
end
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.ox = trainer.src_rect.width/2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
def pbCreateTrainerFrontSprite(idxTrainer, trainerType, numTrainers = 1, sprite_override = nil)
|
||||
def pbCreateTrainerFrontSprite(idxTrainer,trainerType,numTrainers=1,sprite_override=nil)
|
||||
trainerFile = GameData::TrainerType.front_sprite_filename(trainerType)
|
||||
trainerFile = sprite_override if sprite_override
|
||||
|
||||
spriteX, spriteY = PokeBattle_SceneConstants.pbTrainerPosition(1, idxTrainer, numTrainers)
|
||||
trainer = pbAddSprite("trainer_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
spriteX, spriteY = PokeBattle_SceneConstants.pbTrainerPosition(1,idxTrainer,numTrainers)
|
||||
trainer = pbAddSprite("trainer_#{idxTrainer+1}",spriteX,spriteY,trainerFile,@viewport)
|
||||
return if !trainer.bitmap
|
||||
# Alter position of sprite
|
||||
trainer.z = 7 + idxTrainer
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.z = 7+idxTrainer
|
||||
trainer.ox = trainer.src_rect.width/2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
def pbCreatePokemonSprite(idxBattler)
|
||||
sideSize = @battle.pbSideSize(idxBattler)
|
||||
batSprite = PokemonBattlerSprite.new(@viewport, sideSize, idxBattler, @animations)
|
||||
batSprite = PokemonBattlerSprite.new(@viewport,sideSize,idxBattler,@animations)
|
||||
@sprites["pokemon_#{idxBattler}"] = batSprite
|
||||
shaSprite = PokemonBattlerShadowSprite.new(@viewport, sideSize, idxBattler)
|
||||
shaSprite = PokemonBattlerShadowSprite.new(@viewport,sideSize,idxBattler)
|
||||
shaSprite.visible = false
|
||||
@sprites["shadow_#{idxBattler}"] = shaSprite
|
||||
end
|
||||
|
||||
@@ -275,7 +275,6 @@ class PokeBattle_Scene
|
||||
# Animates a data box's Exp bar
|
||||
#=============================================================================
|
||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2)
|
||||
return if startExp > endExp
|
||||
return if !battler
|
||||
startExpLevel = tempExp1-startExp
|
||||
endExpLevel = tempExp2-startExp
|
||||
|
||||
@@ -104,11 +104,6 @@ class LightEffect
|
||||
@disposed = false
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
@light.opacity=value
|
||||
update
|
||||
end
|
||||
|
||||
def disposed?
|
||||
return @disposed
|
||||
end
|
||||
@@ -166,31 +161,6 @@ class LightEffect_Basic < LightEffect
|
||||
end
|
||||
end
|
||||
|
||||
class LightEffect_GlowPlant < LightEffect
|
||||
def update
|
||||
return if !darknessEffectOnCurrentMap()
|
||||
mt_moon_direction = getMtMoonDirection()
|
||||
#return if $game_player.direction != mt_moon_direction
|
||||
return if !@light || !@event
|
||||
super
|
||||
@light.opacity = $game_player.direction == mt_moon_direction ? 100 : 0
|
||||
@light.opacity = 150 if isInMtMoon()
|
||||
@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
|
||||
|
||||
@@ -204,9 +204,11 @@ def isFusedEncounter
|
||||
return (rand(chance) == 0)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def getEncounter(encounter_type)
|
||||
encounter = $PokemonEncounters.choose_wild_pokemon(encounter_type)
|
||||
if $game_switches[SWITCH_RANDOM_WILD] #wild poke random activated
|
||||
if $game_switches[SWITCH_RANDOM_WILD] #wild poke random activated
|
||||
if $game_switches[SWITCH_WILD_RANDOM_GLOBAL] && encounter != nil
|
||||
encounter[0] = getRandomizedTo(encounter[0])
|
||||
end
|
||||
@@ -271,6 +273,8 @@ Events.onMapChanging += proc { |_sender, e|
|
||||
$game_screen.weather(:None, 0, 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Set up various data related to the new map
|
||||
Events.onMapChange += proc { |_sender, e|
|
||||
old_map_ID = e[0] # previous map ID, is 0 if no map ID
|
||||
@@ -283,10 +287,10 @@ Events.onMapChange += proc { |_sender, e|
|
||||
$PokemonGlobal.visitedMaps[$game_map.map_id] = true
|
||||
next if old_map_ID == 0 || old_map_ID == $game_map.map_id
|
||||
|
||||
if !new_map_metadata || !new_map_metadata.weather
|
||||
$game_screen.weather(:None, 0, 0)
|
||||
next
|
||||
end
|
||||
if !new_map_metadata || !new_map_metadata.weather
|
||||
$game_screen.weather(:None, 0, 0)
|
||||
next
|
||||
end
|
||||
map_infos = pbLoadMapInfos
|
||||
if $game_map.name == map_infos[old_map_ID].name
|
||||
old_map_metadata = GameData::MapMetadata.try_get(old_map_ID)
|
||||
@@ -314,6 +318,7 @@ Events.onMapChange += proc { |_sender, e|
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
Events.onMapSceneChange += proc { |_sender, e|
|
||||
scene = e[0]
|
||||
mapChanged = e[1]
|
||||
@@ -328,7 +333,7 @@ Events.onMapSceneChange += proc { |_sender, e|
|
||||
end
|
||||
# Display darkness circle on dark maps
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
if map_metadata && map_metadata.dark_map || (darknessEffectOnCurrentMap())
|
||||
if map_metadata && map_metadata.dark_map
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
scene.spriteset.addUserSprite($PokemonTemp.darknessSprite)
|
||||
if $PokemonGlobal.flashUsed
|
||||
@@ -828,7 +833,7 @@ end
|
||||
# Being given an item
|
||||
#===============================================================================
|
||||
|
||||
def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = true)
|
||||
def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom=true)
|
||||
#item_name -> pour donner un autre nom à l'item. Pas encore réimplémenté et surtout là pour éviter que ça plante quand des events essaient de le faire
|
||||
canRandom = false if !$game_switches[SWITCH_RANDOM_ITEMS_GENERAL]
|
||||
original_item = GameData::Item.get(item)
|
||||
@@ -854,8 +859,8 @@ def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = t
|
||||
if item == :LEFTOVERS
|
||||
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
|
||||
elsif item.is_machine? # TM or HM
|
||||
if $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] && $game_switches[SWITCH_RANDOMIZED_GYM_TYPES] && $game_variables[VAR_CURRENT_GYM_TYPE] > -1
|
||||
item = randomizeGymTM(item)
|
||||
if $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY] && $game_switches[SWITCH_RANDOMIZED_GYM_TYPES] && $game_variables[VAR_CURRENT_GYM_TYPE]>-1
|
||||
item=randomizeGymTM(item)
|
||||
end
|
||||
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
|
||||
elsif quantity > 1
|
||||
@@ -873,18 +878,22 @@ def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = t
|
||||
return false # Can't add the item
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def randomizeGymTM(old_item)
|
||||
gym_index = pbGet(VAR_CURRENT_GYM_TYPE)
|
||||
type_id = pbGet(VAR_GYM_TYPES_ARRAY)[gym_index]
|
||||
idx = 0
|
||||
idx=0
|
||||
if $Trainer.badge_count >= 3
|
||||
idx = 1
|
||||
idx=1
|
||||
end
|
||||
if $Trainer.badge_count >= 6
|
||||
idx = 2
|
||||
idx=2
|
||||
end
|
||||
if $Trainer.badge_count >= 8
|
||||
idx = 3
|
||||
idx=3
|
||||
end
|
||||
typed_tms_array = Settings::RANDOMIZED_GYM_TYPE_TM[type_id]
|
||||
return old_item if !typed_tms_array
|
||||
|
||||
@@ -174,13 +174,11 @@ def pbPrepareBattle(battle)
|
||||
back = getBattleBackgroundFromMetadata(GameData::MapMetadata.get($game_map.map_id))
|
||||
backdrop = back if back && back != ""
|
||||
end
|
||||
|
||||
if !backdrop
|
||||
isOutdoor = GameData::MapMetadata.get($game_map.map_id).outdoor_map rescue false
|
||||
backdrop = "indoorA" if !isOutdoor
|
||||
backdrop = "Field" if isOutdoor
|
||||
end
|
||||
|
||||
battle.backdrop = backdrop
|
||||
# Choose a name for bases depending on environment
|
||||
if battleRules["base"].nil?
|
||||
|
||||
@@ -39,12 +39,3 @@ Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
# YOUR CODE HERE
|
||||
# end
|
||||
#}
|
||||
|
||||
|
||||
#NECROZMA BATTLE
|
||||
Events.onWildPokemonCreate += proc { |_sender, e|
|
||||
pokemon = e[0]
|
||||
if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_4] && pokemon.species == :NECROZMA
|
||||
pokemon.item = :NECROZIUM
|
||||
end
|
||||
}
|
||||
|
||||
@@ -5,86 +5,83 @@ def pbGetTimeNow
|
||||
return Time.now
|
||||
end
|
||||
|
||||
|
||||
|
||||
module PBDayNight
|
||||
HourlyTones = [
|
||||
Tone.new(-70, -90, 15, 55), # Night # Midnight
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-60, -70, -5, 50), # Night
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning # 6AM
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-20, -25, -15, 20), # Day/morning
|
||||
Tone.new(0, 0, 0, 0), # Day
|
||||
Tone.new(0, 0, 0, 0), # Day
|
||||
Tone.new(0, 0, 0, 0), # Day # Noon
|
||||
Tone.new(0, 0, 0, 0), # Day
|
||||
Tone.new(0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new(0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new(0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new(0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new(-5, -30, -20, 0), # Day/evening # 6PM
|
||||
Tone.new(-15, -60, -10, 20), # Day/evening
|
||||
Tone.new(-15, -60, -10, 20), # Day/evening
|
||||
Tone.new(-40, -75, 5, 40), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55) # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night # Midnight
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-60, -70, -5, 50), # Night
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning # 6AM
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-40, -50, -35, 50), # Day/morning
|
||||
Tone.new(-20, -25, -15, 20), # Day/morning
|
||||
Tone.new( 0, 0, 0, 0), # Day
|
||||
Tone.new( 0, 0, 0, 0), # Day
|
||||
Tone.new( 0, 0, 0, 0), # Day # Noon
|
||||
Tone.new( 0, 0, 0, 0), # Day
|
||||
Tone.new( 0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new( 0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new( 0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new( 0, 0, 0, 0), # Day/afternoon
|
||||
Tone.new( -5, -30, -20, 0), # Day/evening # 6PM
|
||||
Tone.new(-15, -60, -10, 20), # Day/evening
|
||||
Tone.new(-15, -60, -10, 20), # Day/evening
|
||||
Tone.new(-40, -75, 5, 40), # Night
|
||||
Tone.new(-70, -90, 15, 55), # Night
|
||||
Tone.new(-70, -90, 15, 55) # Night
|
||||
]
|
||||
@cachedTone = nil
|
||||
@dayNightToneLastUpdate = nil
|
||||
@oneOverSixty = 1 / 60.0
|
||||
@oneOverSixty = 1/60.0
|
||||
|
||||
# Returns true if it's day.
|
||||
def self.isDay?(time = nil)
|
||||
return false if darknessEffectOnCurrentMap()
|
||||
def self.isDay?(time=nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour >= 5 && time.hour < 20)
|
||||
return (time.hour>=5 && time.hour<20)
|
||||
end
|
||||
|
||||
# Returns true if it's night.
|
||||
def self.isNight?(time = nil)
|
||||
return true if darknessEffectOnCurrentMap()
|
||||
def self.isNight?(time=nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour >= 20 || time.hour < 5)
|
||||
return (time.hour>=20 || time.hour<5)
|
||||
end
|
||||
|
||||
# Returns true if it's morning.
|
||||
def self.isMorning?(time = nil)
|
||||
return false if darknessEffectOnCurrentMap()
|
||||
def self.isMorning?(time=nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour >= 5 && time.hour < 10)
|
||||
return (time.hour>=5 && time.hour<10)
|
||||
end
|
||||
|
||||
# Returns true if it's the afternoon.
|
||||
def self.isAfternoon?(time = nil)
|
||||
return false if darknessEffectOnCurrentMap()
|
||||
def self.isAfternoon?(time=nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour >= 14 && time.hour < 17)
|
||||
return (time.hour>=14 && time.hour<17)
|
||||
end
|
||||
|
||||
# Returns true if it's the evening.
|
||||
def self.isEvening?(time = nil)
|
||||
return false if darknessEffectOnCurrentMap()
|
||||
def self.isEvening?(time=nil)
|
||||
time = pbGetTimeNow if !time
|
||||
return (time.hour >= 17 && time.hour < 20)
|
||||
return (time.hour>=17 && time.hour<20)
|
||||
end
|
||||
|
||||
# Gets a number representing the amount of daylight (0=full night, 255=full day).
|
||||
def self.getShade
|
||||
time = pbGetDayNightMinutes
|
||||
time = (24 * 60) - time if time > (12 * 60)
|
||||
return 255 * time / (12 * 60)
|
||||
time = (24*60)-time if time>(12*60)
|
||||
return 255*time/(12*60)
|
||||
end
|
||||
|
||||
# Gets a Tone object representing a suggested shading
|
||||
# tone for the current time of day.
|
||||
def self.getTone
|
||||
@cachedTone = Tone.new(0, 0, 0) if !@cachedTone
|
||||
@cachedTone = Tone.new(0,0,0) if !@cachedTone
|
||||
return @cachedTone if !Settings::TIME_SHADING
|
||||
if !@dayNightToneLastUpdate ||
|
||||
Graphics.frame_count - @dayNightToneLastUpdate >= Graphics.frame_rate * 30
|
||||
Graphics.frame_count-@dayNightToneLastUpdate>=Graphics.frame_rate*30
|
||||
getToneInternal
|
||||
@dayNightToneLastUpdate = Graphics.frame_count
|
||||
end
|
||||
@@ -92,9 +89,8 @@ module PBDayNight
|
||||
end
|
||||
|
||||
def self.pbGetDayNightMinutes
|
||||
return 0 if darknessEffectOnCurrentMap() #midnight
|
||||
now = pbGetTimeNow # Get the current in-game time
|
||||
return (now.hour * 60) + now.min
|
||||
now = pbGetTimeNow # Get the current in-game time
|
||||
return (now.hour*60)+now.min
|
||||
end
|
||||
|
||||
private
|
||||
@@ -102,38 +98,34 @@ module PBDayNight
|
||||
def self.getToneInternal
|
||||
# Calculates the tone for the current frame, used for day/night effects
|
||||
realMinutes = pbGetDayNightMinutes
|
||||
hour = realMinutes / 60
|
||||
minute = realMinutes % 60
|
||||
tone = PBDayNight::HourlyTones[hour]
|
||||
|
||||
nexthourtone = PBDayNight::HourlyTones[(hour + 1) % 24]
|
||||
|
||||
darkness_tone = Tone.new(-80, -100, 05, 55)
|
||||
if $game_switches[SWITCH_KANTO_DARKNESS] || darknessEffectOnCurrentMap()
|
||||
tone = darkness_tone
|
||||
nexthourtone = darkness_tone
|
||||
end
|
||||
|
||||
hour = realMinutes/60
|
||||
minute = realMinutes%60
|
||||
tone = PBDayNight::HourlyTones[hour]
|
||||
nexthourtone = PBDayNight::HourlyTones[(hour+1)%24]
|
||||
# Calculate current tint according to current and next hour's tint and
|
||||
# depending on current minute
|
||||
@cachedTone.red = ((nexthourtone.red - tone.red) * minute * @oneOverSixty) + tone.red
|
||||
@cachedTone.green = ((nexthourtone.green - tone.green) * minute * @oneOverSixty) + tone.green
|
||||
@cachedTone.blue = ((nexthourtone.blue - tone.blue) * minute * @oneOverSixty) + tone.blue
|
||||
@cachedTone.gray = ((nexthourtone.gray - tone.gray) * minute * @oneOverSixty) + tone.gray
|
||||
@cachedTone.red = ((nexthourtone.red-tone.red)*minute*@oneOverSixty)+tone.red
|
||||
@cachedTone.green = ((nexthourtone.green-tone.green)*minute*@oneOverSixty)+tone.green
|
||||
@cachedTone.blue = ((nexthourtone.blue-tone.blue)*minute*@oneOverSixty)+tone.blue
|
||||
@cachedTone.gray = ((nexthourtone.gray-tone.gray)*minute*@oneOverSixty)+tone.gray
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbDayNightTint(object)
|
||||
return if !$scene.is_a?(Scene_Map)
|
||||
if Settings::TIME_SHADING && GameData::MapMetadata.exists?($game_map.map_id) &&
|
||||
GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
GameData::MapMetadata.get($game_map.map_id).outdoor_map
|
||||
tone = PBDayNight.getTone
|
||||
object.tone.set(tone.red, tone.green, tone.blue, tone.gray)
|
||||
object.tone.set(tone.red,tone.green,tone.blue,tone.gray)
|
||||
else
|
||||
object.tone.set(0, 0, 0, 0)
|
||||
object.tone.set(0,0,0,0)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Moon phases and Zodiac
|
||||
#===============================================================================
|
||||
@@ -146,51 +138,50 @@ end
|
||||
# 5 - Waning Gibbous
|
||||
# 6 - Last Quarter
|
||||
# 7 - Waning Crescent
|
||||
def moonphase(time = nil)
|
||||
# in UTC
|
||||
def moonphase(time=nil) # in UTC
|
||||
time = pbGetTimeNow if !time
|
||||
transitions = [
|
||||
1.8456618033125,
|
||||
5.5369854099375,
|
||||
9.2283090165625,
|
||||
12.9196326231875,
|
||||
16.6109562298125,
|
||||
20.3022798364375,
|
||||
23.9936034430625,
|
||||
27.6849270496875]
|
||||
yy = time.year - ((12 - time.mon) / 10.0).floor
|
||||
j = (365.25 * (4712 + yy)).floor + (((time.mon + 9) % 12) * 30.6 + 0.5).floor + time.day + 59
|
||||
j -= (((yy / 100.0) + 49).floor * 0.75).floor - 38 if j > 2299160
|
||||
j += (((time.hour * 60) + time.min * 60) + time.sec) / 86400.0
|
||||
v = (j - 2451550.1) / 29.530588853
|
||||
v = ((v - v.floor) + (v < 0 ? 1 : 0))
|
||||
ag = v * 29.53
|
||||
1.8456618033125,
|
||||
5.5369854099375,
|
||||
9.2283090165625,
|
||||
12.9196326231875,
|
||||
16.6109562298125,
|
||||
20.3022798364375,
|
||||
23.9936034430625,
|
||||
27.6849270496875]
|
||||
yy = time.year-((12-time.mon)/10.0).floor
|
||||
j = (365.25*(4712+yy)).floor + (((time.mon+9)%12)*30.6+0.5).floor + time.day+59
|
||||
j -= (((yy/100.0)+49).floor*0.75).floor-38 if j>2299160
|
||||
j += (((time.hour*60)+time.min*60)+time.sec)/86400.0
|
||||
v = (j-2451550.1)/29.530588853
|
||||
v = ((v-v.floor)+(v<0 ? 1 : 0))
|
||||
ag = v*29.53
|
||||
for i in 0...transitions.length
|
||||
return i if ag <= transitions[i]
|
||||
return i if ag<=transitions[i]
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
# Calculates the zodiac sign based on the given month and day:
|
||||
# 0 is Aries, 11 is Pisces. Month is 1 if January, and so on.
|
||||
def zodiac(month, day)
|
||||
def zodiac(month,day)
|
||||
time = [
|
||||
3, 21, 4, 19, # Aries
|
||||
4, 20, 5, 20, # Taurus
|
||||
5, 21, 6, 20, # Gemini
|
||||
6, 21, 7, 20, # Cancer
|
||||
7, 23, 8, 22, # Leo
|
||||
8, 23, 9, 22, # Virgo
|
||||
9, 23, 10, 22, # Libra
|
||||
10, 23, 11, 21, # Scorpio
|
||||
11, 22, 12, 21, # Sagittarius
|
||||
12, 22, 1, 19, # Capricorn
|
||||
1, 20, 2, 18, # Aquarius
|
||||
2, 19, 3, 20 # Pisces
|
||||
3,21,4,19, # Aries
|
||||
4,20,5,20, # Taurus
|
||||
5,21,6,20, # Gemini
|
||||
6,21,7,20, # Cancer
|
||||
7,23,8,22, # Leo
|
||||
8,23,9,22, # Virgo
|
||||
9,23,10,22, # Libra
|
||||
10,23,11,21, # Scorpio
|
||||
11,22,12,21, # Sagittarius
|
||||
12,22,1,19, # Capricorn
|
||||
1,20,2,18, # Aquarius
|
||||
2,19,3,20 # Pisces
|
||||
]
|
||||
for i in 0...12
|
||||
return i if month == time[i * 4] && day >= time[i * 4 + 1]
|
||||
return i if month == time[i * 4 + 2] && day <= time[i * 4 + 3]
|
||||
return i if month==time[i*4] && day>=time[i*4+1]
|
||||
return i if month==time[i*4+2] && day<=time[i*4+3]
|
||||
end
|
||||
return 0
|
||||
end
|
||||
@@ -198,38 +189,38 @@ end
|
||||
# Returns the opposite of the given zodiac sign.
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacOpposite(sign)
|
||||
return (sign + 6) % 12
|
||||
return (sign+6)%12
|
||||
end
|
||||
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacPartners(sign)
|
||||
return [(sign + 4) % 12, (sign + 8) % 12]
|
||||
return [(sign+4)%12,(sign+8)%12]
|
||||
end
|
||||
|
||||
# 0 is Aries, 11 is Pisces.
|
||||
def zodiacComplements(sign)
|
||||
return [(sign + 1) % 12, (sign + 11) % 12]
|
||||
return [(sign+1)%12,(sign+11)%12]
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
# Days of the week
|
||||
#===============================================================================
|
||||
def pbIsWeekday(wdayVariable, *arg)
|
||||
def pbIsWeekday(wdayVariable,*arg)
|
||||
timenow = pbGetTimeNow
|
||||
wday = timenow.wday
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd == wday
|
||||
ret = true if wd==wday
|
||||
end
|
||||
if wdayVariable > 0
|
||||
if wdayVariable>0
|
||||
$game_variables[wdayVariable] = [
|
||||
_INTL("Sunday"),
|
||||
_INTL("Monday"),
|
||||
_INTL("Tuesday"),
|
||||
_INTL("Wednesday"),
|
||||
_INTL("Thursday"),
|
||||
_INTL("Friday"),
|
||||
_INTL("Saturday")][wday]
|
||||
_INTL("Sunday"),
|
||||
_INTL("Monday"),
|
||||
_INTL("Tuesday"),
|
||||
_INTL("Wednesday"),
|
||||
_INTL("Thursday"),
|
||||
_INTL("Friday"),
|
||||
_INTL("Saturday")][wday]
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
return ret
|
||||
@@ -238,14 +229,14 @@ end
|
||||
#===============================================================================
|
||||
# Months
|
||||
#===============================================================================
|
||||
def pbIsMonth(monVariable, *arg)
|
||||
def pbIsMonth(monVariable,*arg)
|
||||
timenow = pbGetTimeNow
|
||||
thismon = timenow.mon
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd == thismon
|
||||
ret = true if wd==thismon
|
||||
end
|
||||
if monVariable > 0
|
||||
if monVariable>0
|
||||
$game_variables[monVariable] = pbGetMonthName(thismon)
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
@@ -264,7 +255,7 @@ def pbGetMonthName(month)
|
||||
_INTL("September"),
|
||||
_INTL("October"),
|
||||
_INTL("November"),
|
||||
_INTL("December")][month - 1]
|
||||
_INTL("December")][month-1]
|
||||
end
|
||||
|
||||
def pbGetAbbrevMonthName(month)
|
||||
@@ -287,50 +278,31 @@ end
|
||||
# Seasons
|
||||
#===============================================================================
|
||||
def pbGetSeason
|
||||
return (pbGetTimeNow.mon - 1) % 4
|
||||
return (pbGetTimeNow.mon-1)%4
|
||||
end
|
||||
|
||||
def pbIsSeason(seasonVariable, *arg)
|
||||
def pbIsSeason(seasonVariable,*arg)
|
||||
thisseason = pbGetSeason
|
||||
ret = false
|
||||
for wd in arg
|
||||
ret = true if wd == thisseason
|
||||
ret = true if wd==thisseason
|
||||
end
|
||||
if seasonVariable > 0
|
||||
if seasonVariable>0
|
||||
$game_variables[seasonVariable] = [
|
||||
_INTL("Spring"),
|
||||
_INTL("Summer"),
|
||||
_INTL("Autumn"),
|
||||
_INTL("Winter")][thisseason]
|
||||
_INTL("Spring"),
|
||||
_INTL("Summer"),
|
||||
_INTL("Autumn"),
|
||||
_INTL("Winter")][thisseason]
|
||||
$game_map.need_refresh = true if $game_map
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbIsSpring
|
||||
return pbIsSeason(0, 0);
|
||||
end
|
||||
|
||||
# Jan, May, Sep
|
||||
def pbIsSummer
|
||||
return pbIsSeason(0, 1);
|
||||
end
|
||||
|
||||
# Feb, Jun, Oct
|
||||
def pbIsAutumn
|
||||
return pbIsSeason(0, 2);
|
||||
end
|
||||
|
||||
# Mar, Jul, Nov
|
||||
def pbIsFall
|
||||
return pbIsAutumn;
|
||||
end
|
||||
|
||||
def pbIsWinter
|
||||
return pbIsSeason(0, 3);
|
||||
end
|
||||
|
||||
# Apr, Aug, Dec
|
||||
def pbIsSpring; return pbIsSeason(0,0); end # Jan, May, Sep
|
||||
def pbIsSummer; return pbIsSeason(0,1); end # Feb, Jun, Oct
|
||||
def pbIsAutumn; return pbIsSeason(0,2); end # Mar, Jul, Nov
|
||||
def pbIsFall; return pbIsAutumn; end
|
||||
def pbIsWinter; return pbIsSeason(0,3); end # Apr, Aug, Dec
|
||||
|
||||
def pbGetSeasonName(season)
|
||||
return [_INTL("Spring"),
|
||||
|
||||
@@ -401,9 +401,6 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
|
||||
$game_temp.player_new_x = x
|
||||
$game_temp.player_new_y = y
|
||||
$game_temp.player_new_direction = direction
|
||||
$PokemonGlobal.diving = true
|
||||
$PokemonGlobal.surfing = false
|
||||
|
||||
$scene.transfer_player(false)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
@@ -428,6 +425,7 @@ Events.onAction += proc { |_sender, _e|
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:DIVE, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, showmsg)
|
||||
if $PokemonGlobal.diving
|
||||
@@ -494,7 +492,7 @@ HiddenMoveHandlers::UseMove.add(:DIVE, proc { |move, pokemon|
|
||||
HiddenMoveHandlers::CanUseMove.add(:FLASH, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_FLASH, showmsg)
|
||||
if !GameData::MapMetadata.exists?($game_map.map_id) ||
|
||||
!(GameData::MapMetadata.get($game_map.map_id).dark_map || darknessEffectOnCurrentMap())
|
||||
!GameData::MapMetadata.get($game_map.map_id).dark_map
|
||||
pbMessage(_INTL("Can't use that here.")) if showmsg
|
||||
next false
|
||||
end
|
||||
@@ -827,49 +825,6 @@ Events.onAction += proc { |_sender, _e|
|
||||
pbSurf
|
||||
}
|
||||
|
||||
#Flowers
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next if !$game_player.pbFacingTerrainTag.flower
|
||||
if $game_player.pbFacingTerrainTag.flowerRed
|
||||
if $game_switches[SWITCH_ORICORIO_QUEST_IN_PROGRESS]
|
||||
oricorioEventPickFlower(:RED)
|
||||
else
|
||||
changeOricorioFlower(1)
|
||||
end
|
||||
end
|
||||
if $game_player.pbFacingTerrainTag.flowerYellow
|
||||
if $game_switches[SWITCH_ORICORIO_QUEST_IN_PROGRESS]
|
||||
|
||||
else
|
||||
changeOricorioFlower(2)
|
||||
end
|
||||
end
|
||||
if $game_player.pbFacingTerrainTag.flowerPink
|
||||
if $game_switches[SWITCH_ORICORIO_QUEST_IN_PROGRESS]
|
||||
oricorioEventPickFlower(:PINK)
|
||||
else
|
||||
changeOricorioFlower(3)
|
||||
end
|
||||
end
|
||||
if $game_player.pbFacingTerrainTag.flowerBlue
|
||||
if $game_switches[SWITCH_ORICORIO_QUEST_IN_PROGRESS]
|
||||
oricorioEventPickFlower(:BLUE)
|
||||
else
|
||||
changeOricorioFlower(4)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
#Trashcan
|
||||
Events.onAction += proc { |_sender, _e|
|
||||
next if !$game_player.pbFacingTerrainTag.trashcan
|
||||
if $PokemonGlobal.stepcount % 25 == 0
|
||||
pbMessage(_INTL("Woah! A Pokémon jumped out of the trashcan!"))
|
||||
pbWildBattle(:TRUBBISH, 10)
|
||||
$PokemonGlobal.stepcount += 1
|
||||
end
|
||||
}
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:SURF, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_SURF, showmsg)
|
||||
if $PokemonGlobal.surfing
|
||||
@@ -1086,6 +1041,8 @@ HiddenMoveHandlers::UseMove.add(:WATERFALL, proc { |move, pokemon|
|
||||
next true
|
||||
})
|
||||
|
||||
|
||||
|
||||
HiddenMoveHandlers::CanUseMove.add(:ROCKCLIMB, proc { |move, pkmn, showmsg|
|
||||
next false if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_ROCKCLIMB, showmsg)
|
||||
if !$game_player.pbFacingTerrainTag.ledge
|
||||
|
||||
@@ -784,14 +784,8 @@ ItemHandlers::UseOnPokemon.add(:SWIFTWING, proc { |item, pkmn, scene|
|
||||
next true
|
||||
})
|
||||
|
||||
def can_use_rare_candy(pkmn)
|
||||
return false if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
return false if $PokemonSystem.level_caps==1 && pokemonExceedsLevelCap(pkmn)
|
||||
return true
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:RARECANDY, proc { |item, pkmn, scene|
|
||||
if !(can_use_rare_candy(pkmn))
|
||||
if pkmn.level >= GameData::GrowthRate.max_level || pkmn.shadowPokemon?
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
end
|
||||
@@ -1082,13 +1076,3 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, pkmn, scene|
|
||||
end
|
||||
next false
|
||||
})
|
||||
|
||||
|
||||
ItemHandlers::UseInField.add(:REGITABLET, proc { |item|
|
||||
pbCommonEvent(COMMON_EVENT_REGI_TABLET)
|
||||
next true
|
||||
})
|
||||
|
||||
ItemHandlers::UseFromBag.add(:POKERADAR, proc { |item|
|
||||
next (pbCanUsePokeRadar?) ? 2 : 0
|
||||
})
|
||||
@@ -479,7 +479,6 @@ end
|
||||
#===============================================================================
|
||||
class PokemonTemp
|
||||
attr_accessor :heart_gauges
|
||||
attr_accessor :during_battle
|
||||
end
|
||||
|
||||
|
||||
@@ -487,7 +486,6 @@ end
|
||||
# Record current heart gauges of Pokémon in party, to see if they drop to zero
|
||||
# during battle and need to say they're ready to be purified afterwards
|
||||
Events.onStartBattle += proc { |_sender|
|
||||
$PokemonTemp.during_battle=true
|
||||
$PokemonTemp.heart_gauges = []
|
||||
$Trainer.party.each_with_index do |pkmn, i|
|
||||
$PokemonTemp.heart_gauges[i] = pkmn.heart_gauge
|
||||
@@ -495,7 +493,6 @@ Events.onStartBattle += proc { |_sender|
|
||||
}
|
||||
|
||||
Events.onEndBattle += proc { |_sender,_e|
|
||||
$PokemonTemp.during_battle=false
|
||||
$PokemonTemp.heart_gauges.each_with_index do |value, i|
|
||||
pkmn = $Trainer.party[i]
|
||||
next if !pkmn || !value || value == 0
|
||||
|
||||
@@ -58,9 +58,9 @@ class PokemonSprite < SpriteWrapper
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def setPokemonBitmapFromId(id, back = false, shiny = false, bodyShiny = false, headShiny = false,spriteform_body=nil,spriteform_head=nil)
|
||||
def setPokemonBitmapFromId(id, back = false, shiny=false, bodyShiny=false, headShiny=false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back, shiny, bodyShiny, headShiny)
|
||||
@_iconbitmap = GameData::Species.sprite_bitmap_from_pokemon_id(id, back,shiny, bodyShiny,headShiny)
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
self.color = Color.new(0, 0, 0, 0)
|
||||
changeOrigin
|
||||
@@ -154,8 +154,6 @@ class PokemonIconSprite < SpriteWrapper
|
||||
end
|
||||
if useRegularIcon(@pokemon.species) || @pokemon.egg?
|
||||
@animBitmap = AnimatedBitmap.new(GameData::Species.icon_filename_from_pokemon(value))
|
||||
elsif useTripleFusionIcon(@pokemon.species)
|
||||
@animBitmap = AnimatedBitmap.new(pbResolveBitmap(sprintf("Graphics/Icons/iconDNA")))
|
||||
else
|
||||
@animBitmap = createFusionIcon()
|
||||
end
|
||||
@@ -166,10 +164,6 @@ class PokemonIconSprite < SpriteWrapper
|
||||
@currentFrame = 0 if @currentFrame >= @numFrames
|
||||
changeOrigin
|
||||
end
|
||||
def useTripleFusionIcon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
return isTripleFusion?(dexNum)
|
||||
end
|
||||
|
||||
def useRegularIcon(species)
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
@@ -182,28 +176,26 @@ class PokemonIconSprite < SpriteWrapper
|
||||
end
|
||||
|
||||
SPRITE_OFFSET = 10
|
||||
|
||||
def createFusionIcon()
|
||||
bodyPoke_number = getBodyID(pokemon.species)
|
||||
headPoke_number = getHeadID(pokemon.species, bodyPoke_number)
|
||||
|
||||
|
||||
bodyPoke = GameData::Species.get(bodyPoke_number).species
|
||||
headPoke = GameData::Species.get(headPoke_number).species
|
||||
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke, @pokemon.spriteform_head))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke, @pokemon.spriteform_body))
|
||||
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
|
||||
dexNum = getDexNumberForSpecies(@pokemon.species)
|
||||
ensureFusionIconExists
|
||||
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke, @pokemon.spriteform_head)
|
||||
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke)
|
||||
bitmapPath = sprintf("%s.png", bitmapFileName)
|
||||
generated_new_icon = generateFusionIcon(headPokeFileName, bitmapPath)
|
||||
generated_new_icon = generateFusionIcon(headPokeFileName,bitmapPath)
|
||||
result_icon = generated_new_icon ? AnimatedBitmap.new(bitmapPath) : icon1
|
||||
|
||||
for i in 0..icon1.width - 1
|
||||
for j in ((icon1.height / 2) + Settings::FUSION_ICON_SPRITE_OFFSET)..icon1.height - 1
|
||||
for i in 0..icon1.width-1
|
||||
for j in ((icon1.height / 2) + Settings::FUSION_ICON_SPRITE_OFFSET)..icon1.height-1
|
||||
temp = icon2.bitmap.get_pixel(i, j)
|
||||
result_icon.bitmap.set_pixel(i, j, temp)
|
||||
end
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
# The player's party Pokémon are stored in the array $Trainer.party.
|
||||
#===============================================================================
|
||||
class Pokemon
|
||||
attr_accessor :spriteform_body
|
||||
attr_accessor :spriteform_head
|
||||
|
||||
# @return [Symbol] this Pokémon's species
|
||||
attr_reader :species
|
||||
# If defined, this Pokémon's form will be this value even if a MultipleForms
|
||||
# handler tries to say otherwise.
|
||||
# @return [Integer, nil] this Pokémon's formspriteform
|
||||
# @return [Integer, nil] this Pokémon's form
|
||||
attr_accessor :forced_form
|
||||
# If defined, is the time (in Integer form) when this Pokémon's form was set.
|
||||
# @return [Integer, nil] the time this Pokémon's form was set
|
||||
@@ -48,6 +45,7 @@ class Pokemon
|
||||
attr_accessor :body_original_ability_index
|
||||
attr_accessor :head_original_ability_index
|
||||
|
||||
|
||||
# @return [Array<Pokemon::Move>] the moves known by this Pokémon
|
||||
attr_accessor :moves
|
||||
# @return [Array<Integer>] the IDs of moves known by this Pokémon when it was obtained
|
||||
@@ -128,10 +126,7 @@ class Pokemon
|
||||
end
|
||||
|
||||
def species_data
|
||||
if !@species_data || @species != @species_data.species
|
||||
@species_data = GameData::Species.get(@species)
|
||||
end
|
||||
return @species_data #GameData::Species.get(@species)
|
||||
return GameData::Species.get_species_form(@species, form_simple)
|
||||
end
|
||||
|
||||
#=============================================================================
|
||||
@@ -166,7 +161,7 @@ class Pokemon
|
||||
return isSpecies?(check_species)
|
||||
end
|
||||
bodySpecies = getBodyID(species)
|
||||
checkSpeciesId = getID(nil, check_species)
|
||||
checkSpeciesId = getID(nil,check_species)
|
||||
return bodySpecies == checkSpeciesId
|
||||
end
|
||||
|
||||
@@ -175,14 +170,14 @@ class Pokemon
|
||||
return isSpecies?(check_species)
|
||||
end
|
||||
headSpecies = getHeadID(species)
|
||||
checkSpeciesId = getID(nil, check_species)
|
||||
checkSpeciesId = getID(nil,check_species)
|
||||
return headSpecies == checkSpeciesId
|
||||
end
|
||||
|
||||
def shiny=(value)
|
||||
@shiny = value
|
||||
@shiny=value
|
||||
if value && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
|
||||
@debug_shiny = true
|
||||
@debug_shiny=true
|
||||
end
|
||||
end
|
||||
|
||||
@@ -390,7 +385,6 @@ class Pokemon
|
||||
if @ability == :MULTITYPE && species_data.type1 == :NORMAL
|
||||
return getHeldPlateType()
|
||||
end
|
||||
return @type1 if @type1
|
||||
return species_data.type1
|
||||
end
|
||||
|
||||
@@ -403,14 +397,6 @@ class Pokemon
|
||||
return sp_data.type2 || sp_data.type1
|
||||
end
|
||||
|
||||
def type1=(value)
|
||||
@type1 = value
|
||||
end
|
||||
|
||||
def type2=(value)
|
||||
@type2 = value
|
||||
end
|
||||
|
||||
# @return [Array<Symbol>] an array of this Pokémon's types
|
||||
def types
|
||||
sp_data = species_data
|
||||
@@ -492,6 +478,8 @@ class Pokemon
|
||||
return [:AlwaysMale, :AlwaysFemale, :Genderless].include?(gender_ratio)
|
||||
end
|
||||
|
||||
|
||||
|
||||
#=============================================================================
|
||||
# Shininess
|
||||
#=============================================================================
|
||||
@@ -506,13 +494,13 @@ class Pokemon
|
||||
is_shiny = d < Settings::SHINY_POKEMON_CHANCE
|
||||
if is_shiny
|
||||
@shiny = true
|
||||
@natural_shiny = true
|
||||
@natural_shiny=true
|
||||
end
|
||||
|
||||
end
|
||||
if @shiny && Settings::SHINY_POKEMON_CHANCE != S_CHANCE_VALIDATOR
|
||||
@debug_shiny = true
|
||||
@natural_shiny = false
|
||||
@debug_shiny=true
|
||||
@natural_shiny=false
|
||||
end
|
||||
return @shiny
|
||||
end
|
||||
@@ -799,9 +787,9 @@ class Pokemon
|
||||
body_species_id = getBasePokemonID(species)
|
||||
head_species = GameData::Species.get(head_species_id)
|
||||
body_species = GameData::Species.get(body_species_id)
|
||||
return move_data && (pokemon_can_learn_move(head_species, move_data) || pokemon_can_learn_move(body_species, move_data))
|
||||
return move_data && (pokemon_can_learn_move(head_species,move_data) || pokemon_can_learn_move(body_species,move_data))
|
||||
else
|
||||
return move_data && pokemon_can_learn_move(species_data, move_data)
|
||||
return move_data && pokemon_can_learn_move(species_data,move_data)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1062,53 +1050,11 @@ class Pokemon
|
||||
#=============================================================================
|
||||
# Checks whether this Pokemon can evolve because of levelling up.
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
def prompt_evolution_choice(body_evolution, head_evolution)
|
||||
current_body = @species_data.body_pokemon
|
||||
current_head = @species_data.head_pokemon
|
||||
|
||||
choices = [
|
||||
#_INTL("Evolve both!"),
|
||||
_INTL("Evolve head!"),
|
||||
_INTL("Evolve body!"),
|
||||
_INTL("Don't evolve")
|
||||
]
|
||||
choice = pbMessage(_INTL('Both halves of {1} are ready to evolve!', self.name), choices, 0)
|
||||
# if choice == 0 #EVOLVE BOTH
|
||||
# newspecies = getFusionSpecies(body_evolution,head_evolution)
|
||||
if choice == 0 #EVOLVE HEAD
|
||||
newspecies = getFusionSpecies(current_body, head_evolution)
|
||||
elsif choice == 1 #EVOLVE BODY
|
||||
newspecies = getFusionSpecies(body_evolution, current_head)
|
||||
else
|
||||
newspecies = nil
|
||||
end
|
||||
return newspecies
|
||||
end
|
||||
|
||||
def check_evolution_on_level_up
|
||||
|
||||
if @species_data.is_a?(GameData::FusedSpecies)
|
||||
body = self.species_data.body_pokemon
|
||||
head = self.species_data.head_pokemon
|
||||
|
||||
body_evolution = check_evolution_internal(@species_data.body_pokemon) { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
head_evolution = check_evolution_internal(@species_data.head_pokemon) { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
if body_evolution && head_evolution
|
||||
return prompt_evolution_choice(body_evolution, head_evolution)
|
||||
end
|
||||
end
|
||||
|
||||
return check_evolution_internal { |pkmn, new_species, method, parameter|
|
||||
success = GameData::Evolution.get(method).call_level_up(pkmn, parameter)
|
||||
next (success) ? new_species : nil
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
# Checks whether this Pokemon can evolve because of using an item on it.
|
||||
@@ -1145,13 +1091,11 @@ class Pokemon
|
||||
# which will provide either a GameData::Species ID (the species to evolve
|
||||
# into) or nil (keep checking).
|
||||
# @return [Symbol, nil] the ID of the species to evolve into
|
||||
def check_evolution_internal(species = nil)
|
||||
def check_evolution_internal
|
||||
return nil if egg? || shadowPokemon?
|
||||
return nil if hasItem?(:EVERSTONE)
|
||||
return nil if hasAbility?(:BATTLEBOND)
|
||||
species = species_data if !species
|
||||
|
||||
species.get_evolutions(true).each do |evo|
|
||||
species_data.get_evolutions(true).each do |evo|
|
||||
# [new_species, method, parameter, boolean]
|
||||
next if evo[3] # Prevolution
|
||||
ret = yield self, evo[0], evo[1], evo[2] # pkmn, new_species, method, parameter
|
||||
@@ -1277,9 +1221,9 @@ class Pokemon
|
||||
# @param withMoves [TrueClass, FalseClass] whether the Pokémon should have moves
|
||||
# @param rechech_form [TrueClass, FalseClass] whether to auto-check the form
|
||||
def initialize(species, level, owner = $Trainer, withMoves = true, recheck_form = true)
|
||||
@species_data = GameData::Species.get(species)
|
||||
@species = @species_data.species
|
||||
@form = @species_data.form
|
||||
species_data = GameData::Species.get(species)
|
||||
@species = species_data.species
|
||||
@form = species_data.form
|
||||
@forced_form = nil
|
||||
@time_form_set = nil
|
||||
self.level = level
|
||||
@@ -1309,14 +1253,14 @@ class Pokemon
|
||||
@sheen = 0
|
||||
@pokerus = 0
|
||||
@name = nil
|
||||
@happiness = @species_data.happiness
|
||||
@happiness = species_data.happiness
|
||||
@poke_ball = :POKEBALL
|
||||
@markings = 0
|
||||
@iv = {}
|
||||
@ivMaxed = {}
|
||||
@ev = {}
|
||||
@hiddenPowerType = nil
|
||||
@glitter = nil
|
||||
@glitter=nil
|
||||
GameData::Stat.each_main do |s|
|
||||
@iv[s.id] = rand(IV_STAT_LIMIT + 1)
|
||||
@ev[s.id] = 0
|
||||
@@ -1340,8 +1284,6 @@ class Pokemon
|
||||
@personalID = rand(2 ** 16) | rand(2 ** 16) << 16
|
||||
@hp = 1
|
||||
@totalhp = 1
|
||||
@spriteform_body = nil
|
||||
@spriteform_head = nil
|
||||
calc_stats
|
||||
if @form == 0 && recheck_form
|
||||
f = MultipleForms.call("getFormOnCreation", self)
|
||||
|
||||
@@ -177,10 +177,6 @@ class Trainer
|
||||
return pokemon_party.any? { |p| p && p.isSpecies?(species) && (form < 0 || p.form == form) }
|
||||
end
|
||||
|
||||
def has_species_or_fusion?(species, form = -1)
|
||||
return pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
|
||||
end
|
||||
|
||||
# Returns whether there is a fatefully met Pokémon of the given species in the
|
||||
# trainer's party.
|
||||
def has_fateful_species?(species)
|
||||
|
||||
@@ -67,34 +67,6 @@ class Player < Trainer
|
||||
return head_array
|
||||
end
|
||||
|
||||
def resync_pokedex
|
||||
@seen_standard = resync_standard_pokedex_array(@seen_standard)
|
||||
@owned_standard = resync_standard_pokedex_array(@owned_standard)
|
||||
|
||||
@seen_fusion = resync_fused_pokedex_array(@seen_fusion)
|
||||
@owned_fusion = resync_fused_pokedex_array(@owned_fusion)
|
||||
end
|
||||
|
||||
def resync_fused_pokedex_array(original_dex_array)
|
||||
new_dex = initFusionDexArray()
|
||||
(0..NB_POKEMON).each do |head_id|
|
||||
(0..NB_POKEMON).each do |body_id|
|
||||
if original_dex_array[head_id]
|
||||
new_dex[head_id][body_id] = original_dex_array[head_id][body_id] if original_dex_array[head_id][body_id]
|
||||
end
|
||||
end
|
||||
end
|
||||
return new_dex
|
||||
end
|
||||
|
||||
def resync_standard_pokedex_array(original_dex_array)
|
||||
new_dex = initStandardDexArray()
|
||||
(0..NB_POKEMON).each do |pokemon_id|
|
||||
new_dex[pokemon_id] = original_dex_array[pokemon_id] if original_dex_array[pokemon_id]
|
||||
end
|
||||
return new_dex
|
||||
end
|
||||
|
||||
def isTripleFusion(num)
|
||||
return isTripleFusion?(num)
|
||||
end
|
||||
@@ -107,18 +79,6 @@ class Player < Trainer
|
||||
return num > Settings::NB_POKEMON && !isTripleFusion(num)
|
||||
end
|
||||
|
||||
def resyncPokedexIfNumberOfPokemonChanged()
|
||||
if @seen_standard.length < NB_POKEMON || @seen_fusion.length < NB_POKEMON
|
||||
resync_pokedex()
|
||||
end
|
||||
end
|
||||
|
||||
def verify_dex_is_correct_length(current_dex)
|
||||
|
||||
expected_length = 509 + 2
|
||||
return current_dex.length == expected_length
|
||||
end
|
||||
|
||||
def set_seen_fusion(species)
|
||||
bodyId = getBodyID(species)
|
||||
headId = getHeadID(species, bodyId)
|
||||
@@ -178,7 +138,6 @@ class Player < Trainer
|
||||
|
||||
def seen?(species)
|
||||
return false if !species
|
||||
try_resync_pokedex()
|
||||
num = getDexNumberForSpecies(species)
|
||||
if isTripleFusion(num)
|
||||
return seen_triple?(species)
|
||||
@@ -202,7 +161,9 @@ class Player < Trainer
|
||||
# in that region.
|
||||
# @param dex [Integer] region ID
|
||||
def seen_count(dex = -1)
|
||||
try_resync_pokedex()
|
||||
if dex_sync_needed?()
|
||||
resync_pokedex()
|
||||
end
|
||||
return count_dex(@seen_standard, @seen_fusion) + @owned_triple.size
|
||||
end
|
||||
|
||||
@@ -241,7 +202,6 @@ class Player < Trainer
|
||||
# @param species [Symbol, GameData::Species] species to set as owned
|
||||
# @param should_refresh_dexes [Boolean] whether Dex accessibility should be recalculated
|
||||
def set_owned_fusion(species)
|
||||
try_resync_pokedex()
|
||||
bodyId = getBodyID(species)
|
||||
headId = getHeadID(species, bodyId)
|
||||
@owned_fusion[headId][bodyId] = true
|
||||
@@ -254,7 +214,6 @@ class Player < Trainer
|
||||
end
|
||||
|
||||
def set_owned_normalDex(species)
|
||||
try_resync_pokedex()
|
||||
@owned_standard[getDexNumberForSpecies(species)] = true
|
||||
end
|
||||
|
||||
@@ -281,15 +240,6 @@ class Player < Trainer
|
||||
def owned_fusion?(species)
|
||||
bodyId = getBodyID(species)
|
||||
headId = getHeadID(species, bodyId)
|
||||
|
||||
# p headId
|
||||
# p @owned_fusion[headId]
|
||||
# if !@owned_fusion[headId]
|
||||
# print "syncing"
|
||||
# @seen_fusion = initFusionDexArray(true)
|
||||
# end
|
||||
# p @owned_fusion[headId]
|
||||
|
||||
return @owned_fusion[headId][bodyId] == true
|
||||
end
|
||||
|
||||
@@ -300,7 +250,6 @@ class Player < Trainer
|
||||
end
|
||||
|
||||
def owned?(species)
|
||||
try_resync_pokedex()
|
||||
num = getDexNumberForSpecies(species)
|
||||
if isTripleFusion(num)
|
||||
return owned_triple?(species)
|
||||
@@ -326,6 +275,9 @@ class Player < Trainer
|
||||
# in that region.
|
||||
# @param region [Integer] region ID
|
||||
def owned_count(dex = -1)
|
||||
if dex_sync_needed?()
|
||||
resync_pokedex()
|
||||
end
|
||||
return count_dex(@owned_standard, @owned_fusion) + @owned_triple.size
|
||||
end
|
||||
|
||||
@@ -351,36 +303,27 @@ class Player < Trainer
|
||||
end
|
||||
|
||||
def dex_sync_needed?()
|
||||
# p NB_POKEMON
|
||||
# p @owned_standard.length
|
||||
|
||||
return @owned_standard == nil || @owned_fusion == nil || @owned_triple == nil ||
|
||||
!verify_dex_is_correct_length(@owned_standard) || !verify_dex_is_correct_length(@seen_fusion)
|
||||
|
||||
return @owned_standard == nil || @owned_fusion == nil || @owned_triple == nil
|
||||
end
|
||||
|
||||
#todo:
|
||||
# loop on @owned and @seen and add the pokemon in @owned_standard/fusion @seen_standard/fusion
|
||||
# then clear @owned and @seen
|
||||
def try_resync_pokedex()
|
||||
resyncPokedexIfNumberOfPokemonChanged
|
||||
#
|
||||
# if dex_sync_needed?()
|
||||
# print "syncing"
|
||||
# init_new_pokedex_if_needed()
|
||||
# @seen.each { |pokemon|
|
||||
# set_seen(pokemon[0])
|
||||
# }
|
||||
# @owned.each { |pokemon|
|
||||
# set_owned(pokemon[0])
|
||||
# }
|
||||
# self.refresh_accessible_dexes
|
||||
# @seen = {} #deprecated
|
||||
# @owned = {} #deprecated
|
||||
# end
|
||||
def resync_pokedex()
|
||||
init_new_pokedex_if_needed()
|
||||
@seen.each { |pokemon|
|
||||
set_seen(pokemon[0])
|
||||
}
|
||||
@owned.each { |pokemon|
|
||||
set_owned(pokemon[0])
|
||||
}
|
||||
self.refresh_accessible_dexes
|
||||
@seen = {} #deprecated
|
||||
@owned = {} #deprecated
|
||||
#self.clear
|
||||
end
|
||||
|
||||
|
||||
def resync_boxes_to_pokedex
|
||||
$PokemonStorage.boxes.each { |box|
|
||||
box.pokemon.each { |pokemon|
|
||||
@@ -395,12 +338,12 @@ class Player < Trainer
|
||||
end
|
||||
|
||||
def init_new_pokedex_if_needed()
|
||||
@seen_standard = initStandardDexArray() # if @seen_standard == nil
|
||||
@seen_fusion = initFusionDexArray() # if @seen_fusion == nil
|
||||
@seen_standard = initStandardDexArray() if @seen_standard == nil
|
||||
@seen_fusion = initFusionDexArray() if @seen_fusion == nil
|
||||
@seen_triple = {} if @seen_triple == nil
|
||||
|
||||
@owned_standard = initStandardDexArray() # if @owned_standard == nil
|
||||
@owned_fusion = initFusionDexArray() # if @owned_fusion == nil
|
||||
@owned_standard = initStandardDexArray() if @owned_standard == nil
|
||||
@owned_fusion = initFusionDexArray() if @owned_fusion == nil
|
||||
@owned_triple = {} if @owned_triple == nil
|
||||
end
|
||||
|
||||
|
||||
@@ -113,14 +113,6 @@ class PokemonEggHatch_Scene
|
||||
@pokemon.name = nickname
|
||||
@nicknamed = true
|
||||
end
|
||||
|
||||
if !$Trainer.pokedex.owned?(@pokemon.species)
|
||||
$Trainer.pokedex.register(@pokemon)
|
||||
$Trainer.pokedex.set_owned(@pokemon.species)
|
||||
pbMessage(_INTL("{1}'s data was added to the Pokédex", @pokemon.name))
|
||||
pbShowPokedex(@pokemon.species)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def pbEndScene
|
||||
@@ -214,6 +206,8 @@ def pbHatch(pokemon)
|
||||
end
|
||||
|
||||
|
||||
$Trainer.pokedex.register(pokemon)
|
||||
$Trainer.pokedex.set_owned(pokemon.species)
|
||||
pokemon.record_first_moves
|
||||
if !pbHatchAnimation(pokemon)
|
||||
pbMessage(_INTL("Huh?\1"))
|
||||
@@ -226,7 +220,6 @@ def pbHatch(pokemon)
|
||||
pokemon.name = nickname
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Events.onStepTaken += proc { |_sender,_e|
|
||||
|
||||
@@ -607,10 +607,6 @@ class PokemonEvolutionScene
|
||||
# Check for consumed item and check if Pokémon should be duplicated
|
||||
pbEvolutionMethodAfterEvolution if !reversing
|
||||
|
||||
|
||||
@pokemon
|
||||
@pokemon.ability
|
||||
|
||||
oldAbility = @pokemon.ability.id
|
||||
newSpecies = GameData::Species.get(@newspecies)
|
||||
|
||||
@@ -621,17 +617,8 @@ class PokemonEvolutionScene
|
||||
@pokemon.form = 0 if @pokemon.isSpecies?(:MOTHIM)
|
||||
@pokemon.calc_stats
|
||||
# See and own evolved species
|
||||
#
|
||||
|
||||
if !$Trainer.pokedex.owned?(@newspecies)
|
||||
$Trainer.pokedex.register(@pokemon)
|
||||
$Trainer.pokedex.set_owned(@newspecies)
|
||||
Kernel.pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("{1}'s data was added to the Pokédex", newspeciesname))
|
||||
@scene.pbShowPokedex(@newspecies)
|
||||
end
|
||||
|
||||
|
||||
$Trainer.pokedex.register(@pokemon)
|
||||
$Trainer.pokedex.set_owned(@newspecies)
|
||||
|
||||
if allNewPossibleAbilities.include?(oldAbility)
|
||||
@pokemon.ability=oldAbility
|
||||
|
||||
@@ -48,14 +48,14 @@ class Scene_Credits
|
||||
CREDIT = <<_END_
|
||||
|
||||
Pokémon Infinite Fusion
|
||||
By Chardub (Frogman)
|
||||
By Frogman
|
||||
|
||||
General graphics / Music / Intellectual property
|
||||
Nintendo
|
||||
GameFreak
|
||||
|
||||
Programming / Eventing:
|
||||
Chardub
|
||||
Frogman
|
||||
|
||||
Fused Pokemon Sprites :
|
||||
Japeal - Pokefusion 2
|
||||
@@ -66,19 +66,19 @@ rip the sprites and to the owners of Japeal
|
||||
for accepting to share their generated sprites.
|
||||
|
||||
Maps:
|
||||
Chardub, Kiwikelly
|
||||
Frogman
|
||||
Some of the maps were based on work by:
|
||||
BenGames, Zeak6464
|
||||
|
||||
Gameplay / Story:
|
||||
Chardub
|
||||
Frogman
|
||||
The story and dialogues were based
|
||||
off Pokémon Red and Blue, as well as
|
||||
Pokémon Gold and Silver.
|
||||
Both games are made by Game Freak.
|
||||
|
||||
Sprites pack managers
|
||||
Kiwikelly, Payapon, Thornsoflight
|
||||
Sprites pack manager
|
||||
Kiwi
|
||||
|
||||
Sprite Managers
|
||||
avianAnnihilator<s>Blaquaza
|
||||
@@ -88,7 +88,7 @@ Howls<s>Ignus
|
||||
Kiwi<s>Maelmc
|
||||
Milchik the Miltank<s>Payapon
|
||||
Pix<s>Rosemagwin
|
||||
Thornsoflight
|
||||
Thorns
|
||||
|
||||
|
||||
All of the custom fused Pokémon sprites
|
||||
@@ -100,12 +100,11 @@ Including massive contributions from these users:
|
||||
{SPRITER_CREDITS}
|
||||
|
||||
|
||||
|
||||
Other custom graphics:
|
||||
Kiwikelly
|
||||
Knuckles
|
||||
UnworthyPie
|
||||
Doctor Miawoo
|
||||
Chardub
|
||||
calicorn, Doctor Miawoo, Frogman, Kiwi,
|
||||
Knuckles, magnuzone, ,mammuth89, Miawoo,
|
||||
Milchik, Rick1234, Universez, UnworthyPie,
|
||||
|
||||
The following free ressources were also used
|
||||
with their respective authors' consent:
|
||||
|
||||
@@ -2,23 +2,23 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonPokedexInfo_Scene
|
||||
def pbStartScene(dexlist, index, region)
|
||||
@endscene = false
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
def pbStartScene(dexlist,index,region)
|
||||
@endscene=false
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@dexlist = dexlist
|
||||
@index = index
|
||||
@region = region
|
||||
@index = index
|
||||
@region = region
|
||||
@page = 1
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["infosprite"] = PokemonSprite.new(@viewport)
|
||||
@sprites["infosprite"].setOffset(PictureOrigin::Center)
|
||||
@sprites["infosprite"].x = 104
|
||||
@sprites["infosprite"].y = 136
|
||||
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
|
||||
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
|
||||
@sprites["infosprite"].zoom_x = Settings::FRONTSPRITE_SCALE
|
||||
@sprites["infosprite"].zoom_y = Settings::FRONTSPRITE_SCALE
|
||||
|
||||
# @mapdata = pbLoadTownMapData
|
||||
# map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
@@ -51,15 +51,27 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
@sprites["formback"] = PokemonSprite.new(@viewport)
|
||||
@sprites["formback"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["formback"].x = 382 # y is set below as it depends on metrics
|
||||
@sprites["formback"].x = 382 # y is set below as it depends on metrics
|
||||
@sprites["formicon"] = PokemonSpeciesIconSprite.new(nil, @viewport)
|
||||
@sprites["formicon"].setOffset(PictureOrigin::Center)
|
||||
@sprites["formicon"].x = 82
|
||||
@sprites["formicon"].y = 328
|
||||
@sprites["formicon"].visible = false
|
||||
initializeSpritesPageGraphics
|
||||
@sprites["formicon"].visible=false
|
||||
|
||||
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow",8,40,28,2,@viewport)
|
||||
@sprites["uparrow"].x = 20
|
||||
@sprites["uparrow"].y = 250#268
|
||||
@sprites["uparrow"].play
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow",8,40,28,2,@viewport)
|
||||
@sprites["downarrow"].x = 440
|
||||
@sprites["downarrow"].y = 250
|
||||
@sprites["downarrow"].play
|
||||
@sprites["downarrow"].visible = false
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
|
||||
|
||||
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbUpdateDummyPokemon
|
||||
@@ -69,107 +81,60 @@ class PokemonPokedexInfo_Scene
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def initializeSpritesPageGraphics()
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = 20
|
||||
@sprites["leftarrow"].y = 250 #268
|
||||
@sprites["leftarrow"].play
|
||||
@sprites["leftarrow"].visible = false
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = 440
|
||||
@sprites["rightarrow"].y = 250
|
||||
@sprites["rightarrow"].play
|
||||
@sprites["rightarrow"].visible = false
|
||||
|
||||
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["uparrow"].x = 250
|
||||
@sprites["uparrow"].y = 50 #268
|
||||
@sprites["uparrow"].play
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["downarrow"].x = 250
|
||||
@sprites["downarrow"].y = 350
|
||||
@sprites["downarrow"].play
|
||||
@sprites["downarrow"].visible = false
|
||||
end
|
||||
|
||||
def pbStartSpritesSelectSceneBrief(species,alts_list)
|
||||
@available = alts_list
|
||||
@species = species
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@index = 0
|
||||
@page = 3
|
||||
@brief = true
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["infosprite"] = PokemonSprite.new(@viewport)
|
||||
|
||||
@page = 3
|
||||
initializeSpritesPageGraphics
|
||||
initializeSpritesPage(@available)
|
||||
drawPage(@page)
|
||||
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartSceneBrief(species)
|
||||
# For standalone access, shows first page only
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
def pbStartSceneBrief(species) # For standalone access, shows first page only
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
@viewport.z = 99999
|
||||
dexnum = 0
|
||||
dexnumshift = false
|
||||
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
||||
if $Trainer.pokedex.unlocked?(-1) # National Dex is unlocked
|
||||
species_data = GameData::Species.try_get(species)
|
||||
dexnum = species_data.id_number if species_data
|
||||
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(-1)
|
||||
else
|
||||
dexnum = 0
|
||||
for i in 0...$Trainer.pokedex.dexes_count - 1 # Regional Dexes
|
||||
for i in 0...$Trainer.pokedex.dexes_count - 1 # Regional Dexes
|
||||
next if !$Trainer.pokedex.unlocked?(i)
|
||||
num = pbGetRegionalNumber(i, species)
|
||||
num = pbGetRegionalNumber(i,species)
|
||||
next if num <= 0
|
||||
dexnum = num
|
||||
dexnumshift = true if Settings::DEXES_WITH_OFFSETS.include?(i)
|
||||
break
|
||||
end
|
||||
end
|
||||
@dexlist = [[species, "", 0, 0, dexnum, dexnumshift]]
|
||||
@index = 0
|
||||
@dexlist = [[species,"",0,0,dexnum,dexnumshift]]
|
||||
@index = 0
|
||||
@page = 1
|
||||
@brief = true
|
||||
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"] = IconSprite.new(0,0,@viewport)
|
||||
@sprites["infosprite"] = PokemonSprite.new(@viewport)
|
||||
@sprites["infosprite"].setOffset(PictureOrigin::Center)
|
||||
@sprites["infosprite"].x = 104
|
||||
@sprites["infosprite"].y = 136
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbUpdateDummyPokemon
|
||||
@page = 1
|
||||
drawPage(@page)
|
||||
sprite_bitmap = @sprites["infosprite"].getBitmap
|
||||
|
||||
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
pbUpdateDummyPokemon
|
||||
drawPage(@page)
|
||||
sprite_bitmap= @sprites["infosprite"].getBitmap
|
||||
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbStartSpritesPageBrief(species) end
|
||||
|
||||
def pbEndScene
|
||||
pbFadeOutAndHide(@sprites) { pbUpdate }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@typebitmap.dispose if @typebitmap
|
||||
@typebitmap.dispose
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbUpdate
|
||||
if @page == 2
|
||||
intensity = (Graphics.frame_count % 40) * 12
|
||||
intensity = 480 - intensity if intensity > 240
|
||||
if @page==2
|
||||
intensity = (Graphics.frame_count%40)*12
|
||||
intensity = 480-intensity if intensity>240
|
||||
@sprites["areahighlight"].opacity = intensity
|
||||
end
|
||||
pbUpdateSpriteHash(@sprites)
|
||||
@@ -179,18 +144,19 @@ class PokemonPokedexInfo_Scene
|
||||
@species = @dexlist[@index][0]
|
||||
@gender, @form = $Trainer.pokedex.last_form_seen(@species)
|
||||
|
||||
|
||||
if @sprites["selectedSprite"]
|
||||
@sprites["selectedSprite"].visible = false
|
||||
@sprites["selectedSprite"].visible=false
|
||||
end
|
||||
if @sprites["nextSprite"]
|
||||
@sprites["nextSprite"].visible = false
|
||||
@sprites["nextSprite"].visible=false
|
||||
end
|
||||
if @sprites["previousSprite"]
|
||||
@sprites["previousSprite"].visible = false
|
||||
@sprites["previousSprite"].visible=false
|
||||
end
|
||||
# species_data = pbGetSpeciesData(@species)
|
||||
species_data = GameData::Species.get_species_form(@species, @form)
|
||||
@sprites["infosprite"].setSpeciesBitmap(@species, @gender, @form)
|
||||
species_data = GameData::Species.get_species_form(@species, @form)
|
||||
@sprites["infosprite"].setSpeciesBitmap(@species,@gender,@form)
|
||||
# if @sprites["formfront"]
|
||||
# @sprites["formfront"].setSpeciesBitmap(@species,@gender,@form)
|
||||
# end
|
||||
@@ -204,79 +170,76 @@ class PokemonPokedexInfo_Scene
|
||||
# end
|
||||
end
|
||||
|
||||
# def pbGetAvailableForms
|
||||
# ret = []
|
||||
# return ret
|
||||
# # multiple_forms = false
|
||||
# # # Find all genders/forms of @species that have been seen
|
||||
# # GameData::Species.each do |sp|
|
||||
# # next if sp.species != @species
|
||||
# # next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
|
||||
# # next if sp.pokedex_form != sp.form
|
||||
# # multiple_forms = true if sp.form > 0
|
||||
# # case sp.gender_ratio
|
||||
# # when :AlwaysMale, :AlwaysFemale, :Genderless
|
||||
# # real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0
|
||||
# # next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
|
||||
# # real_gender = 2 if sp.gender_ratio == :Genderless
|
||||
# # ret.push([sp.form_name, real_gender, sp.form])
|
||||
# # else # Both male and female
|
||||
# # for real_gender in 0...2
|
||||
# # next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
|
||||
# # ret.push([sp.form_name, real_gender, sp.form])
|
||||
# # break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
|
||||
# # end
|
||||
# # end
|
||||
# # end
|
||||
# # # Sort all entries
|
||||
# # ret.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
|
||||
# # # Create form names for entries if they don't already exist
|
||||
# # ret.each do |entry|
|
||||
# # if !entry[0] || entry[0].empty? # Necessarily applies only to form 0
|
||||
# # case entry[1]
|
||||
# # when 0 then entry[0] = _INTL("Male")
|
||||
# # when 1 then entry[0] = _INTL("Female")
|
||||
# # else
|
||||
# # entry[0] = (multiple_forms) ? _INTL("One Form") : _INTL("Genderless")
|
||||
# # end
|
||||
# # end
|
||||
# # entry[1] = 0 if entry[1] == 2 # Genderless entries are treated as male
|
||||
# # end
|
||||
# # return ret
|
||||
# end
|
||||
def pbGetAvailableForms
|
||||
ret = []
|
||||
return ret
|
||||
# multiple_forms = false
|
||||
# # Find all genders/forms of @species that have been seen
|
||||
# GameData::Species.each do |sp|
|
||||
# next if sp.species != @species
|
||||
# next if sp.form != 0 && (!sp.real_form_name || sp.real_form_name.empty?)
|
||||
# next if sp.pokedex_form != sp.form
|
||||
# multiple_forms = true if sp.form > 0
|
||||
# case sp.gender_ratio
|
||||
# when :AlwaysMale, :AlwaysFemale, :Genderless
|
||||
# real_gender = (sp.gender_ratio == :AlwaysFemale) ? 1 : 0
|
||||
# next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
|
||||
# real_gender = 2 if sp.gender_ratio == :Genderless
|
||||
# ret.push([sp.form_name, real_gender, sp.form])
|
||||
# else # Both male and female
|
||||
# for real_gender in 0...2
|
||||
# next if !$Trainer.pokedex.seen_form?(@species, real_gender, sp.form) && !Settings::DEX_SHOWS_ALL_FORMS
|
||||
# ret.push([sp.form_name, real_gender, sp.form])
|
||||
# break if sp.form_name && !sp.form_name.empty? # Only show 1 entry for each non-0 form
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# # Sort all entries
|
||||
# ret.sort! { |a, b| (a[2] == b[2]) ? a[1] <=> b[1] : a[2] <=> b[2] }
|
||||
# # Create form names for entries if they don't already exist
|
||||
# ret.each do |entry|
|
||||
# if !entry[0] || entry[0].empty? # Necessarily applies only to form 0
|
||||
# case entry[1]
|
||||
# when 0 then entry[0] = _INTL("Male")
|
||||
# when 1 then entry[0] = _INTL("Female")
|
||||
# else
|
||||
# entry[0] = (multiple_forms) ? _INTL("One Form") : _INTL("Genderless")
|
||||
# end
|
||||
# end
|
||||
# entry[1] = 0 if entry[1] == 2 # Genderless entries are treated as male
|
||||
# end
|
||||
# return ret
|
||||
end
|
||||
|
||||
def drawPage(page)
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
overlay.clear
|
||||
# Make certain sprites visible
|
||||
@sprites["infosprite"].visible = (@page == 1)
|
||||
@sprites["areamap"].visible = (@page == 2) if @sprites["areamap"]
|
||||
@sprites["areahighlight"].visible = (@page == 2) if @sprites["areahighlight"]
|
||||
@sprites["areaoverlay"].visible = (@page == 2) if @sprites["areaoverlay"]
|
||||
@sprites["infosprite"].visible = (@page==1)
|
||||
@sprites["areamap"].visible = (@page==2) if @sprites["areamap"]
|
||||
@sprites["areahighlight"].visible = (@page==2) if @sprites["areahighlight"]
|
||||
@sprites["areaoverlay"].visible = (@page==2) if @sprites["areaoverlay"]
|
||||
# @sprites["formfront"].visible = (@page==3) if @sprites["formfront"]
|
||||
#@sprites["formback"].visible = (@page==3) if @sprites["formback"]
|
||||
#@sprites["formicon"].visible = (@page==3) if @sprites["formicon"]
|
||||
|
||||
@sprites["previousSprite"].visible = (@page == 3) if @sprites["previousSprite"]
|
||||
@sprites["selectedSprite"].visible = (@page == 3) if @sprites["selectedSprite"]
|
||||
@sprites["nextSprite"].visible = (@page == 3) if @sprites["nextSprite"]
|
||||
@sprites["previousSprite"].visible = (@page==3) if @sprites["previousSprite"]
|
||||
@sprites["selectedSprite"].visible = (@page==3) if @sprites["selectedSprite"]
|
||||
@sprites["nextSprite"].visible = (@page==3) if @sprites["nextSprite"]
|
||||
|
||||
hide_all_selected_windows
|
||||
# Draw page-specific information
|
||||
case page
|
||||
when 1 then
|
||||
drawPageInfo
|
||||
when 2 then
|
||||
drawPageArea
|
||||
when 3 then
|
||||
drawPageForms
|
||||
when 1 then drawPageInfo
|
||||
when 2 then drawPageArea
|
||||
when 3 then drawPageForms
|
||||
end
|
||||
end
|
||||
|
||||
def drawPageInfo
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_info"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88, 88, 80)
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
imagepos = []
|
||||
if @brief
|
||||
@@ -286,16 +249,16 @@ class PokemonPokedexInfo_Scene
|
||||
# Write various bits of text
|
||||
indexText = "???"
|
||||
#if @dexlist[@index][4] > 0
|
||||
indexNumber = @dexlist[@index][4]
|
||||
indexNumber -= 1 if @dexlist[@index][5]
|
||||
indexNumber = @dexlist[@index][4]
|
||||
indexNumber -= 1 if @dexlist[@index][5]
|
||||
indexNumber = GameData::Species.get(@species).id_number
|
||||
indexText = sprintf("%03d", indexNumber)
|
||||
indexText = sprintf("%03d", indexNumber)
|
||||
# end
|
||||
textpos = [
|
||||
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
|
||||
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
|
||||
[_INTL("Height"), 314, 152, 0, base, shadow],
|
||||
[_INTL("Weight"), 314, 184, 0, base, shadow]
|
||||
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
|
||||
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
|
||||
[_INTL("Height"), 314, 152, 0, base, shadow],
|
||||
[_INTL("Weight"), 314, 184, 0, base, shadow]
|
||||
]
|
||||
if $Trainer.owned?(@species)
|
||||
# Write the category
|
||||
@@ -303,7 +266,7 @@ class PokemonPokedexInfo_Scene
|
||||
# Write the height and weight
|
||||
height = species_data.height
|
||||
weight = species_data.weight
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
inches = (height / 0.254).round
|
||||
pounds = (weight / 0.45359).round
|
||||
textpos.push([_ISPRINTF("{1:d}'{2:02d}\"", inches / 12, inches % 12), 460, 152, 1, base, shadow])
|
||||
@@ -313,12 +276,12 @@ class PokemonPokedexInfo_Scene
|
||||
textpos.push([_ISPRINTF("{1:.1f} kg", weight / 10.0), 482, 184, 1, base, shadow])
|
||||
end
|
||||
# Draw the Pokédex entry text
|
||||
drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
|
||||
drawTextEx(overlay, 40, 244, Graphics.width - (40 * 2), 4, # overlay, x, y, width, num lines
|
||||
species_data.pokedex_entry, base, shadow)
|
||||
# Draw the footprint
|
||||
footprintfile = GameData::Species.footprint_filename(@species, @form)
|
||||
if footprintfile
|
||||
footprint = RPG::Cache.load_bitmap("", footprintfile)
|
||||
footprint = RPG::Cache.load_bitmap("",footprintfile)
|
||||
overlay.blt(226, 138, footprint, footprint.rect)
|
||||
footprint.dispose
|
||||
end
|
||||
@@ -337,7 +300,7 @@ class PokemonPokedexInfo_Scene
|
||||
# Write the category
|
||||
textpos.push([_INTL("????? Pokémon"), 246, 68, 0, base, shadow])
|
||||
# Write the height and weight
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
if System.user_language[3..4] == "US" # If the user is in the United States
|
||||
textpos.push([_INTL("???'??\""), 460, 152, 1, base, shadow])
|
||||
textpos.push([_INTL("????.? lbs."), 494, 184, 1, base, shadow])
|
||||
else
|
||||
@@ -363,13 +326,13 @@ class PokemonPokedexInfo_Scene
|
||||
def drawPageArea
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
base = Color.new(88,88,80)
|
||||
shadow = Color.new(168,184,184)
|
||||
@sprites["areahighlight"].bitmap.clear
|
||||
# Fill the array "points" with all squares of the region map in which the
|
||||
# species can be found
|
||||
points = []
|
||||
mapwidth = 1 + PokemonRegionMap_Scene::RIGHT - PokemonRegionMap_Scene::LEFT
|
||||
mapwidth = 1+PokemonRegionMap_Scene::RIGHT-PokemonRegionMap_Scene::LEFT
|
||||
GameData::Encounter.each_of_version($PokemonGlobal.encounter_version) do |enc_data|
|
||||
next if !pbFindEncounter(enc_data.types, @species)
|
||||
map_metadata = GameData::MapMetadata.try_get(enc_data.map)
|
||||
@@ -377,88 +340,88 @@ class PokemonPokedexInfo_Scene
|
||||
next if !mappos || mappos[0] != @region
|
||||
showpoint = true
|
||||
for loc in @mapdata[@region][2]
|
||||
showpoint = false if loc[0] == mappos[1] && loc[1] == mappos[2] &&
|
||||
loc[7] && !$game_switches[loc[7]]
|
||||
showpoint = false if loc[0]==mappos[1] && loc[1]==mappos[2] &&
|
||||
loc[7] && !$game_switches[loc[7]]
|
||||
end
|
||||
next if !showpoint
|
||||
mapsize = map_metadata.town_map_size
|
||||
if mapsize && mapsize[0] && mapsize[0] > 0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length * 1.0 / mapsize[0]).ceil
|
||||
if mapsize && mapsize[0] && mapsize[0]>0
|
||||
sqwidth = mapsize[0]
|
||||
sqheight = (mapsize[1].length*1.0/mapsize[0]).ceil
|
||||
for i in 0...sqwidth
|
||||
for j in 0...sqheight
|
||||
if mapsize[1][i + j * sqwidth, 1].to_i > 0
|
||||
points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true
|
||||
if mapsize[1][i+j*sqwidth,1].to_i>0
|
||||
points[mappos[1]+i+(mappos[2]+j)*mapwidth] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
points[mappos[1] + mappos[2] * mapwidth] = true
|
||||
points[mappos[1]+mappos[2]*mapwidth] = true
|
||||
end
|
||||
end
|
||||
# Draw coloured squares on each square of the region map with a nest
|
||||
pointcolor = Color.new(0, 248, 248)
|
||||
pointcolorhl = Color.new(192, 248, 248)
|
||||
pointcolor = Color.new(0,248,248)
|
||||
pointcolorhl = Color.new(192,248,248)
|
||||
sqwidth = PokemonRegionMap_Scene::SQUAREWIDTH
|
||||
sqheight = PokemonRegionMap_Scene::SQUAREHEIGHT
|
||||
for j in 0...points.length
|
||||
if points[j]
|
||||
x = (j % mapwidth) * sqwidth
|
||||
x += (Graphics.width - @sprites["areamap"].bitmap.width) / 2
|
||||
y = (j / mapwidth) * sqheight
|
||||
y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y, sqwidth, sqheight, pointcolor)
|
||||
if j - mapwidth < 0 || !points[j - mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y - 2, sqwidth, 2, pointcolorhl)
|
||||
x = (j%mapwidth)*sqwidth
|
||||
x += (Graphics.width-@sprites["areamap"].bitmap.width)/2
|
||||
y = (j/mapwidth)*sqheight
|
||||
y += (Graphics.height+32-@sprites["areamap"].bitmap.height)/2
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y,sqwidth,sqheight,pointcolor)
|
||||
if j-mapwidth<0 || !points[j-mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y-2,sqwidth,2,pointcolorhl)
|
||||
end
|
||||
if j + mapwidth >= points.length || !points[j + mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x, y + sqheight, sqwidth, 2, pointcolorhl)
|
||||
if j+mapwidth>=points.length || !points[j+mapwidth]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x,y+sqheight,sqwidth,2,pointcolorhl)
|
||||
end
|
||||
if j % mapwidth == 0 || !points[j - 1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x - 2, y, 2, sqheight, pointcolorhl)
|
||||
if j%mapwidth==0 || !points[j-1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x-2,y,2,sqheight,pointcolorhl)
|
||||
end
|
||||
if (j + 1) % mapwidth == 0 || !points[j + 1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x + sqwidth, y, 2, sqheight, pointcolorhl)
|
||||
if (j+1)%mapwidth==0 || !points[j+1]
|
||||
@sprites["areahighlight"].bitmap.fill_rect(x+sqwidth,y,2,sqheight,pointcolorhl)
|
||||
end
|
||||
end
|
||||
end
|
||||
# Set the text
|
||||
textpos = []
|
||||
if points.length == 0
|
||||
pbDrawImagePositions(overlay, [
|
||||
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188]
|
||||
if points.length==0
|
||||
pbDrawImagePositions(overlay,[
|
||||
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"),108,188]
|
||||
])
|
||||
textpos.push([_INTL("Area unknown"), Graphics.width / 2, Graphics.height / 2 - 6, 2, base, shadow])
|
||||
textpos.push([_INTL("Area unknown"),Graphics.width/2,Graphics.height/2 - 6,2,base,shadow])
|
||||
end
|
||||
textpos.push([pbGetMessage(MessageTypes::RegionNames, @region), 414, 38, 2, base, shadow])
|
||||
textpos.push([_INTL("{1}'s area", GameData::Species.get(@species).name),
|
||||
Graphics.width / 2, 346, 2, base, shadow])
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
textpos.push([pbGetMessage(MessageTypes::RegionNames,@region),414,38,2,base,shadow])
|
||||
textpos.push([_INTL("{1}'s area",GameData::Species.get(@species).name),
|
||||
Graphics.width/2,346,2,base,shadow])
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
end
|
||||
|
||||
def drawPageForms
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
base = Color.new(88,88,80)
|
||||
shadow = Color.new(168,184,184)
|
||||
# Write species and form name
|
||||
formname = ""
|
||||
for i in @available
|
||||
if i[1] == @gender && i[2] == @form
|
||||
if i[1]==@gender && i[2]==@form
|
||||
formname = i[0]; break
|
||||
end
|
||||
end
|
||||
textpos = [
|
||||
[GameData::Species.get(@species).name, Graphics.width / 2, Graphics.height - 94, 2, base, shadow],
|
||||
[formname, Graphics.width / 2, Graphics.height - 62, 2, base, shadow],
|
||||
[GameData::Species.get(@species).name,Graphics.width/2,Graphics.height-94,2,base,shadow],
|
||||
[formname,Graphics.width/2,Graphics.height-62,2,base,shadow],
|
||||
]
|
||||
# Draw all text
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
pbDrawTextPositions(overlay,textpos)
|
||||
end
|
||||
|
||||
def pbGoToPrevious
|
||||
newindex = @index
|
||||
while newindex > 0
|
||||
while newindex>0
|
||||
newindex -= 1
|
||||
if $Trainer.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
@@ -469,7 +432,7 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
def pbGoToNext
|
||||
newindex = @index
|
||||
while newindex < @dexlist.length - 1
|
||||
while newindex<@dexlist.length-1
|
||||
newindex += 1
|
||||
if $Trainer.seen?(@dexlist[newindex][0])
|
||||
@index = newindex
|
||||
@@ -478,22 +441,22 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
end
|
||||
|
||||
def pbChooseAlt(brief=false)
|
||||
def pbChooseForm
|
||||
index = 0
|
||||
for i in 0...@available.length
|
||||
if @available[i][1] == @gender && @available[i][2] == @form
|
||||
if @available[i][1]==@gender && @available[i][2]==@form
|
||||
index = i
|
||||
break
|
||||
end
|
||||
end
|
||||
oldindex = -1
|
||||
loop do
|
||||
if oldindex != index
|
||||
if oldindex!=index
|
||||
$Trainer.pokedex.set_last_form_seen(@species, @available[index][1], @available[index][2])
|
||||
pbUpdateDummyPokemon
|
||||
drawPage(@page)
|
||||
@sprites["uparrow"].visible = (index > 0)
|
||||
@sprites["downarrow"].visible = (index < @available.length - 1)
|
||||
@sprites["uparrow"].visible = (index>0)
|
||||
@sprites["downarrow"].visible = (index<@available.length-1)
|
||||
oldindex = index
|
||||
end
|
||||
Graphics.update
|
||||
@@ -501,10 +464,10 @@ class PokemonPokedexInfo_Scene
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
index = (index + @available.length - 1) % @available.length
|
||||
index = (index+@available.length-1)%@available.length
|
||||
elsif Input.trigger?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
index = (index + 1) % @available.length
|
||||
index = (index+1)%@available.length
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
break
|
||||
@@ -513,7 +476,7 @@ class PokemonPokedexInfo_Scene
|
||||
break
|
||||
end
|
||||
end
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["uparrow"].visible = false
|
||||
@sprites["downarrow"].visible = false
|
||||
end
|
||||
|
||||
@@ -534,11 +497,11 @@ class PokemonPokedexInfo_Scene
|
||||
if @page == 2 # Area
|
||||
# dorefresh = true
|
||||
elsif @page == 3 # Forms
|
||||
#if @available.length > 1
|
||||
pbPlayDecisionSE
|
||||
pbChooseAlt
|
||||
dorefresh = true
|
||||
# end
|
||||
if @available.length > 1
|
||||
pbPlayDecisionSE
|
||||
pbChooseForm
|
||||
dorefresh = true
|
||||
end
|
||||
end
|
||||
elsif Input.trigger?(Input::UP)
|
||||
oldindex = @index
|
||||
@@ -604,23 +567,6 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pbSelectSpritesSceneBrief
|
||||
pbChooseAlt(true)
|
||||
|
||||
# loop do
|
||||
# Graphics.update
|
||||
# Input.update
|
||||
# pbUpdate
|
||||
# if Input.trigger?(Input::ACTION)
|
||||
# pbPlayDecisionSE
|
||||
# elsif Input.trigger?(Input::BACK)
|
||||
# pbPlayCloseMenuSE
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -631,39 +577,30 @@ class PokemonPokedexInfoScreen
|
||||
@scene = scene
|
||||
end
|
||||
|
||||
def pbStartScreen(dexlist, index, region)
|
||||
@scene.pbStartScene(dexlist, index, region)
|
||||
def pbStartScreen(dexlist,index,region)
|
||||
@scene.pbStartScene(dexlist,index,region)
|
||||
ret = @scene.pbScene
|
||||
@scene.pbEndScene
|
||||
return ret # Index of last species viewed in dexlist
|
||||
return ret # Index of last species viewed in dexlist
|
||||
end
|
||||
|
||||
def pbStartSceneSingle(species)
|
||||
# For use from a Pokémon's summary screen
|
||||
def pbStartSceneSingle(species) # For use from a Pokémon's summary screen
|
||||
region = -1
|
||||
if Settings::USE_CURRENT_REGION_DEX
|
||||
region = pbGetCurrentRegion
|
||||
region = -1 if region >= $Trainer.pokedex.dexes_count - 1
|
||||
else
|
||||
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
|
||||
region = $PokemonGlobal.pokedexDex # National Dex -1, regional Dexes 0, 1, etc.
|
||||
end
|
||||
dexnum = GameData::Species.get(species).id_number #pbGetRegionalNumber(region,species)
|
||||
dexnum = GameData::Species.get(species).id_number#pbGetRegionalNumber(region,species)
|
||||
dexnumshift = Settings::DEXES_WITH_OFFSETS.include?(region)
|
||||
dexlist = [[species, GameData::Species.get(species).name, 0, 0, dexnum, dexnumshift]]
|
||||
@scene.pbStartScene(dexlist, 0, region)
|
||||
dexlist = [[species,GameData::Species.get(species).name,0,0,dexnum,dexnumshift]]
|
||||
@scene.pbStartScene(dexlist,0,region)
|
||||
@scene.pbScene
|
||||
@scene.pbEndScene
|
||||
end
|
||||
|
||||
def pbDexEntry(species)
|
||||
# For use when capturing a new species
|
||||
nb_sprites_for_alts_page = isSpeciesFusion(species) ? 2 : 1
|
||||
alts_list = @scene.pbGetAvailableForms(species)
|
||||
if alts_list.length > nb_sprites_for_alts_page
|
||||
@scene.pbStartSpritesSelectSceneBrief(species,alts_list)
|
||||
@scene.pbSelectSpritesSceneBrief
|
||||
@scene.pbEndScene
|
||||
end
|
||||
def pbDexEntry(species) # For use when capturing a new species
|
||||
@scene.pbStartSceneBrief(species)
|
||||
@scene.pbSceneBrief
|
||||
@scene.pbEndScene
|
||||
|
||||
@@ -14,7 +14,6 @@ class PokemonSystem
|
||||
attr_accessor :sevolume
|
||||
attr_accessor :textinput
|
||||
attr_accessor :quicksurf
|
||||
attr_accessor :level_caps
|
||||
attr_accessor :battle_type
|
||||
attr_accessor :download_sprites
|
||||
|
||||
@@ -572,12 +571,6 @@ class PokemonOption_Scene
|
||||
"Start surfing automatically when interacting with water"
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Level caps"), [_INTL("Off"), _INTL("On")],
|
||||
proc { $PokemonSystem.level_caps },
|
||||
proc { |value| $PokemonSystem.level_caps = value },
|
||||
"Prevents leveling above the next gym leader's highest leveled Pokemon"
|
||||
)
|
||||
|
||||
return options
|
||||
end
|
||||
|
||||
|
||||
@@ -24,20 +24,19 @@ class PokemonBoxIcon < IconSprite
|
||||
return false
|
||||
end
|
||||
|
||||
def createFusionIcon(species,spriteform_head=nil,spriteform_body=nil)
|
||||
def createFusionIcon(species)
|
||||
bodyPoke_number = getBodyID(species)
|
||||
headPoke_number = getHeadID(species, bodyPoke_number)
|
||||
|
||||
bodyPoke = GameData::Species.get(bodyPoke_number).species
|
||||
headPoke = GameData::Species.get(headPoke_number).species
|
||||
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke,spriteform_head))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke,spriteform_body))
|
||||
|
||||
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke))
|
||||
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke))
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
ensureFusionIconExists
|
||||
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke,spriteform_head)
|
||||
headPokeFileName = GameData::Species.icon_filename(headPoke)
|
||||
bitmapPath = sprintf("%s.png", bitmapFileName)
|
||||
generated_new_icon = generateFusionIcon(headPokeFileName,bitmapPath)
|
||||
result_icon = generated_new_icon ? AnimatedBitmap.new(bitmapPath) : icon1
|
||||
@@ -69,7 +68,7 @@ class PokemonBoxIcon < IconSprite
|
||||
if useRegularIcon(@pokemon.species) || @pokemon.egg?
|
||||
self.setBitmap(GameData::Species.icon_filename_from_pokemon(@pokemon))
|
||||
else
|
||||
self.setBitmapDirectly(createFusionIcon(@pokemon.species,@pokemon.spriteform_head, @pokemon.spriteform_body))
|
||||
self.setBitmapDirectly(createFusionIcon(@pokemon.species))
|
||||
if fusion_enabled
|
||||
self.visible = true
|
||||
else
|
||||
@@ -2201,7 +2200,7 @@ class PokemonStorageScreen
|
||||
#
|
||||
|
||||
def pbFuseFromPC(selected, heldpoke)
|
||||
box = selected[0]
|
||||
box = selected[0]
|
||||
index = selected[1]
|
||||
poke_body = @storage[box, index]
|
||||
poke_head = heldpoke
|
||||
@@ -2318,7 +2317,6 @@ class PokemonStorageScreen
|
||||
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
|
||||
playingBGM = $game_system.getPlayingBGM
|
||||
pbFuse(selectedHead, selectedBase, isSuperSplicer)
|
||||
if canDeleteItem(@fusionItem)
|
||||
$PokemonBag.pbDeleteItem(@fusionItem)
|
||||
@@ -2332,7 +2330,6 @@ class PokemonStorageScreen
|
||||
@scene.setFusing(false)
|
||||
@fusionMode = false
|
||||
@scene.sprites["box"].enableFusions()
|
||||
pbBGMPlay(playingBGM)
|
||||
return
|
||||
else
|
||||
# print "fusion cancelled"
|
||||
|
||||
@@ -317,7 +317,7 @@ class MiningGameScene
|
||||
def pbNoDuplicateItems(newitem)
|
||||
return true if newitem==:HEARTSCALE # Allow multiple Heart Scales
|
||||
fossils=[:DOMEFOSSIL,:HELIXFOSSIL,:OLDAMBER,:ROOTFOSSIL,
|
||||
:SKULLFOSSIL,:ARMORFOSSIL,:CLAWFOSSIL,:JAWFOSSIL]
|
||||
:SKULLFOSSIL,:ARMORFOSSIL,:CLAWFOSSIL]
|
||||
plates=[:INSECTPLATE,:DREADPLATE,:DRACOPLATE,:ZAPPLATE,:FISTPLATE,
|
||||
:FLAMEPLATE,:MEADOWPLATE,:EARTHPLATE,:ICICLEPLATE,:TOXICPLATE,
|
||||
:MINDPLATE,:STONEPLATE,:SKYPLATE,:SPOOKYPLATE,:IRONPLATE,:SPLASHPLATE]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,18 +16,18 @@ def pbAutoPositionAll
|
||||
Graphics.update if sp.id_number % 50 == 0
|
||||
bitmap1 = GameData::Species.sprite_bitmap(sp.species, sp.form, nil, nil, nil, true)
|
||||
bitmap2 = GameData::Species.sprite_bitmap(sp.species, sp.form)
|
||||
if bitmap1 && bitmap1.bitmap # Player's y
|
||||
if bitmap1 && bitmap1.bitmap # Player's y
|
||||
sp.back_sprite_x = 0
|
||||
sp.back_sprite_y = (bitmap1.height - (findBottom(bitmap1.bitmap) + 1)) / 2
|
||||
end
|
||||
if bitmap2 && bitmap2.bitmap # Foe's y
|
||||
if bitmap2 && bitmap2.bitmap # Foe's y
|
||||
sp.front_sprite_x = 0
|
||||
sp.front_sprite_y = (bitmap2.height - (findBottom(bitmap2.bitmap) + 1)) / 2
|
||||
sp.front_sprite_y += 4 # Just because
|
||||
sp.front_sprite_y += 4 # Just because
|
||||
end
|
||||
sp.front_sprite_altitude = 0 # Shouldn't be used
|
||||
sp.shadow_x = 0
|
||||
sp.shadow_size = 2
|
||||
sp.front_sprite_altitude = 0 # Shouldn't be used
|
||||
sp.shadow_x = 0
|
||||
sp.shadow_size = 2
|
||||
bitmap1.dispose if bitmap1
|
||||
bitmap2.dispose if bitmap2
|
||||
end
|
||||
@@ -44,9 +44,9 @@ class SpritePositioner
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
battlebg = "Graphics/Battlebacks/battlebg/indoorc"
|
||||
enemybase = "Graphics/Battlebacks/enemybase/indoorc"
|
||||
playerbase = "Graphics/Battlebacks/playerbase/indoorc"
|
||||
battlebg = "Graphics/Battlebacks/indoor1_bg"
|
||||
playerbase = "Graphics/Battlebacks/indoor1_base0"
|
||||
enemybase = "Graphics/Battlebacks/indoor1_base1"
|
||||
@sprites["battle_bg"] = AnimatedPlane.new(@viewport)
|
||||
@sprites["battle_bg"].setBitmap(battlebg)
|
||||
@sprites["battle_bg"].z = 0
|
||||
@@ -68,24 +68,16 @@ class SpritePositioner
|
||||
@sprites["shadow_1"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["shadow_1"].z = 3
|
||||
@sprites["pokemon_0"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon_0"].zoom_x = Settings::BACKRPSPRITE_SCALE
|
||||
@sprites["pokemon_0"].zoom_y = Settings::BACKRPSPRITE_SCALE
|
||||
@sprites["pokemon_0"].mirror = true
|
||||
|
||||
@sprites["pokemon_0"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["pokemon_0"].z = 1
|
||||
@sprites["pokemon_0"].z = 4
|
||||
@sprites["pokemon_1"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon_1"].setOffset(PictureOrigin::Bottom)
|
||||
@sprites["pokemon_1"].z = 4
|
||||
# @sprites["pokemon_1"] = PokemonSprite.new(@viewport)
|
||||
@sprites["pokemon_1"].zoom_x = Settings::FRONTSPRITE_SCALE
|
||||
@sprites["pokemon_1"].zoom_y = Settings::FRONTSPRITE_SCALE
|
||||
|
||||
@sprites["info"] = Window_UnformattedTextPokemon.new("")
|
||||
@sprites["info"].viewport = @viewport
|
||||
@sprites["info"].visible = false
|
||||
@sprites["info"].visible = false
|
||||
@oldSpeciesIndex = 0
|
||||
@species = nil # This can be a species_form
|
||||
@species = nil # This can be a species_form
|
||||
@metricsChanged = false
|
||||
refresh
|
||||
@starting = true
|
||||
@@ -96,7 +88,7 @@ class SpritePositioner
|
||||
pbSaveMetrics
|
||||
@metricsChanged = false
|
||||
else
|
||||
GameData::Species.load # Clear all changes to metrics
|
||||
GameData::Species.load # Clear all changes to metrics
|
||||
end
|
||||
pbFadeOutAndHide(@sprites) { update }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@@ -127,31 +119,32 @@ class SpritePositioner
|
||||
@sprites["pokemon_#{i}"].y = pos[1]
|
||||
species_data.apply_metrics_to_sprite(@sprites["pokemon_#{i}"], i)
|
||||
@sprites["pokemon_#{i}"].visible = true
|
||||
next if i != 1
|
||||
@sprites["shadow_1"].x = pos[0]
|
||||
@sprites["shadow_1"].y = pos[1]
|
||||
if @sprites["shadow_1"].bitmap
|
||||
@sprites["shadow_1"].x -= @sprites["shadow_1"].bitmap.width / 2
|
||||
@sprites["shadow_1"].y -= @sprites["shadow_1"].bitmap.height / 2
|
||||
if i == 1
|
||||
@sprites["shadow_1"].x = pos[0]
|
||||
@sprites["shadow_1"].y = pos[1]
|
||||
if @sprites["shadow_1"].bitmap
|
||||
@sprites["shadow_1"].x -= @sprites["shadow_1"].bitmap.width / 2
|
||||
@sprites["shadow_1"].y -= @sprites["shadow_1"].bitmap.height / 2
|
||||
end
|
||||
species_data.apply_metrics_to_sprite(@sprites["shadow_1"], i, true)
|
||||
@sprites["shadow_1"].visible = true
|
||||
end
|
||||
species_data.apply_metrics_to_sprite(@sprites["shadow_1"], i, true)
|
||||
@sprites["shadow_1"].visible = true
|
||||
end
|
||||
end
|
||||
|
||||
def pbAutoPosition
|
||||
species_data = GameData::Species.get(@species)
|
||||
old_back_y = species_data.back_sprite_y
|
||||
old_front_y = species_data.front_sprite_y
|
||||
old_back_y = species_data.back_sprite_y
|
||||
old_front_y = species_data.front_sprite_y
|
||||
old_front_altitude = species_data.front_sprite_altitude
|
||||
bitmap1 = @sprites["pokemon_0"].bitmap
|
||||
bitmap2 = @sprites["pokemon_1"].bitmap
|
||||
new_back_y = (bitmap1.height - (findBottom(bitmap1) + 1)) / 2
|
||||
new_back_y = (bitmap1.height - (findBottom(bitmap1) + 1)) / 2
|
||||
new_front_y = (bitmap2.height - (findBottom(bitmap2) + 1)) / 2
|
||||
new_front_y += 4 # Just because
|
||||
new_front_y += 4 # Just because
|
||||
if new_back_y != old_back_y || new_front_y != old_front_y || old_front_altitude != 0
|
||||
species_data.back_sprite_y = new_back_y
|
||||
species_data.front_sprite_y = new_front_y
|
||||
species_data.back_sprite_y = new_back_y
|
||||
species_data.front_sprite_y = new_front_y
|
||||
species_data.front_sprite_altitude = 0
|
||||
@metricsChanged = true
|
||||
refresh
|
||||
@@ -164,10 +157,8 @@ class SpritePositioner
|
||||
return if !species_data
|
||||
spe = species_data.species
|
||||
frm = species_data.form
|
||||
# @sprites["pokemon_0"].setSpeciesBitmap(spe, 0, frm, false, false, true)
|
||||
# @sprites["pokemon_1"].setSpeciesBitmap(spe, 0, frm)
|
||||
@sprites["pokemon_0"].setPokemonBitmapFromId(spe, true)
|
||||
@sprites["pokemon_1"].setPokemonBitmapFromId(spe)
|
||||
@sprites["pokemon_0"].setSpeciesBitmap(spe, 0, frm, false, false, true)
|
||||
@sprites["pokemon_1"].setSpeciesBitmap(spe, 0, frm)
|
||||
@sprites["shadow_1"].setBitmap(GameData::Species.shadow_filename(spe, frm))
|
||||
end
|
||||
|
||||
@@ -176,7 +167,7 @@ class SpritePositioner
|
||||
refresh
|
||||
species_data = GameData::Species.get(@species)
|
||||
if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, species_data.form)) ||
|
||||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
|
||||
pbMessage("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited.")
|
||||
return false
|
||||
end
|
||||
@@ -194,7 +185,7 @@ class SpritePositioner
|
||||
defindex = cmdvals.length - 1 if oldval == i
|
||||
end
|
||||
cw = Window_CommandPokemon.new(commands)
|
||||
cw.index = defindex
|
||||
cw.index = defindex
|
||||
cw.viewport = @viewport
|
||||
ret = false
|
||||
oldindex = cw.index
|
||||
@@ -209,7 +200,7 @@ class SpritePositioner
|
||||
pbChangeSpecies(@species)
|
||||
refresh
|
||||
end
|
||||
if Input.trigger?(Input::ACTION) # Cycle to next option
|
||||
if Input.trigger?(Input::ACTION) # Cycle to next option
|
||||
pbPlayDecisionSE
|
||||
@metricsChanged = true if species_data.shadow_size != oldval
|
||||
ret = true
|
||||
@@ -220,7 +211,6 @@ class SpritePositioner
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
@metricsChanged = true if species_data.shadow_size != oldval
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -255,7 +245,7 @@ class SpritePositioner
|
||||
@sprites["info"].visible = true
|
||||
ret = false
|
||||
loop do
|
||||
sprite.visible = (Graphics.frame_count % 16) < 12 # Flash the selected sprite
|
||||
sprite.visible = (Graphics.frame_count % 16) < 12 # Flash the selected sprite
|
||||
Graphics.update
|
||||
Input.update
|
||||
self.update
|
||||
@@ -267,7 +257,7 @@ class SpritePositioner
|
||||
if (Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN)) && param != 3
|
||||
ypos += (Input.repeat?(Input::DOWN)) ? 1 : -1
|
||||
case param
|
||||
when 0 then species_data.back_sprite_y = ypos
|
||||
when 0 then species_data.back_sprite_y = ypos
|
||||
when 1 then species_data.front_sprite_y = ypos
|
||||
end
|
||||
refresh
|
||||
@@ -275,13 +265,13 @@ class SpritePositioner
|
||||
if Input.repeat?(Input::LEFT) || Input.repeat?(Input::RIGHT)
|
||||
xpos += (Input.repeat?(Input::RIGHT)) ? 1 : -1
|
||||
case param
|
||||
when 0 then species_data.back_sprite_x = xpos
|
||||
when 0 then species_data.back_sprite_x = xpos
|
||||
when 1 then species_data.front_sprite_x = xpos
|
||||
when 3 then species_data.shadow_x = xpos
|
||||
when 3 then species_data.shadow_x = xpos
|
||||
end
|
||||
refresh
|
||||
end
|
||||
if Input.repeat?(Input::ACTION) && param != 3 # Cycle to next option
|
||||
if Input.repeat?(Input::ACTION) && param != 3 # Cycle to next option
|
||||
@metricsChanged = true if xpos != oldxpos || ypos != oldypos
|
||||
ret = true
|
||||
pbPlayDecisionSE
|
||||
@@ -311,18 +301,18 @@ class SpritePositioner
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbMenu
|
||||
# pbChangeSpecies(species)
|
||||
def pbMenu(species)
|
||||
pbChangeSpecies(species)
|
||||
refresh
|
||||
cw = Window_CommandPokemon.new([
|
||||
_INTL("Set Ally Position"),
|
||||
_INTL("Set Enemy Position"),
|
||||
_INTL("Set Shadow Size"),
|
||||
_INTL("Set Shadow Position"),
|
||||
_INTL("Auto-Position Sprites")
|
||||
])
|
||||
cw.x = Graphics.width - cw.width
|
||||
cw.y = Graphics.height - cw.height
|
||||
_INTL("Set Ally Position"),
|
||||
_INTL("Set Enemy Position"),
|
||||
_INTL("Set Shadow Size"),
|
||||
_INTL("Set Shadow Position"),
|
||||
_INTL("Auto-Position Sprites")
|
||||
])
|
||||
cw.x = Graphics.width - cw.width
|
||||
cw.y = Graphics.height - cw.height
|
||||
cw.viewport = @viewport
|
||||
ret = -1
|
||||
loop do
|
||||
@@ -356,16 +346,14 @@ class SpritePositioner
|
||||
allspecies = []
|
||||
GameData::Species.each do |sp|
|
||||
name = (sp.form == 0) ? sp.name : _INTL("{1} (form {2})", sp.real_name, sp.form)
|
||||
# allspecies.push([sp.id, sp.species, name]) if name && !name.empty?
|
||||
allspecies.push([sp.id, sp.id_number, name]) if name && !name.empty? # Switched to descending order using the ID of the Pokemon
|
||||
allspecies.push([sp.id, sp.species, name]) if name && !name.empty?
|
||||
end
|
||||
# allspecies.sort! { |a, b| a[2] <=> b[2] }
|
||||
allspecies.sort! { |a, b| b[1] <=> a[1] } # Switched to descending order using the ID of the Pokemon
|
||||
allspecies.sort! { |a, b| a[2] <=> b[2] }
|
||||
commands = []
|
||||
allspecies.each { |sp| commands.push(sp[2]) }
|
||||
cw.commands = commands
|
||||
cw.index = @oldSpeciesIndex
|
||||
ret = false
|
||||
cw.index = @oldSpeciesIndex
|
||||
ret = nil
|
||||
oldindex = -1
|
||||
loop do
|
||||
Graphics.update
|
||||
@@ -383,7 +371,7 @@ class SpritePositioner
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbChangeSpecies(allspecies[cw.index][0])
|
||||
ret = true
|
||||
ret = allspecies[cw.index][0]
|
||||
break
|
||||
end
|
||||
end
|
||||
@@ -407,7 +395,7 @@ class SpritePositionerScreen
|
||||
species = @scene.pbChooseSpecies
|
||||
break if !species
|
||||
loop do
|
||||
command = @scene.pbMenu
|
||||
command = @scene.pbMenu(species)
|
||||
break if command < 0
|
||||
loop do
|
||||
par = @scene.pbSetParameter(command)
|
||||
|
||||
@@ -802,37 +802,28 @@ DebugMenuCommands.register("dexlists", {
|
||||
|
||||
DebugMenuCommands.register("setplayer", {
|
||||
"parent" => "playermenu",
|
||||
"name" => _INTL("Switch Player Character"),
|
||||
"description" => _INTL("Switch the player character from male to female or vice-versa."),
|
||||
"name" => _INTL("Set Player Character"),
|
||||
"description" => _INTL("Edit the player's character, as defined in \"metadata.txt\"."),
|
||||
"effect" => proc {
|
||||
if pbGet(VAR_TRAINER_GENDER)==0
|
||||
pbChangePlayer(1)
|
||||
pbSet(VAR_TRAINER_GENDER,1)
|
||||
else
|
||||
pbChangePlayer(0)
|
||||
pbSet(VAR_TRAINER_GENDER,0)
|
||||
limit = 0
|
||||
for i in 0...8
|
||||
meta = GameData::Metadata.get_player(i)
|
||||
next if meta
|
||||
limit = i
|
||||
break
|
||||
end
|
||||
if limit <= 1
|
||||
pbMessage(_INTL("There is only one player defined."))
|
||||
else
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(0, limit - 1)
|
||||
params.setDefaultValue($Trainer.character_ID)
|
||||
newid = pbMessageChooseNumber(_INTL("Choose the new player character."), params)
|
||||
if newid != $Trainer.character_ID
|
||||
pbChangePlayer(newid)
|
||||
pbMessage(_INTL("The player character was changed."))
|
||||
end
|
||||
end
|
||||
pbMessage(_INTL("The player character was changed."))
|
||||
|
||||
# limit = 0
|
||||
# for i in 0...8
|
||||
# meta = GameData::Metadata.get_player(i)
|
||||
# next if meta
|
||||
# limit = i
|
||||
# break
|
||||
# end
|
||||
# if limit <= 1
|
||||
# pbMessage(_INTL("There is only one player defined."))
|
||||
# else
|
||||
# params = ChooseNumberParams.new
|
||||
# params.setRange(0, limit - 1)
|
||||
# params.setDefaultValue($Trainer.character_ID)
|
||||
# newid = pbMessageChooseNumber(_INTL("Choose the new player character."), params)
|
||||
# if newid != $Trainer.character_ID
|
||||
# pbChangePlayer(newid)
|
||||
# pbMessage(_INTL("The player character was changed."))
|
||||
# end
|
||||
# end
|
||||
}
|
||||
})
|
||||
|
||||
@@ -920,6 +911,65 @@ DebugMenuCommands.register("terraintags", {
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("setencounters", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Wild Encounters"),
|
||||
"description" => _INTL("Edit the wild Pokémon that can be found on maps, and how they are encountered."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbEncountersEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("trainertypes", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Trainer Types"),
|
||||
"description" => _INTL("Edit the properties of trainer types."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbTrainerTypeEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("edittrainers", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Individual Trainers"),
|
||||
"description" => _INTL("Edit individual trainers, their Pokémon and items."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbTrainerBattleEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("edititems", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Items"),
|
||||
"description" => _INTL("Edit item data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbItemEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("editpokemon", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Pokémon"),
|
||||
"description" => _INTL("Edit Pokémon species data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbPokemonEditor }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("editdexes", {
|
||||
"parent" => "editorsmenu",
|
||||
"name" => _INTL("Edit Regional Dexes"),
|
||||
"description" => _INTL("Create, rearrange and delete Regional Pokédex lists."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbFadeOutIn { pbRegionalDexEditorMain }
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("positionsprites", {
|
||||
"parent" => "editorsmenu",
|
||||
@@ -994,60 +1044,73 @@ DebugMenuCommands.register("exportanims", {
|
||||
#===============================================================================
|
||||
# Other options
|
||||
#===============================================================================
|
||||
# DebugMenuCommands.register("othermenu", {
|
||||
# "parent" => "main",
|
||||
# "name" => _INTL("Other options..."),
|
||||
# "description" => _INTL("Mystery Gifts, translations, compile data, etc."),
|
||||
# "always_show" => true
|
||||
# })
|
||||
#
|
||||
# DebugMenuCommands.register("mysterygift", {
|
||||
# "parent" => "othermenu",
|
||||
# "name" => _INTL("Manage Mystery Gifts"),
|
||||
# "description" => _INTL("Edit and enable/disable Mystery Gifts."),
|
||||
# "always_show" => true,
|
||||
# "effect" => proc {
|
||||
# pbManageMysteryGifts
|
||||
# }
|
||||
# })
|
||||
#
|
||||
# DebugMenuCommands.register("extracttext", {
|
||||
# "parent" => "othermenu",
|
||||
# "name" => _INTL("Extract Text"),
|
||||
# "description" => _INTL("Extract all text in the game to a single file for translating."),
|
||||
# "always_show" => true,
|
||||
# "effect" => proc {
|
||||
# pbExtractText
|
||||
# }
|
||||
# })
|
||||
#
|
||||
# DebugMenuCommands.register("compiletext", {
|
||||
# "parent" => "othermenu",
|
||||
# "name" => _INTL("Compile Text"),
|
||||
# "description" => _INTL("Import text and converts it into a language file."),
|
||||
# "always_show" => true,
|
||||
# "effect" => proc {
|
||||
# pbCompileTextUI
|
||||
# }
|
||||
# })
|
||||
#
|
||||
#
|
||||
# DebugMenuCommands.register("renamesprites", {
|
||||
# "parent" => "othermenu",
|
||||
# "name" => _INTL("Rename Old Sprites"),
|
||||
# "description" => _INTL("Renames and moves Pokémon/item/trainer sprites from their old places."),
|
||||
# "always_show" => true,
|
||||
# "effect" => proc {
|
||||
# SpriteRenamer.convert_files
|
||||
# }
|
||||
# })
|
||||
#
|
||||
# DebugMenuCommands.register("invalidtiles", {
|
||||
# "parent" => "othermenu",
|
||||
# "name" => _INTL("Fix Invalid Tiles"),
|
||||
# "description" => _INTL("Scans all maps and erases non-existent tiles."),
|
||||
# "always_show" => true,
|
||||
# "effect" => proc {
|
||||
# pbDebugFixInvalidTiles
|
||||
# }
|
||||
# })
|
||||
DebugMenuCommands.register("othermenu", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Other options..."),
|
||||
"description" => _INTL("Mystery Gifts, translations, compile data, etc."),
|
||||
"always_show" => true
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("mysterygift", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Manage Mystery Gifts"),
|
||||
"description" => _INTL("Edit and enable/disable Mystery Gifts."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbManageMysteryGifts
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("extracttext", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Extract Text"),
|
||||
"description" => _INTL("Extract all text in the game to a single file for translating."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbExtractText
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("compiletext", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Compile Text"),
|
||||
"description" => _INTL("Import text and converts it into a language file."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbCompileTextUI
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("compiledata", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Compile Data"),
|
||||
"description" => _INTL("Fully compile all data."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
msgwindow = pbCreateMessageWindow
|
||||
Compiler.compile_all(true) { |msg| pbMessageDisplay(msgwindow, msg, false); echoln(msg) }
|
||||
pbMessageDisplay(msgwindow, _INTL("All game data was compiled."))
|
||||
pbDisposeMessageWindow(msgwindow)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
DebugMenuCommands.register("renamesprites", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Rename Old Sprites"),
|
||||
"description" => _INTL("Renames and moves Pokémon/item/trainer sprites from their old places."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
SpriteRenamer.convert_files
|
||||
}
|
||||
})
|
||||
|
||||
DebugMenuCommands.register("invalidtiles", {
|
||||
"parent" => "othermenu",
|
||||
"name" => _INTL("Fix Invalid Tiles"),
|
||||
"description" => _INTL("Scans all maps and erases non-existent tiles."),
|
||||
"always_show" => true,
|
||||
"effect" => proc {
|
||||
pbDebugFixInvalidTiles
|
||||
}
|
||||
})
|
||||
|
||||
@@ -328,9 +328,7 @@ module Compiler
|
||||
enumer = GameData.const_get(enumer.to_sym)
|
||||
begin
|
||||
if nil_or_empty?(ret) || !enumer.exists?(ret.to_sym)
|
||||
if enumer != GameData::Species
|
||||
raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport)
|
||||
end
|
||||
raise _INTL("Undefined value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport)
|
||||
end
|
||||
rescue NameError
|
||||
raise _INTL("Incorrect value {1} in {2}\r\n{3}", ret, enumer.name, FileLineData.linereport)
|
||||
@@ -737,7 +735,7 @@ module Compiler
|
||||
|
||||
|
||||
def main
|
||||
return
|
||||
return
|
||||
return if !$DEBUG
|
||||
begin
|
||||
dataFiles = [
|
||||
|
||||
@@ -361,7 +361,7 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
|
||||
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
|
||||
|
||||
Kernel.pbMessage(_INTL("Parsing custom sprites folder"))
|
||||
customsList = getCustomSpeciesList(true, true)
|
||||
customsList = getCustomSpeciesList(true,true)
|
||||
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
|
||||
|
||||
if customsList.length == 0
|
||||
@@ -411,7 +411,7 @@ end
|
||||
# return (body*NB_POKEMON)+head
|
||||
#end
|
||||
|
||||
def getCustomSpeciesList(allowOnline = true, redownload_file = false)
|
||||
def getCustomSpeciesList(allowOnline = true, redownload_file=false)
|
||||
speciesList = []
|
||||
|
||||
for num in 1..NB_POKEMON
|
||||
@@ -454,19 +454,16 @@ end
|
||||
|
||||
#input: ex: 10.10.png
|
||||
def getDexNumFromFilename(filename)
|
||||
begin
|
||||
splitPoke = filename.split(".")
|
||||
head = splitPoke[0].to_i
|
||||
body = splitPoke[1].to_i
|
||||
|
||||
return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
return (body * NB_POKEMON) + head
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
splitPoke = filename.split(".")
|
||||
head = splitPoke[0].to_i
|
||||
body = splitPoke[1].to_i
|
||||
|
||||
return nil if (body * NB_POKEMON) + head > (NB_POKEMON * NB_POKEMON) + 420
|
||||
return (body * NB_POKEMON) + head
|
||||
end
|
||||
|
||||
|
||||
|
||||
# def getCustomSpeciesList()
|
||||
# filesList = Dir["./Graphics/CustomBattlers/*"]
|
||||
# maxDexNumber = (NB_POKEMON * NB_POKEMON) + NB_POKEMON
|
||||
|
||||
@@ -1,336 +0,0 @@
|
||||
module GameData
|
||||
class FusedSpecies < GameData::Species
|
||||
attr_reader :growth_rate
|
||||
attr_reader :body_pokemon
|
||||
attr_reader :head_pokemon
|
||||
|
||||
def initialize(id)
|
||||
if id.is_a?(Integer)
|
||||
body_id = getBodyID(id)
|
||||
head_id = getHeadID(id, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
return GameData::FusedSpecies.new(pokemon_id)
|
||||
end
|
||||
head_id = get_head_number_from_symbol(id)
|
||||
body_id = get_body_number_from_symbol(id)
|
||||
|
||||
@body_pokemon = GameData::Species.get(body_id)
|
||||
@head_pokemon = GameData::Species.get(head_id)
|
||||
|
||||
@id = id
|
||||
@id_number = calculate_dex_number()
|
||||
@species = @id
|
||||
@form = 0
|
||||
@real_name = calculate_name()
|
||||
@real_form_name = nil
|
||||
|
||||
@type1 = calculate_type1()
|
||||
@type2 = calculate_type2()
|
||||
|
||||
#Stats
|
||||
@base_stats = calculate_base_stats()
|
||||
@evs = calculate_evs()
|
||||
adjust_stats_with_evs()
|
||||
|
||||
@base_exp = calculate_base_exp()
|
||||
@growth_rate = calculate_growth_rate()
|
||||
@gender_ratio = calculate_gender() #todo
|
||||
@catch_rate = calculate_catch_rate()
|
||||
@happiness = calculate_base_happiness()
|
||||
|
||||
#Moves
|
||||
@moves = calculate_moveset()
|
||||
@tutor_moves = calculate_tutor_moves() # hash[:tutor_moves] || []
|
||||
@egg_moves = calculate_egg_moves() # hash[:egg_moves] || []
|
||||
|
||||
#Abilities
|
||||
@abilities = calculate_abilities(@body_pokemon, @head_pokemon) # hash[:abilities] || []
|
||||
@hidden_abilities = calculate_hidden_abilities(@body_pokemon, @head_pokemon) # hash[:hidden_abilities] || []
|
||||
|
||||
#wild held items
|
||||
@wild_item_common = get_wild_item(@head_pokemon.wild_item_common, @body_pokemon.wild_item_common) # hash[:wild_item_common]
|
||||
@wild_item_uncommon = get_wild_item(@head_pokemon.wild_item_uncommon, @body_pokemon.wild_item_uncommon) # hash[:wild_item_uncommon]
|
||||
@wild_item_rare = get_wild_item(@head_pokemon.wild_item_rare, @body_pokemon.wild_item_rare) # hash[:wild_item_rare]
|
||||
|
||||
@evolutions = calculate_evolutions() # hash[:evolutions] || []
|
||||
|
||||
#breeding
|
||||
@egg_groups = [:Undiscovered] #calculate_egg_groups() # hash[:egg_groups] || [:Undiscovered]
|
||||
@hatch_steps = calculate_hatch_steps() # hash[:hatch_steps] || 1
|
||||
@incense = nil #hash[:incense]
|
||||
|
||||
#pokedex
|
||||
@pokedex_form = @form #ignored
|
||||
@real_category = calculate_category()
|
||||
@real_pokedex_entry = calculate_dex_entry()
|
||||
@height = average_values(@head_pokemon.height, @body_pokemon.height)
|
||||
@weight = average_values(@head_pokemon.weight, @body_pokemon.weight)
|
||||
@color = @head_pokemon.color
|
||||
@shape = @body_pokemon.shape
|
||||
|
||||
#sprite positioning
|
||||
@back_sprite_x = @body_pokemon.back_sprite_x
|
||||
@back_sprite_y = @body_pokemon.back_sprite_y
|
||||
@front_sprite_x = @body_pokemon.front_sprite_x
|
||||
@front_sprite_y = @body_pokemon.front_sprite_y
|
||||
@front_sprite_altitude = @body_pokemon.front_sprite_altitude
|
||||
@shadow_x = @body_pokemon.shadow_x
|
||||
@shadow_size = @body_pokemon.shadow_size
|
||||
|
||||
# #unused attributes from Species class
|
||||
#
|
||||
# @shape = :Head
|
||||
# @habitat = :None
|
||||
# @generation = 0
|
||||
# @mega_stone = nil
|
||||
# @mega_move = nil
|
||||
# @unmega_form = 0
|
||||
# @mega_message = 0
|
||||
end
|
||||
|
||||
def get_body_number_from_symbol(id)
|
||||
return id.to_s.match(/\d+/)[0].to_i
|
||||
end
|
||||
|
||||
def get_head_number_from_symbol(id)
|
||||
return id.to_s.match(/(?<=H)\d+/)[0].to_i
|
||||
end
|
||||
|
||||
def adjust_stats_with_evs
|
||||
GameData::Stat.each_main do |s|
|
||||
@base_stats[s.id] = 1 if !@base_stats[s.id] || @base_stats[s.id] <= 0
|
||||
@evs[s.id] = 0 if !@evs[s.id] || @evs[s.id] < 0
|
||||
end
|
||||
end
|
||||
|
||||
#FUSION CALCULATIONS
|
||||
def calculate_dex_number()
|
||||
return (@body_pokemon.id_number * NB_POKEMON) + @head_pokemon.id_number
|
||||
end
|
||||
|
||||
def calculate_type1()
|
||||
return @head_pokemon.type2 if @head_pokemon.type1 == :NORMAL && @head_pokemon.type2 == :FLYING
|
||||
return @head_pokemon.type1
|
||||
end
|
||||
|
||||
def calculate_type2()
|
||||
return @body_pokemon.type1 if @body_pokemon.type2 == @type1
|
||||
return @body_pokemon.type2
|
||||
end
|
||||
|
||||
def calculate_base_stats()
|
||||
head_stats = @head_pokemon.base_stats
|
||||
body_stats = @body_pokemon.base_stats
|
||||
|
||||
fused_stats = {}
|
||||
|
||||
#Head dominant stats
|
||||
fused_stats[:HP] = calculate_fused_stats(head_stats[:HP], body_stats[:HP])
|
||||
fused_stats[:SPECIAL_DEFENSE] = calculate_fused_stats(head_stats[:SPECIAL_DEFENSE], body_stats[:SPECIAL_DEFENSE])
|
||||
fused_stats[:SPECIAL_ATTACK] = calculate_fused_stats(head_stats[:SPECIAL_ATTACK], body_stats[:SPECIAL_ATTACK])
|
||||
|
||||
#Body dominant stats
|
||||
fused_stats[:ATTACK] = calculate_fused_stats(body_stats[:ATTACK], head_stats[:ATTACK])
|
||||
fused_stats[:DEFENSE] = calculate_fused_stats(body_stats[:DEFENSE], head_stats[:DEFENSE])
|
||||
fused_stats[:SPEED] = calculate_fused_stats(body_stats[:SPEED], head_stats[:SPEED])
|
||||
|
||||
return fused_stats
|
||||
end
|
||||
|
||||
def calculate_base_exp()
|
||||
head_exp = @head_pokemon.base_exp
|
||||
body_exp = @body_pokemon.base_exp
|
||||
return average_values(head_exp, body_exp)
|
||||
end
|
||||
|
||||
def calculate_catch_rate
|
||||
return get_lowest_value(@body_pokemon.catch_rate, @head_pokemon.catch_rate)
|
||||
end
|
||||
|
||||
def calculate_base_happiness
|
||||
return @head_pokemon.happiness
|
||||
end
|
||||
|
||||
def calculate_moveset
|
||||
return combine_arrays(@body_pokemon.moves, @head_pokemon.moves)
|
||||
end
|
||||
|
||||
def calculate_egg_moves
|
||||
return combine_arrays(@body_pokemon.egg_moves, @head_pokemon.egg_moves)
|
||||
end
|
||||
|
||||
def calculate_tutor_moves
|
||||
return combine_arrays(@body_pokemon.tutor_moves, @head_pokemon.tutor_moves)
|
||||
end
|
||||
|
||||
def get_wild_item(body_item, head_item)
|
||||
rand_num = rand(2)
|
||||
if rand_num == 0
|
||||
return body_item
|
||||
else
|
||||
return head_item
|
||||
end
|
||||
end
|
||||
|
||||
def calculate_abilities(pokemon1, pokemon2)
|
||||
abilities_hash = []
|
||||
|
||||
ability1 = pokemon1.abilities[0]
|
||||
ability2 = pokemon2.abilities[1]
|
||||
if !ability2
|
||||
ability2 = pokemon2.abilities[0]
|
||||
end
|
||||
abilities_hash << ability1
|
||||
abilities_hash << ability2
|
||||
return abilities_hash
|
||||
end
|
||||
|
||||
def calculate_hidden_abilities(pokemon1, pokemon2)
|
||||
#First two spots are the other abilities of the two pokemon
|
||||
abilities_hash = calculate_abilities(pokemon2, pokemon1)
|
||||
#add the hidden ability for the two base pokemon
|
||||
abilities_hash << @body_pokemon.hidden_abilities[0]
|
||||
abilities_hash << @head_pokemon.hidden_abilities[0]
|
||||
return abilities_hash
|
||||
end
|
||||
|
||||
def calculate_name()
|
||||
body_nat_dex = GameData::NAT_DEX_MAPPING[@body_pokemon.id_number] ? GameData::NAT_DEX_MAPPING[@body_pokemon.id_number] : @body_pokemon.id_number
|
||||
head_nat_dex = GameData::NAT_DEX_MAPPING[@head_pokemon.id_number] ? GameData::NAT_DEX_MAPPING[@head_pokemon.id_number] : @head_pokemon.id_number
|
||||
begin
|
||||
prefix = GameData::SPLIT_NAMES[head_nat_dex][0]
|
||||
suffix = GameData::SPLIT_NAMES[body_nat_dex][1]
|
||||
if prefix[-1] == suffix[0]
|
||||
prefix = prefix[0..-2]
|
||||
end
|
||||
return prefix + suffix
|
||||
|
||||
rescue
|
||||
print("species with error: " + @species.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def calculate_evolutions()
|
||||
body_evolutions = @body_pokemon.evolutions
|
||||
head_evolutions = @head_pokemon.evolutions
|
||||
|
||||
fused_evolutions = []
|
||||
|
||||
#body
|
||||
for evolution in body_evolutions
|
||||
evolutionSpecies = evolution[0]
|
||||
evolutionSpecies_dex = GameData::Species.get(evolutionSpecies).id_number
|
||||
fused_species = _INTL("B{1}H{2}", evolutionSpecies_dex, @head_pokemon.id_number)
|
||||
fused_evolutions << build_evolution_array(evolution, fused_species)
|
||||
end
|
||||
|
||||
#head
|
||||
for evolution in head_evolutions
|
||||
evolutionSpecies = evolution[0]
|
||||
evolutionSpecies_dex = GameData::Species.get(evolutionSpecies).id_number
|
||||
fused_species = _INTL("B{1}H{2}", @body_pokemon.id_number, evolutionSpecies_dex)
|
||||
fused_evolutions << build_evolution_array(evolution, fused_species)
|
||||
end
|
||||
|
||||
return fused_evolutions
|
||||
end
|
||||
|
||||
#Change the evolution species depending if head & body and keep the rest of the data the same
|
||||
def build_evolution_array(evolution_data, new_species)
|
||||
fused_evolution_array = []
|
||||
fused_evolution_array << new_species.to_sym
|
||||
|
||||
#add the rest
|
||||
for data in evolution_data
|
||||
next if evolution_data.index(data) == 0
|
||||
fused_evolution_array << data
|
||||
end
|
||||
return fused_evolution_array
|
||||
end
|
||||
|
||||
def calculate_dex_entry
|
||||
body_entry = @body_pokemon.real_pokedex_entry.gsub(@body_pokemon.real_name, @real_name)
|
||||
head_entry = @head_pokemon.real_pokedex_entry.gsub(@head_pokemon.real_name, @real_name)
|
||||
|
||||
return split_and_combine_text(body_entry, head_entry, ".")
|
||||
end
|
||||
|
||||
def calculate_egg_groups
|
||||
body_egg_groups = @body_pokemon.egg_groups
|
||||
head_egg_groups = @head_pokemon.egg_groups
|
||||
return :Undiscovered if body_egg_groups.include?(:Undiscovered) || head_egg_groups.include?(:Undiscovered)
|
||||
return combine_arrays(body_egg_groups, head_egg_groups)
|
||||
end
|
||||
|
||||
def calculate_hatch_steps
|
||||
return average_values(@head_pokemon.hatch_steps, @body_pokemon.hatch_steps)
|
||||
end
|
||||
|
||||
def calculate_evs()
|
||||
return average_map_values(@body_pokemon.evs, @head_pokemon.evs)
|
||||
end
|
||||
|
||||
def calculate_category
|
||||
return split_and_combine_text(@body_pokemon.category, @head_pokemon.category, " ")
|
||||
end
|
||||
|
||||
def calculate_growth_rate
|
||||
growth_rate_priority = [:Slow, :Erratic, :Fluctuating, :Parabolic, :Medium, :Fast] #todo rearrange order for balance?
|
||||
body_growth_rate = @body_pokemon.growth_rate
|
||||
head_growth_rate = @head_pokemon.growth_rate
|
||||
base_growth_rates =[body_growth_rate,head_growth_rate]
|
||||
for rate in growth_rate_priority
|
||||
return rate if base_growth_rates.include?(rate)
|
||||
end
|
||||
return :Medium
|
||||
end
|
||||
|
||||
#TODO
|
||||
# ################## UNFINISHED ####################
|
||||
def calculate_gender
|
||||
return :Genderless
|
||||
end
|
||||
|
||||
############################# UTIL METHODS ###############################
|
||||
|
||||
#Takes 2 strings, splits and combines them using the beginning of the first one and the end of the second one
|
||||
# (for example for pokedex entries)
|
||||
def split_and_combine_text(beginingText_full, endText_full, separator)
|
||||
beginingText_split = beginingText_full.split(separator, 2)
|
||||
endText_split = endText_full.split(separator, 2)
|
||||
|
||||
beginningText = beginingText_split[0]
|
||||
endText = endText_split[1] && endText_split[1] != "" ? endText_split[1] : endText_split[0]
|
||||
return beginningText + separator + endText
|
||||
end
|
||||
|
||||
def calculate_fused_stats(dominantStat, otherStat)
|
||||
return ((2 * dominantStat) / 3) + (otherStat / 3).floor
|
||||
end
|
||||
|
||||
def average_values(value1, value2)
|
||||
return ((value1 + value2) / 2).floor
|
||||
end
|
||||
|
||||
def average_map_values(map1, map2)
|
||||
averaged_map = map1.merge(map2) do |key, value1, value2|
|
||||
((value1 + value2) / 2.0).floor
|
||||
end
|
||||
return averaged_map
|
||||
end
|
||||
|
||||
def get_highest_value(value1, value2)
|
||||
return value1 > value2 ? value1 : value2
|
||||
end
|
||||
|
||||
def get_lowest_value(value1, value2)
|
||||
return value1 < value2 ? value1 : value2
|
||||
end
|
||||
|
||||
def combine_arrays(array1, array2)
|
||||
return array1 + array2
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1,38 +0,0 @@
|
||||
# class PokemonFusionScene
|
||||
# HEAD_SPRITE_STARTING_POS = Graphics.width / 2
|
||||
#
|
||||
#
|
||||
# def pbStartScreen(pokemon_head,pokemon_body,pokemon_fused)
|
||||
#
|
||||
# @pokemon_head = pokemon_head
|
||||
# @pokemon_body = pokemon_body
|
||||
#
|
||||
# @pokemon_fused = pokemon_fused
|
||||
#
|
||||
# @sprites = {}
|
||||
# @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
# @viewport.z = 99999
|
||||
#
|
||||
# initialize_background()
|
||||
# initialize_sprites()
|
||||
# end
|
||||
#
|
||||
# def initialize_background()
|
||||
# addBackgroundOrColoredPlane(@sprites, "background", "DNAbg",
|
||||
# Color.new(248, 248, 248), @viewport)
|
||||
# end
|
||||
#
|
||||
# def initialize_sprites()
|
||||
# pokeHead_number = GameData::Species.get(@pokemon_head.species).id_number
|
||||
# pokeBody_number = GameData::Species.get(@pokemon_body.species).id_number
|
||||
#
|
||||
# @sprites["poke_head"] = PokemonSprite.new(@viewport)
|
||||
# @sprites["poke_head"].setPokemonBitmapFromId(pokeHead_number, false, @pokemon_head.shiny?)
|
||||
#
|
||||
# @sprites["poke_head"].ox = @sprites["rsprite1"].bitmap.width / 2
|
||||
# @sprites["poke_head"].x = Graphics.width / 2
|
||||
# @sprites["poke_head"].zoom_x = Settings::FRONTSPRITE_SCALE
|
||||
#
|
||||
# end
|
||||
#
|
||||
# end
|
||||
@@ -140,13 +140,10 @@ class SpriteMetafile
|
||||
end
|
||||
|
||||
def bitmap=(value)
|
||||
@values[BITMAP]= value
|
||||
@metafile.push([BITMAP, value])
|
||||
|
||||
# if value && !value.disposed?
|
||||
# @values[SRC_RECT].set(0, 0, value.width, value.height)
|
||||
# @metafile.push([SRC_RECT, @values[SRC_RECT].clone])
|
||||
# end
|
||||
if value && !value.disposed?
|
||||
@values[SRC_RECT].set(0, 0, value.width, value.height)
|
||||
@metafile.push([SRC_RECT, @values[SRC_RECT].clone])
|
||||
end
|
||||
end
|
||||
|
||||
def src_rect
|
||||
@@ -344,10 +341,6 @@ class SpriteMetafilePlayer
|
||||
sprite.color = value
|
||||
when SpriteMetafile::TONE
|
||||
sprite.tone = value
|
||||
when SpriteMetafile::BITMAP
|
||||
sprite.bitmap = value
|
||||
echo "\n"
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -418,125 +411,7 @@ end
|
||||
class PokemonFusionScene
|
||||
private
|
||||
|
||||
def generateSplicerMetaFile(nb_seconds,x_pos,y_pos)
|
||||
dna_splicer = SpriteMetafile.new
|
||||
dna_splicer.opacity = 255
|
||||
dna_splicer.x = x_pos
|
||||
dna_splicer.y = y_pos
|
||||
|
||||
max_y = 160
|
||||
min_y = 140
|
||||
|
||||
dna_splicer.z = 0
|
||||
duration = Graphics.frame_rate * nb_seconds
|
||||
direction = 1
|
||||
dna_splicer.bitmap = pbBitmap("Graphics/Items/POTION")
|
||||
|
||||
for j in 0...Graphics.frame_rate * 50
|
||||
if j % 2 ==0
|
||||
dna_splicer.bitmap = pbBitmap("Graphics/Items/SUPERSPLICERS")
|
||||
else
|
||||
dna_splicer.bitmap = pbBitmap("Graphics/Items/DNASPLICERS")
|
||||
end
|
||||
|
||||
if j % 5 == 0
|
||||
dna_splicer.y += direction
|
||||
direction = -1 if dna_splicer.y == max_y
|
||||
direction = 1 if dna_splicer.y == min_y
|
||||
end
|
||||
|
||||
|
||||
dna_splicer.opacity=0 if j >= duration * 0.75
|
||||
dna_splicer.update
|
||||
end
|
||||
@metafile4 = dna_splicer
|
||||
|
||||
end
|
||||
|
||||
#NEW FUSION ANIMATION (WIP)
|
||||
# def pbGenerateMetafiles(nb_seconds,ellipse_center_x,ellipse_center_y,ellipse_major_axis_length,ellipse_minor_axis_length)
|
||||
# sprite_head = SpriteMetafile.new
|
||||
# sprite_body = SpriteMetafile.new
|
||||
# sprite_fused = SpriteMetafile.new
|
||||
#
|
||||
# sprite_head.z = 10
|
||||
# sprite_body.z = 10
|
||||
#
|
||||
# sprite_head.opacity = 0
|
||||
# sprite_body.opacity = 0
|
||||
# sprite_fused.opacity = 0
|
||||
#
|
||||
# duration = Graphics.frame_rate * nb_seconds
|
||||
#
|
||||
# sprite_head_angle = 0
|
||||
# sprite_body_angle = Math::PI
|
||||
#
|
||||
# #Spinning
|
||||
# angle_incr = 0.1 #speed basically
|
||||
# acceleration = 2
|
||||
# sprite_head.opacity = 255
|
||||
# sprite_body.opacity = 255
|
||||
# for j in 0...duration
|
||||
# if j % 20 == 0
|
||||
# ellipse_major_axis_length -= 10 if ellipse_minor_axis_length > 100
|
||||
# ellipse_major_axis_length -= 18 if ellipse_minor_axis_length > 40
|
||||
# ellipse_minor_axis_length -= 5 if ellipse_minor_axis_length > 10
|
||||
# angle_incr += 0.02*acceleration
|
||||
# acceleration+=0.01
|
||||
# end
|
||||
#
|
||||
# sprite_head.x = ellipse_center_x + ellipse_major_axis_length * Math.cos(sprite_head_angle)
|
||||
# sprite_head.y = ellipse_center_y + ellipse_minor_axis_length * Math.sin(sprite_head_angle)
|
||||
#
|
||||
# sprite_body.x = ellipse_center_x + ellipse_major_axis_length * Math.cos(sprite_body_angle)
|
||||
# sprite_body.y = ellipse_center_y + ellipse_minor_axis_length * Math.sin(sprite_body_angle)
|
||||
#
|
||||
# sprite_head_angle += angle_incr
|
||||
# sprite_body_angle += angle_incr
|
||||
#
|
||||
#
|
||||
# sprite_head.mirror= sprite_head.y < ellipse_center_y
|
||||
# sprite_body.mirror= sprite_body.y < ellipse_center_y
|
||||
#
|
||||
# #sprite_body.mirror if sprite_body_angle == 0 || sprite_body_angle == Math::PI
|
||||
#
|
||||
# sprite_head.update
|
||||
# sprite_fused.update
|
||||
# sprite_body.update
|
||||
# end
|
||||
# sprite_head.opacity = 0
|
||||
# sprite_body.opacity = 0
|
||||
# sprite_fused.opacity = 255
|
||||
#
|
||||
# @metafile1 = sprite_head
|
||||
# @metafile2 = sprite_fused
|
||||
# @metafile3 = sprite_body
|
||||
# end
|
||||
|
||||
# def pbGenerateMetafiles(nb_seconds,ellipse_center_x,ellipse_center_y,ellipse_major_axis_length,ellipse_minor_axis_length)
|
||||
|
||||
#def pbGenerateMetafiles(s1x, s1y, s2x, s2y, s3x, s3y, sxx, s3xx)
|
||||
def pbGenerateMetafiles(nb_seconds,ellipse_center_x,ellipse_center_y,ellipse_major_axis_length,ellipse_minor_axis_length)
|
||||
|
||||
@sprites["rsprite1"].ox = @sprites["rsprite1"].bitmap.width / 2
|
||||
@sprites["rsprite1"].oy = @sprites["rsprite1"].bitmap.height / 2
|
||||
|
||||
@sprites["rsprite3"].ox = @sprites["rsprite3"].bitmap.width / 2
|
||||
@sprites["rsprite3"].oy = @sprites["rsprite3"].bitmap.height / 2
|
||||
|
||||
@sprites["rsprite2"].ox = @sprites["rsprite2"].bitmap.width / 2
|
||||
@sprites["rsprite2"].oy = @sprites["rsprite2"].bitmap.height / 2
|
||||
|
||||
@sprites["rsprite2"].x = Graphics.width / 2
|
||||
@sprites["rsprite1"].y = (Graphics.height - 96) / 2
|
||||
@sprites["rsprite3"].y = (Graphics.height - 96) / 2
|
||||
|
||||
@sprites["rsprite1"].x = (Graphics.width / 2) - 100
|
||||
@sprites["rsprite3"].x = (Graphics.width / 2) + 100
|
||||
s1x, s1y, s2x, s2y, s3x, s3y, sxx, s3xx =@sprites["rsprite1"].ox, @sprites["rsprite1"].oy, @sprites["rsprite2"].ox, @sprites["rsprite2"].oy, @sprites["rsprite3"].ox, @sprites["rsprite3"].oy, @sprites["rsprite1"].x, @sprites["rsprite3"].x
|
||||
|
||||
second = Graphics.frame_rate * 1
|
||||
|
||||
def pbGenerateMetafiles(s1x, s1y, s2x, s2y, s3x, s3y, sxx, s3xx)
|
||||
sprite = SpriteMetafile.new
|
||||
sprite3 = SpriteMetafile.new
|
||||
sprite2 = SpriteMetafile.new
|
||||
@@ -640,10 +515,9 @@ class PokemonFusionScene
|
||||
|
||||
end
|
||||
|
||||
|
||||
# Starts the fusion screen
|
||||
|
||||
def pbStartScreen(pokemon1, pokemon2, newspecies,splicerItem)
|
||||
def pbStartScreen(pokemon1, pokemon2, newspecies)
|
||||
@sprites = {}
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@@ -660,19 +534,12 @@ class PokemonFusionScene
|
||||
@sprites["rsprite1"] = PokemonSprite.new(@viewport)
|
||||
@sprites["rsprite2"] = PokemonSprite.new(@viewport)
|
||||
@sprites["rsprite3"] = PokemonSprite.new(@viewport)
|
||||
@sprites["dnasplicer"] = IconSprite.new(300, 150, @viewport)
|
||||
@sprites["dnasplicer"].x=(Graphics.width/2)-30
|
||||
@sprites["dnasplicer"].y=(Graphics.height/2)-50
|
||||
@sprites["dnasplicer"].opacity=0
|
||||
|
||||
@sprites["rsprite1"].setPokemonBitmapFromId(poke1_number, false, pokemon1.shiny?)
|
||||
@sprites["rsprite3"].setPokemonBitmapFromId(poke2_number, false, pokemon2.shiny?)
|
||||
|
||||
@sprites["rsprite2"].setPokemonBitmapFromId(@newspecies, false, pokemon1.shiny? || pokemon2.shiny?, pokemon1.shiny?, pokemon2.shiny?)
|
||||
|
||||
splicer_bitmap = _INTL("Graphics/Items/{1}",splicerItem)
|
||||
@sprites["dnasplicer"].setBitmap(splicer_bitmap)
|
||||
|
||||
@sprites["rsprite1"].ox = @sprites["rsprite1"].bitmap.width / 2
|
||||
@sprites["rsprite1"].oy = @sprites["rsprite1"].bitmap.height / 2
|
||||
|
||||
@@ -701,21 +568,8 @@ class PokemonFusionScene
|
||||
@sprites["rsprite3"].zoom_x = Settings::FRONTSPRITE_SCALE
|
||||
@sprites["rsprite3"].zoom_y = Settings::FRONTSPRITE_SCALE
|
||||
|
||||
#pbGenerateMetafiles(@sprites["rsprite1"].ox, @sprites["rsprite1"].oy, @sprites["rsprite2"].ox, @sprites["rsprite2"].oy, @sprites["rsprite3"].ox, @sprites["rsprite3"].oy, @sprites["rsprite1"].x, @sprites["rsprite3"].x)
|
||||
pbGenerateMetafiles(@sprites["rsprite1"].ox, @sprites["rsprite1"].oy, @sprites["rsprite2"].ox, @sprites["rsprite2"].oy, @sprites["rsprite3"].ox, @sprites["rsprite3"].oy, @sprites["rsprite1"].x, @sprites["rsprite3"].x)
|
||||
|
||||
ellipse_center_x = (Graphics.width/2)
|
||||
ellipse_center_y = (Graphics.height/2)-50
|
||||
ellipse_major_axis_length = 250
|
||||
ellipse_minor_axis_length = 100
|
||||
|
||||
@sprites["rsprite1"].x = ellipse_center_x + ellipse_major_axis_length * Math.cos(0)-75
|
||||
@sprites["rsprite1"].y = ellipse_center_y + ellipse_minor_axis_length * Math.sin(0)
|
||||
|
||||
@sprites["rsprite3"].x = ellipse_center_x + ellipse_major_axis_length * Math.cos(Math::PI)+75
|
||||
@sprites["rsprite3"].y = ellipse_center_y + ellipse_minor_axis_length * Math.sin(Math::PI)
|
||||
|
||||
pbGenerateMetafiles(7.2,ellipse_center_x,ellipse_center_y,ellipse_major_axis_length,ellipse_minor_axis_length)
|
||||
generateSplicerMetaFile(7.2,@sprites["dnasplicer"].x,@sprites["dnasplicer"].y)
|
||||
@sprites["msgwindow"] = Kernel.pbCreateMessageWindow(@viewport)
|
||||
pbFadeInAndShow(@sprites)
|
||||
|
||||
@@ -783,12 +637,11 @@ class PokemonFusionScene
|
||||
metaplayer1 = SpriteMetafilePlayer.new(@metafile1, @sprites["rsprite1"])
|
||||
metaplayer2 = SpriteMetafilePlayer.new(@metafile2, @sprites["rsprite2"])
|
||||
metaplayer3 = SpriteMetafilePlayer.new(@metafile3, @sprites["rsprite3"])
|
||||
metaplayer4 = SpriteMetafilePlayer.new(@metafile4, @sprites["dnasplicer"])
|
||||
|
||||
metaplayer1.play
|
||||
metaplayer2.play
|
||||
metaplayer3.play
|
||||
#metaplayer4.play
|
||||
|
||||
pbBGMStop()
|
||||
pbPlayCry(@pokemon)
|
||||
Kernel.pbMessageDisplay(@sprites["msgwindow"],
|
||||
@@ -808,7 +661,6 @@ class PokemonFusionScene
|
||||
metaplayer1.update
|
||||
metaplayer2.update
|
||||
metaplayer3.update
|
||||
metaplayer4.update
|
||||
|
||||
Graphics.update
|
||||
Input.update
|
||||
@@ -831,7 +683,7 @@ class PokemonFusionScene
|
||||
frames.times do
|
||||
Graphics.update
|
||||
end
|
||||
#pbMEPlay("Voltorb Flip Win")
|
||||
pbMEPlay("Voltorb Flip Win")
|
||||
newSpecies = GameData::Species.get(@newspecies)
|
||||
newspeciesname = newSpecies.real_name
|
||||
oldspeciesname = GameData::Species.get(@pokemon1.species).real_name
|
||||
@@ -839,11 +691,11 @@ class PokemonFusionScene
|
||||
overlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap
|
||||
|
||||
sprite_bitmap = @sprites["rsprite2"].getBitmap
|
||||
drawSpriteCredits(sprite_bitmap.filename, sprite_bitmap.path, @viewport)
|
||||
pbBGMPlay(pbGetWildVictoryME)
|
||||
drawSpriteCredits(sprite_bitmap.filename,sprite_bitmap.path, @viewport)
|
||||
Kernel.pbMessageDisplay(@sprites["msgwindow"],
|
||||
_INTL("\\se[]Congratulations! Your Pokémon were fused into {2}!\\wt[80]", @pokemon1.name, newspeciesname))
|
||||
|
||||
|
||||
#exp
|
||||
@pokemon1.exp_when_fused_head = @pokemon2.exp
|
||||
@pokemon1.exp_when_fused_body = @pokemon1.exp
|
||||
@@ -897,7 +749,7 @@ class PokemonFusionScene
|
||||
removeItem = false
|
||||
if @pokemon2.isShiny? || @pokemon1.isShiny?
|
||||
@pokemon1.makeShiny
|
||||
if !(@pokemon1.debug_shiny || @pokemon2.debug_shiny)
|
||||
if !(@pokemon1.debug_shiny ||@pokemon2.debug_shiny)
|
||||
@pokemon1.natural_shiny = true if @pokemon2.natural_shiny
|
||||
end
|
||||
end
|
||||
@@ -913,31 +765,30 @@ class PokemonFusionScene
|
||||
@pokemon1.level = setPokemonLevel(@pokemon1.level, @pokemon2.level, superSplicer)
|
||||
@pokemon1.calc_stats
|
||||
@pokemon1.obtain_method = 0
|
||||
pbBGMStop
|
||||
pbBGMPlay($PokemonTemp.cueBGM)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def drawSpriteCredits(filename, path, viewport)
|
||||
def drawSpriteCredits(filename,path,viewport)
|
||||
overlay = BitmapSprite.new(Graphics.width, Graphics.height, @viewport).bitmap
|
||||
|
||||
return if path.start_with?(Settings::BATTLERS_FOLDER)
|
||||
x = Graphics.width / 2
|
||||
y = 240
|
||||
spritename = File.basename(filename, '.*')
|
||||
x= Graphics.width/2
|
||||
y=240
|
||||
spritename = File.basename(filename,'.*')
|
||||
|
||||
discord_name = getSpriteCredits(spritename)
|
||||
return if !discord_name
|
||||
return if !discord_name
|
||||
|
||||
author_name = File.basename(discord_name, '#*')
|
||||
return if author_name == nil
|
||||
author_name = File.basename(discord_name,'#*')
|
||||
return if author_name == nil
|
||||
|
||||
label_base_color = Color.new(98, 231, 110)
|
||||
label_shadow_color = Color.new(27, 169, 40)
|
||||
|
||||
#label_shadow_color = Color.new(33, 209, 50)
|
||||
text = _INTL("Sprite by {1}", author_name)
|
||||
text = _INTL("Sprite by {1}",author_name)
|
||||
textpos = [[text, x, y, 2, label_base_color, label_shadow_color]]
|
||||
pbDrawTextPositions(overlay, textpos)
|
||||
end
|
||||
@@ -960,8 +811,9 @@ def setAbilityAndNatureAndNickname(abilitiesList, naturesList)
|
||||
@pokemon1.body_original_ability_index = @pokemon1.ability_index
|
||||
@pokemon1.head_original_ability_index = @pokemon2.ability_index
|
||||
|
||||
|
||||
@pokemon1.ability = scene.selectedAbility
|
||||
@pokemon1.ability_index = locate_ability_index(@pokemon1, scene.selectedAbility)
|
||||
@pokemon1.ability_index = locate_ability_index(@pokemon1,scene.selectedAbility)
|
||||
@pokemon1.nature = scene.selectedNature
|
||||
if scene.hasNickname
|
||||
@pokemon1.name = scene.nickname
|
||||
@@ -979,6 +831,7 @@ def locate_ability_index(pokemon, ability)
|
||||
return nil
|
||||
end
|
||||
|
||||
|
||||
def setFusionMoves(fusedPoke, poke2, selected2ndOption = false)
|
||||
#NEW METHOD (not ready)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,28 +45,7 @@ SWITCH_GOT_BADGE_13 = 43
|
||||
SWITCH_GOT_BADGE_14 = 44
|
||||
SWITCH_GOT_BADGE_15 = 45
|
||||
SWITCH_GOT_BADGE_16 = 50
|
||||
SWITCH_KANTO_DARKNESS = 701
|
||||
SWITCH_KANTO_DARKNESS_STAGE_1 = 702
|
||||
SWITCH_KANTO_DARKNESS_STAGE_2 = 703
|
||||
SWITCH_KANTO_DARKNESS_STAGE_3 = 704
|
||||
SWITCH_KANTO_DARKNESS_STAGE_4 = 705
|
||||
|
||||
SWITCH_ORICORIO_QUEST_PINK = 672
|
||||
SWITCH_ORICORIO_QUEST_RED = 673
|
||||
SWITCH_ORICORIO_QUEST_BLUE = 674
|
||||
SWITCH_ORICORIO_QUEST_IN_PROGRESS = 680
|
||||
|
||||
SWITCH_PICKED_HELIC_FOSSIL= 65
|
||||
SWITCH_PICKED_DOME_FOSSIL= 66
|
||||
|
||||
SWITCH_PICKED_LILEEP_FOSSIL= 589
|
||||
SWITCH_PICKED_ANORITH_FOSSIL= 90
|
||||
|
||||
SWITCH_PICKED_ARMOR_FOSSIL= 616
|
||||
SWITCH_PICKED_SKULL_FOSSIL= 617
|
||||
|
||||
|
||||
VAR_ORICORIO_FLOWERS = 276
|
||||
#Randomizer Switches
|
||||
SWITCH_RANDOM_WILD_TO_FUSION=953
|
||||
SWITCH_RANDOMIZED_AT_LEAST_ONCE = 855
|
||||
@@ -173,19 +152,13 @@ VAR_GALLERY_SELECTED_ARTIST = 263
|
||||
VAR_NEXT_ARTIST_FORMATTED = 264
|
||||
|
||||
VAR_RADIO_POINTS=266
|
||||
VAR_TRAINER_GENDER=52
|
||||
|
||||
#Randomizer
|
||||
VAR_RANDOMIZER_WILD_POKE_BST=197
|
||||
VAR_RANDOMIZER_TRAINER_BST=195
|
||||
VAR_GYM_TYPES_ARRAY=151
|
||||
VAR_CURRENT_GYM_TYPE=152
|
||||
|
||||
##############
|
||||
# COMMON EVENTS
|
||||
################
|
||||
COMMON_EVENT_REGI_TABLET = 84
|
||||
|
||||
|
||||
#############
|
||||
# OTHERS #
|
||||
#############
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module PBSpecies
|
||||
#couldn't figure out how to get the size of GameData::Species so fuck it, here's the hardcoded value
|
||||
def PBSpecies.maxValue
|
||||
return NB_POKEMON*NB_POKEMON
|
||||
return 176840
|
||||
end
|
||||
|
||||
def PBSpecies.getName(species)
|
||||
|
||||
@@ -216,12 +216,13 @@ class PokemonFusionScene
|
||||
|
||||
def pbChooseAbility(poke, hidden1 = false, hidden2 = false)
|
||||
abilityList = poke.getAbilityList
|
||||
|
||||
if $game_switches[SWITCH_DOUBLE_ABILITIES]
|
||||
abID1 = @pokemon1.ability
|
||||
abID2 = @pokemon2.ability
|
||||
else
|
||||
abID1 = hidden1 ? abilityList[-2][0] : abilityList[0][0]
|
||||
abID2 = hidden2 ? abilityList[-1][0] : abilityList[1][0]
|
||||
abID1 = hidden1 ? abilityList[4][0] : abilityList[0][0]
|
||||
abID2 = hidden2 ? abilityList[5][0] : abilityList[1][0]
|
||||
end
|
||||
availableNatures = []
|
||||
availableNatures << @pokemon1.nature
|
||||
|
||||
@@ -81,19 +81,6 @@ class FusionTutorService
|
||||
@show_full_list = value
|
||||
end
|
||||
|
||||
#todo: these moves
|
||||
# DRAGONHAMMER
|
||||
# FIRELASH
|
||||
# BEAKBLAST
|
||||
# CHATTER
|
||||
# SOLARBLADE
|
||||
# LEAFAGE
|
||||
# HEADCHARGE
|
||||
# HYPERSPACEHOLE
|
||||
# HOLDBACK
|
||||
# CELEBRATE
|
||||
# HEARTSWAP
|
||||
|
||||
def getCompatibleMoves(includeLegendaries = false)
|
||||
compatibleMoves = []
|
||||
#normal moves
|
||||
@@ -115,7 +102,7 @@ class FusionTutorService
|
||||
compatibleMoves << :ELECTRIFY if is_fusion_of([:KLINK, :KLANG, :KLINKLANG]) || hasType(:ELECTRIC)
|
||||
compatibleMoves << :AROMATICMIST if is_fusion_of([:WEEZING, :BULBASAUR, :IVYSAUR, :VENUSAUR, :CHIKORITA, :BAYLEEF, :MEGANIUM, :GLOOM, :VILEPLUME, :BELLOSSOM, :ROSELIA, :ROSERADE])
|
||||
compatibleMoves << :FLORALHEALING if is_fusion_of([:SUNFLORA, :BELLOSSOM, :ROSELIA, :ROSERADE])
|
||||
#compatibleMoves << :FLYINGPRESS if is_fusion_of([:TORCHIC, :COMBUSKEN, :BLAZIKEN, :FARFETCHD, :HERACROSS]) || (hasType(:FLYING) && hasType(:FIGHTING))
|
||||
compatibleMoves << :FLYINGPRESS if is_fusion_of([:TORCHIC, :COMBUSKEN, :BLAZIKEN, :FARFETCHD, :HERACROSS]) || (hasType(:FLYING) && hasType(:FIGHTING))
|
||||
compatibleMoves << :SECRETSWORD if is_fusion_of([:HONEDGE, :DOUBLADE, :AEGISLASH, :GALLADE, :FARFETCHD, :ABSOL, :BISHARP])
|
||||
compatibleMoves << :MATBLOCK if is_fusion_of([:MACHOP, :MACHOKE, :MACHAMP, :TYROGUE, :HITMONLEE, :HITMONCHAN, :HITMONTOP])
|
||||
compatibleMoves << :MINDBLOWN if is_fusion_of([:VOLTORB, :ELECTRODE, :EXEGGUTOR])
|
||||
@@ -125,22 +112,22 @@ class FusionTutorService
|
||||
compatibleMoves << :SPIRITSHACKLE if is_fusion_of([:BANETTE, :SPIRITOMB, :DUSKNOIR, :SHEDINJA, :COFAGRIGUS])
|
||||
compatibleMoves << :TRICKORTREAT if (hasType(:GRASS) && hasType(:GHOST)) || is_fusion_of([:GASTLY, :HAUNTER, :GENGAR, :MIMIKYU, :ZORUA, :ZOROARK])
|
||||
compatibleMoves << :TROPKICK if is_fusion_of([:HITMONLEE, :HITMONTOP, :ROSERADE]) || (hasType(:GRASS) && hasType(:FIGHTING))
|
||||
#compatibleMoves << :NEEDLEARM if is_fusion_of([:FERROTHORN])
|
||||
#compatibleMoves << :FORESTSCURSE if (hasType(:GRASS) && hasType(:GHOST))
|
||||
#compatibleMoves << :SPIKYSHIELD if is_fusion_of([:FERROSEED, :FERROTHORN]) || (is_fusion_of([:SANDSLASH, :JOLTEON, :CLOYSTER]) && hasType(:GRASS))
|
||||
compatibleMoves << :NEEDLEARM if is_fusion_of([:FERROTHORN])
|
||||
compatibleMoves << :FORESTSCURSE if (hasType(:GRASS) && hasType(:GHOST))
|
||||
compatibleMoves << :SPIKYSHIELD if is_fusion_of([:FERROSEED, :FERROTHORN]) || (is_fusion_of([:SANDSLASH, :JOLTEON, :CLOYSTER]) && hasType(:GRASS))
|
||||
compatibleMoves << :STRENGTHSAP if is_fusion_of([:ODDISH, :GLOOM, :VILEPLUME, :BELLOSSOM, :HOPPIP, :SKIPLOOM, :JUMPLUFF, :BELLSPROUT, :WEEPINBELL, :VICTREEBEL, :PARAS, :PARASECT, :DRIFBLIM, :BRELOOM])
|
||||
#compatibleMoves << :SHOREUP if is_fusion_of([:GRIMER, :MUK]) && hasType(:GROUND)
|
||||
compatibleMoves << :ICEHAMMER if (canLearnMove(:CRABHAMMER) || canLearnMove(:GRASSHAMMER) || canLearnMove(:HAMMERARM)) && hasType(:ICE)
|
||||
compatibleMoves << :SHOREUP if is_fusion_of([:GRIMER, :MUK]) && hasType(:GROUND)
|
||||
compatibleMoves << :ICEHAMMER if (canLearnMove(:CRABHAMMER) || canLearnMove(:GRASSHAMMER)) && hasType(:ICE)
|
||||
compatibleMoves << :MULTIATTACK if is_fusion_of([:ARCEUS, :MEW, :GENESECT])
|
||||
# compatibleMoves << :REVELATIONDANCE if is_fusion_of([:KECLEON, :BELLOSSOM, :CLEFAIRY, :CLEFABLE, :CLEFFA])
|
||||
#compatibleMoves << :BANEFULBUNKER if is_fusion_of([:TENTACOOL, :TENTACRUEL, :NIDORINA, :NIDORINO, :NIDOQUEEN, :NIDOKING, :GRIMER, :MUK, :QWILFISH])
|
||||
compatibleMoves << :REVELATIONDANCE if is_fusion_of([:KECLEON, :BELLOSSOM, :CLEFAIRY, :CLEFABLE, :CLEFFA])
|
||||
compatibleMoves << :BANEFULBUNKER if is_fusion_of([:TENTACOOL, :TENTACRUEL, :NIDORINA, :NIDORINO, :NIDOQUEEN, :NIDOKING, :GRIMER, :MUK, :QWILFISH])
|
||||
compatibleMoves << :INSTRUCT if is_fusion_of([:CHIMCHAR, :MONFERNO, :INFERNAPE, :KADABRA, :ALAKAZAM, :SLOWKING])
|
||||
compatibleMoves << :PSYCHICTERRAIN if hasType(:PSYCHIC)
|
||||
#compatibleMoves << :GRASSYTERRAIN if hasType(:GRASS)
|
||||
compatibleMoves << :GRASSYTERRAIN if hasType(:GRASS)
|
||||
compatibleMoves << :MISTYTERRAIN if hasType(:FAIRY)
|
||||
compatibleMoves << :SPEEDSWAP if is_fusion_of([:PIKACHU, :RAICHU, :ABRA, :KADABRA, :ALAKAZAM, :PORYGON, :PORYGON2, :PORYGONZ, :MEWTWO, :MEW, :JOLTIK, :GALVANTULA])
|
||||
#compatibleMoves << :ACCELEROCK if is_fusion_of([:AERODACTYL, :KABUTOPS, :ANORITH, :ARMALDO])
|
||||
#compatibleMoves << :ANCHORSHOT if (is_fusion_of([:EMPOLEON, :STEELIX, :BELDUM, :METANG, :METAGROSS, :KLINK, :KLINKLANG, :KLANG, :ARON, :LAIRON, :AGGRON]) && hasType(:WATER)) || (is_fusion_of([:LAPRAS, :WAILORD, :KYOGRE]) && hasType(:STEEL))
|
||||
compatibleMoves << :ACCELEROCK if is_fusion_of([:AERODACTYL, :KABUTOPS, :ANORITH, :ARMALDO])
|
||||
compatibleMoves << :ANCHORSHOT if (is_fusion_of([:EMPOLEON, :STEELIX, :BELDUM, :METANG, :METAGROSS, :KLINK, :KLINKLANG, :KLANG, :ARON, :LAIRON, :AGGRON]) && hasType(:WATER)) || (is_fusion_of([:LAPRAS, :WAILORD, :KYOGRE]) && hasType(:STEEL))
|
||||
compatibleMoves << :SPARKLINGARIA if (is_fusion_of([:JYNX, :JIGGLYPUFF, :WIGGLYTUFF]) && hasType(:WATER)) || is_fusion_of([:LAPRAS])
|
||||
compatibleMoves << :WATERSHURIKEN if is_fusion_of([:NINJASK, :LUCARIO, :ZOROARK, :BISHARP]) && hasType(:WATER)
|
||||
end
|
||||
@@ -168,8 +155,8 @@ class FusionTutorService
|
||||
compatibleMoves << :RELICSONG if is_fusion_of([:JYNX, :LAPRAS, :JIGGLYPUFF, :WIGGLYTUFF, :MISDREAVUS, :MISMAGIUS])
|
||||
compatibleMoves << :HAPPYHOUR if is_fusion_of([:MEOWTH, :JIRACHI, :DELIBIRD, :MUNCHLAX, :SNORLAX, :PIKACHU, :RAICHU])
|
||||
compatibleMoves << :HOLDHANDS if is_fusion_of([:CHARMANDER, :BULBASAUR, :SQUIRTLE, :PIKACHU, :TOGEPI])
|
||||
#compatibleMoves << :PRISMATICLASER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :DEOXYS, :MEWTWO, :MEW]) && hasType(:PSYCHIC)
|
||||
#compatibleMoves << :PHOTONGEYSER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :MEW, :MEWTWO, :DEOXYS]) && hasType(:PSYCHIC)
|
||||
compatibleMoves << :PRISMATICLASER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :DEOXYS, :MEWTWO, :MEW]) && hasType(:PSYCHIC)
|
||||
compatibleMoves << :PHOTONGEYSER if is_fusion_of([:LANTURN, :AMPHAROS, :HOOH, :MEW, :MEWTWO, :DEOXYS]) && hasType(:PSYCHIC)
|
||||
compatibleMoves << :LUNARDANCE if is_fusion_of([:CLEFAIRY, :CLEFABLE, :STARYU, :STARMIE])
|
||||
compatibleMoves << :DIAMONDSTORM if ((hasType(:FAIRY) && hasType(:ROCK)) || (hasType(:ROCK) && hasType(:STEEL))) || is_fusion_of([:DIALGA, :STEELIX])
|
||||
compatibleMoves << :SUNSTEELSTRIKE if is_fusion_of([:CHARIZARD, :VOLCARONA, :FLAREON, :NINETALES, :ENTEI, :HOOH, :RAPIDASH]) && hasType(:STEEL)
|
||||
|
||||
@@ -5,26 +5,26 @@ module GameData
|
||||
species = GameData::Species.get(species).id_number # Just to be sure it's a number
|
||||
return self.egg_sprite_bitmap(species, pkmn.form) if pkmn.egg?
|
||||
if back
|
||||
ret = self.back_sprite_bitmap(species, pkmn.spriteform_body, pkmn.spriteform_head, pkmn.shiny?, pkmn.bodyShiny?, pkmn.headShiny?)
|
||||
ret = self.back_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?)
|
||||
else
|
||||
ret = self.front_sprite_bitmap(species, pkmn.spriteform_body, pkmn.spriteform_head, pkmn.shiny?, pkmn.bodyShiny?, pkmn.headShiny?)
|
||||
ret = self.front_sprite_bitmap(species, nil, nil, pkmn.shiny?,pkmn.bodyShiny?,pkmn.headShiny?)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
def self.sprite_bitmap_from_pokemon_id(id, back = false, shiny = false, bodyShiny = false, headShiny = false)
|
||||
def self.sprite_bitmap_from_pokemon_id(id, back = false, shiny=false, bodyShiny=false,headShiny=false)
|
||||
if back
|
||||
ret = self.back_sprite_bitmap(id, nil, nil, shiny, bodyShiny, headShiny)
|
||||
ret = self.back_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny)
|
||||
else
|
||||
ret = self.front_sprite_bitmap(id, nil, nil, shiny, bodyShiny, headShiny)
|
||||
ret = self.front_sprite_bitmap(id,nil,nil,shiny,bodyShiny,headShiny)
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
MAX_SHIFT_VALUE = 360
|
||||
MINIMUM_OFFSET = 40
|
||||
ADDITIONAL_OFFSET_WHEN_TOO_CLOSE = 40
|
||||
MINIMUM_DEX_DIF = 20
|
||||
MINIMUM_OFFSET=40
|
||||
ADDITIONAL_OFFSET_WHEN_TOO_CLOSE=40
|
||||
MINIMUM_DEX_DIF=20
|
||||
|
||||
def self.calculateShinyHueOffset(dex_number, isBodyShiny = false, isHeadShiny = false)
|
||||
if dex_number <= NB_POKEMON
|
||||
@@ -32,35 +32,36 @@ module GameData
|
||||
return SHINY_COLOR_OFFSETS[dex_number]
|
||||
end
|
||||
body_number = dex_number
|
||||
head_number = dex_number
|
||||
head_number=dex_number
|
||||
|
||||
else
|
||||
else
|
||||
body_number = getBodyID(dex_number)
|
||||
head_number = getHeadID(dex_number, body_number)
|
||||
head_number=getHeadID(dex_number,body_number)
|
||||
end
|
||||
if isBodyShiny && isHeadShiny && SHINY_COLOR_OFFSETS[body_number] && SHINY_COLOR_OFFSETS[head_number]
|
||||
if isBodyShiny && isHeadShiny && SHINY_COLOR_OFFSETS[body_number] && SHINY_COLOR_OFFSETS[head_number]
|
||||
offset = SHINY_COLOR_OFFSETS[body_number] + SHINY_COLOR_OFFSETS[head_number]
|
||||
elsif isHeadShiny && SHINY_COLOR_OFFSETS[head_number]
|
||||
offset = SHINY_COLOR_OFFSETS[head_number]
|
||||
elsif isBodyShiny && SHINY_COLOR_OFFSETS[body_number]
|
||||
offset = SHINY_COLOR_OFFSETS[body_number]
|
||||
else
|
||||
offset = calculateShinyHueOffsetDefaultMethod(body_number, head_number, dex_number, isBodyShiny, isHeadShiny)
|
||||
offset = calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number,isBodyShiny,isHeadShiny)
|
||||
end
|
||||
return offset
|
||||
end
|
||||
|
||||
def self.calculateShinyHueOffsetDefaultMethod(body_number, head_number, dex_number, isBodyShiny = false, isHeadShiny = false)
|
||||
|
||||
def self.calculateShinyHueOffsetDefaultMethod(body_number,head_number,dex_number, isBodyShiny = false, isHeadShiny = false)
|
||||
dex_offset = dex_number
|
||||
#body_number = getBodyID(dex_number)
|
||||
#head_number=getHeadID(dex_number,body_number)
|
||||
dex_diff = (body_number - head_number).abs
|
||||
dex_diff = (body_number-head_number).abs
|
||||
if isBodyShiny && isHeadShiny
|
||||
dex_offset = dex_number
|
||||
elsif isHeadShiny
|
||||
dex_offset = head_number
|
||||
elsif isBodyShiny
|
||||
dex_offset = dex_diff > MINIMUM_DEX_DIF ? body_number : body_number + ADDITIONAL_OFFSET_WHEN_TOO_CLOSE
|
||||
dex_offset = dex_diff > MINIMUM_DEX_DIF ? body_number : body_number+ADDITIONAL_OFFSET_WHEN_TOO_CLOSE
|
||||
end
|
||||
offset = dex_offset + Settings::SHINY_HUE_OFFSET
|
||||
offset /= MAX_SHIFT_VALUE if offset > NB_POKEMON
|
||||
@@ -70,15 +71,21 @@ module GameData
|
||||
return offset
|
||||
end
|
||||
|
||||
def self.front_sprite_bitmap(dex_number, spriteform_body = nil, spriteform_head = nil, isShiny = false, bodyShiny = false, headShiny = false)
|
||||
spriteform_body = nil if spriteform_body == 0
|
||||
spriteform_head = nil if spriteform_head == 0
|
||||
|
||||
def self.front_sprite_bitmap(dex_number, a = 0, b = 0, isShiny = false, bodyShiny = false, headShiny = false)
|
||||
#la méthode est utilisé ailleurs avec d'autres arguments (gender, form, etc.) mais on les veut pas
|
||||
if dex_number.is_a?(Symbol)
|
||||
dex_number = GameData::Species.get(dex_number).id_number
|
||||
end
|
||||
filename = self.sprite_filename(dex_number, spriteform_body, spriteform_head)
|
||||
filename = self.sprite_filename(dex_number)
|
||||
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
if isShiny
|
||||
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
|
||||
end
|
||||
return sprite
|
||||
end
|
||||
|
||||
def self.back_sprite_bitmap(dex_number, b = 0, form = 0, isShiny = false, bodyShiny = false, headShiny = false)
|
||||
filename = self.sprite_filename(dex_number)
|
||||
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
if isShiny
|
||||
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
|
||||
@@ -86,16 +93,7 @@ module GameData
|
||||
return sprite
|
||||
end
|
||||
|
||||
def self.back_sprite_bitmap(dex_number, spriteform_body = nil, spriteform_head = nil, isShiny = false, bodyShiny = false, headShiny = false)
|
||||
filename = self.sprite_filename(dex_number, spriteform_body, spriteform_head)
|
||||
sprite = (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
if isShiny
|
||||
sprite.shiftColors(self.calculateShinyHueOffset(dex_number, bodyShiny, headShiny))
|
||||
end
|
||||
return sprite
|
||||
end
|
||||
|
||||
def self.egg_sprite_bitmap(dex_number, form = nil)
|
||||
def self.egg_sprite_bitmap(dex_number, form = 0)
|
||||
filename = self.egg_sprite_filename(dex_number, form)
|
||||
return (filename) ? AnimatedBitmap.new(filename) : nil
|
||||
end
|
||||
@@ -103,9 +101,7 @@ module GameData
|
||||
def self.getSpecialSpriteName(dexNum)
|
||||
base_path = "Graphics/Battlers/special/"
|
||||
case dexNum
|
||||
when Settings::ZAPMOLCUNO_NB
|
||||
return sprintf(base_path + "144.145.146")
|
||||
when Settings::ZAPMOLCUNO_NB + 1
|
||||
when Settings::ZAPMOLCUNO_NB..Settings::ZAPMOLCUNO_NB + 1
|
||||
return sprintf(base_path + "144.145.146")
|
||||
when Settings::ZAPMOLCUNO_NB + 2
|
||||
return sprintf(base_path + "243.244.245")
|
||||
@@ -157,37 +153,24 @@ module GameData
|
||||
return sprintf(base_path +"343.344.345")
|
||||
when Settings::ZAPMOLCUNO_NB + 25 #sinnohboss right
|
||||
return sprintf(base_path +"invisible")
|
||||
when Settings::ZAPMOLCUNO_NB + 25 #cardboard
|
||||
return sprintf(base_path +"invisible")
|
||||
when Settings::ZAPMOLCUNO_NB + 26 #cardboard
|
||||
return sprintf(base_path + "cardboard")
|
||||
when Settings::ZAPMOLCUNO_NB + 27 #Triple regi
|
||||
return sprintf(base_path + "447.448.449")
|
||||
else
|
||||
return sprintf(base_path + "000")
|
||||
end
|
||||
end
|
||||
|
||||
def self.sprite_filename(dex_number, spriteform_body = nil, spriteform_head = nil)
|
||||
#dex_number = GameData::NAT_DEX_MAPPING[dex_number] ? GameData::NAT_DEX_MAPPING[dex_number] : dex_number
|
||||
if dex_number.is_a?(GameData::Species)
|
||||
dex_number = dex_number.id_number
|
||||
end
|
||||
if dex_number.is_a?(Symbol)
|
||||
dex_number = getDexNumberForSpecies(dex_number)
|
||||
end
|
||||
def self.sprite_filename(dex_number)
|
||||
return nil if dex_number == nil
|
||||
if dex_number <= Settings::NB_POKEMON
|
||||
return get_unfused_sprite_path(dex_number, spriteform_body)
|
||||
return get_unfused_sprite_path(dex_number)
|
||||
else
|
||||
if dex_number >= Settings::ZAPMOLCUNO_NB
|
||||
specialPath = getSpecialSpriteName(dex_number)
|
||||
return pbResolveBitmap(specialPath)
|
||||
head_id = nil
|
||||
head_id=nil
|
||||
else
|
||||
body_id = getBodyID(dex_number)
|
||||
head_id = getHeadID(dex_number, body_id)
|
||||
return get_fusion_sprite_path(head_id, body_id, spriteform_body, spriteform_head)
|
||||
return get_fusion_sprite_path(head_id,body_id)
|
||||
# folder = head_id.to_s
|
||||
# filename = sprintf("%s.%s.png", head_id, body_id)
|
||||
end
|
||||
@@ -207,161 +190,47 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
def get_unfused_sprite_path(dex_number_id, spriteform = nil)
|
||||
dex_number = dex_number_id.to_s
|
||||
spriteform_letter = spriteform ? "_" + spriteform.to_s : ""
|
||||
def get_unfused_sprite_path(dex_number)
|
||||
folder = dex_number.to_s
|
||||
substitution_id = _INTL("{1}{2}", dex_number, spriteform_letter)
|
||||
filename = sprintf("%s.png", dex_number)
|
||||
|
||||
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(substitution_id)
|
||||
substitutionPath = $PokemonGlobal.alt_sprite_substitutions[substitution_id]
|
||||
return substitutionPath if pbResolveBitmap(substitutionPath)
|
||||
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(dex_number)
|
||||
return $PokemonGlobal.alt_sprite_substitutions[dex_number]
|
||||
end
|
||||
random_alt = get_random_alt_letter_for_unfused(dex_number, true) #nil if no main
|
||||
random_alt = "" if !random_alt
|
||||
|
||||
|
||||
filename = _INTL("{1}{2}{3}.png", dex_number, spriteform_letter,random_alt)
|
||||
|
||||
normal_path = Settings::BATTLERS_FOLDER + folder + spriteform_letter + "/" + filename
|
||||
normal_path = Settings::BATTLERS_FOLDER + folder + "/" + filename
|
||||
lightmode_path = Settings::BATTLERS_FOLDER + filename
|
||||
|
||||
path = random_alt == "" ? normal_path : lightmode_path
|
||||
|
||||
if pbResolveBitmap(path)
|
||||
record_sprite_substitution(substitution_id,path)
|
||||
return path
|
||||
end
|
||||
downloaded_path = download_unfused_main_sprite(dex_number, random_alt)
|
||||
if pbResolveBitmap(downloaded_path)
|
||||
record_sprite_substitution(substitution_id,downloaded_path)
|
||||
return downloaded_path
|
||||
end
|
||||
return normal_path
|
||||
return normal_path if pbResolveBitmap(normal_path)
|
||||
return lightmode_path
|
||||
end
|
||||
|
||||
def alt_sprites_substitutions_available
|
||||
return $PokemonGlobal && $PokemonGlobal.alt_sprite_substitutions
|
||||
end
|
||||
|
||||
def print_stack_trace
|
||||
stack_trace = caller
|
||||
stack_trace.each_with_index do |call, index|
|
||||
echo("#{index + 1}: #{call}")
|
||||
end
|
||||
end
|
||||
|
||||
def record_sprite_substitution(substitution_id, sprite_name)
|
||||
return if !$PokemonGlobal
|
||||
return if !$PokemonGlobal.alt_sprite_substitutions
|
||||
$PokemonGlobal.alt_sprite_substitutions[substitution_id] = sprite_name
|
||||
end
|
||||
|
||||
def get_fusion_sprite_path(head_id, body_id, spriteform_body = nil, spriteform_head = nil)
|
||||
#Todo: ça va chier si on fusionne une forme d'un pokemon avec une autre forme, mais pas un problème pour tout de suite
|
||||
form_suffix = ""
|
||||
form_suffix += "_" + spriteform_body.to_s if spriteform_body
|
||||
form_suffix += "_" + spriteform_head.to_s if spriteform_head
|
||||
|
||||
def get_fusion_sprite_path(head_id,body_id)
|
||||
#Swap path if alt is selected for this pokemon
|
||||
dex_num = getSpeciesIdForFusion(head_id, body_id)
|
||||
substitution_id = dex_num.to_s + form_suffix
|
||||
|
||||
|
||||
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(substitution_id)
|
||||
substitutionPath= $PokemonGlobal.alt_sprite_substitutions[substitution_id]
|
||||
return substitutionPath if pbResolveBitmap(substitutionPath)
|
||||
dex_num = getSpeciesIdForFusion(head_id,body_id)
|
||||
if alt_sprites_substitutions_available && $PokemonGlobal.alt_sprite_substitutions.keys.include?(dex_num)
|
||||
return $PokemonGlobal.alt_sprite_substitutions[dex_num]
|
||||
end
|
||||
|
||||
random_alt = get_random_alt_letter_for_custom(head_id, body_id) #nil if no main
|
||||
random_alt = "" if !random_alt
|
||||
|
||||
#Try local custom sprite
|
||||
spriteform_body_letter = spriteform_body ? "_" + spriteform_body.to_s : ""
|
||||
spriteform_head_letter = spriteform_head ? "_" + spriteform_head.to_s : ""
|
||||
filename = sprintf("%s.%s.png", head_id, body_id)
|
||||
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" +filename
|
||||
return local_custom_path if pbResolveBitmap(local_custom_path)
|
||||
|
||||
filename = _INTL("{1}{2}.{3}{4}{5}.png", head_id, spriteform_head_letter, body_id, spriteform_body_letter, random_alt)
|
||||
local_custom_path = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + spriteform_head_letter + "/" + filename
|
||||
if pbResolveBitmap(local_custom_path)
|
||||
record_sprite_substitution(substitution_id, local_custom_path)
|
||||
return local_custom_path
|
||||
end
|
||||
#Try to download custom sprite if none found locally
|
||||
downloaded_custom = download_custom_sprite(head_id, body_id, spriteform_body_letter, spriteform_head_letter, random_alt)
|
||||
if downloaded_custom
|
||||
record_sprite_substitution(substitution_id, downloaded_custom)
|
||||
return downloaded_custom
|
||||
end
|
||||
downloaded_custom = download_custom_sprite(head_id,body_id)
|
||||
return downloaded_custom if downloaded_custom
|
||||
|
||||
#Try local generated sprite
|
||||
local_generated_path = Settings::BATTLERS_FOLDER + head_id.to_s + spriteform_head_letter + "/" + filename
|
||||
local_generated_path = Settings::BATTLERS_FOLDER + head_id.to_s + "/" + filename
|
||||
return local_generated_path if pbResolveBitmap(local_generated_path)
|
||||
|
||||
#Download generated sprite if nothing else found
|
||||
autogen_path = download_autogen_sprite(head_id, body_id)
|
||||
#Download generate sprite if nothing else found
|
||||
autogen_path= download_autogen_sprite(head_id,body_id)
|
||||
return autogen_path if pbResolveBitmap(autogen_path)
|
||||
|
||||
return Settings::DEFAULT_SPRITE_PATH
|
||||
end
|
||||
|
||||
def get_random_alt_letter_for_custom(head_id, body_id, onlyMain = true)
|
||||
spriteName = _INTL("{1}.{2}", head_id, body_id)
|
||||
if onlyMain
|
||||
return list_main_sprites_letters(spriteName).sample
|
||||
else
|
||||
return list_all_sprites_letters(spriteName).sample
|
||||
end
|
||||
end
|
||||
|
||||
def get_random_alt_letter_for_unfused(dex_num, onlyMain = true)
|
||||
spriteName = _INTL("{1}", dex_num)
|
||||
if onlyMain
|
||||
letters_list= list_main_sprites_letters(spriteName)
|
||||
else
|
||||
letters_list= list_all_sprites_letters(spriteName)
|
||||
end
|
||||
letters_list << "" #add main sprite
|
||||
return letters_list.sample
|
||||
end
|
||||
|
||||
def list_main_sprites_letters(spriteName)
|
||||
all_sprites = map_alt_sprite_letters_for_pokemon(spriteName)
|
||||
main_sprites = []
|
||||
all_sprites.each do |key, value|
|
||||
main_sprites << key if value == "main"
|
||||
end
|
||||
return main_sprites
|
||||
end
|
||||
|
||||
def list_all_sprites_letters(spriteName)
|
||||
all_sprites_map = map_alt_sprite_letters_for_pokemon(spriteName)
|
||||
letters = []
|
||||
all_sprites_map.each do |key, value|
|
||||
letters << key
|
||||
end
|
||||
return letters
|
||||
end
|
||||
|
||||
def list_alt_sprite_letters(spriteName)
|
||||
all_sprites = map_alt_sprite_letters_for_pokemon(spriteName)
|
||||
alt_sprites = []
|
||||
all_sprites.each do |key, value|
|
||||
alt_sprites << key if value == "alt"
|
||||
end
|
||||
end
|
||||
|
||||
def map_alt_sprite_letters_for_pokemon(spriteName)
|
||||
alt_sprites = {}
|
||||
File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
row = line.split(',')
|
||||
sprite_name = row[0]
|
||||
if sprite_name.start_with?(spriteName) && sprite_name.length > spriteName.length
|
||||
letter = sprite_name[spriteName.length]
|
||||
if letter.match?(/[a-zA-Z]/)
|
||||
main_or_alt = row[2] ? row[2] : nil
|
||||
alt_sprites[letter] = main_or_alt
|
||||
end
|
||||
end
|
||||
end
|
||||
return alt_sprites
|
||||
end
|
||||
@@ -1,702 +0,0 @@
|
||||
#todo: make the flower disappear from the tileset somehow?
|
||||
def oricorioEventPickFlower(flower_color)
|
||||
quest_progression = pbGet(VAR_ORICORIO_FLOWERS)
|
||||
if flower_color == :PINK
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_PINK] = true
|
||||
pbMessage(_INTL("It's a flower with pink nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the pink flowers.", $Trainer.name))
|
||||
elsif flower_color == :RED && quest_progression == 1
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_RED] = true
|
||||
pbMessage(_INTL("It's a flower with red nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the red flowers.", $Trainer.name))
|
||||
elsif flower_color == :BLUE && quest_progression == 2
|
||||
$game_switches[SWITCH_ORICORIO_QUEST_BLUE] = true
|
||||
pbMessage(_INTL("It's a flower with blue nectar."))
|
||||
pbSEPlay("MiningAllFound")
|
||||
pbMessage(_INTL("{1} picked some of the blue flowers.", $Trainer.name))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def changeOricorioFlower(form = 1)
|
||||
return if !($Trainer.has_species_or_fusion?(:ORICORIO_1) || $Trainer.has_species_or_fusion?(:ORICORIO_2) || $Trainer.has_species_or_fusion?(:ORICORIO_3) || $Trainer.has_species_or_fusion?(:ORICORIO_4))
|
||||
message = ""
|
||||
form_name = ""
|
||||
if form == 1
|
||||
message = "It's a flower with red nectar. "
|
||||
form_name = "Baile"
|
||||
elsif form == 2
|
||||
message = "It's a flower with yellow nectar. "
|
||||
form_name = "Pom-pom"
|
||||
elsif form == 3
|
||||
message = "It's a flower with pink nectar. "
|
||||
form_name = "Pa'u"
|
||||
elsif form == 4
|
||||
message = "It's a flower with blue nectar. "
|
||||
form_name = "Sensu"
|
||||
end
|
||||
|
||||
message = message + "Show it to a Pokémon?"
|
||||
if pbConfirmMessage(message)
|
||||
pbChoosePokemon(1, 2,
|
||||
proc { |poke|
|
||||
!poke.egg? &&
|
||||
(Kernel.isPartPokemon(poke, :ORICORIO_1) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_2) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_3) ||
|
||||
Kernel.isPartPokemon(poke, :ORICORIO_4))
|
||||
})
|
||||
if (pbGet(1) != -1)
|
||||
poke = $Trainer.party[pbGet(1)]
|
||||
if changeOricorioForm(poke, form)
|
||||
pbMessage(_INTL("{1} switched to the {2} style", poke.name, form_name))
|
||||
pbSet(1, poke.name)
|
||||
else
|
||||
pbMessage(_INTL("{1} remained the same...", poke.name, form_name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def changeOricorioForm(pokemon, form = nil)
|
||||
oricorio_forms = [:ORICORIO_1, :ORICORIO_2, :ORICORIO_3, :ORICORIO_4]
|
||||
body_id = pokemon.isFusion? ? get_body_species_from_symbol(pokemon.species) : pokemon.species
|
||||
head_id = pokemon.isFusion? ? get_head_species_from_symbol(pokemon.species) : pokemon.species
|
||||
|
||||
oricorio_body = oricorio_forms.include?(body_id)
|
||||
oricorio_head = oricorio_forms.include?(head_id)
|
||||
|
||||
if form == 1
|
||||
body_id = :ORICORIO_1 if oricorio_body
|
||||
head_id = :ORICORIO_1 if oricorio_head
|
||||
elsif form == 2
|
||||
body_id = :ORICORIO_2 if oricorio_body
|
||||
head_id = :ORICORIO_2 if oricorio_head
|
||||
elsif form == 3
|
||||
body_id = :ORICORIO_3 if oricorio_body
|
||||
head_id = :ORICORIO_3 if oricorio_head
|
||||
elsif form == 4
|
||||
body_id = :ORICORIO_4 if oricorio_body
|
||||
head_id = :ORICORIO_4 if oricorio_head
|
||||
else
|
||||
return false
|
||||
end
|
||||
|
||||
head_number = getDexNumberForSpecies(head_id)
|
||||
body_number = getDexNumberForSpecies(body_id)
|
||||
|
||||
newForm = pokemon.isFusion? ? getSpeciesIdForFusion(head_number, body_number) : head_id
|
||||
$Trainer.pokedex.set_seen(newForm)
|
||||
$Trainer.pokedex.set_owned(newForm)
|
||||
|
||||
pokemon.species = newForm
|
||||
return true
|
||||
end
|
||||
|
||||
# tradedPoke = pbGet(154)
|
||||
# party=[tradedPoke]
|
||||
# customTrainerBattle("Eusine",
|
||||
# :MYSTICALMAN,
|
||||
# party,
|
||||
# tradedPoke.level,
|
||||
# "Okay, okay I'll give it back!" )
|
||||
|
||||
def fossilsGuyBattle(level = 20, end_message = "")
|
||||
team = getFossilsGuyTeam(level)
|
||||
customTrainerBattle("Miguel",
|
||||
:SUPERNERD,
|
||||
team,
|
||||
level,
|
||||
end_message
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
def getFossilsGuyTeam(level)
|
||||
base_poke_evolution_level = 20
|
||||
fossils_evolution_level_1 = 30
|
||||
fossils_evolution_level_2 = 50
|
||||
|
||||
fossils = []
|
||||
base_poke = level <= base_poke_evolution_level ? :B88H109 : :B89H110
|
||||
team = []
|
||||
team << Pokemon.new(base_poke, level)
|
||||
|
||||
#Mt. Moon fossil
|
||||
if $game_switches[SWITCH_PICKED_HELIC_FOSSIL]
|
||||
fossils << :KABUTO if level < fossils_evolution_level_1
|
||||
fossils << :KABUTOPS if level >= fossils_evolution_level_1
|
||||
elsif $game_switches[SWITCH_PICKED_DOME_FOSSIL]
|
||||
fossils << :OMANYTE if level < fossils_evolution_level_1
|
||||
fossils << :OMASTAR if level >= fossils_evolution_level_1
|
||||
end
|
||||
|
||||
#S.S. Anne fossil
|
||||
if $game_switches[SWITCH_PICKED_LILEEP_FOSSIL]
|
||||
fossils << :ANORITH if level < fossils_evolution_level_1
|
||||
fossils << :ARMALDO if level >= fossils_evolution_level_1
|
||||
|
||||
elsif $game_switches[SWITCH_PICKED_ANORITH_FOSSIL]
|
||||
fossils << :LILEEP if level < fossils_evolution_level_1
|
||||
fossils << :CRADILY if level >= fossils_evolution_level_1
|
||||
|
||||
end
|
||||
#Celadon fossil
|
||||
if $game_switches[SWITCH_PICKED_ARMOR_FOSSIL]
|
||||
fossils << :CRANIDOS if level < fossils_evolution_level_2
|
||||
fossils << :RAMPARDOS if level >= fossils_evolution_level_2
|
||||
|
||||
elsif $game_switches[SWITCH_PICKED_SKULL_FOSSIL]
|
||||
fossils << :SHIELDON if level < fossils_evolution_level_2
|
||||
fossils << :BASTIODON if level >= fossils_evolution_level_2
|
||||
end
|
||||
|
||||
skip_next = false
|
||||
for index in 0..fossils.length
|
||||
if index == fossils.length - 1
|
||||
team << Pokemon.new(fossils[index], level)
|
||||
else
|
||||
if skip_next
|
||||
skip_next = false
|
||||
next
|
||||
end
|
||||
head_poke = fossils[index]
|
||||
body_poke = fossils[index + 1]
|
||||
if head_poke && body_poke
|
||||
newPoke = getFusionSpecies(dexNum(body_poke), dexNum(head_poke))
|
||||
team << Pokemon.new(newPoke, level)
|
||||
skip_next = true
|
||||
end
|
||||
end
|
||||
end
|
||||
return team
|
||||
end
|
||||
|
||||
def find_last_outfit(player_sprite)
|
||||
for i in 1..Settings::MAX_NB_OUTFITS
|
||||
return i - 1 if !pbResolveBitmap("Graphics/Characters/" + player_sprite + "_" + i.to_s)
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
def changeToNextOutfit(incr = 1)
|
||||
metadata = GameData::Metadata.get_player($Trainer.character_ID)
|
||||
player_sprite = metadata[$game_player.charsetData[1]]
|
||||
|
||||
currentOutfit = $Trainer.outfit
|
||||
currentOutfit = 0 if !currentOutfit
|
||||
|
||||
nextOutfit = currentOutfit + incr
|
||||
nextOutfitName = "Graphics/Characters/" + player_sprite + "_" + nextOutfit.to_s
|
||||
nextOutfitName = "Graphics/Characters/" + player_sprite if nextOutfit == 0
|
||||
if !pbResolveBitmap(nextOutfitName)
|
||||
if incr > 0
|
||||
nextOutfit = 0
|
||||
else
|
||||
nextOutfit = find_last_outfit(player_sprite)
|
||||
end
|
||||
end
|
||||
$Trainer.outfit = nextOutfit
|
||||
end
|
||||
|
||||
def playPokeFluteAnimation
|
||||
return if $Trainer.outfit != 0
|
||||
$game_player.setDefaultCharName("players/pokeflute", 0, false)
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
|
||||
def restoreDefaultCharacterSprite(charset_number=0)
|
||||
meta = GameData::Metadata.get_player($Trainer.character_ID)
|
||||
charset = pbGetPlayerCharset(meta,charset_number)
|
||||
|
||||
$game_player.setDefaultCharName(charset, 0, false)
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
|
||||
def change_game_difficulty(down_only = false)
|
||||
message = "The game is currently on " + get_difficulty_text() + " difficulty."
|
||||
pbMessage(message)
|
||||
|
||||
choice_easy = "Easy"
|
||||
choice_normal = "Normal"
|
||||
choice_hard = "Hard"
|
||||
choice_cancel = "Cancel"
|
||||
|
||||
available_difficulties = []
|
||||
currentDifficulty = get_current_game_difficulty
|
||||
if down_only
|
||||
if currentDifficulty == :HARD
|
||||
available_difficulties << choice_hard
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :NORMAL
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :EASY
|
||||
available_difficulties << choice_easy
|
||||
end
|
||||
else
|
||||
available_difficulties << choice_easy
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_hard
|
||||
end
|
||||
available_difficulties << choice_cancel
|
||||
index = pbMessage("Select a new difficulty", available_difficulties, available_difficulties[-1])
|
||||
choice = available_difficulties[index]
|
||||
case choice
|
||||
when choice_easy
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = true
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_normal
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_hard
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = true
|
||||
when choice_cancel
|
||||
return
|
||||
end
|
||||
|
||||
message = "The game is currently on " + get_difficulty_text() + " difficulty."
|
||||
pbMessage(message)
|
||||
end
|
||||
|
||||
def Kernel.getPlateType(item)
|
||||
return :FIGHTING if item == PBItems::FISTPLATE
|
||||
return :FLYING if item == PBItems::SKYPLATE
|
||||
return :POISON if item == PBItems::TOXICPLATE
|
||||
return :GROUND if item == PBItems::EARTHPLATE
|
||||
return :ROCK if item == PBItems::STONEPLATE
|
||||
return :BUG if item == PBItems::INSECTPLATE
|
||||
return :GHOST if item == PBItems::SPOOKYPLATE
|
||||
return :STEEL if item == PBItems::IRONPLATE
|
||||
return :FIRE if item == PBItems::FLAMEPLATE
|
||||
return :WATER if item == PBItems::SPLASHPLATE
|
||||
return :GRASS if item == PBItems::MEADOWPLATE
|
||||
return :ELECTRIC if item == PBItems::ZAPPLATE
|
||||
return :PSYCHIC if item == PBItems::MINDPLATE
|
||||
return :ICE if item == PBItems::ICICLEPLATE
|
||||
return :DRAGON if item == PBItems::DRACOPLATE
|
||||
return :DARK if item == PBItems::DREADPLATE
|
||||
return :FAIRY if item == PBItems::PIXIEPLATE
|
||||
return -1
|
||||
end
|
||||
|
||||
def Kernel.listPlatesInBag()
|
||||
list = []
|
||||
list << PBItems::FISTPLATE if $PokemonBag.pbQuantity(:FISTPLATE) >= 1
|
||||
list << PBItems::SKYPLATE if $PokemonBag.pbQuantity(:SKYPLATE) >= 1
|
||||
list << PBItems::TOXICPLATE if $PokemonBag.pbQuantity(:TOXICPLATE) >= 1
|
||||
list << PBItems::EARTHPLATE if $PokemonBag.pbQuantity(:EARTHPLATE) >= 1
|
||||
list << PBItems::STONEPLATE if $PokemonBag.pbQuantity(:STONEPLATE) >= 1
|
||||
list << PBItems::INSECTPLATE if $PokemonBag.pbQuantity(:INSECTPLATE) >= 1
|
||||
list << PBItems::SPOOKYPLATE if $PokemonBag.pbQuantity(:SPOOKYPLATE) >= 1
|
||||
list << PBItems::IRONPLATE if $PokemonBag.pbQuantity(:IRONPLATE) >= 1
|
||||
list << PBItems::FLAMEPLATE if $PokemonBag.pbQuantity(:FLAMEPLATE) >= 1
|
||||
list << PBItems::SPLASHPLATE if $PokemonBag.pbQuantity(:SPLASHPLATE) >= 1
|
||||
list << PBItems::MEADOWPLATE if $PokemonBag.pbQuantity(:MEADOWPLATE) >= 1
|
||||
list << PBItems::ZAPPLATE if $PokemonBag.pbQuantity(:ZAPPLATE) >= 1
|
||||
list << PBItems::MINDPLATE if $PokemonBag.pbQuantity(:MINDPLATE) >= 1
|
||||
list << PBItems::ICICLEPLATE if $PokemonBag.pbQuantity(:ICICLEPLATE) >= 1
|
||||
list << PBItems::DRACOPLATE if $PokemonBag.pbQuantity(:DRACOPLATE) >= 1
|
||||
list << PBItems::DREADPLATE if $PokemonBag.pbQuantity(:DREADPLATE) >= 1
|
||||
list << PBItems::PIXIEPLATE if $PokemonBag.pbQuantity(:PIXIEPLATE) >= 1
|
||||
return list
|
||||
end
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
when :FISTPLATE
|
||||
return :FIGHTING
|
||||
when :SKYPLATE
|
||||
return :FLYING
|
||||
when :TOXICPLATE
|
||||
return :POISON
|
||||
when :EARTHPLATE
|
||||
return :GROUND
|
||||
when :STONEPLATE
|
||||
return :ROCK
|
||||
when :INSECTPLATE
|
||||
return :BUG
|
||||
when :SPOOKYPLATE
|
||||
return :GHOST
|
||||
when :IRONPLATE
|
||||
return :STEEL
|
||||
when :FLAMEPLATE
|
||||
return :FIRE
|
||||
when :SPLASHPLATE
|
||||
return :WATER
|
||||
when :MEADOWPLATE
|
||||
return :GRASS
|
||||
when :ZAPPLATE
|
||||
return :ELECTRIC
|
||||
when :MINDPLATE
|
||||
return :PSYCHIC
|
||||
when :ICICLEPLATE
|
||||
return :ICE
|
||||
when :DRACOPLATE
|
||||
return :DRAGON
|
||||
when :DREADPLATE
|
||||
return :DARK
|
||||
when :PIXIEPLATE
|
||||
return :FAIRY
|
||||
else
|
||||
return :NORMAL
|
||||
end
|
||||
end
|
||||
|
||||
def getGenericPokemonCryText(pokemonSpecies)
|
||||
case pokemonSpecies
|
||||
when 25
|
||||
return "Pika!"
|
||||
when 16, 17, 18, 21, 22, 144, 145, 146, 227, 417, 418, 372 #birds
|
||||
return "Squawk!"
|
||||
when 163, 164
|
||||
return "Hoot!" #owl
|
||||
else
|
||||
return "Guaugh!"
|
||||
end
|
||||
end
|
||||
|
||||
def Kernel.setRocketPassword(variableNum)
|
||||
abilityIndex = rand(233)
|
||||
speciesIndex = rand(PBSpecies.maxValue - 1)
|
||||
|
||||
word1 = PBSpecies.getName(speciesIndex)
|
||||
word2 = GameData::Ability.get(abilityIndex).name
|
||||
password = _INTL("{1}'s {2}", word1, word2)
|
||||
pbSet(variableNum, password)
|
||||
end
|
||||
|
||||
def obtainBadgeMessage(badgeName)
|
||||
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
|
||||
end
|
||||
|
||||
KANTO_OUTDOOR_MAPS = [
|
||||
78, #Route 1
|
||||
185, #Secret Garden
|
||||
86, #Route 2
|
||||
90, #Route 2 (north)
|
||||
655, #Hidden Forest
|
||||
40, #Viridian River
|
||||
490, #Route 3
|
||||
106, #Route 4
|
||||
12, #Route 5
|
||||
16, #Route 6
|
||||
413, # Route 7
|
||||
409, # Route 8
|
||||
351, #Route 9 (east)
|
||||
495, #Route 9 (west)
|
||||
154, #Route 10
|
||||
155, #Route 11
|
||||
159, #Route 12
|
||||
440, #Route 14
|
||||
444, #Route 15
|
||||
712, #Creepy house
|
||||
438, #Route 16
|
||||
146, #Route 17
|
||||
517, #Route 18
|
||||
437, #Route 13
|
||||
57, # Route 19
|
||||
227, #Route 19 (underwater)
|
||||
56, #Route 19 (surf race)
|
||||
58, #Route 20
|
||||
480, #Route 20 underwater 1
|
||||
228, #Route 20 underwater 2
|
||||
171, #Route 22
|
||||
8, #Route 24
|
||||
9, #Route 25
|
||||
143, #Route 23
|
||||
145, #Route 26
|
||||
147, #Route 27
|
||||
58, #Route 21
|
||||
#CITIES
|
||||
42, #Pallet Town
|
||||
79, #Viridian City
|
||||
1, #Cerulean City
|
||||
387, #Cerulean City (race)
|
||||
19, #Vermillion City
|
||||
36, #S.S. Anne deck
|
||||
95, #Celadon city
|
||||
436, #Celadon city dept store (roof)
|
||||
472, #Fuchsia city
|
||||
50, #Lavender town
|
||||
108, #Saffron city
|
||||
98, #Cinnabar island
|
||||
167, #Crimson city
|
||||
303, #indigo plateau
|
||||
380, #Pewter city
|
||||
#
|
||||
# DUNGEONS
|
||||
#
|
||||
102, #Mt. Moon
|
||||
103, #Mt. Moon
|
||||
105, #Mt. Moon
|
||||
496, #Mt Moon
|
||||
104, #Mt. Moon
|
||||
494, #Mt. Moon Square
|
||||
140, #Diglett cave
|
||||
398, #Diglett cave
|
||||
399, #Diglett cave
|
||||
349, #Rock tunnel
|
||||
350, #Rock tunnel
|
||||
512, #Rock tunnel (outdoor)
|
||||
445, #Safari Zone 1
|
||||
484, #Safari Zone 2
|
||||
485, #Safari Zone 3
|
||||
486, #Safari Zone 4
|
||||
487, #Safari Zone 5
|
||||
491, #Viridian Forest
|
||||
529, #Mt. Silver entrance
|
||||
777, #Mt. Silver outdoor 1
|
||||
781, #Mt. Silver outdoor 2
|
||||
782, #Mt. Silver
|
||||
783, #Mt. Silver summit
|
||||
400, #Pokemon Tower
|
||||
401, #Pokemon Tower
|
||||
402, #Pokemon Tower
|
||||
403, #Pokemon Tower
|
||||
467, #Pokemon Tower
|
||||
468, #Pokemon Tower
|
||||
469, #Pokemon Tower
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_1 = [
|
||||
50, #Lavender town
|
||||
409, # Route 8
|
||||
351, #Route 9 (east)
|
||||
495, #Route 9 (west)
|
||||
154, #Route 10
|
||||
108, #Saffron city
|
||||
1, #Cerulean City
|
||||
387, #Cerulean City (race)
|
||||
106, #Route 4
|
||||
8, #Route 24
|
||||
9, #Route 25
|
||||
400, #Pokemon Tower
|
||||
401, #Pokemon Tower
|
||||
402, #Pokemon Tower
|
||||
403, #Pokemon Tower
|
||||
467, #Pokemon Tower
|
||||
468, #Pokemon Tower
|
||||
469, #Pokemon Tower
|
||||
159, #Route 12
|
||||
349, #Rock tunnel
|
||||
350, #Rock tunnel
|
||||
512, #Rock tunnel (outdoor)
|
||||
12, #Route 5
|
||||
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_2 = [
|
||||
95, #Celadon city
|
||||
436, #Celadon city dept store (roof)
|
||||
143, #Route 23
|
||||
167, #Crimson city
|
||||
413, # Route 7
|
||||
438, #Route 16
|
||||
146, #Route 17
|
||||
106, #Route 4
|
||||
19, #Vermillion City
|
||||
36, #S.S. Anne deck
|
||||
16, #Route 6
|
||||
437, #Route 13
|
||||
155, #Route 11
|
||||
140, #Diglett cave
|
||||
398, #Diglett cave
|
||||
399, #Diglett cave
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_3 = [
|
||||
472, #Fuchsia city
|
||||
445, #Safari Zone 1
|
||||
484, #Safari Zone 2
|
||||
485, #Safari Zone 3
|
||||
486, #Safari Zone 4
|
||||
487, #Safari Zone 5
|
||||
444, #Route 15
|
||||
440, #Route 14
|
||||
712, #Creepy house
|
||||
517, #Route 18
|
||||
57, # Route 19
|
||||
227, #Route 19 (underwater)
|
||||
56, #Route 19 (surf race)
|
||||
58, #Route 20
|
||||
480, #Route 20 underwater 1
|
||||
228, #Route 20 underwater 2
|
||||
98, #Cinnabar island
|
||||
58, #Route 21
|
||||
]
|
||||
KANTO_DARKNESS_STAGE_4 = KANTO_OUTDOOR_MAPS
|
||||
|
||||
def darknessEffectOnCurrentMap()
|
||||
return if !$game_switches
|
||||
return if !$game_switches[SWITCH_KANTO_DARKNESS]
|
||||
return darknessEffectOnMap($game_map.map_id)
|
||||
end
|
||||
|
||||
def darknessEffectOnMap(map_id)
|
||||
return if !$game_switches
|
||||
return if !$game_switches[SWITCH_KANTO_DARKNESS]
|
||||
return if !KANTO_OUTDOOR_MAPS.include?(map_id)
|
||||
dark_maps = []
|
||||
dark_maps += KANTO_DARKNESS_STAGE_1 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_1]
|
||||
dark_maps += KANTO_DARKNESS_STAGE_2 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_2]
|
||||
dark_maps += KANTO_DARKNESS_STAGE_3 if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_3]
|
||||
dark_maps = KANTO_OUTDOOR_MAPS if $game_switches[SWITCH_KANTO_DARKNESS_STAGE_4]
|
||||
return dark_maps.include?(map_id)
|
||||
end
|
||||
|
||||
def apply_darkness()
|
||||
$PokemonTemp.darknessSprite = DarknessSprite.new
|
||||
darkness = $PokemonTemp.darknessSprite
|
||||
darkness.radius = 276
|
||||
while darkness.radius > 64
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
darkness.radius -= 4
|
||||
end
|
||||
$PokemonGlobal.flashUsed = false
|
||||
$PokemonTemp.darknessSprite.dispose
|
||||
Events.onMapSceneChange.trigger(self, $scene, true)
|
||||
end
|
||||
|
||||
def isInMtMoon()
|
||||
mt_moon_maps = [102, 103, 105, 496, 104]
|
||||
return mt_moon_maps.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
def getMtMoonDirection()
|
||||
maps_east = [380, #Pewter city
|
||||
490, #Route 3
|
||||
303, #indigo plateau
|
||||
145, #Route 26
|
||||
147, #Route 27
|
||||
]
|
||||
maps_south = [
|
||||
8, #Route 24
|
||||
9, #Route 25
|
||||
143, #Route 23
|
||||
167, #Crimson city
|
||||
]
|
||||
maps_west = []
|
||||
return 2 if maps_south.include?($game_map.map_id)
|
||||
return 4 if maps_west.include?($game_map.map_id)
|
||||
return 6 if maps_east.include?($game_map.map_id)
|
||||
return 8 #north (most maps)
|
||||
end
|
||||
|
||||
def has_species_or_fusion?(species, form = -1)
|
||||
return $Trainer.pokemon_party.any? { |p| p && p.isSpecies?(species) || p.isFusionOf(species) }
|
||||
end
|
||||
|
||||
|
||||
|
||||
#Solution: position of boulders [[x,y],[x,y],etc.]
|
||||
def validate_regirock_ice_puzzle(solution)
|
||||
for boulder_position in solution
|
||||
x = boulder_position[0]
|
||||
y = boulder_position[1]
|
||||
# echoln ""
|
||||
# echoln x.to_s + ", " + y.to_s
|
||||
# echoln $game_map.event_at_position(x,y)
|
||||
return false if !$game_map.event_at_position(x,y)
|
||||
end
|
||||
echoln "all boulders in place"
|
||||
return true
|
||||
end
|
||||
|
||||
def validate_regirock_steel_puzzle()
|
||||
expected_pressed_switches = [75,77,74,68,73,69]
|
||||
expected_unpressed_switches = [76,67,72,70]
|
||||
switch_ids = [75,77,76,67,
|
||||
74,68,
|
||||
73,72,70,69]
|
||||
|
||||
|
||||
pressed_switches =[]
|
||||
unpressed_switches = []
|
||||
switch_ids.each do |switch_id|
|
||||
is_pressed = pbGetSelfSwitch(switch_id,"A")
|
||||
if is_pressed
|
||||
pressed_switches << switch_id
|
||||
else
|
||||
unpressed_switches << switch_id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
for event_id in switch_ids
|
||||
is_pressed = pbGetSelfSwitch(event_id,"A")
|
||||
return false if !is_pressed && expected_pressed_switches.include?(event_id)
|
||||
return false if is_pressed && expected_unpressed_switches.include?(event_id)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
def registeel_ice_press_switch(letter)
|
||||
order = pbGet(1)
|
||||
solution = "ssBSBGG"#GGSBBss"
|
||||
registeel_ice_reset_switches() if !order.is_a?(String)
|
||||
order << letter
|
||||
pbSet(1,order)
|
||||
if order == solution
|
||||
echoln "OK"
|
||||
pbSEPlay("Evolution start",nil,130)
|
||||
elsif order.length >= solution.length
|
||||
registeel_ice_reset_switches()
|
||||
end
|
||||
echoln order
|
||||
end
|
||||
|
||||
def registeel_ice_reset_switches()
|
||||
switches_events = [66,78,84,85,86,87,88]
|
||||
switches_events.each do |switch_id|
|
||||
pbSetSelfSwitch(switch_id, "A", false)
|
||||
echoln "reset" + switch_id.to_s
|
||||
end
|
||||
pbSet(1,"")
|
||||
end
|
||||
|
||||
|
||||
def regirock_steel_move_boulder()
|
||||
|
||||
switches_position = [
|
||||
[16,21],[18,21],[20,21],[22,21],
|
||||
[16,23], [22,23],
|
||||
[16,25],[18,25],[20,25],[22,25]
|
||||
]
|
||||
boulder_event = get_self
|
||||
old_x = boulder_event.x
|
||||
old_y = boulder_event.y
|
||||
stepped_off_switch = switches_position.find { |position| position[0] == old_x && position[1] == old_y }
|
||||
|
||||
|
||||
pbPushThisBoulder()
|
||||
boulder_event = get_self
|
||||
|
||||
if stepped_off_switch
|
||||
switch_event = $game_map.get_event_at_position(old_x,old_y,[boulder_event.id])
|
||||
echoln switch_event.id if switch_event
|
||||
pbSEPlay("Entering Door",nil,80)
|
||||
pbSetSelfSwitch(switch_event.id, "A", false) if switch_event
|
||||
end
|
||||
|
||||
stepped_on_switch = switches_position.find { |position| position[0] == boulder_event.x && position[1] == boulder_event.y }
|
||||
if stepped_on_switch
|
||||
switch_event = $game_map.get_event_at_position(boulder_event.x,boulder_event.y,[boulder_event.id])
|
||||
echoln switch_event.id if switch_event
|
||||
pbSEPlay("Entering Door")
|
||||
pbSetSelfSwitch(switch_event.id, "A", true) if switch_event
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
# PokemonFusion
|
||||
#
|
||||
|
||||
NB_POKEMON = Settings::NB_POKEMON#809#420 #351 #aussi CONST_NB_POKE
|
||||
CONST_NB_POKE = NB_POKEMON
|
||||
NB_POKEMON = 420 #351 #aussi CONST_NB_POKE
|
||||
|
||||
def pbPokemonBitmapFile(species)
|
||||
# Used by the Pokédex
|
||||
# Load normal bitmap
|
||||
|
||||
@@ -146,63 +146,16 @@ def getDexNumberForSpecies(species)
|
||||
return dexNum
|
||||
end
|
||||
|
||||
def getFusedPokemonIdFromDexNum(body_dex, head_dex)
|
||||
return ("B" + body_dex.to_s + "H" + head_dex.to_s).to_sym
|
||||
end
|
||||
|
||||
def getPokemon(dexNum)
|
||||
if dexNum.is_a?(Integer)
|
||||
if dexNum > NB_POKEMON
|
||||
body_id = getBodyID(dexNum)
|
||||
head_id = getHeadID(dexNum, body_id)
|
||||
pokemon_id = getFusedPokemonIdFromDexNum(body_id, head_id)
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
else
|
||||
pokemon_id = dexNum
|
||||
end
|
||||
|
||||
return GameData::Species.get(pokemon_id)
|
||||
return GameData::Species.get(dexNum)
|
||||
end
|
||||
|
||||
def getSpecies(dexnum)
|
||||
return getPokemon(dexnum)
|
||||
end
|
||||
|
||||
def getSpeciesIdForFusion(head_number, body_number)
|
||||
return (body_number) * Settings::NB_POKEMON + head_number
|
||||
end
|
||||
|
||||
|
||||
def get_body_species_from_symbol(fused_id)
|
||||
body_num = get_body_number_from_symbol(fused_id)
|
||||
return GameData::Species.get(body_num).species
|
||||
end
|
||||
|
||||
def get_head_species_from_symbol(fused_id)
|
||||
head_num = get_head_number_from_symbol(fused_id)
|
||||
return GameData::Species.get(head_num).species
|
||||
end
|
||||
|
||||
def get_body_number_from_symbol(id)
|
||||
dexNum = getDexNumberForSpecies(id)
|
||||
return dexNum if !isFusion(dexNum)
|
||||
id.to_s.match(/\d+/)[0]
|
||||
return id.to_s.match(/\d+/)[0].to_i
|
||||
end
|
||||
|
||||
def get_head_number_from_symbol(id)
|
||||
dexNum = getDexNumberForSpecies(id)
|
||||
return dexNum if !isFusion(dexNum)
|
||||
return id.to_s.match(/(?<=H)\d+/)[0].to_i
|
||||
end
|
||||
|
||||
def getFusionSpecies(body, head)
|
||||
body_num = getDexNumberForSpecies(body)
|
||||
head_num = getDexNumberForSpecies(head)
|
||||
id = body_num * Settings::NB_POKEMON + head_num
|
||||
return GameData::Species.get(id)
|
||||
def getSpeciesIdForFusion(head_id, body_id)
|
||||
return (body_id) * Settings::NB_POKEMON + head_id
|
||||
end
|
||||
|
||||
#shortcut for using in game events because of script characters limit
|
||||
@@ -214,15 +167,6 @@ def isTripleFusion?(num)
|
||||
return num >= Settings::ZAPMOLCUNO_NB
|
||||
end
|
||||
|
||||
def isFusion(num)
|
||||
return num > Settings::NB_POKEMON && !isTripleFusion?(num)
|
||||
end
|
||||
|
||||
def isSpeciesFusion(species)
|
||||
num = getDexNumberForSpecies(species)
|
||||
return isFusion(num)
|
||||
end
|
||||
|
||||
def getRandomCustomFusionForIntro(returnRandomPokemonIfNoneFound = true, customPokeList = [], maxPoke = -1, recursionLimit = 3)
|
||||
if customPokeList.length == 0
|
||||
customPokeList = getCustomSpeciesList(false)
|
||||
@@ -295,11 +239,7 @@ def getRandomCustomFusion(returnRandomPokemonIfNoneFound = true, customPokeList
|
||||
end
|
||||
|
||||
def getBodyID(species)
|
||||
if species.is_a?(Integer)
|
||||
dexNum = species
|
||||
else
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
end
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
if dexNum % NB_POKEMON == 0
|
||||
return (dexNum / NB_POKEMON) - 1
|
||||
end
|
||||
@@ -307,19 +247,14 @@ def getBodyID(species)
|
||||
end
|
||||
|
||||
def getHeadID(species, bodyId = nil)
|
||||
if species.is_a?(Integer)
|
||||
fused_dexNum = species
|
||||
else
|
||||
fused_dexNum = getDexNumberForSpecies(species)
|
||||
end
|
||||
|
||||
if bodyId == nil
|
||||
bodyId = getBodyID(species)
|
||||
end
|
||||
fused_dexNum = getDexNumberForSpecies(species)
|
||||
body_dexNum = getDexNumberForSpecies(bodyId)
|
||||
|
||||
calculated_number = (fused_dexNum - (body_dexNum * NB_POKEMON)).round
|
||||
return calculated_number == 0 ? NB_POKEMON : calculated_number
|
||||
return calculated_number == 0 ? 420 : calculated_number
|
||||
end
|
||||
|
||||
def getAllNonLegendaryPokemon()
|
||||
@@ -372,6 +307,10 @@ def pbGetSelfSwitch(eventId, switch)
|
||||
return $game_self_switches[[@map_id, eventId, switch]]
|
||||
end
|
||||
|
||||
def obtainBadgeMessage(badgeName)
|
||||
Kernel.pbMessage(_INTL("\\me[Badge get]{1} obtained the {2}!", $Trainer.name, badgeName))
|
||||
end
|
||||
|
||||
def getAllNonLegendaryPokemon()
|
||||
list = []
|
||||
for i in 1..143
|
||||
@@ -442,6 +381,29 @@ def pbBitmap(path)
|
||||
return bmp
|
||||
end
|
||||
|
||||
def Kernel.setRocketPassword(variableNum)
|
||||
abilityIndex = rand(233)
|
||||
speciesIndex = rand(PBSpecies.maxValue - 1)
|
||||
|
||||
word1 = PBSpecies.getName(speciesIndex)
|
||||
word2 = GameData::Ability.get(abilityIndex).name
|
||||
password = _INTL("{1}'s {2}", word1, word2)
|
||||
pbSet(variableNum, password)
|
||||
end
|
||||
|
||||
def getGenericPokemonCryText(pokemonSpecies)
|
||||
case pokemonSpecies
|
||||
when 25
|
||||
return "Pika!"
|
||||
when 16, 17, 18, 21, 22, 144, 145, 146, 227, 417, 418, 372 #birds
|
||||
return "Squawk!"
|
||||
when 163, 164
|
||||
return "Hoot!" #owl
|
||||
else
|
||||
return "Guaugh!"
|
||||
end
|
||||
end
|
||||
|
||||
def obtainPokemonSpritePath(id, includeCustoms = true)
|
||||
head = getBasePokemonID(param.to_i, false)
|
||||
body = getBasePokemonID(param.to_i, true)
|
||||
@@ -466,25 +428,6 @@ def getCustomSpritePath(body, head)
|
||||
return _INTL("Graphics/CustomBattlers/indexed/{1}/{1}.{2}.png", head, body)
|
||||
end
|
||||
|
||||
def customSpriteExistsForm(species,form_id_head=nil, form_id_body=nil)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
|
||||
folder = head.to_s
|
||||
|
||||
folder += "_" + form_id_head.to_s if form_id_head
|
||||
|
||||
spritename = head.to_s
|
||||
spritename += "_" + form_id_head.to_s if form_id_head
|
||||
spritename += "." + body.to_s
|
||||
spritename += "_" + form_id_body.to_s if form_id_body
|
||||
|
||||
pathCustom = _INTL("Graphics/CustomBattlers/indexed/{1}/{2}.png", folder, spritename)
|
||||
|
||||
return true if pbResolveBitmap(pathCustom) != nil
|
||||
return download_custom_sprite(head, body,form_id_head,form_id_body) != nil
|
||||
end
|
||||
|
||||
def customSpriteExists(species)
|
||||
head = getBasePokemonID(species, false)
|
||||
body = getBasePokemonID(species, true)
|
||||
@@ -511,16 +454,58 @@ def customSpriteExistsBase(body, head)
|
||||
return download_custom_sprite(head, body) != nil
|
||||
end
|
||||
|
||||
# def getSpriteCredits(spriteName)
|
||||
# File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
# row = line.split(';')
|
||||
# echo row[0]
|
||||
# if row[0] == spriteName
|
||||
# return row[1]
|
||||
# end
|
||||
# end
|
||||
# return nil
|
||||
# end
|
||||
def getSpriteCredits(spriteName)
|
||||
File.foreach(Settings::CREDITS_FILE_PATH) do |line|
|
||||
row = line.split(';')
|
||||
echo row[0]
|
||||
if row[0] == spriteName
|
||||
return row[1]
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
def getArceusPlateType(heldItem)
|
||||
return :NORMAL if heldItem == nil
|
||||
case heldItem
|
||||
when :FISTPLATE
|
||||
return :FIGHTING
|
||||
when :SKYPLATE
|
||||
return :FLYING
|
||||
when :TOXICPLATE
|
||||
return :POISON
|
||||
when :EARTHPLATE
|
||||
return :GROUND
|
||||
when :STONEPLATE
|
||||
return :ROCK
|
||||
when :INSECTPLATE
|
||||
return :BUG
|
||||
when :SPOOKYPLATE
|
||||
return :GHOST
|
||||
when :IRONPLATE
|
||||
return :STEEL
|
||||
when :FLAMEPLATE
|
||||
return :FIRE
|
||||
when :SPLASHPLATE
|
||||
return :WATER
|
||||
when :MEADOWPLATE
|
||||
return :GRASS
|
||||
when :ZAPPLATE
|
||||
return :ELECTRIC
|
||||
when :MINDPLATE
|
||||
return :PSYCHIC
|
||||
when :ICICLEPLATE
|
||||
return :ICE
|
||||
when :DRACOPLATE
|
||||
return :DRAGON
|
||||
when :DREADPLATE
|
||||
return :DARK
|
||||
when :PIXIEPLATE
|
||||
return :FAIRY
|
||||
else
|
||||
return :NORMAL
|
||||
end
|
||||
end
|
||||
|
||||
def reverseFusionSpecies(species)
|
||||
dexId = getDexNumberForSpecies(species)
|
||||
@@ -539,6 +524,28 @@ def Kernel.getRoamingMap(roamingArrayPos)
|
||||
return text
|
||||
end
|
||||
|
||||
def Kernel.listPlatesInBag()
|
||||
list = []
|
||||
list << PBItems::FISTPLATE if $PokemonBag.pbQuantity(:FISTPLATE) >= 1
|
||||
list << PBItems::SKYPLATE if $PokemonBag.pbQuantity(:SKYPLATE) >= 1
|
||||
list << PBItems::TOXICPLATE if $PokemonBag.pbQuantity(:TOXICPLATE) >= 1
|
||||
list << PBItems::EARTHPLATE if $PokemonBag.pbQuantity(:EARTHPLATE) >= 1
|
||||
list << PBItems::STONEPLATE if $PokemonBag.pbQuantity(:STONEPLATE) >= 1
|
||||
list << PBItems::INSECTPLATE if $PokemonBag.pbQuantity(:INSECTPLATE) >= 1
|
||||
list << PBItems::SPOOKYPLATE if $PokemonBag.pbQuantity(:SPOOKYPLATE) >= 1
|
||||
list << PBItems::IRONPLATE if $PokemonBag.pbQuantity(:IRONPLATE) >= 1
|
||||
list << PBItems::FLAMEPLATE if $PokemonBag.pbQuantity(:FLAMEPLATE) >= 1
|
||||
list << PBItems::SPLASHPLATE if $PokemonBag.pbQuantity(:SPLASHPLATE) >= 1
|
||||
list << PBItems::MEADOWPLATE if $PokemonBag.pbQuantity(:MEADOWPLATE) >= 1
|
||||
list << PBItems::ZAPPLATE if $PokemonBag.pbQuantity(:ZAPPLATE) >= 1
|
||||
list << PBItems::MINDPLATE if $PokemonBag.pbQuantity(:MINDPLATE) >= 1
|
||||
list << PBItems::ICICLEPLATE if $PokemonBag.pbQuantity(:ICICLEPLATE) >= 1
|
||||
list << PBItems::DRACOPLATE if $PokemonBag.pbQuantity(:DRACOPLATE) >= 1
|
||||
list << PBItems::DREADPLATE if $PokemonBag.pbQuantity(:DREADPLATE) >= 1
|
||||
list << PBItems::PIXIEPLATE if $PokemonBag.pbQuantity(:PIXIEPLATE) >= 1
|
||||
return list
|
||||
end
|
||||
|
||||
def Kernel.getItemNamesAsString(list)
|
||||
strList = ""
|
||||
for i in 0..list.length - 1
|
||||
@@ -552,21 +559,25 @@ def Kernel.getItemNamesAsString(list)
|
||||
return strList
|
||||
end
|
||||
|
||||
def get_body_id_from_symbol(id)
|
||||
split_id = id.to_s.match(/\d+/)
|
||||
if !split_id #non-fusion
|
||||
return GameData::Species.get(id).id_number
|
||||
end
|
||||
return split_id[0].to_i
|
||||
end
|
||||
|
||||
def get_head_id_from_symbol(id)
|
||||
split_id = id.to_s.match(/(?<=H)\d+/)
|
||||
if !split_id #non-fusion
|
||||
return GameData::Species.get(id).id_number
|
||||
end
|
||||
|
||||
return split_id[0].to_i
|
||||
def Kernel.getPlateType(item)
|
||||
return :FIGHTING if item == PBItems::FISTPLATE
|
||||
return :FLYING if item == PBItems::SKYPLATE
|
||||
return :POISON if item == PBItems::TOXICPLATE
|
||||
return :GROUND if item == PBItems::EARTHPLATE
|
||||
return :ROCK if item == PBItems::STONEPLATE
|
||||
return :BUG if item == PBItems::INSECTPLATE
|
||||
return :GHOST if item == PBItems::SPOOKYPLATE
|
||||
return :STEEL if item == PBItems::IRONPLATE
|
||||
return :FIRE if item == PBItems::FLAMEPLATE
|
||||
return :WATER if item == PBItems::SPLASHPLATE
|
||||
return :GRASS if item == PBItems::MEADOWPLATE
|
||||
return :ELECTRIC if item == PBItems::ZAPPLATE
|
||||
return :PSYCHIC if item == PBItems::MINDPLATE
|
||||
return :ICE if item == PBItems::ICICLEPLATE
|
||||
return :DRAGON if item == PBItems::DRACOPLATE
|
||||
return :DARK if item == PBItems::DREADPLATE
|
||||
return :FAIRY if item == PBItems::PIXIEPLATE
|
||||
return -1
|
||||
end
|
||||
|
||||
def get_default_moves_at_level(species, level)
|
||||
@@ -585,6 +596,7 @@ def get_default_moves_at_level(species, level)
|
||||
#moves.push(Pokemon::Move.new(knowable_moves[i]))
|
||||
moves << knowable_moves[i]
|
||||
end
|
||||
p moves
|
||||
return moves
|
||||
end
|
||||
|
||||
@@ -623,9 +635,50 @@ def get_difficulty_text
|
||||
end
|
||||
end
|
||||
|
||||
def pokemonExceedsLevelCap(pokemon)
|
||||
return false if $Trainer.badge_count >= Settings::NB_BADGES
|
||||
current_max_level = Settings::LEVEL_CAPS[$Trainer.badge_count]
|
||||
current_max_level *= Settings::HARD_MODE_LEVEL_MODIFIER if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return pokemon.level >= current_max_level
|
||||
end
|
||||
def change_game_difficulty(down_only = false)
|
||||
message = "The game is currently on " + get_difficulty_text() + " difficulty."
|
||||
pbMessage(message)
|
||||
|
||||
choice_easy = "Easy"
|
||||
choice_normal = "Normal"
|
||||
choice_hard = "Hard"
|
||||
choice_cancel = "Cancel"
|
||||
|
||||
available_difficulties = []
|
||||
currentDifficulty = get_current_game_difficulty
|
||||
if down_only
|
||||
if currentDifficulty == :HARD
|
||||
available_difficulties << choice_hard
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :NORMAL
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_easy
|
||||
elsif currentDifficulty == :EASY
|
||||
available_difficulties << choice_easy
|
||||
end
|
||||
else
|
||||
available_difficulties << choice_easy
|
||||
available_difficulties << choice_normal
|
||||
available_difficulties << choice_hard
|
||||
end
|
||||
available_difficulties << choice_cancel
|
||||
index = pbMessage("Select a new difficulty", available_difficulties, available_difficulties[-1])
|
||||
choice = available_difficulties[index]
|
||||
case choice
|
||||
when choice_easy
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = true
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_normal
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = false
|
||||
when choice_hard
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_EASY] = false
|
||||
$game_switches[SWITCH_GAME_DIFFICULTY_HARD] = true
|
||||
when choice_cancel
|
||||
return
|
||||
end
|
||||
|
||||
message = "The game is currently on " + get_difficulty_text() + " difficulty."
|
||||
pbMessage(message)
|
||||
end
|
||||
@@ -8,12 +8,12 @@ end
|
||||
|
||||
def updateHttpSettingsFile
|
||||
return if $PokemonSystem.download_sprites != 0
|
||||
download_file(Settings::HTTP_CONFIGS_FILE_URL, Settings::HTTP_CONFIGS_FILE_PATH,)
|
||||
download_file(Settings::HTTP_CONFIGS_FILE_URL, Settings::HTTP_CONFIGS_FILE_PATH)
|
||||
end
|
||||
|
||||
def updateCreditsFile
|
||||
return if $PokemonSystem.download_sprites != 0
|
||||
download_file(Settings::CREDITS_FILE_URL, Settings::CREDITS_FILE_PATH,)
|
||||
download_file(Settings::CREDITS_FILE_URL,Settings::CREDITS_FILE_PATH,)
|
||||
end
|
||||
|
||||
def createCustomSpriteFolders()
|
||||
@@ -32,10 +32,8 @@ def download_file(url, saveLocation)
|
||||
File.open(saveLocation, "wb") do |file|
|
||||
file.write(response[:body])
|
||||
end
|
||||
echoln _INTL("\nDownloaded file {1} to {2}", url, saveLocation)
|
||||
echo _INTL("\nDownloaded file {1} to {2}", url, saveLocation)
|
||||
return saveLocation
|
||||
else
|
||||
echoln _INTL("Tried to download file {1} . Got response {2}",url,response[:body])
|
||||
end
|
||||
return nil
|
||||
rescue MKXPError, Errno::ENOENT => error
|
||||
@@ -46,37 +44,33 @@ end
|
||||
|
||||
def download_pokemon_sprite_if_missing(body, head)
|
||||
return if $PokemonSystem.download_sprites != 0
|
||||
get_fusion_sprite_path(head, body)
|
||||
get_fusion_sprite_path(head,body)
|
||||
end
|
||||
|
||||
def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp", alt_letter = "", spriteformBody_suffix = "", spriteformHead_suffix = "")
|
||||
begin
|
||||
head_id = (head_id.to_s) + spriteformHead_suffix
|
||||
body_id = (body_id.to_s) + spriteformBody_suffix
|
||||
|
||||
downloaded_file_name = _INTL("{1}/{2}.{3}{4}.png", saveLocation, head_id, body_id, alt_letter)
|
||||
if !body_id || body_id == ""
|
||||
downloaded_file_name = _INTL("{1}/{2}{3}.png", saveLocation, head_id, alt_letter)
|
||||
|
||||
def download_sprite(base_path, head_id, body_id, saveLocation = "Graphics/temp", alt_letter= "")
|
||||
begin
|
||||
downloaded_file_name = _INTL("{1}/{2}.{3}{4}.png", saveLocation, head_id, body_id,alt_letter)
|
||||
if !body_id
|
||||
downloaded_file_name = _INTL("{1}/{2}{3}.png", saveLocation, head_id,alt_letter)
|
||||
end
|
||||
|
||||
return downloaded_file_name if pbResolveBitmap(downloaded_file_name)
|
||||
|
||||
url = _INTL(base_path, head_id, body_id)
|
||||
|
||||
if !body_id
|
||||
url = _INTL(base_path, head_id)
|
||||
end
|
||||
|
||||
response = HTTPLite.get(url)
|
||||
if response[:status] == 200
|
||||
File.open(downloaded_file_name, "wb") do |file|
|
||||
file.write(response[:body])
|
||||
end
|
||||
echoln _INTL("\nDownloaded file from {1} to {2}", base_path, saveLocation)
|
||||
echo _INTL("\nDownloaded file from {1} to {2}", base_path, saveLocation)
|
||||
return downloaded_file_name
|
||||
end
|
||||
return nil
|
||||
rescue MKXPError, Errno::ENOENT
|
||||
rescue MKXPError,Errno::ENOENT
|
||||
return nil
|
||||
end
|
||||
end
|
||||
@@ -90,59 +84,44 @@ def download_autogen_sprite(head_id, body_id)
|
||||
return nil
|
||||
end
|
||||
|
||||
def download_custom_sprite(head_id, body_id, spriteformBody_suffix = "", spriteformHead_suffix = "", alt_letter="")
|
||||
head_id = (head_id.to_s) + spriteformHead_suffix.to_s
|
||||
body_id = (body_id.to_s) + spriteformBody_suffix.to_s
|
||||
def download_custom_sprite(head_id, body_id)
|
||||
return nil if $PokemonSystem.download_sprites != 0
|
||||
url = Settings::CUSTOM_SPRITES_REPO_URL + "{1}.{2}{3}.png"
|
||||
url = Settings::CUSTOM_SPRITES_REPO_URL + "{1}.{2}.png"
|
||||
destPath = _INTL("{1}{2}", Settings::CUSTOM_BATTLERS_FOLDER_INDEXED, head_id)
|
||||
if !Dir.exist?(destPath)
|
||||
Dir.mkdir(destPath)
|
||||
end
|
||||
sprite = download_sprite(_INTL(url, head_id, body_id,alt_letter), head_id, body_id, destPath, alt_letter)
|
||||
|
||||
sprite = download_sprite(_INTL(url, head_id, body_id), head_id, body_id, destPath)
|
||||
return sprite if sprite
|
||||
return nil
|
||||
end
|
||||
|
||||
#todo refactor & put custom base sprites in same folder as fusion sprites
|
||||
def download_unfused_main_sprite(dex_num, alt_letter="")
|
||||
base_url = alt_letter == "" ? Settings::BASE_POKEMON_SPRITES_REPO_URL : Settings::BASE_POKEMON_ALT_SPRITES_REPO_URL
|
||||
filename = _INTL("{1}{2}.png",dex_num,alt_letter)
|
||||
url = base_url + filename
|
||||
|
||||
|
||||
destPath = alt_letter == "" ? _INTL("{1}{2}", Settings::BATTLERS_FOLDER, dex_num) : Settings::CUSTOM_BASE_SPRITES_FOLDER
|
||||
sprite = download_sprite(url, dex_num, nil, destPath,alt_letter)
|
||||
|
||||
return sprite if sprite
|
||||
return nil
|
||||
end
|
||||
|
||||
def download_all_unfused_alt_sprites(dex_num)
|
||||
def download_unfused_alt_sprites(dex_num)
|
||||
base_url = Settings::BASE_POKEMON_ALT_SPRITES_REPO_URL + "{1}"
|
||||
extension = ".png"
|
||||
destPath = _INTL("{1}", Settings::CUSTOM_BASE_SPRITES_FOLDER)
|
||||
if !Dir.exist?(destPath)
|
||||
Dir.mkdir(destPath)
|
||||
end
|
||||
alt_url = _INTL(base_url, dex_num) + extension
|
||||
download_sprite(alt_url, dex_num, nil, destPath)
|
||||
alphabet = ('a'..'z').to_a + ('aa'..'az').to_a
|
||||
alt_url = _INTL(base_url,dex_num) + extension
|
||||
download_sprite(alt_url, dex_num,nil, destPath )
|
||||
alphabet = ('a'..'z').to_a
|
||||
alphabet.each do |letter|
|
||||
alt_url = _INTL(base_url, dex_num) + letter + extension
|
||||
sprite = download_sprite(alt_url, dex_num, nil, destPath, letter)
|
||||
alt_url = _INTL(base_url,dex_num) + letter + extension
|
||||
sprite = download_sprite(alt_url, dex_num,nil, destPath, letter)
|
||||
return if !sprite
|
||||
end
|
||||
end
|
||||
|
||||
def download_all_alt_sprites(head_id, body_id)
|
||||
def download_alt_sprites(head_id,body_id)
|
||||
base_url = "#{Settings::CUSTOM_SPRITES_REPO_URL}{1}.{2}"
|
||||
extension = ".png"
|
||||
destPath = _INTL("{1}{2}", Settings::CUSTOM_BATTLERS_FOLDER_INDEXED, head_id)
|
||||
if !Dir.exist?(destPath)
|
||||
Dir.mkdir(destPath)
|
||||
end
|
||||
alphabet = ('a'..'z').to_a + ('aa'..'az').to_a
|
||||
alphabet = ('a'..'z').to_a
|
||||
alphabet.each do |letter|
|
||||
alt_url = base_url + letter + extension
|
||||
sprite = download_sprite(alt_url, head_id, body_id, destPath, letter)
|
||||
@@ -150,6 +129,7 @@ def download_all_alt_sprites(head_id, body_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#format: [1.1.png, 1.2.png, etc.]
|
||||
# https://api.github.com/repos/infinitefusion/contents/sprites/CustomBattlers
|
||||
# repo = "Aegide/custom-fusion-sprites"
|
||||
@@ -185,6 +165,7 @@ end
|
||||
# write_custom_sprites_csv(files)
|
||||
# end
|
||||
|
||||
|
||||
# Too many file to get everything without getting
|
||||
# rate limited by github, so instead we're getting the
|
||||
# files list from a csv file that will be manually updated
|
||||
@@ -192,22 +173,23 @@ end
|
||||
|
||||
def updateOnlineCustomSpritesFile
|
||||
return if $PokemonSystem.download_sprites != 0
|
||||
download_file(Settings::SPRITES_FILE_URL, Settings::CUSTOM_SPRITES_FILE_PATH)
|
||||
download_file(Settings::SPRITES_FILE_URL,Settings::CUSTOM_SPRITES_FILE_PATH)
|
||||
end
|
||||
|
||||
def list_online_custom_sprites(updateList = false)
|
||||
sprites_list = []
|
||||
|
||||
def list_online_custom_sprites(updateList=false)
|
||||
sprites_list= []
|
||||
File.foreach(Settings::CUSTOM_SPRITES_FILE_PATH) do |line|
|
||||
sprites_list << line
|
||||
end
|
||||
return sprites_list
|
||||
end
|
||||
|
||||
GAME_VERSION_FORMAT_REGEX = /\A\d+(\.\d+)*\z/
|
||||
|
||||
GAME_VERSION_FORMAT_REGEX = /\A\d+(\.\d+)*\z/
|
||||
def fetch_latest_game_version
|
||||
begin
|
||||
download_file(Settings::VERSION_FILE_URL, Settings::VERSION_FILE_PATH,)
|
||||
download_file(Settings::VERSION_FILE_URL,Settings::VERSION_FILE_PATH,)
|
||||
version_file = File.open(Settings::VERSION_FILE_PATH, "r")
|
||||
version = version_file.first
|
||||
version_file.close
|
||||
|
||||
@@ -285,7 +285,9 @@ class PokemonLoadScreen
|
||||
def try_load_backup(file_path)
|
||||
if File.file?(file_path + ".bak")
|
||||
pbMessage(_INTL("The save file is corrupt. A backup will be loaded."))
|
||||
save_data = load_save_file(file_path + ".bak")
|
||||
file_copy(file_path, SaveData.get_backup_file_path)
|
||||
File.rename(file_path + '.bak', file_path)
|
||||
save_data = load_save_file(file_path)
|
||||
else
|
||||
self.prompt_save_deletion(file_path)
|
||||
return {}
|
||||
@@ -694,6 +696,9 @@ module Game
|
||||
$Trainer.save_slot = slot unless auto
|
||||
$Trainer.last_time_saved = Time.now
|
||||
begin
|
||||
if File.exists?(file_path)
|
||||
file_copy(file_path, file_path + '.bak')
|
||||
end
|
||||
SaveData.save_to_file(file_path)
|
||||
Graphics.frame_reset
|
||||
rescue IOError, SystemCallError
|
||||
|
||||
@@ -41,7 +41,7 @@ def getRockSmashItemList(inclRareItems)
|
||||
:REVIVE,:NUGGET,:DIAMOND]
|
||||
|
||||
fossilItems = [:ROOTFOSSIL,:CLAWFOSSIL,:DOMEFOSSIL,:HELIXFOSSIL,
|
||||
:SKULLFOSSIL,:ARMORFOSSIL,:JAWFOSSIL,:SAILFOSSIL]
|
||||
:SKULLFOSSIL,:ARMORFOSSIL]
|
||||
|
||||
# Kernel.pbMessage(inclRareItems.to_s)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ def useLantern()
|
||||
Kernel.pbMessage(_INTL("It's already illuminated..."))
|
||||
return false
|
||||
end
|
||||
Kernel.pbMessage(_INTL("The Lantern illuminated the area!"))
|
||||
Kernel.pbMessage(_INTL("The Lantern illuminated the cave!"))
|
||||
darkness.radius += 176
|
||||
$PokemonGlobal.flashUsed = true
|
||||
while darkness.radius < 176
|
||||
@@ -208,7 +208,7 @@ ItemHandlers::UseFromBag.add(:LANTERN, proc { |item|
|
||||
Kernel.pbMessage(_INTL("The cave is already illuminated."))
|
||||
next false
|
||||
end
|
||||
Kernel.pbMessage(_INTL("The Lantern illuminated the area!"))
|
||||
Kernel.pbMessage(_INTL("The Lantern illuminated the cave!"))
|
||||
$PokemonGlobal.flashUsed = true
|
||||
darkness.radius += 176
|
||||
while darkness.radius < 176
|
||||
@@ -388,17 +388,6 @@ def useDreamMirror
|
||||
Kernel.pbMessage(_INTL("You can see a faint glimpse of {1} in the reflection.", map_name))
|
||||
end
|
||||
|
||||
|
||||
def useStrangePlant
|
||||
if darknessEffectOnCurrentMap()
|
||||
Kernel.pbMessage(_INTL("The strange plant appears to be glowing."))
|
||||
$scene.spriteset.addUserSprite(LightEffect_GlowPlant.new($game_player))
|
||||
else
|
||||
Kernel.pbMessage(_INTL("It had no effect"))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#DREAMMIRROR
|
||||
ItemHandlers::UseFromBag.add(:DREAMMIRROR, proc { |item|
|
||||
useDreamMirror
|
||||
@@ -410,17 +399,6 @@ ItemHandlers::UseInField.add(:DREAMMIRROR, proc { |item|
|
||||
next 1
|
||||
})
|
||||
|
||||
#STRANGE PLANT
|
||||
ItemHandlers::UseFromBag.add(:STRANGEPLANT, proc { |item|
|
||||
useStrangePlant()
|
||||
next 1
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:STRANGEPLANT, proc { |item|
|
||||
useStrangePlant()
|
||||
next 1
|
||||
})
|
||||
|
||||
ItemHandlers::UseFromBag.add(:MAGICBOOTS, proc { |item|
|
||||
if $DEBUG
|
||||
if Kernel.pbConfirmMessageSerious(_INTL("Take off the Magic Boots?"))
|
||||
@@ -484,52 +462,48 @@ end
|
||||
#########################
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:INFINITESPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene, true, true)
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:DNASPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene)
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:DNASPLICERS, proc { |item|
|
||||
fusion_success = useSplicerFromField(item)
|
||||
fusion_success = useSplicerFromField(false, false)
|
||||
next 3 if fusion_success
|
||||
next false
|
||||
})
|
||||
|
||||
|
||||
ItemHandlers::UseInField.add(:SUPERSPLICERS, proc { |item|
|
||||
fusion_success = useSplicerFromField(item)
|
||||
fusion_success = useSplicerFromField(true, true)
|
||||
next 3 if fusion_success
|
||||
next false
|
||||
})
|
||||
|
||||
|
||||
ItemHandlers::UseInField.add(:INFINITESPLICERS, proc { |item|
|
||||
fusion_success = useSplicerFromField(item)
|
||||
fusion_success = useSplicerFromField(false, false)
|
||||
next true if fusion_success
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseInField.add(:INFINITESPLICERS2, proc { |item|
|
||||
fusion_success = useSplicerFromField(item)
|
||||
fusion_success = useSplicerFromField(true, true)
|
||||
next true if fusion_success
|
||||
next false
|
||||
})
|
||||
|
||||
def isSuperSplicersMechanics(item)
|
||||
return [:SUPERSPLICERS,:INFINITESPLICERS2].include?(item)
|
||||
end
|
||||
|
||||
def useSplicerFromField(item)
|
||||
def useSplicerFromField(supersplicers, superSplicer_arg2)
|
||||
scene = PokemonParty_Scene.new
|
||||
scene.pbStartScene($Trainer.party,"Select a Pokémon")
|
||||
screen = PokemonPartyScreen.new(scene, $Trainer.party)
|
||||
chosen = screen.pbChoosePokemon("Select a Pokémon")
|
||||
pokemon = $Trainer.party[chosen]
|
||||
fusion_success = pbDNASplicing(pokemon, scene, item)
|
||||
fusion_success = pbDNASplicing(pokemon, scene, supersplicers, superSplicer_arg2)
|
||||
screen.pbEndScene
|
||||
scene.dispose
|
||||
return fusion_success
|
||||
@@ -768,7 +742,7 @@ def drawPokemonType(pokemon_id, x_pos = 192, y_pos = 264)
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SUPERSPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene, true, true)
|
||||
})
|
||||
|
||||
def returnItemsToBag(pokemon, poke2)
|
||||
@@ -899,18 +873,22 @@ ItemHandlers::UseOnPokemon.add(:DAMAGEUP, proc { |item, pokemon, scene|
|
||||
|
||||
#easter egg for evolving shellder into slowbro's tail
|
||||
ItemHandlers::UseOnPokemon.add(:SLOWPOKETAIL, proc { |item, pokemon, scene|
|
||||
echoln pokemon.species
|
||||
#next false if pokemon.species != :SHELLDER
|
||||
shellbroNum = NB_POKEMON * PBSpecies::SHELLDER + PBSpecies::SLOWBRO #SHELLBRO
|
||||
newspecies = pokemon.species == PBSpecies::SHELLDER ? shellbroNum : -1
|
||||
if newspecies <= 0
|
||||
scene.pbDisplay(_INTL("It won't have any effect."))
|
||||
next false
|
||||
else
|
||||
pbFadeOutInWithMusic(99999) {
|
||||
evo = PokemonEvolutionScene.new
|
||||
evo.pbStartScreen(pokemon, :B90H80)
|
||||
evo.pbStartScreen(pokemon, newspecies)
|
||||
evo.pbEvolution(false)
|
||||
evo.pbEndScreen
|
||||
scene.pbRefreshAnnotations(proc { |p| pbCheckEvolution(p, item) > 0 }) if scene.pbHasAnnotations?
|
||||
scene.pbRefresh
|
||||
}
|
||||
next true
|
||||
|
||||
end
|
||||
})
|
||||
#
|
||||
# ItemHandlers::UseOnPokemon.add(:SHINYSTONE, proc { |item, pokemon, scene|
|
||||
@@ -1314,17 +1292,17 @@ end
|
||||
#########################
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:INFINITESPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene)
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:INFINITESPLICERS2, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene, true, true)
|
||||
next false
|
||||
})
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:DNASPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene)
|
||||
next false
|
||||
})
|
||||
|
||||
@@ -1338,9 +1316,7 @@ def getPokemonPositionInParty(pokemon)
|
||||
end
|
||||
|
||||
#don't remember why there's two Supersplicers arguments.... probably a mistake
|
||||
def pbDNASplicing(pokemon, scene, item=:DNASPLICERS)
|
||||
is_supersplicer = isSuperSplicersMechanics(item)
|
||||
|
||||
def pbDNASplicing(pokemon, scene, supersplicers = false, superSplicer = false)
|
||||
playingBGM = $game_system.getPlayingBGM
|
||||
dexNumber = pokemon.species_data.id_number
|
||||
if (pokemon.species_data.id_number <= NB_POKEMON)
|
||||
@@ -1372,7 +1348,7 @@ def pbDNASplicing(pokemon, scene, item=:DNASPLICERS)
|
||||
return false
|
||||
end
|
||||
|
||||
selectedHead = selectFusion(pokemon, poke2, is_supersplicer)
|
||||
selectedHead = selectFusion(pokemon, poke2, supersplicers)
|
||||
if selectedHead == -1 #cancelled
|
||||
return false
|
||||
end
|
||||
@@ -1391,8 +1367,8 @@ def pbDNASplicing(pokemon, scene, item=:DNASPLICERS)
|
||||
end
|
||||
end
|
||||
|
||||
if (Kernel.pbConfirmMessage(_INTL("Fuse {1} and {2}?",selectedHead.name,selectedBase.name)))
|
||||
pbFuse(selectedHead, selectedBase, item)
|
||||
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
|
||||
pbFuse(selectedHead, selectedBase, superSplicer)
|
||||
pbRemovePokemonAt(chosen)
|
||||
scene.pbHardRefresh
|
||||
pbBGMPlay(playingBGM)
|
||||
@@ -1412,7 +1388,7 @@ def pbDNASplicing(pokemon, scene, item=:DNASPLICERS)
|
||||
end
|
||||
else
|
||||
#UNFUSE
|
||||
return true if pbUnfuse(pokemon, scene, is_supersplicer)
|
||||
return true if pbUnfuse(pokemon, scene, supersplicers)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1450,20 +1426,12 @@ end
|
||||
# end
|
||||
# end
|
||||
|
||||
def pbFuse(pokemon, poke2, splicer_item)
|
||||
|
||||
use_supersplicers_mechanics =isSuperSplicersMechanics(splicer_item)
|
||||
pokemon.spriteform_body=nil
|
||||
pokemon.spriteform_head=nil
|
||||
poke2.spriteform_body=nil
|
||||
poke2.spriteform_head=nil
|
||||
|
||||
def pbFuse(pokemon, poke2, supersplicers = false)
|
||||
newid = (pokemon.species_data.id_number) * NB_POKEMON + poke2.species_data.id_number
|
||||
fus = PokemonFusionScene.new
|
||||
|
||||
if (fus.pbStartScreen(pokemon, poke2, newid,splicer_item))
|
||||
if (fus.pbStartScreen(pokemon, poke2, newid))
|
||||
returnItemsToBag(pokemon, poke2)
|
||||
fus.pbFusionScreen(false, use_supersplicers_mechanics)
|
||||
fus.pbFusionScreen(false, supersplicers)
|
||||
$game_variables[VAR_FUSE_COUNTER] += 1 #fuse counter
|
||||
fus.pbEndScreen
|
||||
return true
|
||||
@@ -1471,9 +1439,6 @@ def pbFuse(pokemon, poke2, splicer_item)
|
||||
end
|
||||
|
||||
def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
|
||||
pokemon.spriteform_body=nil
|
||||
pokemon.spriteform_head=nil
|
||||
|
||||
bodyPoke = getBasePokemonID(pokemon.species_data.id_number, true)
|
||||
headPoke = getBasePokemonID(pokemon.species_data.id_number, false)
|
||||
|
||||
@@ -1604,6 +1569,8 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
|
||||
#On ajoute l'autre dans le pokedex aussi
|
||||
$Trainer.pokedex.set_seen(poke1.species)
|
||||
$Trainer.pokedex.set_owned(poke1.species)
|
||||
$Trainer.pokedex.set_seen(poke2.species)
|
||||
$Trainer.pokedex.set_owned(poke2.species)
|
||||
|
||||
pokemon.species = poke1.species
|
||||
pokemon.level = poke1.level
|
||||
@@ -1621,7 +1588,7 @@ def pbUnfuse(pokemon, scene, supersplicers, pcPosition = nil)
|
||||
end
|
||||
|
||||
ItemHandlers::UseOnPokemon.add(:SUPERSPLICERS, proc { |item, pokemon, scene|
|
||||
next true if pbDNASplicing(pokemon, scene, item)
|
||||
next true if pbDNASplicing(pokemon, scene, true, true)
|
||||
})
|
||||
|
||||
def returnItemsToBag(pokemon, poke2)
|
||||
|
||||
@@ -1,44 +1,33 @@
|
||||
class PokedexUtils
|
||||
# POSSIBLE_ALTS = ["", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
|
||||
# "r", "s", "t", "u", "v", "w", "x", "y", "z", "aa", "ab", "ac", "ad", "ae", "af", "ag", "ah",
|
||||
# "ai", "aj", "ak", "al", "am", "an", "ao", "ap", "aq", "ar", "as", "at", "au", "av", "aw", "ax",
|
||||
# "ay", "az"]
|
||||
|
||||
def getAltLettersList()
|
||||
return ('a'..'z').to_a + ('aa'..'az').to_a
|
||||
end
|
||||
|
||||
def pbGetAvailableAlts(species, form_index = 0)
|
||||
if form_index
|
||||
form_suffix = form_index <= 0 ? "" : "_" + form_index.to_s
|
||||
else
|
||||
form_suffix = ""
|
||||
end
|
||||
POSSIBLE_ALTS = ["", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
|
||||
"r", "s", "t", "u", "v", "w", "x", "y", "z"]
|
||||
|
||||
def pbGetAvailableAlts(species)
|
||||
ret = []
|
||||
return ret if !species
|
||||
dexNum = getDexNumberForSpecies(species)
|
||||
isFusion = dexNum > NB_POKEMON
|
||||
if !isFusion
|
||||
ret << Settings::BATTLERS_FOLDER + dexNum.to_s + form_suffix + "/" + dexNum.to_s + form_suffix + ".png"
|
||||
ret << Settings::BATTLERS_FOLDER + dexNum.to_s + "/" + dexNum.to_s + ".png"
|
||||
|
||||
getAltLettersList().each { |alt_letter|
|
||||
altFilePath = Settings::CUSTOM_BASE_SPRITES_FOLDER + dexNum.to_s + form_suffix + alt_letter + ".png"
|
||||
POSSIBLE_ALTS.each { |alt_letter|
|
||||
altFilePath = Settings::CUSTOM_BASE_SPRITES_FOLDER + dexNum.to_s + alt_letter + ".png"
|
||||
if pbResolveBitmap(altFilePath)
|
||||
ret << altFilePath
|
||||
end
|
||||
}
|
||||
|
||||
return ret
|
||||
end
|
||||
body_id = getBodyID(species)
|
||||
head_id = getHeadID(species, body_id)
|
||||
|
||||
baseFilename = head_id.to_s + "." + body_id.to_s + form_suffix
|
||||
baseFilename = head_id.to_s + "." + body_id.to_s
|
||||
baseFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" + baseFilename + ".png"
|
||||
if pbResolveBitmap(baseFilePath)
|
||||
ret << baseFilePath
|
||||
end
|
||||
getAltLettersList().each { |alt_letter|
|
||||
POSSIBLE_ALTS.each { |alt_letter|
|
||||
if alt_letter != "" #empty is included in alt letters because unfused sprites can be alts and not have a letter
|
||||
altFilePath = Settings::CUSTOM_BATTLERS_FOLDER_INDEXED + head_id.to_s + "/" + baseFilename + alt_letter + ".png"
|
||||
if pbResolveBitmap(altFilePath)
|
||||
|
||||
@@ -70,7 +70,6 @@ def pbColor(color)
|
||||
end
|
||||
|
||||
defaultQuestColor = :PURPLE
|
||||
specialQuestColor = :DARKRED
|
||||
questBranchHotels = "Hotel Quests"
|
||||
questBranchField = "Field Quests"
|
||||
|
||||
@@ -125,7 +124,7 @@ QUESTS = [
|
||||
Quest.new(30, "Diamonds and Pearls", "Find a Diamond Necklace to save the man's marriage.", questBranchHotels, "BW (71)", "Cinnabar Island", defaultQuestColor),
|
||||
|
||||
#Goldenrod City
|
||||
Quest.new(31, "Hoenn Pokémon", "A woman wants you to show her a Pokémon native to the Hoenn region.", questBranchHotels, "BW (48)", "Goldenrod City", defaultQuestColor),
|
||||
Quest.new(31, "Hoenn Pokémon", "A woman wants you to show her a Pokémon native to the Hoenn region.", questBranchHotels, "BW (37)", "Goldenrod City", defaultQuestColor),
|
||||
Quest.new(32, "Safari Souvenir!", "Bring back a souvenir from the Fuchsia City Safari Zone", questBranchHotels, "BW (28)", "Goldenrod City", defaultQuestColor),
|
||||
|
||||
#Violet City
|
||||
@@ -150,20 +149,6 @@ QUESTS = [
|
||||
Quest.new(45, "First Contact (Part 2)", "Ask the sailor at Cinnabar Island's harbour to take you to the uncharted island where the spaceship might be located", questBranchHotels, "BW (92)", "Bond Bridge", defaultQuestColor),
|
||||
Quest.new(46, "The rarest fish", "A fisherman wants you to show him a Feebas. Apparently they can be fished around the Sevii Islands when it rains.", questBranchField, "BW056", "Kin Island", defaultQuestColor),
|
||||
|
||||
#Necrozma quest
|
||||
Quest.new(47, "Mysterious prisms", "You found a pedestal with a mysterious prism on it. There seems to be room for more prisms.", questBranchField, "BW_Sabrina", "Pokémon Tower", specialQuestColor),
|
||||
|
||||
Quest.new(48, "The long night (Part 1)", "A mysterious darkness has shrouded some of the region. Meet Sabrina outside of Saffron City's western gate to investigate.", questBranchField, "BW_Sabrina", "Lavender Town", specialQuestColor),
|
||||
Quest.new(49, "The long night (Part 2)", "The mysterious darkness has expended. Meet Sabrina on top of Celadon City's Dept. Store to figure out the source of the darkness.", questBranchField, "BW_Sabrina", "Route 7", specialQuestColor),
|
||||
Quest.new(50, "The long night (Part 3)", "Fuchsia City appears to be unaffected by the darkness. Go investigate to see if you can find out more information.", questBranchField, "BW_Sabrina", "Celadon City", specialQuestColor),
|
||||
Quest.new(51, "The long night (Part 4)", "The mysterious darkness has expended yet again and strange plants have appeared. Follow the plants to see where they lead.", questBranchField, "BW_koga", "Fuchsia City", specialQuestColor),
|
||||
Quest.new(52, "The long night (Part 5)", "You found a strange fruit that appears to be related to the mysterious darkness. Go see professor Oak to have it analyzed.", questBranchField, "BW029", "Safari Zone", specialQuestColor),
|
||||
Quest.new(53, "The long night (Part 6)", "The strange plant you found appears to glow in the mysterious darkness that now covers the entire region. Try to follow the glow to find out the source of the disturbance.", questBranchField, "BW-oak", "Pallet Town", specialQuestColor),
|
||||
|
||||
Quest.new(54, "Nectar garden", "An old man wants you to bring differently colored flowers for the city's garden.", questBranchField, "BW (039)", "Pewter City", defaultQuestColor),
|
||||
Quest.new(55, "The Cursed Forest", "A child wants you to find a floating tree stump in Ilex Forest. What could she be talking about?", questBranchHotels, "BW109", "Goldenrod City", defaultQuestColor),
|
||||
Quest.new(56, "Bitey Pokémon", "A fisherman wants to know what is the sharp-toothed Pokémon that bit him in the Safari Zone's lake.", questBranchHotels, "BW (71)", "Fuchsia City", defaultQuestColor),
|
||||
|
||||
# attention: c'est un array et non un hash... l'id est en fait l'index, donc il est important de garder l'ordre
|
||||
#out of order quests
|
||||
#42 (cinnabar)
|
||||
@@ -174,8 +159,7 @@ class PokeBattle_Trainer
|
||||
attr_accessor :quests
|
||||
end
|
||||
|
||||
|
||||
def pbAcceptNewQuest(id, bubblePosition = 20, show_description=true)
|
||||
def pbAcceptNewQuest(id, bubblePosition = 20)
|
||||
return if isQuestAlreadyAccepted?(id)
|
||||
$game_variables[96] += 1 #nb. quests accepted
|
||||
$game_variables[97] += 1 #nb. quests active
|
||||
@@ -187,10 +171,8 @@ def pbAcceptNewQuest(id, bubblePosition = 20, show_description=true)
|
||||
|
||||
pbCallBub(1, bubblePosition)
|
||||
Kernel.pbMessage("\\C[6]NEW QUEST: " + title)
|
||||
if show_description
|
||||
pbCallBub(1, bubblePosition)
|
||||
Kernel.pbMessage("\\C[1]" + description)
|
||||
end
|
||||
pbCallBub(1, bubblePosition)
|
||||
Kernel.pbMessage("\\C[1]" + description)
|
||||
pbAddQuest(id)
|
||||
end
|
||||
|
||||
@@ -203,9 +185,6 @@ def isQuestAlreadyAccepted?(id)
|
||||
end
|
||||
|
||||
def finishQuest(id)
|
||||
pbMEPlay("Register phone")
|
||||
Kernel.pbMessage("\\C[6]Quest completed!")
|
||||
|
||||
$game_variables[222] += 1 # karma
|
||||
$game_variables[97] -= 1 #nb. quests active
|
||||
$game_variables[98] += 1 #nb. quests completed
|
||||
@@ -336,6 +315,7 @@ class Questlog
|
||||
pbDrawOutlineText(@main, 0, 142, 512, 384, "Ongoing: " + @ongoing.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
|
||||
pbDrawOutlineText(@main, 0, 198, 512, 384, "Completed: " + @completed.size.to_s, Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
|
||||
|
||||
|
||||
12.times do |i|
|
||||
Graphics.update
|
||||
@sprites["bg0"].opacity += 32 if i < 8
|
||||
@@ -797,9 +777,11 @@ class Questlog
|
||||
@sprites["completed#{i}"].src_rect.height = (@sprites["completed#{i}"].bitmap.height / 2).round
|
||||
@sprites["completed#{i}"].src_rect.y = (@sprites["completed#{i}"].bitmap.height / 2).round if i == @sel_two
|
||||
@sprites["completed#{i}"].opacity = 0
|
||||
pbDrawOutlineText(@main, 11, getCellYPosition(i), 512, 384, @completed[i].name, @completed[i].color, Color.new(0, 0, 0), 1)
|
||||
pbDrawOutlineText(@main, 11,getCellYPosition(i), 512, 384, @completed[i].name, @completed[i].color, Color.new(0, 0, 0), 1)
|
||||
end
|
||||
|
||||
|
||||
|
||||
pbDrawOutlineText(@main, 0, 175, 512, 384, "No completed quests", pbColor(:WHITE), pbColor(:BLACK), 1) if @completed.size == 0
|
||||
pbDrawOutlineText(@main, 0, 2, 512, 384, "Completed Quests", Color.new(255, 255, 255), Color.new(0, 0, 0), 1)
|
||||
12.times do |i|
|
||||
@@ -814,10 +796,10 @@ class Questlog
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def getCellYPosition(i)
|
||||
return 56 + (52 * i)
|
||||
end
|
||||
|
||||
def pbEnd
|
||||
12.times do |i|
|
||||
Graphics.update
|
||||
@@ -825,7 +807,7 @@ class Questlog
|
||||
@sprites["btn0"].opacity -= 32 if @sprites["btn0"]
|
||||
@sprites["btn1"].opacity -= 32 if @sprites["btn1"]
|
||||
@sprites["main"].opacity -= 32 if @sprites["main"]
|
||||
@sprites["char"].opacity -= 40 if @sprites["char"] rescue nil
|
||||
@sprites["char"].opacity -= 40 if @sprites["char"]rescue nil
|
||||
@sprites["char2"].opacity -= 40 if @sprites["char2"] rescue nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,9 +55,7 @@ module Graphics
|
||||
$GameSpeed = 0 if $GameSpeed >= SPEEDUP_STAGES.size
|
||||
end
|
||||
$frame += 1
|
||||
speedStage = SPEEDUP_STAGES[$GameSpeed]
|
||||
speedStage=5 if $DEBUG && Input.press?(Input::SHIFT)
|
||||
return unless $frame % speedStage == 0
|
||||
return unless $frame % SPEEDUP_STAGES[$GameSpeed] == 0
|
||||
fast_forward_update
|
||||
$frame = 0
|
||||
end
|
||||
|
||||
@@ -222,7 +222,12 @@ def getFusionSpeciesSymbol(body, head)
|
||||
return GameData::Species.get(id).species
|
||||
end
|
||||
|
||||
|
||||
def getFusionSpecies(body, head)
|
||||
body_num = dexNum(body)
|
||||
head_num = dexNum(head)
|
||||
id = body_num * Settings::NB_POKEMON + head_num
|
||||
return GameData::Species.get(id)
|
||||
end
|
||||
|
||||
#
|
||||
def evolveHead(species)
|
||||
|
||||
@@ -14,15 +14,16 @@ class PokemonPokedexInfo_Scene
|
||||
X_POSITION_BG_SELECTED = 145
|
||||
X_POSITION_BG_NEXT = 363
|
||||
|
||||
def drawPageForms()
|
||||
def drawPageForms
|
||||
#@selected_index=0
|
||||
|
||||
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
|
||||
overlay = @sprites["overlay"].bitmap
|
||||
base = Color.new(88, 88, 80)
|
||||
shadow = Color.new(168, 184, 184)
|
||||
|
||||
#alts_list= pbGetAvailableAlts
|
||||
@selected_index = 0 if !@selected_index
|
||||
@selected_index = 0
|
||||
update_displayed
|
||||
end
|
||||
|
||||
@@ -50,16 +51,9 @@ class PokemonPokedexInfo_Scene
|
||||
end
|
||||
|
||||
def initializeSpritesPage(altsList)
|
||||
@forms_list = list_pokemon_forms()
|
||||
@formIndex = 0
|
||||
|
||||
init_selected_bg
|
||||
@speciesData = getSpecies(@species)
|
||||
|
||||
@selected_index = 0
|
||||
set_displayed_to_current_alt(altsList)
|
||||
|
||||
|
||||
@sprites["selectedSprite"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["selectedSprite"].x = X_POSITION_SELECTED
|
||||
@sprites["selectedSprite"].y = Y_POSITION_BIG
|
||||
@@ -100,36 +94,19 @@ class PokemonPokedexInfo_Scene
|
||||
|
||||
end
|
||||
|
||||
|
||||
def set_displayed_to_current_alt(altsList)
|
||||
species_id = getDexNumberForSpecies(@species).to_s
|
||||
return if !$PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
|
||||
current_sprite =$PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
index = @selected_index
|
||||
for alt in altsList
|
||||
if alt == current_sprite
|
||||
@selected_index = index
|
||||
return
|
||||
end
|
||||
index +=1
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def pbGetAvailableForms(species=nil)
|
||||
chosen_species = species != nil ? species : @species
|
||||
dex_num = getDexNumberForSpecies(chosen_species)
|
||||
def pbGetAvailableForms
|
||||
dex_num = getDexNumberForSpecies(@species)
|
||||
if dex_num <= NB_POKEMON
|
||||
download_all_unfused_alt_sprites(dex_num)
|
||||
download_unfused_alt_sprites(dex_num)
|
||||
else
|
||||
body_id = getBodyID(chosen_species)
|
||||
head_id = getHeadID(chosen_species, body_id)
|
||||
body_id = getBodyID(@species)
|
||||
head_id = getHeadID(@species, body_id)
|
||||
download_custom_sprite(head_id, body_id)
|
||||
download_autogen_sprite(head_id, body_id)
|
||||
download_all_alt_sprites(head_id, body_id)
|
||||
download_alt_sprites(head_id, body_id)
|
||||
end
|
||||
return PokedexUtils.new.pbGetAvailableAlts(chosen_species, @formIndex)
|
||||
|
||||
return PokedexUtils.new.pbGetAvailableAlts(@species)
|
||||
end
|
||||
|
||||
def hide_all_selected_windows
|
||||
@@ -158,11 +135,10 @@ class PokemonPokedexInfo_Scene
|
||||
if previousIndex < 0
|
||||
previousIndex = @available.size - 1
|
||||
end
|
||||
@sprites["previousSprite"].visible = @available.size > 2
|
||||
@sprites["nextSprite"].visible = @available.size > 1
|
||||
@sprites["previousSprite"].visible = false if @available.size <= 2
|
||||
@sprites["nextSprite"].visible = false if @available.size <= 1
|
||||
|
||||
@sprites["previousSprite"].setBitmap(@available[previousIndex]) if previousIndex != nextIndex
|
||||
|
||||
@sprites["selectedSprite"].setBitmap(@available[@selected_index])
|
||||
@sprites["nextSprite"].setBitmap(@available[nextIndex])
|
||||
|
||||
@@ -197,85 +173,33 @@ class PokemonPokedexInfo_Scene
|
||||
pbDrawTextPositions(@creditsOverlay, textpos)
|
||||
end
|
||||
|
||||
def list_pokemon_forms
|
||||
dexNum = dexNum(@species)
|
||||
if dexNum > NB_POKEMON
|
||||
body_id = getBodyID(dexNum)
|
||||
else
|
||||
if @species.is_a?(Symbol)
|
||||
body_id = get_body_number_from_symbol(@species)
|
||||
else
|
||||
body_id = dexNum
|
||||
end
|
||||
end
|
||||
forms_list = []
|
||||
found_last_form = false
|
||||
form_index = 0
|
||||
while !found_last_form
|
||||
form_index += 1
|
||||
form_path = Settings::BATTLERS_FOLDER + body_id.to_s + "_" + form_index.to_s
|
||||
echoln form_path
|
||||
if File.directory?(form_path)
|
||||
forms_list << form_index
|
||||
else
|
||||
found_last_form = true
|
||||
end
|
||||
end
|
||||
return forms_list
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbChooseAlt(brief=false)
|
||||
def pbChooseForm
|
||||
loop do
|
||||
@sprites["rightarrow"].visible = true
|
||||
@sprites["leftarrow"].visible = true
|
||||
if @forms_list.length >= 1
|
||||
@sprites["uparrow"].visible = true
|
||||
@sprites["downarrow"].visible = true
|
||||
end
|
||||
multiple_forms = @forms_list.length > 0
|
||||
@sprites["uparrow"].visible = true
|
||||
@sprites["downarrow"].visible = true
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdate
|
||||
if Input.trigger?(Input::LEFT)
|
||||
if Input.trigger?(Input::RIGHT)
|
||||
pbPlayCursorSE
|
||||
@selected_index -= 1 #(index+@available.length-1)%@available.length
|
||||
if @selected_index < 0
|
||||
@selected_index = @available.size - 1
|
||||
end
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
elsif Input.trigger?(Input::LEFT)
|
||||
pbPlayCursorSE
|
||||
@selected_index += 1
|
||||
@selected_index += 1 #= (index+1)%@available.length
|
||||
if @selected_index > @available.size - 1
|
||||
@selected_index = 0
|
||||
end
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::UP) && multiple_forms
|
||||
pbPlayCursorSE
|
||||
@formIndex += 1
|
||||
if @formIndex > @forms_list.length
|
||||
@formIndex = 0
|
||||
end
|
||||
@available = pbGetAvailableForms()
|
||||
@selected_index = 0
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::DOWN) && multiple_forms
|
||||
pbPlayCursorSE
|
||||
@formIndex -= 1
|
||||
if @formIndex < 0
|
||||
@formIndex = @forms_list.length
|
||||
end
|
||||
@available = pbGetAvailableForms()
|
||||
@selected_index = 0
|
||||
update_displayed
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
break
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
if select_sprite(brief)
|
||||
if select_sprite
|
||||
@endscene = true
|
||||
break
|
||||
end
|
||||
@@ -303,7 +227,7 @@ class PokemonPokedexInfo_Scene
|
||||
index = @selected_index
|
||||
end
|
||||
selected_sprite = @available[index]
|
||||
species_id = getDexNumberForSpecies(@species).to_s
|
||||
species_id = getDexNumberForSpecies(@species)
|
||||
$PokemonGlobal.alt_sprite_substitutions = {} if !$PokemonGlobal.alt_sprite_substitutions
|
||||
if $PokemonGlobal.alt_sprite_substitutions[species_id]
|
||||
return $PokemonGlobal.alt_sprite_substitutions[species_id] == selected_sprite
|
||||
@@ -320,28 +244,14 @@ class PokemonPokedexInfo_Scene
|
||||
return spritename.match?(/[a-zA-Z]/)
|
||||
end
|
||||
|
||||
def select_sprite(brief=false)
|
||||
if @available.length > 1
|
||||
if is_main_sprite
|
||||
if brief
|
||||
pbMessage("This sprite will remain the displayed sprite")
|
||||
return true
|
||||
else
|
||||
pbMessage("This sprite is already the displayed sprite")
|
||||
end
|
||||
else
|
||||
if @forms_list.length > 0
|
||||
message = _INTL('Would you like to use this sprite instead of the current sprite for form {1}?', @formIndex)
|
||||
else
|
||||
message = 'Would you like to use this sprite instead of the current sprite?'
|
||||
end
|
||||
if pbConfirmMessage(_INTL(message))
|
||||
swap_main_sprite()
|
||||
return true
|
||||
end
|
||||
end
|
||||
def select_sprite
|
||||
if is_main_sprite
|
||||
pbMessage("This sprite is already the displayed sprite")
|
||||
else
|
||||
pbMessage("This is the only sprite available for this Pokémon!")
|
||||
if pbConfirmMessage(_INTL('Would you like to use this sprite instead of the current sprite?'))
|
||||
swap_main_sprite()
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -350,7 +260,7 @@ class PokemonPokedexInfo_Scene
|
||||
old_main_sprite = @available[0]
|
||||
new_main_sprite = @available[@selected_index]
|
||||
species_number = dexNum(@species)
|
||||
set_alt_sprite_substitution(species_number, new_main_sprite, @formIndex)
|
||||
set_alt_sprite_substitution(species_number, new_main_sprite)
|
||||
end
|
||||
|
||||
# def swap_main_sprite
|
||||
@@ -391,14 +301,9 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :alt_sprite_substitutions
|
||||
end
|
||||
|
||||
def set_alt_sprite_substitution(original_sprite_name, selected_alt, formIndex = 0)
|
||||
def set_alt_sprite_substitution(original_sprite_name, selected_alt)
|
||||
if !$PokemonGlobal.alt_sprite_substitutions
|
||||
$PokemonGlobal.alt_sprite_substitutions = {}
|
||||
end
|
||||
if formIndex
|
||||
form_suffix = formIndex != 0 ? "_" + formIndex.to_s : ""
|
||||
else
|
||||
form_suffix = ""
|
||||
end
|
||||
$PokemonGlobal.alt_sprite_substitutions[original_sprite_name.to_s + form_suffix] = selected_alt
|
||||
$PokemonGlobal.alt_sprite_substitutions[original_sprite_name] = selected_alt
|
||||
end
|
||||
|
||||
@@ -98,7 +98,7 @@ def pbWonderTrade(lvl, except = [], except2 = [], premiumWonderTrade = true)
|
||||
end
|
||||
if species > 0
|
||||
skipLegendaryCheck = premiumWonderTrade && rand(100) < luck
|
||||
species = 0 if pokemonIsPartLegendary(species) && !$game_switches[SWITCH_BEAT_THcE_LEAGUE] && !skipLegendaryCheck
|
||||
species = 0 if pokemonIsPartLegendary(species) && !$game_switches[SWITCH_BEAT_THE_LEAGUE] && !skipLegendaryCheck
|
||||
end
|
||||
#Redo loop if below BST - 200
|
||||
species = 0 if bst < (chosenBST - 200)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
EXPORT_EXCEPT_MAP_IDS= [768,722,723,724,720]
|
||||
|
||||
def exportAllMaps
|
||||
for id in 810..815
|
||||
for id in 1..798
|
||||
begin
|
||||
MapExporter.export(id, [:Events]) if !EXPORT_EXCEPT_MAP_IDS.include?(id)
|
||||
rescue
|
||||
@@ -11,16 +11,6 @@ def exportAllMaps
|
||||
end
|
||||
end
|
||||
|
||||
def exportSpecificMaps(maps_to_export)
|
||||
for id in maps_to_export
|
||||
begin
|
||||
MapExporter.export(id, [:Events])
|
||||
rescue
|
||||
echo "error in " +(id.to_s) +"\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
module MapExporter
|
||||
@@map = nil
|
||||
|
||||
Reference in New Issue
Block a user