mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-17 05:31:05 +00:00
release 6.2
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
#==============================================================================#
|
||||
module Settings
|
||||
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
|
||||
GAME_VERSION = '6.1.0'
|
||||
GAME_VERSION_NUMBER = "6.1.4"
|
||||
GAME_VERSION = '6.2.0'
|
||||
GAME_VERSION_NUMBER = "6.2.0"
|
||||
|
||||
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
|
||||
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
|
||||
@@ -31,6 +31,24 @@ module Settings
|
||||
VERSION_FILE_PATH = "Data/VERSION"
|
||||
CUSTOM_SPRITES_FILE_PATH = "Data/CUSTOM_SPRITES"
|
||||
CUSTOM_DEX_ENTRIES_PATH = "Data/dex.json"
|
||||
|
||||
BACK_ITEM_ICON_PATH = "Graphics/Items/back.png"
|
||||
|
||||
PLAYER_GRAPHICS_FOLDER = "Graphics/Characters/player/"
|
||||
PLAYER_HAT_FOLDER = 'hat'
|
||||
PLAYER_HAIR_FOLDER = 'hair'
|
||||
PLAYER_CLOTHES_FOLDER = 'clothes'
|
||||
PLAYER_BALL_FOLDER = 'balls'
|
||||
PLAYER_TEMP_OUTFIT_FALLBACK = 'temp'
|
||||
|
||||
|
||||
HATS_DATA_PATH = "Data/hats_data.json"
|
||||
HAIRSTYLE_DATA_PATH = "Data/hairstyles_data.json"
|
||||
CLOTHES_DATA_PATH = "Data/clothes_data.json"
|
||||
|
||||
PLAYER_SURFBASE_FOLDER = 'surf_base/'
|
||||
OW_SHINE_ANIMATION_ID=25
|
||||
|
||||
HTTP_CONFIGS_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/Scripts/RemoteUrls.rb"
|
||||
HTTP_CONFIGS_FILE_PATH = "Data/Scripts/DownloadedSettings.rb"
|
||||
|
||||
@@ -71,6 +89,12 @@ module Settings
|
||||
WONDERTRADE_PUBLIC_KEY = "http://localhost:8080"
|
||||
|
||||
MAX_NB_OUTFITS=99
|
||||
DEFAULT_OUTFIT_MALE = "red"
|
||||
DEFAULT_OUTFIT_FEMALE = "leaf"
|
||||
STARTING_OUTFIT = "pikajamas"
|
||||
|
||||
OUTFIT_PREVIEW_PICTURE_ID=20
|
||||
|
||||
# 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).
|
||||
@@ -110,6 +134,12 @@ module Settings
|
||||
# always inherit egg moves from its father.
|
||||
BREEDING_CAN_INHERIT_EGG_MOVES_FROM_MOTHER = (MECHANICS_GENERATION >= 6)
|
||||
|
||||
KANTO_STARTERS = [:BULBASAUR, :CHARMANDER, :SQUIRTLE]
|
||||
JOHTO_STARTERS = [:CHIKORITA, :CYNDAQUIL, :TOTODILE]
|
||||
HOENN_STARTERS = [:TREECKO, :TORCHIC, :MUDKIP]
|
||||
SINNOH_STARTERS = [:TURTWIG, :CHIMCHAR, :PIPLUP]
|
||||
|
||||
|
||||
#=============================================================================
|
||||
|
||||
# The amount of money the player starts the game with.
|
||||
@@ -345,11 +375,11 @@ module Settings
|
||||
# * Name of BGM to play for that encounter (optional).
|
||||
# * Roaming areas specifically for this Pokémon (optional).
|
||||
ROAMING_SPECIES = [
|
||||
[:ENTEI, 50, 350, 1, "Legendary Birds"],
|
||||
[:B245H243, 50, 341, 1, "Legendary Birds"],
|
||||
[:LATIOS, 50, 602, 0, "Legendary Birds",SEVII_ROAMING],
|
||||
[:LATIAS, 50, 602, 0, "Legendary Birds",SEVII_ROAMING],
|
||||
[:FEEBAS, 15, 4, 3, "Pokemon HeartGold and SoulSilver - Wild Pokemon Battle (Kanto)",SEVII_ROAMING]
|
||||
[:ENTEI, 50, 350, 1, "Legendary Birds",ROAMING_AREAS,:Sunny],
|
||||
[:B245H243, 50, 341, 1, "Legendary Birds",ROAMING_AREAS,:Storm],
|
||||
[:LATIOS, 50, 602, 0, "Legendary Birds",SEVII_ROAMING,:StrongWinds],
|
||||
[:LATIAS, 50, 602, 0, "Legendary Birds",SEVII_ROAMING,:StrongWinds],
|
||||
[:FEEBAS, 15, 4, 3, "Pokemon HeartGold and SoulSilver - Wild Pokemon Battle (Kanto)",SEVII_ROAMING,:Rain]
|
||||
]
|
||||
|
||||
#=============================================================================
|
||||
|
||||
@@ -43,6 +43,9 @@ module Kernel
|
||||
end
|
||||
|
||||
def echoln(string)
|
||||
caller_info = caller(1..1).first
|
||||
file, line, method = caller_info.split(":")
|
||||
echo "#{file}, #{line}:\t"
|
||||
echo(string)
|
||||
echo("\r\n")
|
||||
end
|
||||
|
||||
@@ -106,6 +106,7 @@ module Game
|
||||
if ngp_storage != nil
|
||||
$PokemonStorage = ngp_clean_pc_data(ngp_storage, ngp_trainer.party)
|
||||
end
|
||||
onStartingNewGame()
|
||||
end
|
||||
|
||||
# Loads the game from the given save data and starts the map scene.
|
||||
@@ -119,6 +120,7 @@ module Game
|
||||
$game_map.update
|
||||
$PokemonMap.updateMap
|
||||
$scene = Scene_Map.new
|
||||
onLoadExistingGame()
|
||||
end
|
||||
|
||||
# Loads and validates the map. Called when loading a saved game.
|
||||
|
||||
@@ -238,6 +238,10 @@ class Scene_Map
|
||||
end
|
||||
end
|
||||
|
||||
def reset_player_sprite
|
||||
@spritesetGlobal.playersprite.updateBitmap
|
||||
end
|
||||
|
||||
def reset_map(fadeout = false)
|
||||
$MapFactory.setup($game_map.map_id)
|
||||
$game_player.moveto($game_player.x, $game_player.y)
|
||||
|
||||
@@ -19,10 +19,18 @@ class Game_Map
|
||||
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_accessor :fog_ox # fog x-coordinate starting point
|
||||
attr_accessor :fog_oy # fog y-coordinate starting point
|
||||
|
||||
attr_accessor :fog2_ox # fog x-coordinate starting point
|
||||
attr_accessor :fog2_oy # fog y-coordinate starting point
|
||||
attr_accessor :fog2_sx # fog sx
|
||||
attr_accessor :fog2_sy # fog sy
|
||||
attr_accessor :fog2_opacity # fog sy
|
||||
|
||||
attr_reader :fog_tone # fog color tone
|
||||
attr_accessor :battleback_name # battleback file name
|
||||
attr_reader :display_x # display x-coordinate * 128
|
||||
@@ -49,6 +57,13 @@ class Game_Map
|
||||
updateTileset
|
||||
@fog_ox = 0
|
||||
@fog_oy = 0
|
||||
|
||||
@fog2_ox = 0
|
||||
@fog2_oy = 0
|
||||
@fog2_sx = 0
|
||||
@fog2_sy = 0
|
||||
@fog2_opacity = 0
|
||||
|
||||
@fog_tone = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_target = Tone.new(0, 0, 0, 0)
|
||||
@fog_tone_duration = 0
|
||||
@@ -133,6 +148,21 @@ class Game_Map
|
||||
end
|
||||
end
|
||||
|
||||
def setFog2(filename,sx=0,sy=0,opacity=32)
|
||||
@fog2_sx=sx
|
||||
@fog2_sy=-sy
|
||||
@fog2_opacity = opacity
|
||||
$scene.spriteset.setFog2(filename)
|
||||
end
|
||||
|
||||
def eraseFog2()
|
||||
@fog2_sx=0
|
||||
@fog2_sy=-0
|
||||
@fog2_opacity = 0
|
||||
$scene.spriteset.disposeFog2()
|
||||
end
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Plays background music
|
||||
# Plays music called "[normal BGM]_n" if it's night time and it exists
|
||||
@@ -459,6 +489,10 @@ class Game_Map
|
||||
# Update fog
|
||||
@fog_ox -= @fog_sx / 8.0
|
||||
@fog_oy -= @fog_sy / 8.0
|
||||
|
||||
@fog2_ox -= @fog2_sx / 8.0 if @fog2_ox
|
||||
@fog2_oy -= @fog2_sy / 8.0 if @fog2_oy
|
||||
|
||||
if @fog_tone_duration >= 1
|
||||
d = @fog_tone_duration
|
||||
target = @fog_tone_target
|
||||
|
||||
@@ -371,7 +371,7 @@ class Game_Character
|
||||
end
|
||||
|
||||
def force_move_route(move_route)
|
||||
echoln screen_z() if self == $game_player
|
||||
#echoln screen_z() if self == $game_player
|
||||
if @original_move_route == nil
|
||||
@original_move_route = @move_route
|
||||
@original_move_route_index = @move_route_index
|
||||
|
||||
@@ -9,6 +9,7 @@ class Game_Player < Game_Character
|
||||
attr_accessor :bump_se
|
||||
attr_accessor :charsetData
|
||||
attr_accessor :encounter_count
|
||||
attr_accessor :outfit_changed
|
||||
attr_accessor :x
|
||||
attr_accessor :y
|
||||
|
||||
@@ -390,9 +391,9 @@ def pbGetPlayerCharset(meta,charset,trainer=nil,force=false)
|
||||
$game_player.charsetData = [$Trainer.character_ID,charset,outfit] if $game_player
|
||||
ret = meta[charset]
|
||||
ret = meta[1] if nil_or_empty?(ret)
|
||||
if pbResolveBitmap("Graphics/Characters/"+ret+"_"+outfit.to_s)
|
||||
ret = ret+"_"+outfit.to_s
|
||||
end
|
||||
# if pbResolveBitmap("Graphics/Characters/player/"+ret+"_"+outfit.to_s)
|
||||
# ret = ret+"_"+outfit.to_s
|
||||
# end
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
@@ -40,12 +40,35 @@ class Game_Player < Game_Character
|
||||
meta = GameData::Metadata.get_player($Trainer.character_ID)
|
||||
if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
|
||||
charset = 1 # Display normal character sprite
|
||||
if pbCanRun? && (moving? || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
|
||||
|
||||
|
||||
player_is_moving = moving?
|
||||
if pbCanRun? && (player_is_moving || @wasmoving) && Input.dir4!=0 && meta[4] && meta[4]!=""
|
||||
charset = 4 # Display running character sprite
|
||||
end
|
||||
|
||||
newCharName = pbGetPlayerCharset(meta,charset)
|
||||
|
||||
if newCharName
|
||||
# echoln caller
|
||||
# echoln newCharName
|
||||
# echoln "moving: " + moving?.to_s
|
||||
# echoln "was moving: " + @wasmoving.to_s
|
||||
#
|
||||
# echoln "can run: " + pbCanRun?.to_s
|
||||
# echoln "Input.dir4 " + Input.dir4.to_s
|
||||
#
|
||||
#
|
||||
# echoln (moving? || @wasmoving)
|
||||
# echoln charset
|
||||
# echoln ""
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@character_name = newCharName if newCharName
|
||||
@wasmoving = moving?
|
||||
@wasmoving = player_is_moving
|
||||
end
|
||||
end
|
||||
return @character_name
|
||||
|
||||
@@ -5,6 +5,7 @@ class BushBitmap
|
||||
@isTile = isTile
|
||||
@isBitmap = @bitmap.is_a?(Bitmap)
|
||||
@depth = depth
|
||||
@manual_refresh=false
|
||||
end
|
||||
|
||||
def dispose
|
||||
@@ -63,9 +64,8 @@ class Sprite_Character < RPG::Sprite
|
||||
def initialize(viewport, character = nil)
|
||||
super(viewport)
|
||||
@character = character
|
||||
|
||||
if darknessEffectOnCurrentMap()
|
||||
if @character.is_a?(Game_Event)
|
||||
if @character.is_a?(Game_Event)
|
||||
$game_map.events[@character.id].erase if event_is_trainer(@character)
|
||||
end
|
||||
end
|
||||
@@ -79,6 +79,11 @@ class Sprite_Character < RPG::Sprite
|
||||
update
|
||||
end
|
||||
|
||||
def setSurfingPokemon(pokemonSpecies)
|
||||
@surfingPokemon = pokemonSpecies
|
||||
@surfbase.setPokemon(pokemonSpecies) if @surfbase
|
||||
end
|
||||
|
||||
def groundY
|
||||
return @character.screen_y_ground
|
||||
end
|
||||
@@ -100,13 +105,57 @@ class Sprite_Character < RPG::Sprite
|
||||
super
|
||||
end
|
||||
|
||||
def updateBitmap
|
||||
@manual_refresh=true
|
||||
end
|
||||
|
||||
def pbLoadOutfitBitmap(outfitFileName)
|
||||
# Construct the file path for the outfit bitmap based on the given value
|
||||
#outfitFileName = sprintf("Graphics/Outfits/%s", value)
|
||||
|
||||
# Attempt to load the outfit bitmap
|
||||
begin
|
||||
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
|
||||
return outfitBitmap
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def generateClothedBitmap()
|
||||
return
|
||||
end
|
||||
|
||||
def applyDayNightTone()
|
||||
if @character.is_a?(Game_Event) && @character.name[/regulartone/i]
|
||||
self.tone.set(0, 0, 0, 0)
|
||||
else
|
||||
pbDayNightTint(self)
|
||||
end
|
||||
end
|
||||
|
||||
def updateCharacterBitmap
|
||||
AnimatedBitmap.new('Graphics/Characters/' + @character_name, @character_hue)
|
||||
end
|
||||
|
||||
def should_update?
|
||||
return @tile_id != @character.tile_id ||
|
||||
@character_name != @character.character_name ||
|
||||
@character_hue != @character.character_hue ||
|
||||
@oldbushdepth != @character.bush_depth ||
|
||||
@manual_refresh
|
||||
end
|
||||
|
||||
def refreshOutfit()
|
||||
self.bitmap = getClothedPlayerSprite(true)
|
||||
end
|
||||
|
||||
def update
|
||||
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
|
||||
if should_update?
|
||||
@manual_refresh=false
|
||||
@tile_id = @character.tile_id
|
||||
@character_name = @character.character_name
|
||||
@character_hue = @character.character_hue
|
||||
@@ -127,13 +176,14 @@ class Sprite_Character < RPG::Sprite
|
||||
@character.sprite_size = [@cw, @ch]
|
||||
else
|
||||
@charbitmap.dispose if @charbitmap
|
||||
@charbitmap = AnimatedBitmap.new(
|
||||
'Graphics/Characters/' + @character_name, @character_hue)
|
||||
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @character == $game_player
|
||||
@charbitmapAnimated = true
|
||||
|
||||
@charbitmap = updateCharacterBitmap()
|
||||
|
||||
RPG::Cache.retain('Graphics/Characters/', @character_name, @character_hue) if @charbitmapAnimated = true
|
||||
@bushbitmap.dispose if @bushbitmap
|
||||
@bushbitmap = nil
|
||||
@spriteoffset = @character_name[/offset/i]
|
||||
#@spriteoffset = @character_name[/offset/i]
|
||||
@spriteoffset = @character_name[/fish/i] || @character_name[/dive/i] || @character_name[/surf/i]
|
||||
@cw = @charbitmap.width / 4
|
||||
@ch = @charbitmap.height / 4
|
||||
self.ox = @cw / 2
|
||||
@@ -143,7 +193,11 @@ class Sprite_Character < RPG::Sprite
|
||||
@charbitmap.update if @charbitmapAnimated
|
||||
bushdepth = @character.bush_depth
|
||||
if bushdepth == 0
|
||||
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
|
||||
if @character == $game_player
|
||||
self.bitmap = getClothedPlayerSprite()#generateClothedBitmap()
|
||||
else
|
||||
self.bitmap = (@charbitmapAnimated) ? @charbitmap.bitmap : @charbitmap
|
||||
end
|
||||
else
|
||||
@bushbitmap = BushBitmap.new(@charbitmap, (@tile_id >= 384), bushdepth) if !@bushbitmap
|
||||
self.bitmap = @bushbitmap.bitmap
|
||||
@@ -157,11 +211,7 @@ class Sprite_Character < RPG::Sprite
|
||||
self.oy -= @character.bob_height
|
||||
end
|
||||
if self.visible
|
||||
if @character.is_a?(Game_Event) && @character.name[/regulartone/i]
|
||||
self.tone.set(0, 0, 0, 0)
|
||||
else
|
||||
pbDayNightTint(self)
|
||||
end
|
||||
applyDayNightTone()
|
||||
end
|
||||
self.x = @character.screen_x
|
||||
self.y = @character.screen_y
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
class Sprite_SurfBase
|
||||
attr_reader :visible
|
||||
attr_reader :visible
|
||||
attr_accessor :event
|
||||
|
||||
def initialize(sprite,event,viewport=nil)
|
||||
@rsprite = sprite
|
||||
@sprite = nil
|
||||
@event = event
|
||||
def initialize(sprite, event, viewport = nil)
|
||||
@rsprite = sprite
|
||||
@sprite = nil
|
||||
@event = event
|
||||
@viewport = viewport
|
||||
@disposed = false
|
||||
@surfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
|
||||
@divebitmap = AnimatedBitmap.new("Graphics/Characters/base_dive")
|
||||
RPG::Cache.retain("Graphics/Characters/base_surf")
|
||||
RPG::Cache.retain("Graphics/Characters/base_dive")
|
||||
@cws = @surfbitmap.width/4
|
||||
@chs = @surfbitmap.height/4
|
||||
@cwd = @divebitmap.width/4
|
||||
@chd = @divebitmap.height/4
|
||||
#@surfbitmap = AnimatedBitmap.new("Graphics/Characters/base_surf")
|
||||
@surfbitmap = update_surf_bitmap(:SURF)
|
||||
@divebitmap = update_surf_bitmap(:DIVE)
|
||||
# RPG::Cache.retain("Graphics/Characters/base_surf")
|
||||
# RPG::Cache.retain("Graphics/Characters/base_dive")
|
||||
@cws = @surfbitmap.width / 4
|
||||
@chs = @surfbitmap.height / 4
|
||||
@cwd = @divebitmap.width / 4
|
||||
@chd = @divebitmap.height / 4
|
||||
update
|
||||
end
|
||||
|
||||
def dispose
|
||||
return if @disposed
|
||||
@sprite.dispose if @sprite
|
||||
@sprite = nil
|
||||
@sprite = nil
|
||||
@surfbitmap.dispose
|
||||
@divebitmap.dispose
|
||||
@disposed = true
|
||||
@@ -37,6 +38,70 @@ class Sprite_SurfBase
|
||||
@sprite.visible = value if @sprite && !@sprite.disposed?
|
||||
end
|
||||
|
||||
def update_surf_bitmap(type)
|
||||
species = $Trainer.surfing_pokemon
|
||||
path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_board" if type == :SURF
|
||||
#path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_scuba" if type == :DIVE
|
||||
path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_Head" if type == :DIVE
|
||||
if species
|
||||
shape = species.shape
|
||||
basePath = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER
|
||||
action = "divemon" if type == :DIVE
|
||||
action = "surfmon" if type == :SURF
|
||||
path = "#{basePath}#{action}_#{shape.to_s}"
|
||||
end
|
||||
return AnimatedBitmap.new(path)
|
||||
end
|
||||
|
||||
|
||||
# case species.shape
|
||||
# when :Head
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_Head" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_Head" if type == :SURF
|
||||
# when :Serpentine
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Finned
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :HeadArms
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :HeadBase
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :BipedalTail
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :HeadLegs
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Quadruped
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Winged
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Multiped
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :MultiBody
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Bipedal
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :MultiWinged
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# when :Insectoid
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_HeadBase" if type == :DIVE
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "surfmon_HeadBase" if type == :SURF
|
||||
# else
|
||||
# path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_SURFBASE_FOLDER + "divemon_01"
|
||||
# end
|
||||
|
||||
|
||||
def update
|
||||
return if disposed?
|
||||
if !$PokemonGlobal.surfing && !$PokemonGlobal.diving
|
||||
@@ -51,32 +116,34 @@ class Sprite_SurfBase
|
||||
@sprite = Sprite.new(@viewport) if !@sprite
|
||||
if @sprite
|
||||
if $PokemonGlobal.surfing
|
||||
@surfbitmap = update_surf_bitmap(:SURF)
|
||||
@sprite.bitmap = @surfbitmap.bitmap
|
||||
cw = @cws
|
||||
ch = @chs
|
||||
elsif $PokemonGlobal.diving
|
||||
@divebitmap = update_surf_bitmap(:DIVE)
|
||||
@sprite.bitmap = @divebitmap.bitmap
|
||||
cw = @cwd
|
||||
ch = @chd
|
||||
end
|
||||
sx = @event.pattern_surf*cw
|
||||
sy = ((@event.direction-2)/2)*ch
|
||||
@sprite.src_rect.set(sx,sy,cw,ch)
|
||||
sx = @event.pattern_surf * cw
|
||||
sy = ((@event.direction - 2) / 2) * ch
|
||||
@sprite.src_rect.set(sx, sy, cw, ch)
|
||||
if $PokemonTemp.surfJump
|
||||
@sprite.x = ($PokemonTemp.surfJump[0]*Game_Map::REAL_RES_X-@event.map.display_x+3)/4+(Game_Map::TILE_WIDTH/2)
|
||||
@sprite.y = ($PokemonTemp.surfJump[1]*Game_Map::REAL_RES_Y-@event.map.display_y+3)/4+(Game_Map::TILE_HEIGHT/2)+16
|
||||
@sprite.x = ($PokemonTemp.surfJump[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2)
|
||||
@sprite.y = ($PokemonTemp.surfJump[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16
|
||||
else
|
||||
@sprite.x = @rsprite.x
|
||||
@sprite.y = @rsprite.y
|
||||
end
|
||||
@sprite.ox = cw/2
|
||||
@sprite.oy = ch-16 # Assume base needs offsetting
|
||||
@sprite.oy -= @event.bob_height
|
||||
@sprite.z = @event.screen_z(ch)-1
|
||||
@sprite.zoom_x = @rsprite.zoom_x
|
||||
@sprite.zoom_y = @rsprite.zoom_y
|
||||
@sprite.tone = @rsprite.tone
|
||||
@sprite.color = @rsprite.color
|
||||
@sprite.ox = cw / 2
|
||||
@sprite.oy = ch - 16 # Assume base needs offsetting
|
||||
@sprite.oy -= @event.bob_height
|
||||
@sprite.z = @event.screen_z(ch) - 1
|
||||
@sprite.zoom_x = @rsprite.zoom_x
|
||||
@sprite.zoom_y = @rsprite.zoom_y
|
||||
@sprite.tone = @rsprite.tone
|
||||
@sprite.color = @rsprite.color
|
||||
@sprite.opacity = @rsprite.opacity
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class Spriteset_Global
|
||||
@@viewport2.z = 200
|
||||
|
||||
def initialize
|
||||
@playersprite = Sprite_Character.new(Spriteset_Map.viewport, $game_player)
|
||||
@playersprite = Sprite_Player.new(Spriteset_Map.viewport, $game_player)
|
||||
@picture_sprites = []
|
||||
for i in 1..100
|
||||
@picture_sprites.push(Sprite_Picture.new(@@viewport2, $game_screen.pictures[i]))
|
||||
|
||||
@@ -51,6 +51,7 @@ class Spriteset_Map
|
||||
@panorama = AnimatedPlane.new(@@viewport0)
|
||||
@fog = AnimatedPlane.new(@@viewport1)
|
||||
@fog.z = 3000
|
||||
@fog2=nil
|
||||
@character_sprites = []
|
||||
for i in @map.events.keys.sort
|
||||
sprite = Sprite_Character.new(@@viewport1,@map.events[i])
|
||||
@@ -61,6 +62,18 @@ class Spriteset_Map
|
||||
update
|
||||
end
|
||||
|
||||
def setFog2(filename="010-Water04")
|
||||
disposeFog2()
|
||||
@fog2 = AnimatedPlane.new(@@viewport1)
|
||||
@fog2.z = 3001
|
||||
@fog2.setFog(filename)
|
||||
end
|
||||
|
||||
def disposeFog2()
|
||||
@fog2.dispose if @fog2
|
||||
@fog2 =nil
|
||||
end
|
||||
|
||||
def dispose
|
||||
if $scene.is_a?(Scene_Map)
|
||||
$scene.map_renderer.remove_tileset(@map.tileset_name)
|
||||
@@ -68,6 +81,7 @@ class Spriteset_Map
|
||||
end
|
||||
@panorama.dispose
|
||||
@fog.dispose
|
||||
@fog2.dispose if @fog2
|
||||
for sprite in @character_sprites
|
||||
sprite.dispose
|
||||
end
|
||||
@@ -116,8 +130,18 @@ class Spriteset_Map
|
||||
@fog.opacity = @map.fog_opacity
|
||||
@fog.blend_type = @map.fog_blend_type
|
||||
@fog.tone = @map.fog_tone
|
||||
|
||||
@fog2.ox = tmox+@map.fog2_ox if @fog2
|
||||
@fog2.oy = tmoy+@map.fog2_oy if @fog2
|
||||
@fog2.zoom_x = @map.fog_zoom/100.0 if @fog2
|
||||
@fog2.zoom_y = @map.fog_zoom/100.0 if @fog2
|
||||
@fog2.opacity = @map.fog2_opacity if @fog2
|
||||
|
||||
|
||||
@panorama.update
|
||||
@fog.update
|
||||
@fog2.update if @fog2
|
||||
|
||||
for sprite in @character_sprites
|
||||
sprite.update
|
||||
end
|
||||
|
||||
27
Data/Scripts/005_Sprites/013_Sprite_Player_Offsets.rb
Normal file
27
Data/Scripts/005_Sprites/013_Sprite_Player_Offsets.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
#[FRAME1 [x,y]],[FRAME2 [x,y], etc.]
|
||||
module Outfit_Offsets
|
||||
BASE_OFFSET = [[0, 0], [0, 0], [0, 0], [0, 0]]
|
||||
|
||||
|
||||
RUN_OFFSETS_DOWN = [[0, 2], [0, 6], [0, 2], [0, 6]]
|
||||
RUN_OFFSETS_LEFT = [[-2, -2], [-2, -2], [-2, -2], [-2, -2]]
|
||||
RUN_OFFSETS_RIGHT = [[4, -2], [4, -2], [4, -2], [4, -2]]
|
||||
RUN_OFFSETS_UP = [[0, -2], [0, -2], [0, -2], [0, -2]]
|
||||
|
||||
SURF_OFFSETS_DOWN = [[0, -6], [0, -4], [0, -6], [0, -4]]
|
||||
SURF_OFFSETS_LEFT = [[-2, -10], [-2, -8], [-2, -10], [-2, -8]]
|
||||
SURF_OFFSETS_RIGHT = [[4, -10], [4, -8], [4, -10], [4, -8]]
|
||||
SURF_OFFSETS_UP = [[0, -6], [0, -4], [0, -6], [0, -4]]
|
||||
|
||||
DIVE_OFFSETS_DOWN = [[0, -6], [0, -4], [0, -6], [0, -4]]
|
||||
DIVE_OFFSETS_LEFT = [[6, -8], [6, -6], [6, -8], [6, -6]]
|
||||
DIVE_OFFSETS_RIGHT = [[-6, -8], [-6, -6], [-6, -8], [-6, -6]]
|
||||
DIVE_OFFSETS_UP = [[0, -2], [0, 0], [0, -2], [0, 0]]
|
||||
|
||||
BIKE_OFFSETS_DOWN = [[0, -2], [2, 0], [0, -2], [-2, 0]]
|
||||
BIKE_OFFSETS_LEFT = [[-4, -4], [-2, -2], [-4, -4], [-6, -2]]
|
||||
BIKE_OFFSETS_RIGHT = [[4, -4], [2, -2], [4, -4], [6, -2]]
|
||||
BIKE_OFFSETS_UP = [[0, -2], [-2, 0], [0, -2], [2, 0]]
|
||||
|
||||
end
|
||||
181
Data/Scripts/005_Sprites/013_Sprite_Wearable.rb
Normal file
181
Data/Scripts/005_Sprites/013_Sprite_Wearable.rb
Normal file
@@ -0,0 +1,181 @@
|
||||
class Sprite_Wearable < RPG::Sprite
|
||||
attr_accessor :filename
|
||||
attr_accessor :action
|
||||
attr_accessor :sprite
|
||||
|
||||
def initialize(player_sprite, filename, action, viewport)
|
||||
@player_sprite = player_sprite
|
||||
@viewport = viewport
|
||||
@sprite = Sprite.new(@viewport)
|
||||
@wearableBitmap = AnimatedBitmap.new(filename) if pbResolveBitmap(filename)
|
||||
@filename = filename
|
||||
@sprite.bitmap = @wearableBitmap.bitmap if @wearableBitmap
|
||||
@action = action
|
||||
@color = 0
|
||||
@frameWidth = 80 #@sprite.width
|
||||
@frameHeight = 80 #@sprite.height / 4
|
||||
@sprite.z = 0
|
||||
@relative_z=0 #relative to player
|
||||
echoln(_INTL("init had at z = {1}, player sprite at {2}",@sprite.z,@player_sprite.z))
|
||||
|
||||
#Unused position offset
|
||||
# @x_pos_base_offset = 0
|
||||
# @y_pos_base_offset = 0
|
||||
end
|
||||
|
||||
def apply_sprite_offset(offsets_array, current_frame)
|
||||
@sprite.x += offsets_array[current_frame][0]
|
||||
@sprite.y += offsets_array[current_frame][1]
|
||||
end
|
||||
|
||||
def set_sprite_position(action, direction, current_frame)
|
||||
@sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
@sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
case action
|
||||
when "run"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
|
||||
end
|
||||
when "surf"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
|
||||
end
|
||||
when "dive"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
|
||||
end
|
||||
when "bike"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
|
||||
end
|
||||
else
|
||||
@sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
@sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
end
|
||||
@sprite.y -= 2 if current_frame % 2 == 1
|
||||
end
|
||||
|
||||
def animate(action)
|
||||
@action = action
|
||||
current_frame = @player_sprite.character.pattern
|
||||
direction = @player_sprite.character.direction
|
||||
crop_spritesheet(direction)
|
||||
set_sprite_position(@action, direction, current_frame)
|
||||
adjust_layer()
|
||||
end
|
||||
|
||||
def update(action, filename,color)
|
||||
@sprite.opacity = @player_sprite.opacity if @wearableBitmap
|
||||
if filename != @filename || color != @color
|
||||
if pbResolveBitmap(filename)
|
||||
#echoln pbResolveBitmap(filename)
|
||||
@wearableBitmap = AnimatedBitmap.new(filename,color)
|
||||
@sprite.bitmap = @wearableBitmap.bitmap
|
||||
else
|
||||
@wearableBitmap = nil
|
||||
@sprite.bitmap = nil
|
||||
end
|
||||
@color =color
|
||||
@filename = filename
|
||||
end
|
||||
animate(action)
|
||||
end
|
||||
|
||||
def adjust_layer()
|
||||
if @sprite.z != @player_sprite.z+@relative_z
|
||||
@sprite.z = @player_sprite.z+@relative_z
|
||||
end
|
||||
end
|
||||
|
||||
def crop_spritesheet(direction)
|
||||
sprite_x = 0
|
||||
sprite_y = ((direction - 2) / 2) * @frameHeight
|
||||
@sprite.src_rect.set(sprite_x, sprite_y, @frameWidth, @frameHeight)
|
||||
end
|
||||
|
||||
def dispose
|
||||
return if @disposed
|
||||
@sprite.dispose if @sprite
|
||||
@sprite = nil
|
||||
@disposed = true
|
||||
end
|
||||
|
||||
def disposed?
|
||||
@disposed
|
||||
end
|
||||
|
||||
# def getCurrentSpriteOffset()
|
||||
# direction = @character.direction
|
||||
# current_frame = @character.pattern
|
||||
# case @character_name
|
||||
# when "run"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# return Outfit_Offsets::RUN_OFFSETS_DOWN[current_frame]
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# return Outfit_Offsets::RUN_OFFSETS_LEFT[current_frame]
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# return Outfit_Offsets::RUN_OFFSETS_RIGHT[current_frame]
|
||||
# elsif direction == DIRECTION_UP
|
||||
# return Outfit_Offsets::RUN_OFFSETS_UP[current_frame]
|
||||
# end
|
||||
# when "surf"
|
||||
# #when "dive"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# return Outfit_Offsets::SURF_OFFSETS_DOWN[current_frame]
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# return Outfit_Offsets::SURF_OFFSETS_LEFT[current_frame]
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# return Outfit_Offsets::SURF_OFFSETS_RIGHT[current_frame]
|
||||
# elsif direction == DIRECTION_UP
|
||||
# return Outfit_Offsets::SURF_OFFSETS_UP[current_frame]
|
||||
# end
|
||||
# when "dive"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# return Outfit_Offsets::DIVE_OFFSETS_DOWN[current_frame]
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# return Outfit_Offsets::DIVE_OFFSETS_LEFT[current_frame]
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# return Outfit_Offsets::DIVE_OFFSETS_RIGHT[current_frame]
|
||||
# elsif direction == DIRECTION_UP
|
||||
# return Outfit_Offsets::DIVE_OFFSETS_UP[current_frame]
|
||||
# end
|
||||
# when "bike"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# return Outfit_Offsets::BIKE_OFFSETS_DOWN[current_frame]
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# return Outfit_Offsets::BIKE_OFFSETS_LEFT[current_frame]
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# return Outfit_Offsets::BIKE_OFFSETS_RIGHT[current_frame]
|
||||
# elsif direction == DIRECTION_UP
|
||||
# return Outfit_Offsets::BIKE_OFFSETS_UP[current_frame]
|
||||
# end
|
||||
# end
|
||||
# return Outfit_Offsets::BASE_OFFSET[current_frame]
|
||||
# end
|
||||
|
||||
|
||||
end
|
||||
8
Data/Scripts/005_Sprites/014_Sprite_Hair.rb
Normal file
8
Data/Scripts/005_Sprites/014_Sprite_Hair.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class Sprite_Hair < Sprite_Wearable
|
||||
def initialize(player_sprite, filename, action, viewport)
|
||||
super
|
||||
@relative_z = 1
|
||||
|
||||
#@sprite.z = @player_sprite.z + 1
|
||||
end
|
||||
end
|
||||
192
Data/Scripts/005_Sprites/014_Sprite_Hat.rb
Normal file
192
Data/Scripts/005_Sprites/014_Sprite_Hat.rb
Normal file
@@ -0,0 +1,192 @@
|
||||
class Sprite_Hat < Sprite_Wearable
|
||||
def initialize(player_sprite, filename, action, viewport)
|
||||
super
|
||||
@relative_z = 2
|
||||
#@sprite.z = @player_sprite.z + 2
|
||||
|
||||
end
|
||||
|
||||
def set_sprite_position(action, direction, current_frame)
|
||||
@sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
@sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
case action
|
||||
when "run"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
|
||||
end
|
||||
when "surf"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
|
||||
end
|
||||
when "dive"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
|
||||
end
|
||||
when "bike"
|
||||
if direction == DIRECTION_DOWN
|
||||
apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
|
||||
elsif direction == DIRECTION_LEFT
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
|
||||
elsif direction == DIRECTION_RIGHT
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
|
||||
elsif direction == DIRECTION_UP
|
||||
apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
|
||||
end
|
||||
else
|
||||
@sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
@sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
end
|
||||
@sprite.y -= 2 if current_frame % 2 == 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
# class Sprite_Hat < RPG::Sprite
|
||||
# attr_accessor :filename
|
||||
# attr_accessor :action
|
||||
# attr_accessor :hat_sprite
|
||||
#
|
||||
# def initialize(player_sprite, filename, action, viewport)
|
||||
# @player_sprite = player_sprite
|
||||
# @viewport = viewport
|
||||
# @hat_sprite = Sprite.new(@viewport)
|
||||
# @hatBitmap = AnimatedBitmap.new(filename) if pbResolveBitmap(filename)
|
||||
# @filename = filename
|
||||
# @hat_sprite.bitmap = @hatBitmap.bitmap if @hatBitmap
|
||||
# @action = action
|
||||
# @color = 0
|
||||
# @frameWidth = 80 #@hat_sprite.width
|
||||
# @frameHeight = 80 #@hat_sprite.height / 4
|
||||
# @hat_sprite.z = @player_sprite.z + 2
|
||||
# echoln(_INTL("init had at z = {1}, player sprite at {2}",@hat_sprite.z,@player_sprite.z))
|
||||
#
|
||||
# #Unused position offset
|
||||
# # @x_pos_base_offset = 0
|
||||
# # @y_pos_base_offset = 0
|
||||
# end
|
||||
#
|
||||
# def apply_sprite_offset(offsets_array, current_frame)
|
||||
# @hat_sprite.x += offsets_array[current_frame][0]
|
||||
# @hat_sprite.y += offsets_array[current_frame][1]
|
||||
# end
|
||||
#
|
||||
# def set_sprite_position(action, direction, current_frame)
|
||||
# @hat_sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
# @hat_sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
# case action
|
||||
# when "run"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_DOWN, current_frame)
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_LEFT, current_frame)
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_RIGHT, current_frame)
|
||||
# elsif direction == DIRECTION_UP
|
||||
# apply_sprite_offset(Outfit_Offsets::RUN_OFFSETS_UP, current_frame)
|
||||
# end
|
||||
# when "surf"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# apply_sprite_offset(Outfit_Offsets::SURF_OFFSETS_DOWN,current_frame)
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_LEFT,current_frame)
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_RIGHT,current_frame)
|
||||
# elsif direction == DIRECTION_UP
|
||||
# apply_sprite_offset( Outfit_Offsets::SURF_OFFSETS_UP,current_frame)
|
||||
# end
|
||||
# when "dive"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# apply_sprite_offset(Outfit_Offsets::DIVE_OFFSETS_DOWN,current_frame)
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_LEFT,current_frame)
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_RIGHT,current_frame)
|
||||
# elsif direction == DIRECTION_UP
|
||||
# apply_sprite_offset( Outfit_Offsets::DIVE_OFFSETS_UP,current_frame)
|
||||
# end
|
||||
# when "bike"
|
||||
# if direction == DIRECTION_DOWN
|
||||
# apply_sprite_offset(Outfit_Offsets::BIKE_OFFSETS_DOWN,current_frame)
|
||||
# elsif direction == DIRECTION_LEFT
|
||||
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_LEFT,current_frame)
|
||||
# elsif direction == DIRECTION_RIGHT
|
||||
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_RIGHT,current_frame)
|
||||
# elsif direction == DIRECTION_UP
|
||||
# apply_sprite_offset( Outfit_Offsets::BIKE_OFFSETS_UP,current_frame)
|
||||
# end
|
||||
# else
|
||||
# @hat_sprite.x = @player_sprite.x - @player_sprite.ox
|
||||
# @hat_sprite.y = @player_sprite.y - @player_sprite.oy
|
||||
# end
|
||||
# @hat_sprite.y -= 2 if current_frame % 2 == 1
|
||||
# end
|
||||
#
|
||||
# def animate(action)
|
||||
# @action = action
|
||||
# current_frame = @player_sprite.character.pattern
|
||||
# direction = @player_sprite.character.direction
|
||||
# crop_spritesheet(direction)
|
||||
# set_sprite_position(@action, direction, current_frame)
|
||||
# adjust_hat_layer()
|
||||
# end
|
||||
#
|
||||
# def update(action, hatFilename,color)
|
||||
# @hat_sprite.opacity = @player_sprite.opacity if @hatBitmap
|
||||
# if hatFilename != @filename || color != @color
|
||||
# if pbResolveBitmap(hatFilename)
|
||||
# #echoln pbResolveBitmap(hatFilename)
|
||||
# @hatBitmap = AnimatedBitmap.new(hatFilename,color)
|
||||
# @hat_sprite.bitmap = @hatBitmap.bitmap
|
||||
# else
|
||||
# @hatBitmap = nil
|
||||
# @hat_sprite.bitmap = nil
|
||||
# end
|
||||
# @color =color
|
||||
# @filename = hatFilename
|
||||
# end
|
||||
# animate(action)
|
||||
# end
|
||||
#
|
||||
# def adjust_hat_layer()
|
||||
# if @hat_sprite.z != @player_sprite.z
|
||||
# @hat_sprite.z = @player_sprite.z
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# def crop_spritesheet(direction)
|
||||
# sprite_x = 0
|
||||
# sprite_y = ((direction - 2) / 2) * @frameHeight
|
||||
# @hat_sprite.src_rect.set(sprite_x, sprite_y, @frameWidth, @frameHeight)
|
||||
# end
|
||||
#
|
||||
# def dispose
|
||||
# return if @disposed
|
||||
# @hat_sprite.dispose if @hat_sprite
|
||||
# @hat_sprite = nil
|
||||
# @disposed = true
|
||||
# end
|
||||
#
|
||||
# def disposed?
|
||||
# @disposed
|
||||
# end
|
||||
#
|
||||
# end
|
||||
104
Data/Scripts/005_Sprites/016_Sprite_Player.rb
Normal file
104
Data/Scripts/005_Sprites/016_Sprite_Player.rb
Normal file
@@ -0,0 +1,104 @@
|
||||
class Sprite_Player < Sprite_Character
|
||||
def initialize(viewport, character = nil)
|
||||
super
|
||||
@viewport = viewport
|
||||
@outfit_bitmap = nil
|
||||
@hat_bitmap = nil
|
||||
|
||||
hatFilename = ""
|
||||
hairFilename = ""
|
||||
@hair = Sprite_Hair.new(self, hairFilename, @character_name, @viewport)
|
||||
@hat = Sprite_Hat.new(self, hatFilename, @character_name, @viewport)
|
||||
|
||||
@previous_skinTone = 0
|
||||
|
||||
@current_bitmap = nil
|
||||
@previous_action =nil
|
||||
getClothedPlayerSprite(true)
|
||||
end
|
||||
|
||||
def updateCharacterBitmap
|
||||
skinTone = $Trainer.skin_tone ? $Trainer.skin_tone : 0
|
||||
baseBitmapFilename = getBaseOverworldSpriteFilename(@character_name, skinTone)
|
||||
if !pbResolveBitmap(baseBitmapFilename)
|
||||
baseBitmapFilename = Settings::PLAYER_GRAPHICS_FOLDER + @character_name
|
||||
end
|
||||
AnimatedBitmap.new(baseBitmapFilename, @character_hue)
|
||||
end
|
||||
|
||||
def applyDayNightTone
|
||||
super
|
||||
pbDayNightTint(@hat.sprite) if @hat && @hat.sprite.bitmap
|
||||
pbDayNightTint(@hair.sprite) if @hair && @hair.sprite.bitmap
|
||||
end
|
||||
|
||||
def opacity=(value)
|
||||
super
|
||||
@hat.sprite.opacity= value if @hat && @hat.sprite.bitmap
|
||||
@hair.sprite.opacity= value if @hair && @hair.sprite.bitmap
|
||||
end
|
||||
|
||||
def getClothedPlayerSprite(forceUpdate=false)
|
||||
if @previous_action != @character_name || forceUpdate
|
||||
@current_bitmap = generateClothedBitmap
|
||||
end
|
||||
@previous_action = @character_name
|
||||
@hair.animate(@character_name) if @hair
|
||||
@hat.animate(@character_name) if @hat
|
||||
return @current_bitmap
|
||||
end
|
||||
|
||||
|
||||
def generateClothedBitmap()
|
||||
@charbitmap.bitmap.clone #nekkid sprite
|
||||
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
|
||||
|
||||
outfitFilename = getOverworldOutfitFilename($Trainer.clothes, @character_name) #
|
||||
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
|
||||
hairFilename = getOverworldHairFilename($Trainer.hair)
|
||||
hatFilename = getOverworldHatFilename($Trainer.hat)
|
||||
|
||||
hair_color_shift = $Trainer.hair_color
|
||||
hat_color_shift = $Trainer.hat_color
|
||||
clothes_color_shift = $Trainer.clothes_color
|
||||
|
||||
hair_color_shift = 0 if !hair_color_shift
|
||||
hat_color_shift = 0 if !hat_color_shift
|
||||
clothes_color_shift = 0 if !clothes_color_shift
|
||||
@hair.update(@character_name, hairFilename, hair_color_shift) if @hair
|
||||
@hat.update(@character_name, hatFilename, hat_color_shift) if @hat
|
||||
|
||||
if !pbResolveBitmap(outfitFilename)
|
||||
raise "No temp clothes graphics available"
|
||||
end
|
||||
|
||||
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) if pbResolveBitmap(outfitFilename) #pbLoadOutfitBitmap(outfitFilename) if pbResolveBitmap(outfitFilename)
|
||||
baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
|
||||
@previous_action = @character_name
|
||||
return baseBitmap
|
||||
end
|
||||
|
||||
def positionHair(baseBitmap, hairBirmap, offset)
|
||||
baseBitmap.blt(offset[0], offset[1], hairBirmap, hairBirmap.rect)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
super
|
||||
end
|
||||
|
||||
def dispose
|
||||
super
|
||||
@hat.dispose if @hat
|
||||
@hair.dispose if @hair
|
||||
end
|
||||
|
||||
def pbLoadOutfitBitmap(outfitFileName)
|
||||
begin
|
||||
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
|
||||
return outfitBitmap
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,6 +3,10 @@ module MessageConfig
|
||||
LIGHT_TEXT_SHADOW_COLOR = Color.new(72, 80, 88)
|
||||
DARK_TEXT_MAIN_COLOR = Color.new(80, 80, 88)
|
||||
DARK_TEXT_SHADOW_COLOR = Color.new(160, 160, 168)
|
||||
|
||||
BLUE_TEXT_MAIN_COLOR = Color.new(35, 130, 200)
|
||||
BLUE_TEXT_SHADOW_COLOR = Color.new(20, 75, 115)
|
||||
|
||||
FONT_NAME = "Power Green"
|
||||
FONT_SIZE = 29
|
||||
SMALL_FONT_NAME = "Power Green Small"
|
||||
|
||||
@@ -233,6 +233,7 @@ class AnimatedSprite < SpriteWrapper
|
||||
attr_reader :frameheight
|
||||
attr_reader :framecount
|
||||
attr_reader :animname
|
||||
attr_reader :playing
|
||||
|
||||
def initializeLong(animname, framecount, framewidth, frameheight, frameskip)
|
||||
@animname = pbBitmapName(animname)
|
||||
@@ -335,6 +336,11 @@ class AnimatedSprite < SpriteWrapper
|
||||
@playing = false
|
||||
end
|
||||
|
||||
def reset
|
||||
@frame=0
|
||||
@realframes = 0
|
||||
end
|
||||
|
||||
def update
|
||||
super
|
||||
if @playing
|
||||
@@ -390,6 +396,7 @@ class IconSprite < SpriteWrapper
|
||||
return if bitmap == nil
|
||||
@_iconbitmap = bitmap
|
||||
# for compatibility
|
||||
#
|
||||
self.bitmap = @_iconbitmap ? @_iconbitmap.bitmap : nil
|
||||
self.src_rect = oldrc
|
||||
end
|
||||
|
||||
@@ -67,6 +67,10 @@ class AnimatedBitmap
|
||||
@bitmap.bitmap;
|
||||
end
|
||||
|
||||
def bitmap=(bitmap)
|
||||
@bitmap.bitmap = bitmap;
|
||||
end
|
||||
|
||||
def currentIndex
|
||||
@bitmap.currentIndex;
|
||||
end
|
||||
|
||||
@@ -162,3 +162,12 @@ GameData::Weather.register({
|
||||
:tile_delta_y => 0,
|
||||
:graphics => [nil, ["fog_tile"]]
|
||||
})
|
||||
|
||||
GameData::Weather.register({
|
||||
:id => :StrongWinds,
|
||||
:category => :StrongWinds,
|
||||
:id_number => 9,
|
||||
:tile_delta_x => -1200,
|
||||
:tile_delta_y => 0,
|
||||
:graphics => [nil, ["strong_winds"]]
|
||||
})
|
||||
|
||||
@@ -122,6 +122,8 @@ module GameData
|
||||
new_ret.each { |bitmap| alter_bitmap_function.call(pkmn, bitmap) }
|
||||
ret = new_ret
|
||||
end
|
||||
print "hat"
|
||||
add_hat_to_bitmap(ret,pkmn.hat,pkmn.hat_x,pkmn.hat_y) if pkmn.hat
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
@@ -52,7 +52,8 @@ module GameData
|
||||
end
|
||||
|
||||
def self.player_front_sprite_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
#outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
outfit=0
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit))
|
||||
end
|
||||
|
||||
@@ -61,7 +62,8 @@ module GameData
|
||||
end
|
||||
|
||||
def self.player_back_sprite_filename(tr_type)
|
||||
outfit = ($Trainer) ? $Trainer.outfit : 0 rescue 0
|
||||
#outfit = ($Trainer) ? $Trainer.outfit : 0
|
||||
outfit=0
|
||||
return self.check_file(tr_type, "Graphics/Trainers/", sprintf("_%d", outfit), "_back")
|
||||
end
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ module GameData
|
||||
end
|
||||
|
||||
def self.get_player(id)
|
||||
return self.get.player_A
|
||||
case id
|
||||
when 0 then return self.get.player_A
|
||||
when 1 then return self.get.player_B
|
||||
|
||||
@@ -699,11 +699,11 @@ class PokeBattle_Battle
|
||||
@field.weather = :None
|
||||
pbDisplay("The heavy rain has lifted!")
|
||||
end
|
||||
when :StrongWinds
|
||||
if !pbCheckGlobalAbility(:DELTASTREAM)
|
||||
@field.weather = :None
|
||||
pbDisplay("The mysterious air current has dissipated!")
|
||||
end
|
||||
# when :StrongWinds
|
||||
# if !pbCheckGlobalAbility(:DELTASTREAM)
|
||||
# @field.weather = :None
|
||||
# pbDisplay("The mysterious air current has dissipated!")
|
||||
# end
|
||||
end
|
||||
if @field.weather!=oldWeather
|
||||
# Check for form changes caused by the weather changing
|
||||
|
||||
@@ -282,6 +282,8 @@ class PokeBattle_Battle
|
||||
pbStartBattleSendOut(sendOuts)
|
||||
# Weather announcement
|
||||
weather_data = GameData::BattleWeather.try_get(@field.weather)
|
||||
echoln @field.weather
|
||||
|
||||
pbCommonAnimation(weather_data.animation) if weather_data
|
||||
case @field.weather
|
||||
when :Sun then pbDisplay(_INTL("The sunlight is strong."))
|
||||
@@ -466,7 +468,7 @@ class PokeBattle_Battle
|
||||
@scene.pbWildBattleSuccess if !Settings::GAIN_EXP_FOR_CAPTURE
|
||||
end
|
||||
# Register captured Pokémon in the Pokédex, and store them
|
||||
pbRecordAndStoreCaughtPokemon
|
||||
#pbRecordAndStoreCaughtPokemon
|
||||
|
||||
isRematch = $game_switches[SWITCH_IS_REMATCH]
|
||||
begin
|
||||
@@ -504,13 +506,7 @@ class PokeBattle_Battle
|
||||
end
|
||||
end
|
||||
end
|
||||
# Clean up battle stuff
|
||||
@scene.pbEndBattle(@decision)
|
||||
@battlers.each do |b|
|
||||
next if !b
|
||||
pbCancelChoice(b.index) # Restore unused items to Bag
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(b.ability,b,true) if b.abilityActive?
|
||||
end
|
||||
|
||||
pbParty(0).each_with_index do |pkmn,i|
|
||||
next if !pkmn
|
||||
@peer.pbOnLeavingBattle(self,pkmn,@usedInBattle[0][i],true) # Reset form
|
||||
@@ -518,6 +514,16 @@ class PokeBattle_Battle
|
||||
pkmn.spriteform_head=nil
|
||||
pkmn.spriteform_body=nil
|
||||
end
|
||||
pbRecordAndStoreCaughtPokemon
|
||||
|
||||
# Clean up battle stuff
|
||||
@scene.pbEndBattle(@decision)
|
||||
@battlers.each do |b|
|
||||
next if !b
|
||||
pbCancelChoice(b.index) # Restore unused items to Bag
|
||||
BattleHandlers.triggerAbilityOnSwitchOut(b.ability,b,true) if b.abilityActive?
|
||||
end
|
||||
|
||||
return @decision
|
||||
end
|
||||
|
||||
|
||||
@@ -589,13 +589,13 @@ class PokemonBattlerSprite < RPG::Sprite
|
||||
@pkmn = pkmn
|
||||
@_iconBitmap.dispose if @_iconBitmap
|
||||
@_iconBitmap = GameData::Species.sprite_bitmap_from_pokemon(@pkmn, back)
|
||||
if @back
|
||||
@_iconBitmap.scale_bitmap(Settings::BACKRPSPRITE_SCALE)
|
||||
else
|
||||
@_iconBitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
end
|
||||
scale =Settings::FRONTSPRITE_SCALE
|
||||
scale = Settings::BACKRPSPRITE_SCALE if @back
|
||||
@_iconBitmap.scale_bitmap(scale)
|
||||
|
||||
self.bitmap = (@_iconBitmap) ? @_iconBitmap.bitmap : nil
|
||||
add_hat_to_bitmap(self.bitmap,pkmn.hat,pkmn.hat_x,pkmn.hat_y,scale,self.mirror) if self.bitmap && pkmn.hat
|
||||
|
||||
pbSetPosition
|
||||
end
|
||||
|
||||
|
||||
@@ -244,6 +244,7 @@ class PokeBattle_Scene
|
||||
sprite = IconSprite.new(x,y,viewport)
|
||||
if filename
|
||||
sprite.setBitmap(filename) rescue nil
|
||||
|
||||
end
|
||||
@sprites[id] = sprite
|
||||
return sprite
|
||||
|
||||
@@ -170,23 +170,39 @@ class PokeBattle_Scene
|
||||
end
|
||||
|
||||
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
|
||||
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)
|
||||
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
|
||||
end
|
||||
trainer.ox = trainer.src_rect.width / 2
|
||||
trainer.oy = trainer.bitmap.height
|
||||
x = 100
|
||||
y = 410
|
||||
|
||||
sprite = IconSprite.new(x,y,@viewport)
|
||||
sprite.setBitmapDirectly(generate_front_trainer_sprite_bitmap())
|
||||
sprite.zoom_x=2
|
||||
sprite.zoom_y=2
|
||||
sprite.z=30 + idxTrainer
|
||||
|
||||
sprite.mirror =true
|
||||
@sprites["player_#{idxTrainer + 1}"] = sprite
|
||||
return sprite
|
||||
|
||||
#trainer = pbAddSprite("player_#{idxTrainer + 1}", spriteX, spriteY, trainerFile, @viewport)
|
||||
#
|
||||
# if idxTrainer == 0 # Player's sprite
|
||||
# #trainerFile = GameData::TrainerType.player_back_sprite_filename(trainerType)
|
||||
# trainerFile = generate_front_trainer_sprite_bitmap()
|
||||
# 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)
|
||||
# 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
|
||||
# end
|
||||
# trainer.ox = trainer.src_rect.width / 2
|
||||
# trainer.oy = trainer.bitmap.height
|
||||
end
|
||||
|
||||
def pbCreateTrainerFrontSprite(idxTrainer, trainerType, numTrainers = 1, sprite_override = nil)
|
||||
|
||||
@@ -306,18 +306,36 @@ Events.onMapChange += proc { |_sender, e|
|
||||
$game_screen.weather(new_weather[0], 9, 0) if rand(100) < new_weather[1]
|
||||
}
|
||||
|
||||
Events.onMapChange += proc { |_sender, e|
|
||||
next if !Settings::SEVII_ROAMING.include?($game_map.map_id)
|
||||
new_map_ID = e[0]
|
||||
new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
||||
next if new_map_metadata && new_map_metadata.weather
|
||||
feebas_map = $PokemonGlobal.roamPosition[4]
|
||||
if $game_map.map_id == feebas_map
|
||||
$game_screen.weather(:Rain, 4, 0)
|
||||
else
|
||||
$game_screen.weather(:None, 0, 0)
|
||||
end
|
||||
}
|
||||
# Events.onMapChange += proc { |_sender, e|
|
||||
# next if !Settings::SEVII_ROAMING.include?($game_map.map_id)
|
||||
# new_map_ID = e[0]
|
||||
# new_map_metadata = GameData::MapMetadata.try_get(new_map_ID)
|
||||
# next if new_map_metadata && new_map_metadata.weather
|
||||
# feebas_map = $PokemonGlobal.roamPosition[4]
|
||||
# if $game_map.map_id == feebas_map
|
||||
# $game_screen.weather(:Rain, 4, 0)
|
||||
# else
|
||||
# $game_screen.weather(:None, 0, 0)
|
||||
# end
|
||||
# }
|
||||
|
||||
# [:ENTEI, 50, 350, 1, "Legendary Birds",ROAMING_AREAS,:Sunny],
|
||||
# Events.onMapChange += proc { |_sender, e|
|
||||
# next if $game_screen.weather_type != :None
|
||||
# currently_roaming = $PokemonGlobal.roamPosition.keys
|
||||
# currently_roaming.each do |roamer_id|
|
||||
# roamerOnCurrentMap = $PokemonGlobal.roamPosition[roamer_id] == $game_map.map_id
|
||||
# echoln _INTL("{1} is on map {2}",roamer_id,$game_map.map_id)
|
||||
# echoln $PokemonGlobal.roamPokemon
|
||||
# if roamerOnCurrentMap
|
||||
# next if $PokemonGlobal.roamPokemonCaught[roamer_id]
|
||||
# weather = Settings::ROAMING_SPECIES[roamer_id][6]
|
||||
# $game_screen.weather(weather, 4, 0)
|
||||
# next
|
||||
# end
|
||||
#
|
||||
# end
|
||||
# }
|
||||
|
||||
Events.onMapSceneChange += proc { |_sender, e|
|
||||
scene = e[0]
|
||||
|
||||
@@ -153,6 +153,8 @@ def pbPrepareBattle(battle)
|
||||
battle.defaultWeather = :Sandstorm
|
||||
when :Sun
|
||||
battle.defaultWeather = :Sun
|
||||
when :StrongWinds
|
||||
battle.defaultWeather = :StrongWinds
|
||||
end
|
||||
else
|
||||
battle.defaultWeather = battleRules["defaultWeather"]
|
||||
|
||||
@@ -42,12 +42,12 @@ def pbBattleAnimation(bgm=nil,battletype=0,foe=nil)
|
||||
if $PokemonGlobal.surfing || $PokemonGlobal.diving
|
||||
location = 3
|
||||
elsif $PokemonTemp.encounterType &&
|
||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
||||
GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
|
||||
location = 3
|
||||
elsif $PokemonEncounters.has_cave_encounters?
|
||||
location = 2
|
||||
elsif !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
|
||||
location = 1
|
||||
end
|
||||
anim = ""
|
||||
@@ -136,10 +136,16 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
##### Tweaked by Maruno #####
|
||||
if (battletype==1 || battletype==3) && foe.length==1 # Against single trainer
|
||||
tr_type = foe[0].trainer_type
|
||||
tr_number= GameData::TrainerType.get(tr_type).id_number
|
||||
|
||||
|
||||
if tr_type
|
||||
tbargraphic = sprintf("vsBar_%s", tr_type.to_s) rescue nil
|
||||
tgraphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
|
||||
if pbResolveBitmap("Graphics/Transitions/" + tbargraphic) && pbResolveBitmap("Graphics/Transitions/" + tgraphic)
|
||||
#tgraphic = sprintf("vsTrainer_%s", tr_type.to_s) rescue nil
|
||||
tgraphic = sprintf("trainer%03d", tr_number) rescue nil
|
||||
|
||||
echoln tgraphic
|
||||
if pbResolveBitmap("Graphics/Transitions/" + tbargraphic) && pbResolveBitmap("Graphics/Characters/" + tgraphic)
|
||||
player_tr_type = $Trainer.trainer_type
|
||||
outfit = $Trainer.outfit
|
||||
# Set up
|
||||
@@ -156,11 +162,15 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
overlay = Sprite.new(viewport)
|
||||
overlay.bitmap = Bitmap.new(Graphics.width,Graphics.height)
|
||||
pbSetSystemFont(overlay.bitmap)
|
||||
pbargraphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
#pbargraphic = sprintf("vsBar_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
|
||||
if !pbResolveBitmap("Graphics/Transitions/" + pbargraphic)
|
||||
pbargraphic = sprintf("vsBar_%s", player_tr_type.to_s) rescue nil
|
||||
end
|
||||
# xoffset = ((Graphics.width/2)/10)*10
|
||||
xoffset = ((Graphics.width/2)/10)*10
|
||||
#xoffset = 0#((Graphics.width/2)/10)*10
|
||||
|
||||
bar1 = Sprite.new(viewplayer)
|
||||
bar1.bitmap = RPG::Cache.transition(pbargraphic)
|
||||
bar1.x = -xoffset
|
||||
@@ -179,6 +189,7 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
flash.opacity = 0
|
||||
# Animate bars sliding in from either side
|
||||
slideInTime = (Graphics.frame_rate*0.25).floor
|
||||
|
||||
for i in 0...slideInTime
|
||||
bar1.x = xoffset*(i+1-slideInTime)/slideInTime
|
||||
bar2.x = xoffset*(slideInTime-i-1)/slideInTime
|
||||
@@ -195,17 +206,38 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
bar1.bitmap = RPG::Cache.transition(pbargraphic)
|
||||
bar2 = AnimatedPlane.new(viewopp)
|
||||
bar2.bitmap = RPG::Cache.transition(tbargraphic)
|
||||
pgraphic = sprintf("vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
if !pbResolveBitmap("Graphics/Transitions/" + pgraphic)
|
||||
pgraphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil
|
||||
end
|
||||
#pgraphic = sprintf("vsTrainer_%s_%d", player_tr_type.to_s, outfit) rescue nil
|
||||
#pgraphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil
|
||||
|
||||
# pgraphic = generate_front_trainer_sprite_bitmap()#sprintf("trainer%03d", tr_number) rescue nil
|
||||
#
|
||||
# #if !pbResolveBitmap("Graphics/Transitions/" + pgraphic)
|
||||
# if !pbResolveBitmap("Graphics/Characters/" + pgraphic)
|
||||
# pgraphic = sprintf("vsTrainer_%s", player_tr_type.to_s) rescue nil
|
||||
# end
|
||||
player = Sprite.new(viewplayer)
|
||||
player.bitmap = RPG::Cache.transition(pgraphic)
|
||||
player.x = -xoffset
|
||||
#player.bitmap = RPG::Cache.transition(tgraphic)
|
||||
#
|
||||
playerSpriteWrapper = generate_front_trainer_sprite_bitmap()
|
||||
player.bitmap = playerSpriteWrapper.bitmap # RPG::Cache.load_bitmap("Graphics/Characters/", pgraphic) #RPG::Cache.transition(pgraphic)
|
||||
player.x = -250
|
||||
player.y = -30
|
||||
player.zoom_x = 2
|
||||
player.zoom_y = 2
|
||||
|
||||
player.mirror =true
|
||||
player_center_offset=-20
|
||||
|
||||
trainer = Sprite.new(viewopp)
|
||||
trainer.bitmap = RPG::Cache.transition(tgraphic)
|
||||
trainer.x = xoffset
|
||||
#trainer.bitmap = RPG::Cache.transition(tgraphic)
|
||||
trainer.bitmap =RPG::Cache.load_bitmap("Graphics/Characters/", tgraphic) #RPG::Cache.transition(pgraphic)
|
||||
trainer.x = xoffset+150
|
||||
trainer.tone = Tone.new(-255,-255,-255)
|
||||
trainer.zoom_x = 2
|
||||
trainer.zoom_y = 2
|
||||
trainer.y = -10
|
||||
trainer_center_offset=0
|
||||
|
||||
# Dim the flash and make the trainer sprites appear, while animating bars
|
||||
animTime = (Graphics.frame_rate*1.2).floor
|
||||
for i in 0...animTime
|
||||
@@ -213,13 +245,20 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
bar1.ox -= 32*20/Graphics.frame_rate
|
||||
bar2.ox += 32*20/Graphics.frame_rate
|
||||
if i>=animTime/2 && i<slideInTime+animTime/2
|
||||
player.x = xoffset*(i+1-slideInTime-animTime/2)/slideInTime
|
||||
trainer.x = xoffset*(slideInTime-i-1+animTime/2)/slideInTime
|
||||
player.x = (xoffset*(i+1-slideInTime-animTime/2)/slideInTime)+player_center_offset
|
||||
trainer.x = xoffset*(slideInTime-i-1+animTime/2)/slideInTime+trainer_center_offset
|
||||
end
|
||||
pbWait(1)
|
||||
end
|
||||
player.x = 0
|
||||
trainer.x = 0
|
||||
|
||||
|
||||
echoln "VS flash"
|
||||
#player.x = -150
|
||||
#player.y=-75
|
||||
|
||||
#trainer.x = -20
|
||||
# trainer.y = -75
|
||||
|
||||
# Make whole screen flash white again
|
||||
flash.opacity = 255
|
||||
pbSEPlay("Vs sword")
|
||||
@@ -228,10 +267,10 @@ def pbBattleAnimationOverride(viewport,battletype=0,foe=nil)
|
||||
trainer.tone = Tone.new(0,0,0)
|
||||
trainername = foe[0].name
|
||||
textpos = [
|
||||
[$Trainer.name,Graphics.width/4,(Graphics.height/1.5)+4,2,
|
||||
Color.new(248,248,248),Color.new(12*6,12*6,12*6)],
|
||||
[trainername,(Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+4,2,
|
||||
Color.new(248,248,248),Color.new(12*6,12*6,12*6)]
|
||||
[$Trainer.name,Graphics.width/4,(Graphics.height/1.5)+4,2,
|
||||
Color.new(248,248,248),Color.new(12*6,12*6,12*6)],
|
||||
[trainername,(Graphics.width/4)+(Graphics.width/2),(Graphics.height/1.5)+4,2,
|
||||
Color.new(248,248,248),Color.new(12*6,12*6,12*6)]
|
||||
]
|
||||
pbDrawTextPositions(overlay.bitmap,textpos)
|
||||
# Fade out flash, shudder Vs logo and expand it, and then fade to black
|
||||
|
||||
@@ -32,6 +32,16 @@ def pbRoamingAreas(idxRoamer)
|
||||
return Settings::ROAMING_AREAS
|
||||
end
|
||||
|
||||
def getRoamingMap(roamingPokemon)
|
||||
possible_roamers = {}
|
||||
for roamer in Settings::ROAMING_SPECIES
|
||||
name = roamer[0]
|
||||
id =
|
||||
possible_roamers[name] = id
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
# Puts a roamer in a completely random map available to it.
|
||||
def pbRandomRoam(index)
|
||||
return if !$PokemonGlobal.roamPosition
|
||||
@@ -55,6 +65,23 @@ def pbRoamPokemon
|
||||
for i in 0...Settings::ROAMING_SPECIES.length
|
||||
pbRoamPokemonOne(i)
|
||||
end
|
||||
|
||||
applyRoamWeather()
|
||||
end
|
||||
|
||||
|
||||
def applyRoamWeather()
|
||||
return if $game_screen.weather_type != :None
|
||||
currently_roaming = $PokemonGlobal.roamPosition.keys
|
||||
currently_roaming.each do |roamer_id|
|
||||
roamerOnCurrentMap = $PokemonGlobal.roamPosition[roamer_id] == $game_map.map_id
|
||||
if roamerOnCurrentMap
|
||||
return if $PokemonGlobal.roamPokemonCaught[roamer_id]
|
||||
weather = Settings::ROAMING_SPECIES[roamer_id][6]
|
||||
$game_screen.weather(weather, 4, 0)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Makes a single roaming Pokémon roam to another map. Doesn't roam if it isn't
|
||||
|
||||
@@ -338,6 +338,14 @@ def pbDive
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The sea is deep here. Would you like to use Dive?"))
|
||||
speciesname = (movefinder) ? movefinder.name : $Trainer.name
|
||||
if movefinder
|
||||
$Trainer.surfing_pokemon= getSpecies(movefinder.species)
|
||||
|
||||
echoln movefinder.species
|
||||
echoln getSpecies(movefinder.species)
|
||||
else
|
||||
$Trainer.surfing_pokemon=nil
|
||||
end
|
||||
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
pbFadeOutIn {
|
||||
@@ -349,6 +357,7 @@ def pbDive
|
||||
$PokemonGlobal.diving = true
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false)
|
||||
addWaterCausticsEffect()
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
@@ -403,8 +412,10 @@ def pbTransferUnderwater(mapid, x, y, direction = $game_player.direction)
|
||||
$game_temp.player_new_direction = direction
|
||||
$PokemonGlobal.diving = true
|
||||
$PokemonGlobal.surfing = false
|
||||
pbUpdateVehicle
|
||||
$scene.transfer_player(false )
|
||||
addWaterCausticsEffect()
|
||||
|
||||
$scene.transfer_player(false)
|
||||
$game_map.autoplay
|
||||
$game_map.refresh
|
||||
}
|
||||
@@ -804,7 +815,8 @@ def pbSurf
|
||||
if $PokemonSystem.quicksurf == 1
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
surfingPoke = movefinder.species if movefinder
|
||||
pbStartSurfing(surfingPoke)
|
||||
return true
|
||||
end
|
||||
if pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
|
||||
@@ -814,14 +826,21 @@ def pbSurf
|
||||
pbHiddenMoveAnimation(movefinder)
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm && !Settings::MAPS_WITHOUT_SURF_MUSIC.include?($game_map.map_id)
|
||||
pbStartSurfing
|
||||
|
||||
surfingPoke = movefinder.species if movefinder
|
||||
pbStartSurfing(surfingPoke)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def pbStartSurfing
|
||||
def pbStartSurfing(speciesID=nil)
|
||||
pbCancelVehicles
|
||||
if speciesID
|
||||
$Trainer.surfing_pokemon=getSpecies(speciesID)
|
||||
else
|
||||
$Trainer.surfing_pokemon=nil
|
||||
end
|
||||
$PokemonEncounters.reset_step_count
|
||||
$PokemonGlobal.surfing = true
|
||||
pbUpdateVehicle
|
||||
@@ -949,7 +968,8 @@ HiddenMoveHandlers::UseMove.add(:SURF, proc { |move, pokemon|
|
||||
end
|
||||
surfbgm = GameData::Metadata.get.surf_BGM
|
||||
pbCueBGM(surfbgm, 0.5) if surfbgm
|
||||
pbStartSurfing
|
||||
surfingPoke = pokemon if pokemon
|
||||
pbStartSurfing(surfingPoke)
|
||||
next true
|
||||
})
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, pkmn, scene|
|
||||
if scene.pbConfirm(_INTL("Would you like to change {1}'s Ability to {2}?",
|
||||
pkmn.name, newabilname))
|
||||
pkmn.ability_index = newabil
|
||||
pkmn.ability = GameData::Ability.get((newabil == 0) ? abil1 : abil2).id
|
||||
#pkmn.ability = GameData::Ability.get((newabil == 0) ? abil1 : abil2).id
|
||||
scene.pbHardRefresh
|
||||
scene.pbDisplay(_INTL("{1}'s Ability changed to {2}!", pkmn.name, newabilname))
|
||||
next true
|
||||
|
||||
@@ -10,6 +10,7 @@ class PokeRadar_UI
|
||||
|
||||
ICON_LINE_END = 450
|
||||
|
||||
GRAPHICS_Z = 99999
|
||||
|
||||
def initialize(seenPokemon = [], unseenPokemon = [], rarePokemon = [])
|
||||
@seen_pokemon = seenPokemon
|
||||
@@ -17,7 +18,7 @@ class PokeRadar_UI
|
||||
@rare_pokemon = rarePokemon
|
||||
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99
|
||||
@viewport.z = GRAPHICS_Z
|
||||
@sprites = {}
|
||||
@sprites["background"] = IconSprite.new(0, 0, @viewport)
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/Pokeradar/banner")
|
||||
@@ -89,7 +90,7 @@ class PokeRadar_UI
|
||||
@sprites[iconId].visible = true
|
||||
@sprites[iconId].x = @current_x
|
||||
@sprites[iconId].y = @current_y
|
||||
@sprites[iconId].z = 100
|
||||
@sprites[iconId].z = GRAPHICS_Z+1
|
||||
|
||||
@current_x += ICON_MARGIN_X
|
||||
if @current_x >= ICON_LINE_END
|
||||
|
||||
@@ -66,6 +66,11 @@ class ItemIconSprite < SpriteWrapper
|
||||
end
|
||||
end
|
||||
|
||||
def animbitmap=(path="")
|
||||
@animbitmap = AnimatedBitmap.new(path)
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
def item=(value)
|
||||
return if @item==value && !@forceitemchange
|
||||
@item = value
|
||||
|
||||
@@ -53,7 +53,16 @@ class PokemonSprite < SpriteWrapper
|
||||
def setPokemonBitmap(pokemon, back = false)
|
||||
@_iconbitmap.dispose if @_iconbitmap
|
||||
@_iconbitmap = (pokemon) ? GameData::Species.sprite_bitmap_from_pokemon(pokemon, back) : nil
|
||||
self.bitmap = (@_iconbitmap) ? @_iconbitmap.bitmap : nil
|
||||
if @_iconbitmap
|
||||
if pokemon.hat
|
||||
add_hat_to_bitmap(@_iconbitmap.bitmap,pokemon.hat,pokemon.hat_x,pokemon.hat_y)
|
||||
else
|
||||
|
||||
end
|
||||
self.bitmap = @_iconbitmap.bitmap
|
||||
else
|
||||
@_iconbitmap.bitmap=nil
|
||||
end
|
||||
self.color = Color.new(0, 0, 0, 0)
|
||||
changeOrigin
|
||||
end
|
||||
|
||||
@@ -22,6 +22,10 @@ class Pokemon
|
||||
attr_accessor :exp_when_fused_body
|
||||
attr_accessor :exp_gained_since_fused
|
||||
|
||||
attr_accessor :hat
|
||||
attr_accessor :hat_x
|
||||
attr_accessor :hat_y
|
||||
|
||||
# @return [Integer] the number of steps until this Pokémon hatches, 0 if this Pokémon is not an egg
|
||||
attr_accessor :steps_to_hatch
|
||||
# @return [Integer] the current HP
|
||||
@@ -113,6 +117,67 @@ class Pokemon
|
||||
|
||||
S_CHANCE_VALIDATOR = 16
|
||||
|
||||
def print_all_attributes
|
||||
echoln("Spriteform Body: #{@spriteform_body}")
|
||||
echoln("Spriteform Head: #{@spriteform_head}")
|
||||
echoln("Species: #{@species}")
|
||||
echoln("Forced Form: #{@forced_form}")
|
||||
echoln("Time Form Set: #{@time_form_set}")
|
||||
echoln("Experience: #{@exp}")
|
||||
echoln("EXP When Fused Head: #{@exp_when_fused_head}")
|
||||
echoln("EXP When Fused Body: #{@exp_when_fused_body}")
|
||||
echoln("EXP Gained Since Fused: #{@exp_gained_since_fused}")
|
||||
echoln("Hat: #{@hat}")
|
||||
echoln("Hat X: #{@hat_x}")
|
||||
echoln("Hat Y: #{@hat_y}")
|
||||
echoln("Steps to Hatch: #{@steps_to_hatch}")
|
||||
echoln("HP: #{@hp}")
|
||||
echoln("Status: #{@status}")
|
||||
echoln("Status Count: #{@statusCount}")
|
||||
echoln("Glitter: #{@glitter}")
|
||||
echoln("Head Shiny: #{@head_shiny}")
|
||||
echoln("Body Shiny: #{@body_shiny}")
|
||||
echoln("Debug Shiny: #{@debug_shiny}")
|
||||
echoln("Natural Shiny: #{@natural_shiny}")
|
||||
|
||||
echoln("Calculated ability: #{@ability}")
|
||||
echoln("Abilities hash: #{getAbilityList()}")
|
||||
|
||||
echoln("Ability Index: #{@ability_index}")
|
||||
echoln("Body Original Ability Index: #{@body_original_ability_index}")
|
||||
echoln("Head Original Ability Index: #{@head_original_ability_index}")
|
||||
|
||||
move1, move2, move3, move4 = "", "", "", ""
|
||||
|
||||
move1 = @moves[0].id if @moves[0]
|
||||
move2 = @moves[1].id if @moves[1]
|
||||
move3 = @moves[2].id if @moves[2]
|
||||
move4 = @moves[3].id if @moves[3]
|
||||
|
||||
echoln("Moves: #{move1} #{move2} #{move3} #{move4}")
|
||||
echoln("First Moves: #{@first_moves}")
|
||||
echoln("Ribbons: #{@ribbons}")
|
||||
echoln("Cool: #{@cool}, Beauty: #{@beauty}, Cute: #{@cute}, Smart: #{@smart}, Tough: #{@tough}, Sheen: #{@sheen}")
|
||||
echoln("Pokerus: #{@pokerus}")
|
||||
echoln("Happiness: #{@happiness}")
|
||||
echoln("Poke Ball: #{@poke_ball}")
|
||||
echoln("Markings: #{@markings}")
|
||||
echoln("IV: #{@iv}")
|
||||
echoln("IV Maxed: #{@ivMaxed}")
|
||||
echoln("EV: #{@ev}")
|
||||
echoln("Total HP: #{@totalhp}, Attack: #{@attack}, Defense: #{@defense}, Sp. Attack: #{@spatk}, Sp. Defense: #{@spdef}, Speed: #{@speed}")
|
||||
echoln("Owner: #{@owner}")
|
||||
echoln("Obtain Method: #{@obtain_method}")
|
||||
echoln("Obtain Map: #{@obtain_map}")
|
||||
echoln("Obtain Text: #{@obtain_text}")
|
||||
echoln("Obtain Level: #{@obtain_level}")
|
||||
echoln("Hatched Map: #{@hatched_map}")
|
||||
echoln("Fused: #{@fused}")
|
||||
echoln("Personal ID: #{@personalID}")
|
||||
echoln("Hidden Power Type: #{@hiddenPowerType}")
|
||||
# Add other attribute print statements here
|
||||
end
|
||||
|
||||
def self.play_cry(species, form = 0, volume = 90, pitch = 100)
|
||||
GameData::Species.play_cry_from_species(species, form, volume, pitch)
|
||||
end
|
||||
@@ -200,10 +265,12 @@ class Pokemon
|
||||
return @head_shiny
|
||||
end
|
||||
|
||||
|
||||
def isFusionOf(check_species)
|
||||
return hasBodyOf?(check_species) || hasHeadOf?(check_species)
|
||||
end
|
||||
|
||||
|
||||
def dexNum
|
||||
return species_data.id_number
|
||||
end
|
||||
@@ -555,6 +622,10 @@ class Pokemon
|
||||
return @ability_index
|
||||
end
|
||||
|
||||
def forced_ability
|
||||
return @ability
|
||||
end
|
||||
|
||||
# @return [GameData::Ability, nil] an Ability object corresponding to this Pokémon's ability
|
||||
def ability
|
||||
return GameData::Ability.try_get(ability_id)
|
||||
@@ -1370,6 +1441,11 @@ class Pokemon
|
||||
@totalhp = 1
|
||||
@spriteform_body = nil
|
||||
@spriteform_head = nil
|
||||
|
||||
@hat = nil
|
||||
@hat_x = 0
|
||||
@hat_y = 0
|
||||
|
||||
calc_stats
|
||||
if @form == 0 && recheck_form
|
||||
f = MultipleForms.call("getFormOnCreation", self)
|
||||
|
||||
@@ -9,6 +9,9 @@ class Trainer
|
||||
attr_accessor :party
|
||||
attr_accessor :quests
|
||||
attr_accessor :sprite_override
|
||||
attr_accessor :lowest_difficulty
|
||||
attr_accessor :selected_difficulty
|
||||
attr_accessor :game_mode
|
||||
|
||||
def inspect
|
||||
str = super.chop
|
||||
@@ -216,6 +219,9 @@ class Trainer
|
||||
@language = pbGetLanguage
|
||||
@party = []
|
||||
@sprite_override = sprite_override
|
||||
@lowest_difficulty=2 #On hard by default, lowered whenever the player selects another difficulty
|
||||
@selected_difficulty=2 #On hard by default, lowered whenever the player selects another difficulty
|
||||
@game_mode =0 #classic
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -2,22 +2,40 @@
|
||||
# Walking charset, for use in text entry screens and load game screen
|
||||
#===============================================================================
|
||||
class TrainerWalkingCharSprite < SpriteWrapper
|
||||
def initialize(charset,viewport=nil)
|
||||
def initialize(charset,viewport=nil,trainer=nil)
|
||||
super(viewport)
|
||||
@animbitmap = nil
|
||||
@trainer=trainer
|
||||
self.charset = charset
|
||||
@animframe = 0 # Current pattern
|
||||
@frame = 0 # Frame counter
|
||||
self.animspeed = 5 # Animation speed (frames per pattern)
|
||||
end
|
||||
|
||||
|
||||
def charset=(value)
|
||||
@animbitmap.dispose if @animbitmap
|
||||
@animbitmap = nil
|
||||
|
||||
outfit_bitmap = _INTL("Graphics/Characters/players/outfits/{1}_{2}",value,$Trainer.outfit) if $Trainer && $Trainer.outfit
|
||||
|
||||
@trainer = $Trainer if !@trainer
|
||||
if $Trainer
|
||||
meta=GameData::Metadata.get_player($Trainer.character_ID)
|
||||
isPlayerCharacter = value == pbGetPlayerCharset(meta,1,nil,true)
|
||||
end
|
||||
isPlayerCharacter = true if $scene.is_a?(Scene_Intro) #
|
||||
|
||||
bitmapFileName = sprintf("Graphics/Characters/%s",value)
|
||||
@charset = pbResolveBitmap(bitmapFileName)
|
||||
if @charset
|
||||
@animbitmap = AnimatedBitmap.new(@charset)
|
||||
if isPlayerCharacter #Display clothed player on continue screen
|
||||
@animbitmap.bitmap = generateClothedBitmapStatic(@trainer)
|
||||
@animbitmap.bitmap.blt(0, 0, outfit_bitmap, outfit_bitmap.rect) if pbResolveBitmap(outfit_bitmap)
|
||||
else
|
||||
@animbitmap.bitmap.blt(0, 0, outfit_bitmap, outfit_bitmap.rect) if pbResolveBitmap(outfit_bitmap)
|
||||
end
|
||||
self.bitmap = @animbitmap.bitmap
|
||||
self.src_rect.set(0,0,self.bitmap.width/4,self.bitmap.height/4)
|
||||
else
|
||||
@@ -54,6 +72,7 @@ class TrainerWalkingCharSprite < SpriteWrapper
|
||||
@animbitmap.update
|
||||
self.bitmap = @animbitmap.bitmap
|
||||
end
|
||||
|
||||
@frame += 1
|
||||
if @frame>=@frameskip
|
||||
@animframe = (@animframe+1)%4
|
||||
|
||||
@@ -5,7 +5,22 @@ class Player < Trainer
|
||||
# @return [Integer] the character ID of the player
|
||||
attr_accessor :character_ID
|
||||
# @return [Integer] the player's outfit
|
||||
attr_accessor :outfit
|
||||
attr_accessor :outfit #old - unused
|
||||
|
||||
attr_accessor :skin_tone
|
||||
attr_accessor :clothes
|
||||
attr_accessor :hat
|
||||
attr_accessor :hair
|
||||
attr_accessor :hair_color
|
||||
attr_accessor :hat_color
|
||||
attr_accessor :clothes_color
|
||||
attr_accessor :unlocked_clothes
|
||||
attr_accessor :unlocked_hats
|
||||
attr_accessor :unlocked_hairstyles
|
||||
|
||||
|
||||
attr_accessor :surfing_pokemon
|
||||
|
||||
# @return [Array<Boolean>] the player's Gym Badges (true if owned)
|
||||
attr_accessor :badges
|
||||
# @return [Integer] the player's money
|
||||
@@ -54,6 +69,102 @@ class Player < Trainer
|
||||
@coins = value.clamp(0, Settings::MAX_COINS)
|
||||
end
|
||||
|
||||
def outfit=(value)
|
||||
@outfit=value
|
||||
$game_player.outfit_changed=true
|
||||
end
|
||||
|
||||
def hat=(value)
|
||||
if value.is_a?(Symbol)
|
||||
value = HATS[value].id
|
||||
end
|
||||
@hat=value
|
||||
refreshPlayerOutfit()
|
||||
$game_player.outfit_changed=true
|
||||
end
|
||||
|
||||
def hair=(value)
|
||||
if value.is_a?(Symbol)
|
||||
value = HAIRSTYLES[value].id
|
||||
end
|
||||
@hair=value
|
||||
refreshPlayerOutfit()
|
||||
$game_player.outfit_changed=true
|
||||
end
|
||||
|
||||
def clothes=(value)
|
||||
if value.is_a?(Symbol)
|
||||
value = OUTFITS[value].id
|
||||
end
|
||||
@clothes=value
|
||||
refreshPlayerOutfit()
|
||||
$game_player.outfit_changed=true
|
||||
end
|
||||
|
||||
|
||||
def unlock_clothes(outfitID,silent=false)
|
||||
update_global_clothes_list()
|
||||
outfit = $PokemonGlobal.clothes_data[outfitID]
|
||||
@unlocked_clothes = [] if !@unlocked_clothes
|
||||
@unlocked_clothes << outfitID if !@unlocked_clothes.include?(outfitID)
|
||||
|
||||
if !silent
|
||||
filename = getTrainerSpriteOutfitFilename(outfitID)
|
||||
name= outfit ? outfit.name : outfitID
|
||||
unlock_outfit_animation(filename,name)
|
||||
end
|
||||
end
|
||||
|
||||
def unlock_hat(hatID,silent=false)
|
||||
update_global_hats_list()
|
||||
|
||||
hat = $PokemonGlobal.hats_data[hatID]
|
||||
@unlocked_hats = [] if !@unlocked_hats
|
||||
@unlocked_hats << hatID if !@unlocked_hats.include?(hatID)
|
||||
|
||||
|
||||
if !silent
|
||||
filename = getTrainerSpriteHatFilename(hatID)
|
||||
name= hat ? hat.name : hatID
|
||||
unlock_outfit_animation(filename,name)
|
||||
end
|
||||
end
|
||||
|
||||
def unlock_hair(hairID,silent=false)
|
||||
update_global_hairstyles_list()
|
||||
|
||||
hairstyle = $PokemonGlobal.hairstyles_data[hairID]
|
||||
if hairID.is_a?(Symbol)
|
||||
hairID = HAIRSTYLES[hairID].id
|
||||
end
|
||||
@unlocked_hairstyles = [] if !@unlocked_hairstyles
|
||||
@unlocked_hairstyles << hairID if !@unlocked_hairstyles.include?(hairID)
|
||||
|
||||
if !silent
|
||||
filename = getTrainerSpriteHairFilename("2_" + hairID)
|
||||
name= hairstyle ? hairstyle.name : hairID
|
||||
unlock_outfit_animation(filename,name)
|
||||
end
|
||||
end
|
||||
|
||||
def unlock_outfit_animation(filepath,name,color=2)
|
||||
outfit_preview = PictureWindow.new(filepath)
|
||||
outfit_preview.x = Graphics.width/4
|
||||
musicEffect= "Key item get"
|
||||
pbMessage(_INTL("{1} obtained \\C[{2}]{3}\\C[0]!\\me[{4}]",$Trainer.name,color,name,musicEffect))
|
||||
outfit_preview.dispose
|
||||
end
|
||||
|
||||
def surfing_pokemon=(species)
|
||||
@surfing_pokemon = species
|
||||
end
|
||||
|
||||
|
||||
def skin_tone=(value)
|
||||
@skin_tone=value
|
||||
$scene.reset_player_sprite
|
||||
#$scene.spritesetGlobal.playersprite.updateCharacterBitmap
|
||||
end
|
||||
|
||||
def beat_league=(value)
|
||||
@beat_league = value
|
||||
@@ -105,6 +216,11 @@ class Player < Trainer
|
||||
super
|
||||
@character_ID = -1
|
||||
@outfit = 0
|
||||
@hat = 0
|
||||
@hair = 0
|
||||
@clothes = 0
|
||||
@hair_color = 0
|
||||
@skin_tone = 0
|
||||
@badges = [false] * 8
|
||||
@money = Settings::INITIAL_MONEY
|
||||
@coins = 0
|
||||
@@ -120,5 +236,6 @@ class Player < Trainer
|
||||
@beat_league = false
|
||||
@new_game_plus_unlocked = false
|
||||
@new_game_plus = false
|
||||
@surfing_pokemon = nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -209,7 +209,7 @@ def pbHatch(pokemon)
|
||||
pokemon.hatched_map = $game_map.map_id
|
||||
if player_on_hidden_ability_map
|
||||
chosenAbility = pokemon.getAbilityList.sample #format: [[:ABILITY, index],...]
|
||||
pokemon.ability = chosenAbility[0]
|
||||
#pokemon.ability = chosenAbility[0]
|
||||
pokemon.ability_index = chosenAbility[1]
|
||||
end
|
||||
|
||||
|
||||
@@ -633,9 +633,9 @@ class PokemonEvolutionScene
|
||||
|
||||
|
||||
|
||||
if allNewPossibleAbilities.include?(oldAbility)
|
||||
@pokemon.ability=oldAbility
|
||||
end
|
||||
# if allNewPossibleAbilities.include?(oldAbility)
|
||||
# @pokemon.ability=oldAbility
|
||||
# end
|
||||
|
||||
# Learn moves upon evolution for evolved species
|
||||
movelist = @pokemon.getMoveList
|
||||
|
||||
@@ -219,6 +219,10 @@ def pbStartTrade(pokemonIndex,newpoke,nickname,trainerName,trainerGender=0,saveg
|
||||
Kernel.Autosave if savegame
|
||||
|
||||
myPokemon = $Trainer.party[pokemonIndex]
|
||||
heldItem = myPokemon.item
|
||||
echoln heldItem
|
||||
$PokemonBag.pbStoreItem(heldItem, 1) if heldItem
|
||||
|
||||
opponent = NPCTrainer.new(trainerName,trainerGender)
|
||||
opponent.id = $Trainer.make_foreign_ID
|
||||
yourPokemon = nil
|
||||
|
||||
@@ -245,7 +245,7 @@ class HallOfFame_Scene
|
||||
|
||||
def createTrainerBattler
|
||||
@sprites["trainer"] = IconSprite.new(@viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.front_sprite_filename($Trainer.trainer_type))
|
||||
@sprites["trainer"].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
|
||||
if !SINGLEROW
|
||||
@sprites["trainer"].x = Graphics.width - 96
|
||||
@sprites["trainer"].y = 160
|
||||
@@ -276,14 +276,9 @@ class HallOfFame_Scene
|
||||
end
|
||||
end
|
||||
|
||||
#Get difficulty for displaying in-game
|
||||
def getDifficulty
|
||||
if $game_switches[SWITCH_GAME_DIFFICULTY_EASY]
|
||||
return "Easy"
|
||||
elsif $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
|
||||
return "Hard"
|
||||
else
|
||||
return "Normal"
|
||||
end
|
||||
return getDisplayDifficulty()
|
||||
end
|
||||
|
||||
def writeTrainerData
|
||||
@@ -344,7 +339,7 @@ class HallOfFame_Scene
|
||||
pbDrawTextPositions(overlay, [[_INTL("Welcome to the Hall of Fame!"),
|
||||
Graphics.width / 2, Graphics.height - 80, 2, BASECOLOR, SHADOWCOLOR]])
|
||||
|
||||
writeCurrentDate(overlay, 120 , Graphics.height - 50)
|
||||
writeCurrentDate(overlay, 120, Graphics.height - 50)
|
||||
writeGameMode(overlay, (Graphics.width / 2) + 100, Graphics.height - 50)
|
||||
end
|
||||
|
||||
@@ -364,7 +359,7 @@ class HallOfFame_Scene
|
||||
end
|
||||
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
|
||||
pokemon_number = pbGet(VAR_SINGLE_POKEMON_MODE)
|
||||
if pokemon_number.is_a?(Integer) && pokemon_number >0
|
||||
if pokemon_number.is_a?(Integer) && pokemon_number > 0
|
||||
pokemon = GameData::Species.get(pokemon_number)
|
||||
gameMode = pokemon.real_name + " mode"
|
||||
else
|
||||
|
||||
@@ -110,6 +110,8 @@ Knuckles
|
||||
UnworthyPie
|
||||
Doctor Miawoo
|
||||
Chardub
|
||||
elupsis
|
||||
TCGrunler#4583
|
||||
|
||||
The following free ressources were also used
|
||||
with their respective authors' consent:
|
||||
@@ -211,6 +213,7 @@ _END_
|
||||
# Stop Editing
|
||||
|
||||
def main
|
||||
endCredits() if $PokemonSystem.on_mobile
|
||||
#-------------------------------
|
||||
# Animated Background Setup
|
||||
#-------------------------------
|
||||
@@ -326,13 +329,17 @@ _END_
|
||||
# Check if the credits should be cancelled
|
||||
def cancel?
|
||||
if Input.trigger?(Input::USE) && $PokemonGlobal.creditsPlayed
|
||||
$scene = Scene_Map.new
|
||||
pbBGMFade(1.0)
|
||||
endCredits
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def endCredits
|
||||
$scene = Scene_Map.new
|
||||
pbBGMFade(1.0)
|
||||
end
|
||||
|
||||
# Checks if credits bitmap has reached its ending point
|
||||
def last?
|
||||
if @realOY > @total_height + @trim
|
||||
|
||||
@@ -251,7 +251,7 @@ class PokemonPauseMenu
|
||||
elsif cmdOption >= 0 && command == cmdOption
|
||||
pbPlayDecisionSE
|
||||
pbFadeOutIn {
|
||||
scene = PokemonOption_Scene.new
|
||||
scene = PokemonGameOption_Scene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
pbUpdateSceneMap
|
||||
|
||||
@@ -427,9 +427,9 @@ class PokemonPartyPanel < SpriteWrapper
|
||||
end
|
||||
# Draw shiny icon
|
||||
if @pokemon.shiny?
|
||||
imagePos=[]
|
||||
addShinyStarsToGraphicsArray(imagePos,80,48,@pokemon.bodyShiny?,@pokemon.headShiny?,@pokemon.debugShiny?,0,0,16,16)
|
||||
pbDrawImagePositions(@overlaysprite.bitmap,imagePos)
|
||||
imagePos = []
|
||||
addShinyStarsToGraphicsArray(imagePos, 80, 48, @pokemon.bodyShiny?, @pokemon.headShiny?, @pokemon.debugShiny?, 0, 0, 16, 16)
|
||||
pbDrawImagePositions(@overlaysprite.bitmap, imagePos)
|
||||
end
|
||||
end
|
||||
pbDrawTextPositions(@overlaysprite.bitmap, textpos)
|
||||
@@ -467,6 +467,7 @@ end
|
||||
# Pokémon party visuals
|
||||
#===============================================================================
|
||||
class PokemonParty_Scene
|
||||
attr_accessor :viewport
|
||||
def pbStartScene(party, starthelptext, annotations = nil, multiselect = false)
|
||||
@sprites = {}
|
||||
@party = party
|
||||
@@ -691,6 +692,15 @@ class PokemonParty_Scene
|
||||
return ret
|
||||
end
|
||||
|
||||
def pbOpenHatScreen(pokemon)
|
||||
#oldsprites = pbFadeOutAndHide(@sprites)
|
||||
scene = PokemonHatView.new
|
||||
screen = PokemonHatPresenter.new(scene, pokemon)
|
||||
screen.pbStartScreen()
|
||||
yield if block_given?
|
||||
#pbFadeInAndShow(@sprites, oldsprites)
|
||||
end
|
||||
|
||||
def pbUseItem(bag, pokemon)
|
||||
ret = nil
|
||||
pbFadeOutIn {
|
||||
@@ -1152,6 +1162,31 @@ class PokemonPartyScreen
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
def pbPokemonHat(pokemon)
|
||||
cmd = 0
|
||||
msg = "What should you do?"
|
||||
loop do
|
||||
cmd = @scene.pbShowCommands(msg, [
|
||||
_INTL("Put on hat"),
|
||||
_INTL("Remove hat"),
|
||||
_INTL("Back")], cmd)
|
||||
echoln cmd
|
||||
break if cmd == -1
|
||||
if cmd == 0 #Put on hat
|
||||
@scene.pbOpenHatScreen(pokemon)
|
||||
pbDisplay(_INTL("{1} put on a hat!",pokemon.name))
|
||||
elsif cmd == 1 #remove hat
|
||||
if pbConfirm(_INTL("Remove {1}'s hat?",pokemon.name))
|
||||
pokemon.hat=nil
|
||||
pbDisplay(_INTL("{1}'s hat was removed",pokemon.name))
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def pbPokemonRename(pkmn, pkmnid)
|
||||
cmd = 0
|
||||
loop do
|
||||
@@ -1160,7 +1195,7 @@ class PokemonPartyScreen
|
||||
_INTL("{1} has no nickname.", speciesname)][pkmn.name == speciesname ? 1 : 0]
|
||||
cmd = @scene.pbShowCommands(msg, [
|
||||
_INTL("Rename"),
|
||||
_INTL("Quit")], cmd)
|
||||
_INTL("Back")], cmd)
|
||||
# Break
|
||||
if cmd == -1
|
||||
break
|
||||
@@ -1201,6 +1236,8 @@ class PokemonPartyScreen
|
||||
cmdSwitch = -1
|
||||
cmdMail = -1
|
||||
cmdItem = -1
|
||||
cmdHat = -1
|
||||
|
||||
# Build the commands
|
||||
commands[cmdSummary = commands.length] = _INTL("Summary")
|
||||
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
|
||||
@@ -1214,6 +1251,7 @@ class PokemonPartyScreen
|
||||
end
|
||||
end
|
||||
commands[cmdSwitch = commands.length] = _INTL("Switch") if @party.length > 1
|
||||
commands[cmdHat = commands.length] = _INTL("Hat") if !pkmn.egg? && $game_switches[SWITCH_UNLOCKED_POKEMON_HATS]
|
||||
if !pkmn.egg?
|
||||
if pkmn.mail
|
||||
commands[cmdMail = commands.length] = _INTL("Mail")
|
||||
@@ -1281,8 +1319,10 @@ class PokemonPartyScreen
|
||||
@scene.pbSummary(pkmnid) {
|
||||
@scene.pbSetHelpText((@party.length > 1) ? _INTL("Choose a Pokémon.") : _INTL("Choose Pokémon or cancel."))
|
||||
}
|
||||
elsif cmdHat >= 0 && command == cmdHat
|
||||
pbPokemonHat(pkmn)
|
||||
elsif cmdNickname >= 0 && command == cmdNickname
|
||||
pbPokemonRename(pkmn,pkmnid)
|
||||
pbPokemonRename(pkmn, pkmnid)
|
||||
elsif cmdDebug >= 0 && command == cmdDebug
|
||||
pbPokemonDebug(pkmn, pkmnid)
|
||||
elsif cmdSwitch >= 0 && command == cmdSwitch
|
||||
|
||||
@@ -1276,10 +1276,13 @@ class PokemonSummary_Scene
|
||||
cmdTakeItem = -1
|
||||
cmdPokedex = -1
|
||||
cmdMark = -1
|
||||
cmdHat = -1
|
||||
|
||||
if !@pokemon.egg?
|
||||
if pbBattleChallenge.currentChallenge == -1
|
||||
commands[cmdGiveItem = commands.length] = _INTL("Give item")
|
||||
commands[cmdTakeItem = commands.length] = _INTL("Take item") if @pokemon.hasItem?
|
||||
commands[cmdHat = commands.length] = _INTL("Hat") if !@pokemon.egg? && $game_switches[SWITCH_UNLOCKED_POKEMON_HATS]
|
||||
end
|
||||
commands[cmdPokedex = commands.length] = _INTL("View Pokédex") if $Trainer.has_pokedex
|
||||
end
|
||||
@@ -1298,6 +1301,8 @@ class PokemonSummary_Scene
|
||||
end
|
||||
elsif cmdTakeItem >= 0 && command == cmdTakeItem
|
||||
dorefresh = pbTakeItemFromPokemon(@pokemon, self)
|
||||
elsif cmdHat >= 0 && command == cmdHat
|
||||
pbPokemonHatFromSummary(@pokemon)
|
||||
elsif cmdPokedex >= 0 && command == cmdPokedex
|
||||
$Trainer.pokedex.register_last_seen(@pokemon)
|
||||
pbFadeOutIn {
|
||||
@@ -1313,6 +1318,47 @@ class PokemonSummary_Scene
|
||||
return dorefresh
|
||||
end
|
||||
|
||||
def pbOpenHatScreenSummary(pokemon)
|
||||
#oldsprites = pbFadeOutAndHide(@sprites)
|
||||
x_pos = -8 #todo: Set as relative position instead of hardcoded value
|
||||
y_pos = 94#
|
||||
|
||||
scene = PokemonHatView.new(x_pos,y_pos,false)
|
||||
screen = PokemonHatPresenter.new(scene, pokemon)
|
||||
screen.pbStartScreen()
|
||||
yield if block_given?
|
||||
#pbFadeInAndShow(@sprites, oldsprites)
|
||||
end
|
||||
|
||||
def pbPokemonHatFromSummary(pokemon)
|
||||
cmd = 0
|
||||
msg = "What should you do?"
|
||||
loop do
|
||||
cmd = pbShowCommands([
|
||||
_INTL("Put on hat"),
|
||||
_INTL("Remove hat"),
|
||||
_INTL("Back")])
|
||||
echoln cmd
|
||||
break if cmd == -1
|
||||
if cmd == 0 #Put on hat
|
||||
@sprites["pokemon"].visible=false
|
||||
pbOpenHatScreenSummary(pokemon)
|
||||
@sprites["pokemon"].visible=true
|
||||
pbDisplay(_INTL("{1} put on a hat!",pokemon.name))
|
||||
#@sprites["pokemon"].visible=false
|
||||
|
||||
elsif cmd == 1 #remove hat
|
||||
if pbConfirm(_INTL("Remove {1}'s hat?",pokemon.name))
|
||||
pokemon.hat=nil
|
||||
pbDisplay(_INTL("{1}'s hat was removed",pokemon.name))
|
||||
end
|
||||
else
|
||||
break
|
||||
end
|
||||
pbChangePokemon()
|
||||
end
|
||||
end
|
||||
|
||||
def pbChooseMoveToForget(move_to_learn)
|
||||
new_move = (move_to_learn) ? Pokemon::Move.new(move_to_learn) : nil
|
||||
selmove = 0
|
||||
|
||||
@@ -35,7 +35,8 @@ class PokemonTrainerCard_Scene
|
||||
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
@sprites["trainer"] = IconSprite.new(336,112,@viewport)
|
||||
@sprites["trainer"].setBitmap(GameData::TrainerType.player_front_sprite_filename($Trainer.trainer_type))
|
||||
@sprites["trainer"].setBitmapDirectly(generate_front_trainer_sprite_bitmap())
|
||||
|
||||
@sprites["trainer"].x -= (@sprites["trainer"].bitmap.width-128)/2
|
||||
@sprites["trainer"].y -= (@sprites["trainer"].bitmap.height-128)
|
||||
@sprites["trainer"].z = 2
|
||||
|
||||
@@ -65,8 +65,12 @@ class PokemonLoadPanel < SpriteWrapper
|
||||
textpos.push([@title,16*2,2*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Badges:"),16*2,53*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.badge_count.to_s,103*2,53*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([_INTL("Pokédex:"),16*2,69*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([@trainer.pokedex.seen_count.to_s,103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
# textpos.push([_INTL("Pokédex:"),16*2,69*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
# textpos.push([@trainer.pokedex.seen_count.to_s,103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
|
||||
textpos.push([_INTL(getDisplayDifficultyFromIndex(@trainer.lowest_difficulty)),16*2,69*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
textpos.push([getGameModeFromIndex(@trainer.game_mode),103*2,69*2,1,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
|
||||
textpos.push([_INTL("Time:"),16*2,85*2,0,TEXTCOLOR,TEXTSHADOWCOLOR])
|
||||
hour = @totalsec / 60 / 60
|
||||
min = @totalsec / 60 % 60
|
||||
@@ -166,7 +170,7 @@ class PokemonLoad_Scene
|
||||
meta = GameData::Metadata.get_player(trainer.character_ID)
|
||||
if meta
|
||||
filename = pbGetPlayerCharset(meta,1,trainer,true)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport)
|
||||
@sprites["player"] = TrainerWalkingCharSprite.new(filename,@viewport,trainer)
|
||||
charwidth = @sprites["player"].bitmap.width
|
||||
charheight = @sprites["player"].bitmap.height
|
||||
@sprites["player"].x = 56*2-charwidth/8
|
||||
@@ -341,7 +345,7 @@ class PokemonLoadScreen
|
||||
pbFadeOutIn { pbDownloadMysteryGift(@save_data[:player]) }
|
||||
when cmd_options
|
||||
pbFadeOutIn do
|
||||
scene = PokemonOption_Scene.new
|
||||
scene = PokemonGameOption_Scene.new
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen(true)
|
||||
end
|
||||
|
||||
@@ -19,6 +19,8 @@ class PokemonSystem
|
||||
attr_accessor :download_sprites
|
||||
attr_accessor :speedup
|
||||
attr_accessor :speedup_speed
|
||||
attr_accessor :max_nb_sprites_download
|
||||
attr_accessor :on_mobile
|
||||
|
||||
def initialize
|
||||
@textspeed = 1 # Text speed (0=slow, 1=normal, 2=fast)
|
||||
@@ -37,6 +39,8 @@ class PokemonSystem
|
||||
@speedup = 0 #0= hold, 1=toggle
|
||||
@speedup_speed = 3 #for hold only
|
||||
@download_sprites = 0
|
||||
@max_nb_sprites_download = 5
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -349,6 +353,7 @@ class PokemonOption_Scene
|
||||
|
||||
def initialize
|
||||
@autosave_menu = false
|
||||
@manually_changed_difficulty=false
|
||||
end
|
||||
|
||||
def initUIElements
|
||||
@@ -411,192 +416,9 @@ class PokemonOption_Scene
|
||||
end
|
||||
end
|
||||
|
||||
#IMPLEMENT IN INHERITED CLASSES
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = []
|
||||
options << SliderOption.new(_INTL("Music Volume"), 0, 100, 5,
|
||||
proc { $PokemonSystem.bgmvolume },
|
||||
proc { |value|
|
||||
if $PokemonSystem.bgmvolume != value
|
||||
$PokemonSystem.bgmvolume = value
|
||||
if $game_system.playing_bgm != nil && !inloadscreen
|
||||
playingBGM = $game_system.getPlayingBGM
|
||||
$game_system.bgm_pause
|
||||
$game_system.bgm_resume(playingBGM)
|
||||
end
|
||||
end
|
||||
}, "Sets the volume for background music"
|
||||
)
|
||||
|
||||
options << SliderOption.new(_INTL("SE Volume"), 0, 100, 5,
|
||||
proc { $PokemonSystem.sevolume },
|
||||
proc { |value|
|
||||
if $PokemonSystem.sevolume != value
|
||||
$PokemonSystem.sevolume = value
|
||||
if $game_system.playing_bgs != nil
|
||||
$game_system.playing_bgs.volume = value
|
||||
playingBGS = $game_system.getPlayingBGS
|
||||
$game_system.bgs_pause
|
||||
$game_system.bgs_resume(playingBGS)
|
||||
end
|
||||
pbPlayCursorSE
|
||||
end
|
||||
}, "Sets the volume for sound effects"
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Default Movement"), [_INTL("Walking"), _INTL("Running")],
|
||||
proc { $PokemonSystem.runstyle },
|
||||
proc { |value| $PokemonSystem.runstyle = value },
|
||||
["Default to walking when not holding the Run key",
|
||||
"Default to running when not holding the Run key"]
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Text Speed"), [_INTL("Normal"), _INTL("Fast")],
|
||||
proc { $PokemonSystem.textspeed },
|
||||
proc { |value|
|
||||
$PokemonSystem.textspeed = value
|
||||
MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value))
|
||||
}, "Sets the speed at which the text is displayed"
|
||||
)
|
||||
|
||||
if $game_switches
|
||||
options <<
|
||||
EnumOption.new(_INTL("Autosave"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[AUTOSAVE_ENABLED_SWITCH] ? 0 : 1 },
|
||||
proc { |value|
|
||||
if !$game_switches[AUTOSAVE_ENABLED_SWITCH] && value == 0
|
||||
@autosave_menu = true
|
||||
openAutosaveMenu()
|
||||
end
|
||||
$game_switches[AUTOSAVE_ENABLED_SWITCH] = value == 0
|
||||
},
|
||||
"Automatically saves when healing at Pokémon centers"
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
options << EnumOption.new(_INTL("Speed-up type"), [_INTL("Hold"), _INTL("Toggle")],
|
||||
proc { $PokemonSystem.speedup },
|
||||
proc { |value|
|
||||
$PokemonSystem.speedup = value
|
||||
}, "Pick how you want speed-up to be enabled"
|
||||
)
|
||||
|
||||
options << SliderOption.new(_INTL("Speed-up speed"), 1, 10, 1,
|
||||
proc { $PokemonSystem.speedup_speed },
|
||||
proc { |value|
|
||||
$PokemonSystem.speedup_speed = value
|
||||
}, "Sets by how much to speed up the game when holding the speed up button (Default: 3x)"
|
||||
)
|
||||
# if $game_switches && ($game_switches[SWITCH_NEW_GAME_PLUS] || $game_switches[SWITCH_BEAT_THE_LEAGUE]) #beat the league
|
||||
# options << EnumOption.new(_INTL("Text Speed"), [_INTL("Normal"), _INTL("Fast"), _INTL("Instant")],
|
||||
# proc { $PokemonSystem.textspeed },
|
||||
# proc { |value|
|
||||
# $PokemonSystem.textspeed = value
|
||||
# MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value))
|
||||
# }, "Sets the speed at which the text is displayed"
|
||||
# )
|
||||
# else
|
||||
# options << EnumOption.new(_INTL("Text Speed"), [_INTL("Normal"), _INTL("Fast")],
|
||||
# proc { $PokemonSystem.textspeed },
|
||||
# proc { |value|
|
||||
# $PokemonSystem.textspeed = value
|
||||
# MessageConfig.pbSetTextSpeed(MessageConfig.pbSettingToTextSpeed(value))
|
||||
# }, "Sets the speed at which the text is displayed"
|
||||
# )
|
||||
# end
|
||||
options <<
|
||||
EnumOption.new(_INTL("Download sprites"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $PokemonSystem.download_sprites },
|
||||
proc { |value|
|
||||
$PokemonSystem.download_sprites = value
|
||||
},
|
||||
"Automatically download custom sprites from the internet"
|
||||
)
|
||||
|
||||
|
||||
|
||||
if $game_switches && ($game_switches[SWITCH_NEW_GAME_PLUS] || $game_switches[SWITCH_BEAT_THE_LEAGUE]) #beat the league
|
||||
options <<
|
||||
EnumOption.new(_INTL("Battle type"), [_INTL("1v1"), _INTL("2v2"), _INTL("3v3")],
|
||||
proc { $PokemonSystem.battle_type },
|
||||
proc { |value|
|
||||
if value == 0
|
||||
$game_variables[VAR_DEFAULT_BATTLE_TYPE] = [1, 1]
|
||||
elsif value == 1
|
||||
$game_variables[VAR_DEFAULT_BATTLE_TYPE] = [2, 2]
|
||||
elsif value == 2
|
||||
$game_variables[VAR_DEFAULT_BATTLE_TYPE] = [3, 3]
|
||||
else
|
||||
$game_variables[VAR_DEFAULT_BATTLE_TYPE] = [1, 1]
|
||||
end
|
||||
$PokemonSystem.battle_type = value
|
||||
}, "Sets the number of Pokémon sent out in battles (when possible)"
|
||||
)
|
||||
end
|
||||
|
||||
options << EnumOption.new(_INTL("Battle Effects"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $PokemonSystem.battlescene },
|
||||
proc { |value| $PokemonSystem.battlescene = value },
|
||||
"Display move animations in battles"
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Battle Style"), [_INTL("Switch"), _INTL("Set")],
|
||||
proc { $PokemonSystem.battlestyle },
|
||||
proc { |value| $PokemonSystem.battlestyle = value },
|
||||
["Prompts to switch Pokémon before the opponent sends out the next one",
|
||||
"No prompt to switch Pokémon before the opponent sends the next one"]
|
||||
)
|
||||
|
||||
|
||||
options << NumberOption.new(_INTL("Speech Frame"), 1, Settings::SPEECH_WINDOWSKINS.length,
|
||||
proc { $PokemonSystem.textskin },
|
||||
proc { |value|
|
||||
$PokemonSystem.textskin = value
|
||||
MessageConfig.pbSetSpeechFrame("Graphics/Windowskins/" + Settings::SPEECH_WINDOWSKINS[value])
|
||||
}
|
||||
)
|
||||
# NumberOption.new(_INTL("Menu Frame"),1,Settings::MENU_WINDOWSKINS.length,
|
||||
# proc { $PokemonSystem.frame },
|
||||
# proc { |value|
|
||||
# $PokemonSystem.frame = value
|
||||
# MessageConfig.pbSetSystemFrame("Graphics/Windowskins/" + Settings::MENU_WINDOWSKINS[value])
|
||||
# }
|
||||
# ),
|
||||
options << EnumOption.new(_INTL("Text Entry"), [_INTL("Cursor"), _INTL("Keyboard")],
|
||||
proc { $PokemonSystem.textinput },
|
||||
proc { |value| $PokemonSystem.textinput = value },
|
||||
["Enter text by selecting letters on the screen",
|
||||
"Enter text by typing on the keyboard"]
|
||||
)
|
||||
if $game_variables
|
||||
options << EnumOption.new(_INTL("Fusion icons"), [_INTL("Combined"), _INTL("DNA")],
|
||||
proc { $game_variables[VAR_FUSION_ICON_STYLE] },
|
||||
proc { |value| $game_variables[VAR_FUSION_ICON_STYLE] = value },
|
||||
["Combines both Pokémon's party icons",
|
||||
"Uses the same party icon for all fusions"]
|
||||
)
|
||||
end
|
||||
options << EnumOption.new(_INTL("Screen Size"), [_INTL("S"), _INTL("M"), _INTL("L"), _INTL("XL"), _INTL("Full")],
|
||||
proc { [$PokemonSystem.screensize, 4].min },
|
||||
proc { |value|
|
||||
if $PokemonSystem.screensize != value
|
||||
$PokemonSystem.screensize = value
|
||||
pbSetResizeFactor($PokemonSystem.screensize)
|
||||
end
|
||||
}, "Sets the size of the screen"
|
||||
)
|
||||
options << EnumOption.new(_INTL("Quick Surf"), [_INTL("Off"), _INTL("On")],
|
||||
proc { $PokemonSystem.quicksurf },
|
||||
proc { |value| $PokemonSystem.quicksurf = value },
|
||||
"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
|
||||
|
||||
|
||||
@@ -79,6 +79,14 @@ class PokemonMartAdapter
|
||||
def removeItem(item)
|
||||
return $PokemonBag.pbDeleteItem(item)
|
||||
end
|
||||
|
||||
def getBaseColorOverride(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
def getShadowColorOverride(item)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -97,6 +105,14 @@ class BuyAdapter
|
||||
@adapter.getDisplayPrice(item, false)
|
||||
end
|
||||
|
||||
def getBaseColorOverride(item)
|
||||
return @adapter.getBaseColorOverride(item)
|
||||
end
|
||||
|
||||
def getShadowColorOverride(item)
|
||||
return @adapter.getShadowColorOverride(item)
|
||||
end
|
||||
|
||||
def isSelling?
|
||||
return false
|
||||
end
|
||||
@@ -125,6 +141,15 @@ class SellAdapter
|
||||
def isSelling?
|
||||
return true
|
||||
end
|
||||
|
||||
def getBaseColorOverride(item)
|
||||
return @adapter.getBaseColorOverride(item)
|
||||
end
|
||||
|
||||
def getShadowColorOverride(item)
|
||||
return @adapter.getShadowColorOverride(item)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
#===============================================================================
|
||||
@@ -158,11 +183,18 @@ class Window_PokemonMart < Window_DrawableCommand
|
||||
else
|
||||
item = @stock[index]
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
|
||||
baseColorOverride = @adapter.getBaseColorOverride(item)
|
||||
shadowColorOverride = @adapter.getShadowColorOverride(item)
|
||||
|
||||
baseColor = baseColorOverride ? baseColorOverride : self.baseColor
|
||||
shadowColor = shadowColorOverride ? shadowColorOverride : self.shadowColor
|
||||
|
||||
qty = @adapter.getDisplayPrice(item)
|
||||
sizeQty = self.contents.text_size(qty).width
|
||||
xQty = rect.x + rect.width - sizeQty - 2 - 16
|
||||
textpos.push([itemname, rect.x, ypos - 4, false, self.baseColor, self.shadowColor])
|
||||
textpos.push([qty, xQty, ypos - 4, false, self.baseColor, self.shadowColor])
|
||||
textpos.push([itemname, rect.x, ypos - 4, false, baseColor, shadowColor])
|
||||
textpos.push([qty, xQty, ypos - 4, false, baseColor, shadowColor])
|
||||
end
|
||||
pbDrawTextPositions(self.contents, textpos)
|
||||
end
|
||||
@@ -188,15 +220,23 @@ class PokemonMart_Scene
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
@sprites["icon"].item = itemwindow.item
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
|
||||
itemwindow.refresh
|
||||
end
|
||||
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString,@currency_name)
|
||||
end
|
||||
|
||||
def scroll_map()
|
||||
pbScrollMap(6, 5, 5)
|
||||
end
|
||||
|
||||
def scroll_back_map()
|
||||
pbScrollMap(4, 5, 5)
|
||||
end
|
||||
|
||||
def pbStartBuyOrSellScene(buying, stock, adapter)
|
||||
# Scroll right before showing screen
|
||||
pbScrollMap(6, 5, 5)
|
||||
scroll_map()
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@stock = stock
|
||||
@@ -207,12 +247,12 @@ class PokemonMart_Scene
|
||||
@sprites["icon"] = ItemIconSprite.new(36, Graphics.height - 50, nil, @viewport)
|
||||
winAdapter = buying ? BuyAdapter.new(adapter) : SellAdapter.new(adapter)
|
||||
@sprites["itemwindow"] = Window_PokemonMart.new(stock, winAdapter,
|
||||
Graphics.width - 316 - 16, 12, 330 + 16, Graphics.height - 126)
|
||||
Graphics.width - 316 - 16, 12, 330 + 16, Graphics.height - 126)
|
||||
@sprites["itemwindow"].viewport = @viewport
|
||||
@sprites["itemwindow"].index = 0
|
||||
@sprites["itemwindow"].refresh
|
||||
@sprites["itemtextwindow"] = Window_UnformattedTextPokemon.newWithSize("",
|
||||
64, Graphics.height - 96 - 16, Graphics.width - 64, 128, @viewport)
|
||||
64, Graphics.height - 96 - 16, Graphics.width - 64, 128, @viewport)
|
||||
pbPrepareWindow(@sprites["itemtextwindow"])
|
||||
@sprites["itemtextwindow"].baseColor = Color.new(248, 248, 248)
|
||||
@sprites["itemtextwindow"].shadowColor = Color.new(0, 0, 0)
|
||||
@@ -291,9 +331,10 @@ class PokemonMart_Scene
|
||||
|
||||
def pbEndBuyScene
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
Kernel.pbClearText()
|
||||
@viewport.dispose
|
||||
# Scroll left after showing screen
|
||||
pbScrollMap(4, 5, 5)
|
||||
scroll_back_map()
|
||||
end
|
||||
|
||||
def pbEndSellScene
|
||||
@@ -418,64 +459,64 @@ class PokemonMart_Scene
|
||||
itemprice /= 2 if !@buying
|
||||
pbDisplay(helptext, true)
|
||||
using(numwindow = Window_AdvancedTextPokemon.new("")) { # Showing number of items
|
||||
qty = @adapter.getQuantity(item)
|
||||
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
|
||||
pbPrepareWindow(numwindow)
|
||||
pbPrepareWindow(inbagwindow)
|
||||
numwindow.viewport = @viewport
|
||||
numwindow.width = 224
|
||||
numwindow.height = 64
|
||||
numwindow.baseColor = Color.new(88, 88, 80)
|
||||
numwindow.shadowColor = Color.new(168, 184, 184)
|
||||
inbagwindow.visible = @buying
|
||||
inbagwindow.viewport = @viewport
|
||||
inbagwindow.width = 190
|
||||
inbagwindow.height = 64
|
||||
inbagwindow.baseColor = Color.new(88, 88, 80)
|
||||
inbagwindow.shadowColor = Color.new(168, 184, 184)
|
||||
inbagwindow.text = _INTL("In Bag:<r>{1} ", qty)
|
||||
qty = @adapter.getQuantity(item)
|
||||
using(inbagwindow = Window_AdvancedTextPokemon.new("")) { # Showing quantity in bag
|
||||
pbPrepareWindow(numwindow)
|
||||
pbPrepareWindow(inbagwindow)
|
||||
numwindow.viewport = @viewport
|
||||
numwindow.width = 224
|
||||
numwindow.height = 64
|
||||
numwindow.baseColor = Color.new(88, 88, 80)
|
||||
numwindow.shadowColor = Color.new(168, 184, 184)
|
||||
inbagwindow.visible = @buying
|
||||
inbagwindow.viewport = @viewport
|
||||
inbagwindow.width = 190
|
||||
inbagwindow.height = 64
|
||||
inbagwindow.baseColor = Color.new(88, 88, 80)
|
||||
inbagwindow.shadowColor = Color.new(168, 184, 184)
|
||||
inbagwindow.text = _INTL("In Bag:<r>{1} ", qty)
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
pbBottomRight(numwindow)
|
||||
numwindow.y -= helpwindow.height
|
||||
pbBottomLeft(inbagwindow)
|
||||
inbagwindow.y -= helpwindow.height
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
numwindow.update
|
||||
inbagwindow.update
|
||||
self.update
|
||||
if Input.repeat?(Input::LEFT)
|
||||
pbPlayCursorSE
|
||||
curnumber -= 10
|
||||
curnumber = 1 if curnumber < 1
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
pbBottomRight(numwindow)
|
||||
numwindow.y -= helpwindow.height
|
||||
pbBottomLeft(inbagwindow)
|
||||
inbagwindow.y -= helpwindow.height
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
numwindow.update
|
||||
inbagwindow.update
|
||||
self.update
|
||||
if Input.repeat?(Input::LEFT)
|
||||
pbPlayCursorSE
|
||||
curnumber -= 10
|
||||
curnumber = 1 if curnumber < 1
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.repeat?(Input::RIGHT)
|
||||
pbPlayCursorSE
|
||||
curnumber += 10
|
||||
curnumber = maximum if curnumber > maximum
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.repeat?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
curnumber += 1
|
||||
curnumber = 1 if curnumber > maximum
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.repeat?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
curnumber -= 1
|
||||
curnumber = maximum if curnumber < 1
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
ret = curnumber
|
||||
break
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
ret = 0
|
||||
break
|
||||
end
|
||||
end
|
||||
}
|
||||
elsif Input.repeat?(Input::RIGHT)
|
||||
pbPlayCursorSE
|
||||
curnumber += 10
|
||||
curnumber = maximum if curnumber > maximum
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.repeat?(Input::UP)
|
||||
pbPlayCursorSE
|
||||
curnumber += 1
|
||||
curnumber = 1 if curnumber > maximum
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.repeat?(Input::DOWN)
|
||||
pbPlayCursorSE
|
||||
curnumber -= 1
|
||||
curnumber = maximum if curnumber < 1
|
||||
numwindow.text = _INTL("x{1}<r>$ {2}", curnumber, (curnumber * itemprice).to_s_formatted)
|
||||
elsif Input.trigger?(Input::USE)
|
||||
pbPlayDecisionSE
|
||||
ret = curnumber
|
||||
break
|
||||
elsif Input.trigger?(Input::BACK)
|
||||
pbPlayCancelSE
|
||||
ret = 0
|
||||
break
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
helpwindow.visible = false
|
||||
return ret
|
||||
@@ -494,7 +535,7 @@ class PokemonMart_Scene
|
||||
if itemwindow.item != olditem
|
||||
@sprites["icon"].item = itemwindow.item
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit shopping.")
|
||||
end
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCloseMenuSE
|
||||
@@ -557,7 +598,7 @@ class PokemonMartScreen
|
||||
end
|
||||
if GameData::Item.get(item).is_important?
|
||||
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
|
||||
itemname,price.to_s_formatted))
|
||||
itemname,price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
quantity=1
|
||||
@@ -565,11 +606,11 @@ class PokemonMartScreen
|
||||
maxafford = (price <= 0) ? Settings::BAG_MAX_PER_SLOT : @adapter.getMoney / price
|
||||
maxafford = Settings::BAG_MAX_PER_SLOT if maxafford > Settings::BAG_MAX_PER_SLOT
|
||||
quantity=@scene.pbChooseNumber(
|
||||
_INTL("{1}? Certainly. How many would you like?",itemname),item,maxafford)
|
||||
_INTL("{1}? Certainly. How many would you like?",itemname),item,maxafford)
|
||||
next if quantity==0
|
||||
price*=quantity
|
||||
if !pbConfirm(_INTL("{1}, and you want {2}. That will be ${3}. OK?",
|
||||
itemname,quantity,price.to_s_formatted))
|
||||
itemname,quantity,price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
end
|
||||
@@ -626,7 +667,7 @@ class PokemonMartScreen
|
||||
@scene.pbShowMoney
|
||||
if qty>1
|
||||
qty=@scene.pbChooseNumber(
|
||||
_INTL("{1}? How many would you like to sell?",itemname),item,qty)
|
||||
_INTL("{1}? How many would you like to sell?",itemname),item,qty)
|
||||
end
|
||||
if qty==0
|
||||
@scene.pbHideMoney
|
||||
@@ -653,11 +694,11 @@ def replaceShopStockWithRandomized(stock)
|
||||
newStock = []
|
||||
for item in stock
|
||||
newItem =$PokemonGlobal.randomItemsHash[item]
|
||||
if newItem != nil && GameData::Item.get(newItem).price >0 && !Settings::EXCLUDE_FROM_RANDOM_SHOPS.include?(newItem)
|
||||
newStock << newItem
|
||||
else
|
||||
newStock << item
|
||||
end
|
||||
if newItem != nil && GameData::Item.get(newItem).price >0 && !Settings::EXCLUDE_FROM_RANDOM_SHOPS.include?(newItem)
|
||||
newStock << newItem
|
||||
else
|
||||
newStock << item
|
||||
end
|
||||
end
|
||||
return newStock
|
||||
end
|
||||
@@ -685,8 +726,8 @@ def pbPokemonMart(stock,speech=nil,cantsell=false)
|
||||
commands[cmdSell = commands.length] = _INTL("Sell") if !cantsell
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
cmd = pbMessage(
|
||||
speech ? speech : _INTL("Welcome! How may I serve you?"),
|
||||
commands,cmdQuit+1)
|
||||
speech ? speech : _INTL("Welcome! How may I serve you?"),
|
||||
commands,cmdQuit+1)
|
||||
loop do
|
||||
if cmdBuy>=0 && cmd==cmdBuy
|
||||
scene = PokemonMart_Scene.new
|
||||
@@ -701,7 +742,7 @@ def pbPokemonMart(stock,speech=nil,cantsell=false)
|
||||
break
|
||||
end
|
||||
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
|
||||
commands,cmdQuit+1)
|
||||
commands,cmdQuit+1)
|
||||
end
|
||||
$game_temp.clear_mart_prices
|
||||
end
|
||||
|
||||
@@ -10,6 +10,7 @@ end
|
||||
def pbWarpToMapId
|
||||
params = ChooseNumberParams.new
|
||||
params.setRange(1,pbMapTree().length)
|
||||
params.setDefaultValue($game_map.map_id)
|
||||
map_id = pbMessageChooseNumber("map id?",params)
|
||||
return [map_id,0,0]
|
||||
end
|
||||
|
||||
@@ -837,6 +837,16 @@ PokemonDebugMenuCommands.register("setgender", {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
PokemonDebugMenuCommands.register("printInfo", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Dump info"),
|
||||
"always_show" => true,
|
||||
"effect" => proc { |pkmn, pkmnid, heldpoke, settingUpBattle, screen|
|
||||
pkmn.print_all_attributes
|
||||
next false
|
||||
}
|
||||
})
|
||||
PokemonDebugMenuCommands.register("speciesform", {
|
||||
"parent" => "main",
|
||||
"name" => _INTL("Species/form..."),
|
||||
|
||||
@@ -481,7 +481,7 @@ module Compiler
|
||||
:height => contents["Height"],
|
||||
:weight => contents["Weight"],
|
||||
:color => contents["Color"],
|
||||
#:shape => GameData::BodyShape.get(contents["Shape"]).id,
|
||||
:shape => GameData::BodyShape.get(contents["Shape"]).id,
|
||||
:habitat => contents["Habitat"],
|
||||
:generation => contents["Generation"],
|
||||
:back_sprite_x => contents["BattlerPlayerX"],
|
||||
|
||||
@@ -129,8 +129,8 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
super
|
||||
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
|
||||
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
|
||||
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
@@ -164,6 +164,13 @@ class RandomizerTrainerOptionsScene < PokemonOption_Scene
|
||||
"Use only Pokémon that have custom sprites in trainer teams"
|
||||
)
|
||||
|
||||
# options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
|
||||
# proc { $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] ? 0 : 1 },
|
||||
# proc { |value|
|
||||
# $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] = value == 0
|
||||
# }, "Regular Pokémon can also be randomized into legendaries"
|
||||
# )
|
||||
|
||||
return options
|
||||
end
|
||||
end
|
||||
@@ -238,11 +245,24 @@ class RandomizerWildPokemonOptionsScene < PokemonOption_Scene
|
||||
}, "['Fuse everything' & starters] Include only Pokémon with a custom sprite."
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Starters"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 1 },
|
||||
options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = value == 0
|
||||
}, "Randomize the selection of starters to choose from at the start of the game"
|
||||
$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES] = value == 0
|
||||
}, ["Regular wild Pokémon can also be randomized into legendaries.",
|
||||
"Only legendaries can be randomized into legendaries"]
|
||||
)
|
||||
|
||||
options << EnumOption.new(_INTL("Starters"), [_INTL("1st Stage"), _INTL("Any"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_STARTERS] ? 0 : 2 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_STARTERS] = (value == 0 || value == 1)
|
||||
if value == 0
|
||||
$game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE] = true
|
||||
end
|
||||
}, ["The starters will always be a first evolution Pokémon",
|
||||
"The starters can be any Pokémon",
|
||||
"The starters are not randomized"]
|
||||
)
|
||||
options << EnumOption.new(_INTL("Static encounters"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_STATIC] ? 0 : 1 },
|
||||
@@ -278,8 +298,8 @@ class RandomizerGymOptionsScene < PokemonOption_Scene
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
super
|
||||
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
|
||||
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
|
||||
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
@@ -317,6 +337,14 @@ class RandomizerGymOptionsScene < PokemonOption_Scene
|
||||
$game_switches[RANDOM_GYM_TYPES] = value == 0
|
||||
}, "Shuffle the gym types"
|
||||
)
|
||||
|
||||
# options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
|
||||
# proc { $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] ? 0 : 1 },
|
||||
# proc { |value|
|
||||
# $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] = value == 0
|
||||
# }, "Regular Pokémon can also be randomized into legendaries"
|
||||
# )
|
||||
|
||||
options << EnumOption.new(_INTL("Rerandomize each battle"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_GYM_RANDOM_EACH_BATTLE] ? 0 : 1 },
|
||||
proc { |value|
|
||||
@@ -338,8 +366,85 @@ class RandomizerItemOptionsScene < PokemonOption_Scene
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
super
|
||||
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
|
||||
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
|
||||
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
end
|
||||
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("Randomizer settings: Items"), 0, 0, Graphics.width, 64, @viewport)
|
||||
@sprites["textbox"].text = _INTL("Set the randomizer settings for items")
|
||||
|
||||
pbFadeInAndShow(@sprites) { pbUpdate }
|
||||
end
|
||||
|
||||
def pbFadeInAndShow(sprites, visiblesprites = nil)
|
||||
return if !@changedColor
|
||||
super
|
||||
end
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = [
|
||||
EnumOption.new(_INTL("Found items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_FOUND_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_FOUND_ITEMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_ITEMS] = $game_switches[SWITCH_RANDOM_FOUND_ITEMS] || $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]
|
||||
}, "Randomize the items picked up on the ground"
|
||||
),
|
||||
EnumOption.new(_INTL("Found TMs"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_FOUND_TMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_FOUND_TMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_TMS] = $game_switches[SWITCH_RANDOM_FOUND_TMS] || $game_switches[SWITCH_RANDOM_GIVEN_TMS]
|
||||
}, "Randomize the TMs picked up on the ground"
|
||||
),
|
||||
EnumOption.new(_INTL("Given items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_GIVEN_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_GIVEN_ITEMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_ITEMS] = $game_switches[SWITCH_RANDOM_FOUND_ITEMS] || $game_switches[SWITCH_RANDOM_GIVEN_ITEMS]
|
||||
}, "Randomize the items given by NPCs (may make some quests impossible to complete)"
|
||||
),
|
||||
EnumOption.new(_INTL("Given TMs"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_GIVEN_TMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_GIVEN_TMS] = value == 0
|
||||
$game_switches[SWITCH_RANDOM_TMS] = $game_switches[SWITCH_RANDOM_FOUND_TMS] || $game_switches[SWITCH_RANDOM_GIVEN_TMS]
|
||||
}, "Randomize the TMs given by NPCs"
|
||||
),
|
||||
|
||||
EnumOption.new(_INTL("Shop items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_SHOP_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[SWITCH_RANDOM_SHOP_ITEMS] = value == 0
|
||||
}, "Randomizes the items available in shops (always mapped)"
|
||||
),
|
||||
|
||||
EnumOption.new(_INTL("Trainer Held items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[RANDOM_HELD_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
$game_switches[RANDOM_HELD_ITEMS] = value == 0
|
||||
}, "Give random held items to all trainers"
|
||||
)
|
||||
]
|
||||
return options
|
||||
end
|
||||
end
|
||||
|
||||
class RandomizerItemOptionsScene < PokemonOption_Scene
|
||||
RANDOM_HELD_ITEMS = 843
|
||||
|
||||
def initialize
|
||||
@changedColor = false
|
||||
end
|
||||
|
||||
def pbStartScene(inloadscreen = false)
|
||||
super
|
||||
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
@@ -358,33 +463,6 @@ class RandomizerItemOptionsScene < PokemonOption_Scene
|
||||
|
||||
def pbGetOptions(inloadscreen = false)
|
||||
options = [
|
||||
# EnumOption.new(_INTL("Type"), [_INTL("Mapped"), _INTL("Dynamic")],
|
||||
# proc {
|
||||
# if $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC]
|
||||
# 1
|
||||
# else
|
||||
# 0
|
||||
# end
|
||||
# },
|
||||
# proc { |value|
|
||||
# if value == 0
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = true
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC] = false
|
||||
# else
|
||||
# value == 1
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = false
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_DYNAMIC] = true
|
||||
# end
|
||||
# },
|
||||
# [
|
||||
# "Random items are decided at the start of the game",
|
||||
# "Random items are decided as you obtain them"],
|
||||
# proc { $game_switches[SWITCH_RANDOM_ITEMS_FULL] ? 0 : 1 },
|
||||
# proc { |value|
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_MAPPED] = value == 0
|
||||
# $game_switches[SWITCH_RANDOM_ITEMS_FULL] = value == 1
|
||||
# }, ["Random items are decided at the start of the game", "Random items are decided as you obtain them"]
|
||||
#),
|
||||
EnumOption.new(_INTL("Found items"), [_INTL("On"), _INTL("Off")],
|
||||
proc { $game_switches[SWITCH_RANDOM_FOUND_ITEMS] ? 0 : 1 },
|
||||
proc { |value|
|
||||
|
||||
@@ -33,14 +33,15 @@ def Kernel.randomizeWildPokemonByRoute()
|
||||
end
|
||||
|
||||
#input: [[60, :TENTACOOL,5,40, [30, :GOLDEEN, 5, 35], etc.]]
|
||||
def randomizePokemonList(encountersList,bstRange=50,maxSpecies=420,customOnly=false,customsList=[])
|
||||
def randomizePokemonList(encountersList,bstRange=50,maxSpecies=NB_POKEMON,customOnly=false,customsList=[])
|
||||
includeLegendaries = $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
|
||||
newList=[]
|
||||
for encounter in encountersList
|
||||
oldPokemon = encounter[1]
|
||||
if customOnly
|
||||
newPokemon = getNewCustomSpecies(oldPokemon,customsList,bstRange,false)
|
||||
newPokemon = getNewCustomSpecies(oldPokemon,customsList,bstRange,false,includeLegendaries)
|
||||
else
|
||||
newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies)
|
||||
newPokemon = getNewSpecies(oldPokemon,bstRange,false,maxSpecies,includeLegendaries)
|
||||
end
|
||||
newEntry =[]
|
||||
newEntry << encounter[0]
|
||||
|
||||
@@ -64,7 +64,7 @@ class PokeBattle_Battle
|
||||
for pokemon in party
|
||||
next if !pokemon
|
||||
newspecies = rand(PBSpecies.maxValue - 1) + 1
|
||||
while !gymLeaderOk(newspecies) || bstOk(newspecies, pokemon.species, $game_variables[VAR_RANDOMIZER_WILD_POKE_BST])
|
||||
while !gymLeaderOk(newspecies) || bstNotOk(newspecies, pokemon.species, $game_variables[VAR_RANDOMIZER_WILD_POKE_BST])
|
||||
newspecies = rand(PBSpecies.maxValue - 1) + 1
|
||||
end
|
||||
pokemon.species = newspecies
|
||||
@@ -120,7 +120,18 @@ end
|
||||
# end
|
||||
#
|
||||
|
||||
def bstOk(newspecies, oldPokemonSpecies, bst_range = 50)
|
||||
def legendaryOk(oldspecies,newspecies,includeLegendaries)
|
||||
oldSpeciesIsLegendary = is_legendary(oldspecies)
|
||||
if oldSpeciesIsLegendary #legendaries always randomize to legendaries
|
||||
return is_legendary(newspecies)
|
||||
else
|
||||
return true if includeLegendaries
|
||||
return !is_legendary(newspecies)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def bstNotOk(newspecies, oldPokemonSpecies, bst_range = 50)
|
||||
newBST = calcBaseStatsSum(newspecies)
|
||||
originalBST = calcBaseStatsSum(oldPokemonSpecies)
|
||||
return newBST < originalBST - bst_range || newBST > originalBST + bst_range
|
||||
@@ -259,13 +270,13 @@ def Kernel.pbRandomizeTM()
|
||||
end
|
||||
end
|
||||
|
||||
def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, maxDexNumber = PBSpecies.maxValue)
|
||||
def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, maxDexNumber = PBSpecies.maxValue, includeLegendaries=true)
|
||||
oldSpecies_dex = dexNum(oldSpecies)
|
||||
return oldSpecies_dex if (oldSpecies_dex == Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES && !ignoreRivalPlaceholder)
|
||||
return oldSpecies_dex if oldSpecies_dex >= Settings::ZAPMOLCUNO_NB
|
||||
newspecies_dex = rand(maxDexNumber - 1) + 1
|
||||
i = 0
|
||||
while bstOk(newspecies_dex, oldSpecies_dex, bst_range)
|
||||
while bstNotOk(newspecies_dex, oldSpecies_dex, bst_range) || !(legendaryOk(oldSpecies_dex,newspecies_dex,includeLegendaries))
|
||||
newspecies_dex = rand(maxDexNumber - 1) + 1
|
||||
i += 1
|
||||
if i % 10 == 0
|
||||
@@ -275,14 +286,15 @@ def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, ma
|
||||
return newspecies_dex
|
||||
end
|
||||
|
||||
def getNewCustomSpecies(oldSpecies, customSpeciesList, bst_range = 50, ignoreRivalPlaceholder = false)
|
||||
def getNewCustomSpecies(oldSpecies, customSpeciesList, bst_range = 50, ignoreRivalPlaceholder = false,includeLegendaries=true)
|
||||
oldSpecies_dex = dexNum(oldSpecies)
|
||||
return oldSpecies_dex if (oldSpecies_dex == Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES && !ignoreRivalPlaceholder)
|
||||
return oldSpecies_dex if oldSpecies_dex >= Settings::ZAPMOLCUNO_NB
|
||||
i = rand(customSpeciesList.length - 1) + 1
|
||||
n = 0
|
||||
newspecies_dex = customSpeciesList[i]
|
||||
while bstOk(newspecies_dex, oldSpecies_dex, bst_range)
|
||||
|
||||
while bstNotOk(newspecies_dex, oldSpecies_dex, bst_range) || !(legendaryOk(oldSpecies_dex,newspecies_dex,includeLegendaries))
|
||||
i = rand(customSpeciesList.length - 1) #+1
|
||||
newspecies_dex = customSpeciesList[i]
|
||||
n += 1
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
LEGENDARIES_LIST = [:ARTICUNO, :ZAPDOS, :MOLTRES, :MEWTWO, :MEW,
|
||||
:ENTEI, :RAIKOU, :SUICUNE, :HOOH, :LUGIA, :CELEBI,
|
||||
:GROUDON, :KYOGRE, :RAYQUAZA, :DEOXYS, :JIRACHI, :LATIAS, :LATIOS,
|
||||
:REGIGIGAS, :DIALGA, :PALKIA, :GIRATINA, :DARKRAI, :CRESSELIA, :ARCEUS,
|
||||
:GENESECT, :RESHIRAM, :ZEKROM, :KYUREM, :MELOETTA,
|
||||
:NECROZMA]
|
||||
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :psuedoHash
|
||||
attr_accessor :psuedoBSTHash
|
||||
@@ -6,7 +13,6 @@ class PokemonGlobalMetadata
|
||||
attr_accessor :randomItemsHash
|
||||
attr_accessor :randomTMsHash
|
||||
|
||||
|
||||
alias random_init initialize
|
||||
|
||||
def initialize
|
||||
@@ -21,7 +27,7 @@ class PokemonGlobalMetadata
|
||||
end
|
||||
|
||||
#pense pas que c'est utilisé mais bon...
|
||||
def get_pokemon_list(include_fusions=false)
|
||||
def get_pokemon_list(include_fusions = false)
|
||||
#Create array of all pokemon dex numbers
|
||||
pokeArray = []
|
||||
|
||||
@@ -33,8 +39,7 @@ def get_pokemon_list(include_fusions=false)
|
||||
return pokeArray
|
||||
end
|
||||
|
||||
|
||||
def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
|
||||
def get_randomized_bst_hash(poke_list, bst_range, show_progress = true)
|
||||
bst_hash = Hash.new
|
||||
for i in 1..NB_POKEMON - 1
|
||||
show_shuffle_progress(i) if show_progress
|
||||
@@ -43,20 +48,45 @@ def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
|
||||
|
||||
targetStats_max = statsTotal + bst_range
|
||||
targetStats_min = statsTotal - bst_range
|
||||
max_bst_allowed=targetStats_max
|
||||
min_bst_allowed=targetStats_min
|
||||
max_bst_allowed = targetStats_max
|
||||
min_bst_allowed = targetStats_min
|
||||
#if a match, add to hash, remove from array, and cycle to next poke in dex
|
||||
|
||||
#only randomize legendaries to legendaries if Allow Legendaries not enabled
|
||||
#
|
||||
|
||||
#
|
||||
# if !$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
|
||||
# current_species = GameData::Species.get(i).id
|
||||
# random_poke_species = GameData::Species.get(random_poke).id
|
||||
# next if !legendaryOk(current_species,random_poke_species,$game_switches[SWITCH_RANDOM_WILD_LEGENDARIES])
|
||||
#
|
||||
# if !is_legendary(current_species)
|
||||
# next if is_legendary(random_poke_species,true)
|
||||
# else
|
||||
# next if !is_legendary(random_poke_species,true)
|
||||
# end
|
||||
# end
|
||||
playShuffleSE(i)
|
||||
random_poke = poke_list.sample
|
||||
random_poke_bst=getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
|
||||
j=0
|
||||
while(random_poke_bst <= min_bst_allowed || random_poke_bst >= max_bst_allowed)
|
||||
random_poke_bst = getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
|
||||
j = 0
|
||||
|
||||
includeLegendaries = $game_switches[SWITCH_RANDOM_WILD_LEGENDARIES]
|
||||
current_species = GameData::Species.get(i).id
|
||||
random_poke_species = GameData::Species.get(random_poke).id
|
||||
while (random_poke_bst <= min_bst_allowed || random_poke_bst >= max_bst_allowed) || !legendaryOk(current_species,random_poke_species,includeLegendaries)
|
||||
random_poke = poke_list.sample
|
||||
random_poke_bst=getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
|
||||
j+=1
|
||||
if j % 5 ==0 #to avoid infinite loops if can't find anything
|
||||
min_bst_allowed-=1
|
||||
max_bst_allowed+=1
|
||||
random_poke_species = GameData::Species.get(random_poke).id
|
||||
#todo: right now, the main function uses dex numbers, but the legendaryOK check needs the ids.
|
||||
# This can be a hit on performance to recalculate the ids from the dex numbers.
|
||||
# The function should be optimized to just use the ids everywhere
|
||||
|
||||
random_poke_bst = getStatsTotal(getBaseStatsFormattedForRandomizer(random_poke))
|
||||
j += 1
|
||||
if j % 5 == 0 #to avoid infinite loops if can't find anything
|
||||
min_bst_allowed -= 1
|
||||
max_bst_allowed += 1
|
||||
end
|
||||
end
|
||||
bst_hash[i] = random_poke
|
||||
@@ -64,13 +94,22 @@ def get_randomized_bst_hash(poke_list, bst_range,show_progress=true)
|
||||
return bst_hash
|
||||
end
|
||||
|
||||
def is_legendary(dex_num,printInfo=false)
|
||||
pokemon_id = getPokemon(dex_num).id
|
||||
is_legendary = is_fusion_of_any(pokemon_id,LEGENDARIES_LIST)
|
||||
|
||||
#echoln "#{pokemon_id} is legendary? : #{is_legendary}"
|
||||
#echoln _INTL("{1} ({2}) {3}",dex_num,pokemon_id,is_legendary) if printInfo
|
||||
return is_legendary
|
||||
end
|
||||
|
||||
def show_shuffle_progress(i)
|
||||
if i % 2 == 0
|
||||
n = (i.to_f/NB_POKEMON)*100
|
||||
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON))
|
||||
n = (i.to_f / NB_POKEMON) * 100
|
||||
Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^", sprintf('%.2f', n), NB_POKEMON))
|
||||
end
|
||||
end
|
||||
|
||||
##############
|
||||
# randomizer shuffle
|
||||
# ##############
|
||||
@@ -84,10 +123,10 @@ def Kernel.pbShuffleDex(range = 50, type = 0)
|
||||
only_customs = $game_switches[SWITCH_RANDOM_WILD_ONLY_CUSTOMS] && should_include_fusions
|
||||
# create hash
|
||||
pokemon_list = only_customs ? getCustomSpeciesList(true) : get_pokemon_list(should_include_fusions)
|
||||
if !pokemon_list #when not enough custom sprites
|
||||
if !pokemon_list #when not enough custom sprites
|
||||
pokemon_list = get_pokemon_list(should_include_fusions)
|
||||
end
|
||||
$PokemonGlobal.psuedoBSTHash = get_randomized_bst_hash(pokemon_list,range,should_include_fusions)
|
||||
$PokemonGlobal.psuedoBSTHash = get_randomized_bst_hash(pokemon_list, range, should_include_fusions)
|
||||
end
|
||||
|
||||
def itemCanBeRandomized(item)
|
||||
@@ -102,7 +141,7 @@ def pbShuffleItems()
|
||||
randomItemsHash = Hash.new
|
||||
available_items = []
|
||||
for itemElement in GameData::Item.list_all
|
||||
item=itemElement[1]
|
||||
item = itemElement[1]
|
||||
if itemCanBeRandomized(item)
|
||||
if !available_items.include?(item.id)
|
||||
available_items << item.id
|
||||
@@ -120,12 +159,11 @@ def pbShuffleItems()
|
||||
$PokemonGlobal.randomItemsHash = randomItemsHash
|
||||
end
|
||||
|
||||
|
||||
def pbShuffleTMs()
|
||||
randomItemsHash = Hash.new
|
||||
available_items = []
|
||||
for itemElement in GameData::Item.list_all
|
||||
item=itemElement[1]
|
||||
item = itemElement[1]
|
||||
if item.is_TM?
|
||||
if !available_items.include?(item.id)
|
||||
available_items << item.id
|
||||
@@ -143,7 +181,6 @@ def pbShuffleTMs()
|
||||
$PokemonGlobal.randomTMsHash = randomItemsHash
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# # ######
|
||||
# # #on remet arceus a la fin
|
||||
@@ -229,7 +266,7 @@ end
|
||||
# Here is a cheap workaround lol
|
||||
def getBaseStatsFormattedForRandomizer(dex_num)
|
||||
statsArray = []
|
||||
stats = GameData::Species.get(dex_num).base_stats
|
||||
stats = GameData::Species.get(dex_num).base_stats
|
||||
statsArray << stats[:HP]
|
||||
statsArray << stats[:ATTACK]
|
||||
statsArray << stats[:DEFENSE]
|
||||
@@ -308,4 +345,22 @@ def tryRandomizeGiftPokemon(pokemon, dontRandomize = false)
|
||||
pokemon.species = getSpecies($PokemonGlobal.psuedoBSTHash[oldSpecies])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def obtainRandomizedStarter(starterIndex)
|
||||
case starterIndex
|
||||
when 0
|
||||
dexNumber =1
|
||||
when 1
|
||||
dexNumber = 4
|
||||
else
|
||||
dexNumber = 7
|
||||
end
|
||||
random_starter = $PokemonGlobal.psuedoBSTHash[dexNumber]
|
||||
if $game_switches[SWITCH_RANDOM_STARTER_FIRST_STAGE]
|
||||
species = GameData::Species.get(random_starter)
|
||||
random_starter = GameData::Species.get(species.get_baby_species(false)).id_number
|
||||
end
|
||||
|
||||
return random_starter
|
||||
end
|
||||
@@ -44,8 +44,8 @@ module GameData
|
||||
@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] || []
|
||||
@abilities = calculate_abilities() # hash[:abilities] || []
|
||||
@hidden_abilities = calculate_hidden_abilities() # 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]
|
||||
@@ -104,7 +104,6 @@ module GameData
|
||||
return @head_pokemon
|
||||
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
|
||||
@@ -181,25 +180,50 @@ module GameData
|
||||
end
|
||||
end
|
||||
|
||||
def calculate_abilities(pokemon1, pokemon2)
|
||||
def calculate_abilities()
|
||||
abilities_hash = []
|
||||
|
||||
ability1 = pokemon1.abilities[0]
|
||||
ability2 = pokemon2.abilities[1]
|
||||
if !ability2
|
||||
ability2 = pokemon2.abilities[0]
|
||||
end
|
||||
ability1 = @body_pokemon.abilities[0]
|
||||
ability2 = @head_pokemon.abilities[0]
|
||||
abilities_hash << ability1
|
||||
abilities_hash << ability2
|
||||
return abilities_hash
|
||||
end
|
||||
|
||||
def calculate_hidden_abilities(pokemon1, pokemon2)
|
||||
# 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()
|
||||
abilities_hash = []
|
||||
|
||||
#First two spots are the other abilities of the two pokemon
|
||||
abilities_hash = calculate_abilities(pokemon2, pokemon1)
|
||||
ability1 = @body_pokemon.abilities[1]
|
||||
ability2 = @head_pokemon.abilities[1]
|
||||
ability1 = @body_pokemon.abilities[0] if !ability1
|
||||
ability2 = @head_pokemon.abilities[0] if !ability2
|
||||
|
||||
abilities_hash << ability1
|
||||
abilities_hash << ability2
|
||||
|
||||
#add the hidden ability for the two base pokemon
|
||||
abilities_hash << @body_pokemon.hidden_abilities[0]
|
||||
abilities_hash << @head_pokemon.hidden_abilities[0]
|
||||
hiddenAbility1 = @body_pokemon.hidden_abilities[0]
|
||||
hiddenAbility1 = ability1 if !hiddenAbility1
|
||||
|
||||
hiddenAbility2 = @head_pokemon.hidden_abilities[0]
|
||||
hiddenAbility2 = ability2 if !hiddenAbility2
|
||||
|
||||
abilities_hash << hiddenAbility1
|
||||
abilities_hash << hiddenAbility2
|
||||
return abilities_hash
|
||||
end
|
||||
|
||||
@@ -288,7 +312,7 @@ module GameData
|
||||
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]
|
||||
base_growth_rates = [body_growth_rate, head_growth_rate]
|
||||
for rate in growth_rate_priority
|
||||
return rate if base_growth_rates.include?(rate)
|
||||
end
|
||||
|
||||
@@ -41,8 +41,8 @@ class FusionMovesOptionsScene < PokemonOption_Scene
|
||||
@sprites["overlay"].z = 9999
|
||||
pbSetSystemFont(@sprites["overlay"].bitmap)
|
||||
|
||||
@sprites["option"].nameBaseColor = Color.new(35, 130, 200)
|
||||
@sprites["option"].nameShadowColor = Color.new(20, 75, 115)
|
||||
@sprites["option"].nameBaseColor = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
@sprites["option"].nameShadowColor = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
@changedColor = true
|
||||
for i in 0...@PokemonOptions.length
|
||||
@sprites["option"][i] = (@PokemonOptions[i].get || 0)
|
||||
|
||||
@@ -869,17 +869,23 @@ class PokemonFusionScene
|
||||
overlay.dispose
|
||||
#first check if hidden ability
|
||||
# getAbilityList format: [[:ABILITY, index],...]
|
||||
hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[-1][0]
|
||||
hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[-1][0]
|
||||
# hiddenAbility1 = @pokemon1.ability == @pokemon1.getAbilityList[-1][0]
|
||||
# hiddenAbility2 = @pokemon2.ability == @pokemon2.getAbilityList[-1][0]
|
||||
|
||||
# ability1 = @pokemon1.ability_index
|
||||
# ability2 = @pokemon2.ability_index
|
||||
|
||||
#change species
|
||||
ability1 = @pokemon1.ability
|
||||
ability2 = @pokemon2.ability
|
||||
|
||||
@pokemon1.species = newSpecies
|
||||
if @pokemon2.egg? || @pokemon1.egg?
|
||||
@pokemon1.steps_to_hatch = @pokemon1.species_data.hatch_steps
|
||||
end
|
||||
#@pokemon1.ability = pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
|
||||
#
|
||||
pbChooseAbility(@pokemon1, hiddenAbility1, hiddenAbility2)
|
||||
pbChooseAbility(ability1,ability2)
|
||||
|
||||
setFusionMoves(@pokemon1, @pokemon2, firstOptionSelected) if !noMoves
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ module GameData
|
||||
["Yan", "ma"],
|
||||
["Woo", "per"],
|
||||
["Quag", "sire"],
|
||||
["Es", "peon"],
|
||||
["Esp", "eon"],
|
||||
["Umb", "reon"],
|
||||
["Mur", "krow"],
|
||||
["Slow", "king"],
|
||||
@@ -598,7 +598,7 @@ module GameData
|
||||
["Jol", "tik"],
|
||||
["Galvan", "tula"],
|
||||
["Ferro", "seed"],
|
||||
["Ferron ", "thorn"],
|
||||
["Ferro", "thorn"],
|
||||
["Kli", "ink"],
|
||||
["Kla", "ang"],
|
||||
["Klink", "klang"],
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#############
|
||||
# SETTINGS #
|
||||
#############
|
||||
|
||||
|
||||
# This is for settings that are used in scripts since it's a chore to change them everywhere to include the module name
|
||||
NUM_BADGES = Settings::NB_BADGES
|
||||
EGGINITIALLEVEL = Settings::EGG_LEVEL
|
||||
@@ -20,6 +22,7 @@ BEAT_MT_SILVER = 918 #don't remove this - used in some events
|
||||
SWITCH_REVERSED_MODE = 47
|
||||
SWITCH_GAME_DIFFICULTY_EASY = 665
|
||||
SWITCH_GAME_DIFFICULTY_HARD = 666
|
||||
|
||||
SWITCH_MODERN_MODE=974
|
||||
SWITCH_EXPERT_MODE=772
|
||||
|
||||
@@ -69,6 +72,12 @@ SWITCH_PICKED_SKULL_FOSSIL= 617
|
||||
|
||||
SWITCH_NIGHTMARE_EFFECT= 805
|
||||
|
||||
SWITCH_JOHTO_STARTERS=884
|
||||
SWITCH_HOENN_STARTERS=885
|
||||
SWITCH_SINNOH_STARTERS=886
|
||||
SWITCH_CUSTOM_STARTERS=883
|
||||
|
||||
|
||||
|
||||
VAR_ORICORIO_FLOWERS = 276
|
||||
#Randomizer Switches
|
||||
@@ -81,6 +90,7 @@ SWITCH_RANDOM_WILD_AREA = 777
|
||||
|
||||
SWITCH_RANDOM_TRAINERS = 987
|
||||
SWITCH_RANDOM_STARTERS = 954
|
||||
SWITCH_RANDOM_STARTER_FIRST_STAGE = 771
|
||||
|
||||
SWITCH_RANDOM_ITEMS_GENERAL=759
|
||||
SWITCH_RANDOM_ITEMS=751
|
||||
@@ -107,6 +117,12 @@ SWITCH_RANDOM_GIFT_POKEMON = 780
|
||||
SWITCH_RANDOM_HELD_ITEMS = 843
|
||||
SWITCH_DEFINED_RIVAL_STARTER=840
|
||||
SWITCH_RANDOMIZED_WILD_POKEMON_TO_FUSIONS=829
|
||||
|
||||
SWITCH_RANDOM_WILD_LEGENDARIES=1031
|
||||
SWITCH_RANDOM_TRAINER_LEGENDARIES=1032
|
||||
SWITCH_RANDOM_GYM_LEGENDARIES=1033
|
||||
|
||||
|
||||
#Other switches
|
||||
SWITCH_RACE_BIKE = 984
|
||||
SWITCH_IS_REMATCH=200
|
||||
@@ -124,6 +140,7 @@ SWITCH_BATTLE_FACTORY_INCLUDE_ALL = 775
|
||||
SWITCH_SUPER_SLOW_SPEED=649
|
||||
SWITCH_LOUNGE_BATTLE_LEVEL = 240
|
||||
SWITCH_CANNOT_CATCH_POKEMON = 75
|
||||
SWITCH_UNLOCKED_POKEMON_HATS = 700
|
||||
|
||||
SWITCH_LOCK_PLAYER_MOVEMENT = 815
|
||||
|
||||
@@ -133,6 +150,9 @@ SWITCH_BAND_ELECTRIC_GUITAR = 1006
|
||||
SWITCH_BAND_HARP = 1007
|
||||
SWITCH_BAND_FLUTE = 1008
|
||||
|
||||
SWITCH_SELECTING_CLOTHES = 804
|
||||
|
||||
|
||||
#############
|
||||
# VARIABLES #
|
||||
#############
|
||||
@@ -189,6 +209,8 @@ VAR_NEXT_ARTIST_FORMATTED = 264
|
||||
|
||||
VAR_RADIO_POINTS=266
|
||||
VAR_TRAINER_GENDER=52
|
||||
VAR_TRAINER_AGE=99
|
||||
|
||||
#Randomizer
|
||||
VAR_RANDOMIZER_WILD_POKE_BST=197
|
||||
VAR_RANDOMIZER_TRAINER_BST=195
|
||||
@@ -249,5 +271,8 @@ TEMPLATE_EVENT_SILHOUETTE = 7
|
||||
SWITCH_TRIPLE_BOSS_BATTLE = 824
|
||||
SWITCH_SILVERBOSS_BATTLE = 675
|
||||
|
||||
GENDER_FEMALE=0
|
||||
GENDER_MALE=1
|
||||
|
||||
MELOETTA_BAND_NAME = "Miss Melody and the Mystic Musicians"
|
||||
SUCKY_BAND_NAME = "MooMoo Milk"
|
||||
242
Data/Scripts/050_Outfits/001_OutfitsMain/LayeredClothes.rb
Normal file
242
Data/Scripts/050_Outfits/001_OutfitsMain/LayeredClothes.rb
Normal file
@@ -0,0 +1,242 @@
|
||||
def find_last_outfit(outfit_type_path, firstOutfit)
|
||||
for i in firstOutfit..Settings::MAX_NB_OUTFITS
|
||||
outfit_path = outfit_type_path + "/" + i.to_s #Settings::PLAYER_GRAPHICS_FOLDER + outfit_type_path + "/" + outfit_type_path + "_" + player_sprite + "_" + i.to_s
|
||||
return i - 1 if !Dir.exist?(outfit_path)
|
||||
end
|
||||
return firstOutfit
|
||||
end
|
||||
|
||||
def list_all_numeric_folders(directory_path)
|
||||
entries = Dir.entries(directory_path)
|
||||
# Filter out only the directories whose names are numeric (excluding "." and "..")
|
||||
numeric_folders = entries.select do |entry|
|
||||
full_path = File.join(directory_path, entry)
|
||||
File.directory?(full_path) && entry != '.' && entry != '..' && entry.match?(/^\d+$/)
|
||||
end
|
||||
|
||||
# Convert the folder names to integers and store in an array
|
||||
folder_integers = numeric_folders.map(&:to_i)
|
||||
folder_integers.sort!
|
||||
return folder_integers
|
||||
end
|
||||
|
||||
def list_all_numeric_files_with_filter(directory_path, prefix)
|
||||
entries = Dir.entries(directory_path)
|
||||
prefixless = []
|
||||
for file in entries
|
||||
next if file == "." || file == ".."
|
||||
prefixless << file.gsub((prefix + "_"), "")
|
||||
end
|
||||
|
||||
folder_integers = prefixless.map(&:to_i)
|
||||
folder_integers.sort!
|
||||
return folder_integers
|
||||
end
|
||||
|
||||
#unlocked:
|
||||
# -1 for all outfits unlocked
|
||||
# Otherwise, an array of the ids of unlocked outfits
|
||||
def list_available_outfits(directory, versions = [], unlocked = [], prefix_filter = nil)
|
||||
if prefix_filter
|
||||
outfits = list_all_numeric_files_with_filter(directory, prefix_filter)
|
||||
else
|
||||
outfits = list_all_numeric_folders(directory)
|
||||
end
|
||||
# #echoln outfits
|
||||
# return outfits #todo: remove this return for unlockable outfits
|
||||
available_outfits = []
|
||||
for outfit in outfits
|
||||
if !unlocked || unlocked.include?(outfit)
|
||||
for version in versions
|
||||
available_outfits << outfit.to_s + version
|
||||
end
|
||||
available_outfits << outfit.to_s if versions.empty?
|
||||
end
|
||||
end
|
||||
return available_outfits
|
||||
end
|
||||
|
||||
def get_current_outfit_position(currentOutfit_id, available_outfits)
|
||||
current_index = available_outfits.index(currentOutfit_id)
|
||||
return current_index.nil? ? 0 : current_index
|
||||
end
|
||||
|
||||
def setHairColor(hue_shift)
|
||||
$Trainer.hair_color = hue_shift
|
||||
end
|
||||
|
||||
def shiftHatColor(incr)
|
||||
$Trainer.hat_color = 0 if !$Trainer.hat_color
|
||||
$Trainer.hat_color += incr
|
||||
end
|
||||
|
||||
def shiftClothesColor(incr)
|
||||
$Trainer.clothes_color = 0 if !$Trainer.clothes_color
|
||||
$Trainer.clothes_color += incr
|
||||
end
|
||||
|
||||
def shiftHairColor(incr)
|
||||
$Trainer.hair_color = 0 if !$Trainer.hair_color
|
||||
$Trainer.hair_color += incr
|
||||
end
|
||||
|
||||
def pbLoadOutfitBitmap(outfitFileName)
|
||||
begin
|
||||
outfitBitmap = RPG::Cache.load_bitmap("", outfitFileName)
|
||||
return outfitBitmap
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
def setOutfit(outfit_id)
|
||||
$Trainer.clothes = outfit_id
|
||||
end
|
||||
|
||||
def setHat(hat_id)
|
||||
$Trainer.hat = hat_id
|
||||
end
|
||||
|
||||
def getEasterEggHeldItem()
|
||||
map = $game_map.map_id
|
||||
return "HOTDOG" if [141, 194].include?(map) #restaurant
|
||||
return "SNOWBALL" if [670, 693, 698, 694].include?(map)
|
||||
return "WALLET" if [432, 433, 434, 435, 436, 292].include?(map) #dept. store
|
||||
return "ALARMCLOCK" if [43, 48, 67, 68, 69, 70, 71, 73].include?(map) #Player room
|
||||
return "SAFARIBALL" if [445, 484, 485, 486, 107, 487, 488, 717, 82, 75, 74].include?(map) #Safari Zone
|
||||
|
||||
return nil
|
||||
end
|
||||
|
||||
def getCurrentPokeball()
|
||||
otherItem = getEasterEggHeldItem()
|
||||
return otherItem if otherItem
|
||||
firstPokemon = $Trainer.party[0]
|
||||
return firstPokemon.poke_ball if firstPokemon
|
||||
return nil
|
||||
end
|
||||
|
||||
def generate_front_trainer_sprite_bitmap(pokeball = nil, clothes_id = nil, hat_id = nil, hair_id = nil,
|
||||
skin_tone_id = nil, hair_color = nil, hat_color = nil, clothes_color = nil)
|
||||
clothes_id = $Trainer.clothes if !clothes_id
|
||||
hat_id = $Trainer.hat if !hat_id
|
||||
hair_id = $Trainer.hair if !hair_id
|
||||
skin_tone_id = $Trainer.skin_tone if !skin_tone_id
|
||||
hair_color = $Trainer.hair_color if !hair_color
|
||||
hat_color = $Trainer.hat_color if !hat_color
|
||||
clothes_color = $Trainer.clothes_color if !clothes_color
|
||||
|
||||
hairFilename = getTrainerSpriteHairFilename(hair_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER + "/hair_trainer_{1}", $Trainer.hair)
|
||||
outfitFilename = getTrainerSpriteOutfitFilename(clothes_id) #_INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_CLOTHES_FOLDER + "/clothes_trainer_{1}", $Trainer.clothes)
|
||||
|
||||
hatFilename = getTrainerSpriteHatFilename(hat_id) # _INTL(Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAT_FOLDER + "/hat_trainer_{1}", $Trainer.hat)
|
||||
pokeball = getCurrentPokeball if !pokeball
|
||||
ballFilename = getTrainerSpriteBallFilename(pokeball) if pokeball
|
||||
|
||||
baseFilePath = getBaseTrainerSpriteFilename(skin_tone_id)
|
||||
|
||||
hair_color_shift = hair_color
|
||||
hat_color_shift = hat_color
|
||||
clothes_color_shift = clothes_color
|
||||
|
||||
hair_color_shift = 0 if !hair_color_shift
|
||||
hat_color_shift = 0 if !hat_color_shift
|
||||
clothes_color_shift = 0 if !clothes_color_shift
|
||||
|
||||
baseBitmap = AnimatedBitmap.new(baseFilePath) if pbResolveBitmap(baseFilePath)
|
||||
ballBitmap = pbLoadOutfitBitmap(ballFilename) if pbResolveBitmap(ballFilename)
|
||||
|
||||
if !pbResolveBitmap(outfitFilename)
|
||||
outfitFilename = getTrainerSpriteOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK)
|
||||
end
|
||||
if !pbResolveBitmap(outfitFilename)
|
||||
raise "No temp clothes graphics available"
|
||||
end
|
||||
|
||||
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) # if pbResolveBitmap(outfitFilename) #pb
|
||||
hairBitmapWrapper = AnimatedBitmap.new(hairFilename, hair_color_shift) if pbResolveBitmap(hairFilename)
|
||||
|
||||
hatBitmap = AnimatedBitmap.new(hatFilename, hat_color_shift) if pbResolveBitmap(hatFilename) #pbLoadOutfitBitmap(hatFilename) if pbResolveBitmap(hatFilename)
|
||||
|
||||
baseBitmap.bitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
|
||||
|
||||
baseBitmap.bitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect) if hairBitmapWrapper
|
||||
baseBitmap.bitmap.blt(0, 0, hatBitmap.bitmap, hatBitmap.bitmap.rect) if hatBitmap
|
||||
baseBitmap.bitmap.blt(44, 42, ballBitmap, ballBitmap.rect) if ballBitmap
|
||||
|
||||
return baseBitmap
|
||||
end
|
||||
|
||||
def generateClothedBitmapStatic(trainer, action = "walk")
|
||||
baseBitmapFilename = getBaseOverworldSpriteFilename(action, trainer.skin_tone)
|
||||
if !pbResolveBitmap(baseBitmapFilename)
|
||||
baseBitmapFilename = Settings::PLAYER_GRAPHICS_FOLDER + action
|
||||
end
|
||||
baseSprite = AnimatedBitmap.new(baseBitmapFilename)
|
||||
|
||||
baseBitmap = baseSprite.bitmap.clone #nekkid sprite
|
||||
outfitFilename = getOverworldOutfitFilename(trainer.clothes, action) #
|
||||
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
|
||||
hairFilename = getOverworldHairFilename(trainer.hair)
|
||||
hatFilename = getOverworldHatFilename(trainer.hat)
|
||||
|
||||
hair_color_shift = trainer.hair_color
|
||||
hat_color_shift = trainer.hat_color
|
||||
clothes_color_shift = trainer.clothes_color
|
||||
|
||||
hair_color_shift = 0 if !hair_color_shift
|
||||
hat_color_shift = 0 if !hat_color_shift
|
||||
clothes_color_shift = 0 if !clothes_color_shift
|
||||
#@hat.update(@character_name, hatFilename,hat_color_shift) if @hat
|
||||
if !pbResolveBitmap(outfitFilename)
|
||||
outfitFilename = Settings::PLAYER_TEMP_OUTFIT_FALLBACK
|
||||
end
|
||||
|
||||
outfitBitmap = AnimatedBitmap.new(outfitFilename, clothes_color_shift) # if pbResolveBitmap(outfitFilename) #pbLoadOutfitBitmap(outfitFilename) if pbResolveBitmap(outfitFilename)
|
||||
hairBitmapWrapper = AnimatedBitmap.new(hairFilename, hair_color_shift) if pbResolveBitmap(hairFilename)
|
||||
|
||||
baseBitmap.blt(0, 0, outfitBitmap.bitmap, outfitBitmap.bitmap.rect) if outfitBitmap
|
||||
|
||||
#baseBitmap.blt(0, 0, hairBitmapWrapper.bitmap, hairBitmapWrapper.bitmap.rect)
|
||||
|
||||
current_offset = 0 #getCurrentSpriteOffset()
|
||||
positionHair(baseBitmap, hairBitmapWrapper.bitmap, current_offset) if hairBitmapWrapper
|
||||
#baseBitmap.blt(0, 0, hatBitmap, hatBitmap.rect) if hatBitmap
|
||||
return baseBitmap
|
||||
end
|
||||
|
||||
def positionHair(baseBitmap, hairBirmap, offset)
|
||||
baseBitmap.blt(offset[0], offset[1], hairBirmap, hairBirmap.rect)
|
||||
end
|
||||
|
||||
def add_hat_to_bitmap(bitmap, hat_id, x_pos, y_pos, scale = 1, mirrored = false)
|
||||
base_scale = 1.5 #coz hat & poke sprites aren't the same size
|
||||
adjusted_scale = base_scale * scale
|
||||
hat_filename = getTrainerSpriteHatFilename(hat_id)
|
||||
hatBitmapWrapper = AnimatedBitmap.new(hat_filename, 0) if pbResolveBitmap(hat_filename)
|
||||
hatBitmapWrapper.scale_bitmap(adjusted_scale) if hatBitmapWrapper
|
||||
hatBitmapWrapper.mirror if mirrored
|
||||
bitmap.blt(x_pos * adjusted_scale, y_pos * adjusted_scale, hatBitmapWrapper.bitmap, hatBitmapWrapper.bitmap.rect) if hatBitmapWrapper
|
||||
end
|
||||
|
||||
class PokemonTemp
|
||||
attr_accessor :trainer_preview
|
||||
end
|
||||
|
||||
def display_outfit_preview(x = 320, y = 0, withBorder = true)
|
||||
hide_outfit_preview() if $PokemonTemp.trainer_preview
|
||||
$PokemonTemp.trainer_preview = TrainerClothesPreview.new(x, y, withBorder)
|
||||
$PokemonTemp.trainer_preview.show()
|
||||
end
|
||||
|
||||
def hide_outfit_preview()
|
||||
$game_screen.pictures[20].erase
|
||||
$PokemonTemp.trainer_preview.erase() if $PokemonTemp.trainer_preview
|
||||
$PokemonTemp.trainer_preview = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
114
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitSelector.rb
Normal file
114
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitSelector.rb
Normal file
@@ -0,0 +1,114 @@
|
||||
class OutfitSelector
|
||||
attr_reader :clothes_list
|
||||
attr_reader :hats_list
|
||||
attr_reader :hairstyles_list
|
||||
|
||||
def initialize()
|
||||
@clothes_list = parse_clothes_folder()
|
||||
@hats_list = parse_hats_folder()
|
||||
@hairstyles_list =parse_hairstyles_folder()
|
||||
end
|
||||
|
||||
|
||||
def parse_clothes_folder
|
||||
return list_folders(get_clothes_sets_list_path())
|
||||
end
|
||||
|
||||
def parse_hats_folder
|
||||
return list_folders(get_hats_sets_list_path())
|
||||
end
|
||||
|
||||
def parse_hairstyle_types_folder
|
||||
return list_folders(get_hair_sets_list_path())
|
||||
end
|
||||
|
||||
def parse_hairstyles_folder
|
||||
hairstyle_types= list_folders(get_hair_sets_list_path())
|
||||
max_versions_number = 10
|
||||
list= []
|
||||
for hairstyle in hairstyle_types
|
||||
for i in 1..max_versions_number
|
||||
type = i.to_s + "_" + hairstyle
|
||||
filePath = getOverworldHairFilename(type)
|
||||
if pbResolveBitmap(filePath)
|
||||
list << type
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
||||
|
||||
def list_folders(path)
|
||||
entries= Dir.entries(path)
|
||||
return entries.select { |entry| File.directory?(File.join(path, entry)) && entry != '.' && entry != '..' }
|
||||
end
|
||||
|
||||
|
||||
def filter_unlocked_outfits(outfits_list,unlocked_outfits)
|
||||
available_outfits = []
|
||||
outfits_list.each do |outfit|
|
||||
available_outfits << outfit if unlocked_outfits.include?(outfit)
|
||||
end
|
||||
return available_outfits
|
||||
end
|
||||
|
||||
|
||||
def selectNextOutfit(currentOutfit, incr, outfits_list, versions = [], allowNone = true, prefix_filter = nil,unlockedOutfits=[],everythingUnlocked=false)
|
||||
available_outfits = []
|
||||
available_outfits = outfits_list if everythingUnlocked
|
||||
available_outfits << "" if allowNone
|
||||
available_outfits += filter_unlocked_outfits(outfits_list,unlockedOutfits) if !everythingUnlocked
|
||||
#available_outfits += list_available_outfits(directory, versions, unlockedOutfits, prefix_filter) #unlockedOutfits = nil for all outfits unlocked
|
||||
last_outfit = available_outfits[-1]
|
||||
|
||||
current_outfit_index = get_current_outfit_position(currentOutfit, available_outfits)
|
||||
next_outfit_index = current_outfit_index +incr
|
||||
|
||||
nextOutfit = available_outfits[next_outfit_index]
|
||||
nextOutfit = last_outfit if next_outfit_index < 0
|
||||
|
||||
nextOutfit = available_outfits[0] if next_outfit_index >= available_outfits.length()
|
||||
|
||||
return nextOutfit if available_outfits.include?(nextOutfit)
|
||||
return currentOutfit
|
||||
end
|
||||
|
||||
def changeToNextClothes(incr,all_unlocked=false)
|
||||
$Trainer.unlocked_clothes = [] if !$Trainer.unlocked_clothes
|
||||
|
||||
|
||||
currentOutfit = $Trainer.clothes
|
||||
currentOutfit = 0 if !currentOutfit
|
||||
nextOutfit = selectNextOutfit(currentOutfit, incr, @clothes_list, [], false,nil,$Trainer.unlocked_clothes,all_unlocked)
|
||||
$Trainer.clothes = nextOutfit
|
||||
$Trainer.clothes_color = 0
|
||||
echoln $Trainer.clothes
|
||||
|
||||
end
|
||||
|
||||
def changeToNextHat(incr,all_unlocked=false)
|
||||
$Trainer.unlocked_hats = [] if !$Trainer.unlocked_hats
|
||||
|
||||
currentHat = $Trainer.hat
|
||||
currentHat = 0 if !currentHat
|
||||
nextOutfit = selectNextOutfit(currentHat, incr, @hats_list, [], true, "hat",$Trainer.unlocked_hats,all_unlocked)
|
||||
$Trainer.hat = nextOutfit
|
||||
$Trainer.hat_color = 0
|
||||
echoln $Trainer.hat
|
||||
|
||||
end
|
||||
|
||||
def changeToNextHairstyle(incr,all_unlocked=false)
|
||||
$Trainer.unlocked_hairstyles = [] if !$Trainer.unlocked_hairstyles
|
||||
|
||||
currentHair = $Trainer.hair
|
||||
currentHair = 0 if !currentHair
|
||||
nextOutfit = selectNextOutfit(currentHair, incr, @hairstyles_list, ["a", "b", "c", "d"], true,nil,$Trainer.unlocked_hairstyles,all_unlocked)
|
||||
$Trainer.hair_color = 0
|
||||
$Trainer.hair = nextOutfit
|
||||
echoln $Trainer.hair
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
75
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitsGlobal.rb
Normal file
75
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitsGlobal.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :hats_data
|
||||
attr_accessor :hairstyles_data
|
||||
attr_accessor :clothes_data
|
||||
end
|
||||
|
||||
def update_global_hats_list()
|
||||
file_path = Settings::HATS_DATA_PATH
|
||||
json_data = File.read(file_path)
|
||||
hat_data = HTTPLite::JSON.parse(json_data)
|
||||
|
||||
$PokemonGlobal.hats_data = {}
|
||||
|
||||
# Iterate through the JSON data and create Hat objects
|
||||
hat_data.each do |data|
|
||||
tags = data['tags'] ? data['tags'].split(',') : []
|
||||
hat = Hat.new(
|
||||
data['id'],
|
||||
data['name'],
|
||||
data['description'],
|
||||
data['price'],
|
||||
tags
|
||||
)
|
||||
$PokemonGlobal.hats_data[hat.id] = hat
|
||||
end
|
||||
end
|
||||
|
||||
def update_global_hairstyles_list()
|
||||
file_path = Settings::HAIRSTYLE_DATA_PATH
|
||||
json_data = File.read(file_path)
|
||||
hair_data = HTTPLite::JSON.parse(json_data)
|
||||
|
||||
$PokemonGlobal.hairstyles_data = {}
|
||||
|
||||
# Iterate through the JSON data and create Hat objects
|
||||
hair_data.each do |data|
|
||||
tags = data['tags'] ? data['tags'].split(',') : []
|
||||
hair = Hairstyle.new(
|
||||
data['id'],
|
||||
data['name'],
|
||||
data['description'],
|
||||
data['price'],
|
||||
tags
|
||||
)
|
||||
$PokemonGlobal.hairstyles_data[hair.id] = hair
|
||||
end
|
||||
end
|
||||
|
||||
def update_global_clothes_list()
|
||||
file_path = Settings::CLOTHES_DATA_PATH
|
||||
json_data = File.read(file_path)
|
||||
outfits_data = HTTPLite::JSON.parse(json_data)
|
||||
|
||||
$PokemonGlobal.clothes_data = {}
|
||||
|
||||
# Iterate through the JSON data and create Hat objects
|
||||
outfits_data.each do |data|
|
||||
tags = data['tags'] ? data['tags'].split(',') : []
|
||||
outfit = Clothes.new(
|
||||
data['id'],
|
||||
data['name'],
|
||||
data['description'],
|
||||
data['price'],
|
||||
tags
|
||||
)
|
||||
$PokemonGlobal.clothes_data[outfit.id] = outfit
|
||||
end
|
||||
end
|
||||
|
||||
def update_global_outfit_lists()
|
||||
update_global_hats_list
|
||||
update_global_hairstyles_list
|
||||
update_global_clothes_list
|
||||
end
|
||||
|
||||
99
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitsSearch.rb
Normal file
99
Data/Scripts/050_Outfits/001_OutfitsMain/OutfitsSearch.rb
Normal file
@@ -0,0 +1,99 @@
|
||||
#CLOTHES
|
||||
|
||||
def search_clothes(matching_tags = [], only_unlocked = false)
|
||||
update_global_outfit_lists()
|
||||
selector = OutfitSelector.new
|
||||
|
||||
full_data_list = $PokemonGlobal.clothes_data
|
||||
existing_files_list = selector.parse_clothes_folder()
|
||||
unlocked_list = $Trainer.unlocked_clothes
|
||||
return search_outfits_by_tag(full_data_list, matching_tags, existing_files_list, unlocked_list, only_unlocked)
|
||||
end
|
||||
|
||||
def filter_clothes(filter_tags = [], only_unlocked = false)
|
||||
update_global_outfit_lists()
|
||||
selector = OutfitSelector.new
|
||||
|
||||
full_data_list = $PokemonGlobal.hats_data
|
||||
existing_files_list = selector.parse_hats_folder()
|
||||
unlocked_list = $Trainer.unlocked_hats
|
||||
return filter_outfits_by_tag(full_data_list, filter_tags, existing_files_list, unlocked_list, only_unlocked)
|
||||
end
|
||||
|
||||
#HATS
|
||||
|
||||
def search_hats(matching_tags = [], only_unlocked = false)
|
||||
update_global_outfit_lists()
|
||||
selector = OutfitSelector.new
|
||||
|
||||
full_data_list = $PokemonGlobal.hats_data
|
||||
existing_files_list = selector.parse_hats_folder()
|
||||
unlocked_list = $Trainer.unlocked_hats
|
||||
return search_outfits_by_tag(full_data_list, matching_tags, existing_files_list, unlocked_list, only_unlocked)
|
||||
end
|
||||
|
||||
def filter_hats(filter_tags = [], only_unlocked = false)
|
||||
update_global_outfit_lists()
|
||||
selector = OutfitSelector.new
|
||||
|
||||
full_data_list = $PokemonGlobal.hats_data
|
||||
existing_files_list = selector.parse_hats_folder()
|
||||
echoln existing_files_list
|
||||
unlocked_list = $Trainer.unlocked_hats
|
||||
return filter_outfits_by_tag(full_data_list, filter_tags, existing_files_list, unlocked_list, only_unlocked)
|
||||
end
|
||||
|
||||
|
||||
# Generic searching methods
|
||||
|
||||
#Get outfits that have ANY of the tags
|
||||
def search_outfits_by_tag(outfits_map, matching_tags = [], physical_files_list = [], unlocked_list = [], require_unlocked = false)
|
||||
filtered_list = []
|
||||
outfits_map.each do |outfit_id, outfit|
|
||||
if outfit.tags.any? { |tag| matching_tags.include?(tag) }
|
||||
filtered_list << outfit_id if outfit_is_valid?(outfit_id, physical_files_list, unlocked_list, require_unlocked)
|
||||
end
|
||||
end
|
||||
return filtered_list
|
||||
end
|
||||
|
||||
#Get outfits that have ALL of the tags
|
||||
def filter_outfits_by_tag(outfits_map, filter_tags = [], physical_files_list = [], unlocked_list = [], require_unlocked = false)
|
||||
update_global_outfit_lists()
|
||||
|
||||
filtered_list = []
|
||||
outfits_map.each do |outfit_id, outfit|
|
||||
if filter_tags.all? { |tag| outfit.tags.include?(tag) }
|
||||
filtered_list << outfit_id if outfit_is_valid?(outfit_id, physical_files_list, unlocked_list, require_unlocked)
|
||||
end
|
||||
end
|
||||
return filtered_list
|
||||
end
|
||||
|
||||
|
||||
def outfit_is_valid?(outfit_id, physical_files_list, unlocked_list, require_unlocked)
|
||||
return false if require_unlocked && !unlocked_list.include?(outfit_id)
|
||||
return physical_files_list.include?(outfit_id)
|
||||
end
|
||||
|
||||
def add_tags(tags_list=[])
|
||||
newTag=pbEnterText("add tag",0,10)
|
||||
return tags_list if newTag.length == 0
|
||||
tags_list << newTag
|
||||
return tags_list
|
||||
end
|
||||
|
||||
def get_clothes_by_id(id)
|
||||
update_global_outfit_lists()
|
||||
return $PokemonGlobal.clothes_data.has_key?(id) ? $PokemonGlobal.clothes_data[id] : nil
|
||||
end
|
||||
|
||||
def get_hat_by_id(id)
|
||||
update_global_outfit_lists()
|
||||
return $PokemonGlobal.hats_data.has_key?(id) ? $PokemonGlobal.hats_data[id] : nil
|
||||
end
|
||||
|
||||
def get_hair_by_id(id)
|
||||
update_global_outfit_lists()
|
||||
return $PokemonGlobal.hairstyles_data.has_key?(id) ? $PokemonGlobal.hairstyles_data[id] : nil
|
||||
end
|
||||
181
Data/Scripts/050_Outfits/UI/CharacterSelectMenu.rb
Normal file
181
Data/Scripts/050_Outfits/UI/CharacterSelectMenu.rb
Normal file
@@ -0,0 +1,181 @@
|
||||
class CharacterSelectionMenuView
|
||||
attr_accessor :name_sprite
|
||||
attr_accessor :viewport
|
||||
attr_accessor :sprites
|
||||
attr_accessor :textValues
|
||||
|
||||
|
||||
OPTIONS_START_Y = 66
|
||||
CURSOR_Y_MARGIN = 50
|
||||
CURSOR_X_MARGIN = 76
|
||||
|
||||
CHECKMARK_Y_MARGIN = 20
|
||||
CHECKMARK_WIDTH = 50
|
||||
|
||||
OPTIONS_LABEL_X = 50
|
||||
|
||||
|
||||
OPTIONS_LABEL_WIDTH = 100
|
||||
|
||||
OPTIONS_VALUE_X = 194
|
||||
SELECTOR_X = 120
|
||||
SELECTOR_STAGGER_OFFSET=26
|
||||
|
||||
|
||||
ARROW_LEFT_X_POSITION = 75
|
||||
ARROW_RIGHT_X_POSITION = 275
|
||||
ARROWS_Y_OFFSET = 10#20
|
||||
|
||||
CONFIRM_X = 296
|
||||
CONFIRM_Y= 322
|
||||
|
||||
STAGGER_OFFSET_1 = 26
|
||||
STAGGER_OFFSET_2 = 50
|
||||
|
||||
|
||||
|
||||
def initialize
|
||||
@presenter = CharacterSelectMenuPresenter.new(self)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@sprites = {}
|
||||
@textValues={}
|
||||
@max_index=5
|
||||
end
|
||||
|
||||
def init_graphics()
|
||||
@sprites["bg"] = IconSprite.new(@viewport)
|
||||
@sprites["bg"].setBitmap("Graphics/Pictures/trainer_application_form")
|
||||
|
||||
|
||||
@sprites["select"] = IconSprite.new(@viewport)
|
||||
@sprites["select"].setBitmap("Graphics/Pictures/cc_selection_box")
|
||||
@sprites["select"].x = get_cursor_x_position(0)#OPTIONS_LABEL_X + OPTIONS_LABEL_WIDTH + CURSOR_X_MARGIN
|
||||
@sprites["select"].y = OPTIONS_START_Y
|
||||
@sprites["select"].visible = true
|
||||
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = ARROW_LEFT_X_POSITION
|
||||
@sprites["leftarrow"].y = 0
|
||||
@sprites["leftarrow"].visible = false
|
||||
@sprites["leftarrow"].play
|
||||
|
||||
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = ARROW_RIGHT_X_POSITION
|
||||
@sprites["rightarrow"].y = 0
|
||||
@sprites["rightarrow"].visible = false
|
||||
@sprites["rightarrow"].play
|
||||
|
||||
@presenter.setInitialValues()
|
||||
end
|
||||
|
||||
def setMaxIndex(maxIndex)
|
||||
@max_index=maxIndex
|
||||
end
|
||||
|
||||
def init_labels()
|
||||
Kernel.pbDisplayText("Confirm", (CONFIRM_X+CURSOR_X_MARGIN), CONFIRM_Y)
|
||||
|
||||
#Labels are directly in the image
|
||||
|
||||
# current_Y = OPTIONS_START_Y
|
||||
# for option in @presenter.options
|
||||
# x_pos = option == "Confirm" ? OPTIONS_VALUE_X : OPTIONS_LABEL_X
|
||||
#
|
||||
# Kernel.pbDisplayText(option, x_pos, current_Y)
|
||||
# current_Y += CURSOR_Y_MARGIN
|
||||
# end
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
def start
|
||||
init_graphics()
|
||||
init_labels()
|
||||
@presenter.main()
|
||||
end
|
||||
|
||||
def get_cursor_y_position(index)
|
||||
return CONFIRM_Y if index == @max_index
|
||||
return index * CURSOR_Y_MARGIN + OPTIONS_START_Y
|
||||
end
|
||||
|
||||
def get_cursor_x_position(index)
|
||||
return CONFIRM_X if index == @max_index
|
||||
return SELECTOR_X + getTextBoxStaggerOffset(index)
|
||||
end
|
||||
|
||||
def get_value_x_position(index)
|
||||
return (OPTIONS_VALUE_X + getTextBoxStaggerOffset(index))
|
||||
end
|
||||
|
||||
def getTextBoxStaggerOffset(index)
|
||||
case index
|
||||
when 1
|
||||
return STAGGER_OFFSET_1
|
||||
when 2
|
||||
return STAGGER_OFFSET_2
|
||||
when 3
|
||||
return STAGGER_OFFSET_1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def showSideArrows(y_index)
|
||||
y_position = get_cursor_y_position(y_index)
|
||||
|
||||
@sprites["rightarrow"].y=y_position+ARROWS_Y_OFFSET
|
||||
@sprites["leftarrow"].y=y_position+ARROWS_Y_OFFSET
|
||||
|
||||
@sprites["leftarrow"].x=getTextBoxStaggerOffset(y_index)+ARROW_LEFT_X_POSITION
|
||||
@sprites["rightarrow"].x= getTextBoxStaggerOffset(y_index)+ARROW_RIGHT_X_POSITION
|
||||
|
||||
@sprites["rightarrow"].visible=true
|
||||
@sprites["leftarrow"].visible=true
|
||||
end
|
||||
|
||||
def hideSideArrows()
|
||||
@sprites["rightarrow"].visible=false
|
||||
@sprites["leftarrow"].visible=false
|
||||
end
|
||||
|
||||
def displayAge(age,y_index)
|
||||
y_position = get_cursor_y_position(y_index)
|
||||
x_position = get_value_x_position(y_index)
|
||||
Kernel.pbClearNumber()
|
||||
Kernel.pbDisplayNumber(age,x_position,y_position)
|
||||
end
|
||||
|
||||
def displayText(spriteId,text,y_index)
|
||||
@textValues[spriteId].dispose if @textValues[spriteId]
|
||||
yposition = get_cursor_y_position(y_index)
|
||||
xposition = get_value_x_position(y_index)
|
||||
|
||||
baseColor= baseColor ? baseColor : Color.new(72,72,72)
|
||||
shadowColor= shadowColor ? shadowColor : Color.new(160,160,160)
|
||||
@textValues[spriteId] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
text1=_INTL(text)
|
||||
textPosition=[
|
||||
[text1,xposition,yposition,2,baseColor,shadowColor],
|
||||
]
|
||||
pbSetSystemFont(@textValues[spriteId].bitmap)
|
||||
pbDrawTextPositions(@textValues[spriteId].bitmap,textPosition)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def updateGraphics()
|
||||
Graphics.update
|
||||
Input.update
|
||||
if @sprites
|
||||
@sprites["rightarrow"].update
|
||||
@sprites["leftarrow"].update
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
265
Data/Scripts/050_Outfits/UI/CharacterSelectMenuPresenter.rb
Normal file
265
Data/Scripts/050_Outfits/UI/CharacterSelectMenuPresenter.rb
Normal file
@@ -0,0 +1,265 @@
|
||||
class CharacterSelectMenuPresenter
|
||||
attr_accessor :options
|
||||
attr_reader :current_index
|
||||
|
||||
OPTION_NAME = 'Name'
|
||||
OPTION_AGE = "Age"
|
||||
OPTION_GENDER = "Gender"
|
||||
OPTION_HAIR = "Hair"
|
||||
OPTION_SKIN = "Skin"
|
||||
OPTION_CONFIRM = "Confirm"
|
||||
|
||||
MIN_AGE = 10
|
||||
MAX_AGE = 17
|
||||
DEFAULT_NAMES = ["Green", "Red"]
|
||||
|
||||
MIN_SKIN_COLOR = 1
|
||||
MAX_SKIN_COLOR = 6
|
||||
SKIN_COLOR_IDS = ["Type A", "Type B", "Type C", "Type D", "Type E", "Type F"]
|
||||
GENDERS_IDS = ["Female", "Male"]
|
||||
|
||||
HAIR_COLOR_IDS = [1, 2, 3, 4]
|
||||
HAIR_COLOR_NAMES = ["Blonde", "Light Brown", "Dark Brown", "Black"]
|
||||
|
||||
#ids for displayed text sprites
|
||||
NAME_TEXT_ID = "name"
|
||||
HAIR_TEXT_ID = "hair"
|
||||
SKIN_TEXT_ID = "skin"
|
||||
|
||||
def initialize(view)
|
||||
@view = view
|
||||
|
||||
@gender = 1
|
||||
@age = MIN_AGE
|
||||
@name = ""
|
||||
@skinTone = 5
|
||||
@hairstyle = "red"
|
||||
@hairColor = 2
|
||||
|
||||
@options = [OPTION_NAME, OPTION_GENDER, OPTION_AGE, OPTION_SKIN, OPTION_HAIR, OPTION_CONFIRM]
|
||||
|
||||
@trainerPreview = TrainerClothesPreview.new(300, 80, false, "POKEBALL")
|
||||
@trainerPreview.show()
|
||||
@closed = false
|
||||
@current_index = 0
|
||||
@view.setMaxIndex(@options.length - 1)
|
||||
end
|
||||
|
||||
def main()
|
||||
pbSEPlay("GUI naming tab swap start", 80, 100)
|
||||
@current_index = 0
|
||||
loop do
|
||||
@view.updateGraphics()
|
||||
if Input.trigger?(Input::DOWN)
|
||||
@current_index = move_menu_vertical(1)
|
||||
elsif Input.trigger?(Input::UP)
|
||||
@current_index = move_menu_vertical(-1)
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
move_menu_horizontal(@current_index, 1)
|
||||
elsif Input.trigger?(Input::LEFT)
|
||||
move_menu_horizontal(@current_index, -1)
|
||||
elsif Input.trigger?(Input::ACTION) || Input.trigger?(Input::USE)
|
||||
action_button_pressed(@current_index)
|
||||
end
|
||||
break if @closed
|
||||
end
|
||||
end
|
||||
|
||||
def updateTrainerPreview
|
||||
@trainerPreview.resetOutfits
|
||||
@trainerPreview.updatePreview
|
||||
end
|
||||
|
||||
def action_button_pressed(current_index)
|
||||
selected_option = @options[current_index]
|
||||
case selected_option
|
||||
when OPTION_NAME
|
||||
pbSEPlay("GUI summary change page", 80, 100)
|
||||
@name = pbEnterPlayerName(_INTL("Enter your name"), 0, Settings::MAX_PLAYER_NAME_SIZE)
|
||||
@name = getDefaultName() if @name == ''
|
||||
pbSEPlay("GUI trainer card open", 80, 100)
|
||||
updateDisplayedName(current_index)
|
||||
when OPTION_CONFIRM
|
||||
pbSEPlay("GUI save choice", 80, 100)
|
||||
@current_index = @options.length - 1
|
||||
update_cursor(@current_index)
|
||||
@name = getDefaultName if @name == ""
|
||||
updateDisplayedName(getOptionIndex(OPTION_NAME))
|
||||
cmd = pbMessage("Is this this information correct?", [_INTL("Yes"), _INTL("No")])
|
||||
if cmd == 0
|
||||
pbSEPlay("GUI naming confirm", 80, 100)
|
||||
#pbMessage("You will be able to customize your appearance further while playing")
|
||||
applyAllSelectedValues()
|
||||
close_menu()
|
||||
end
|
||||
else
|
||||
pbSEPlay("GUI save choice", 80, 100)
|
||||
@current_index = @options.length - 1
|
||||
update_cursor(@current_index)
|
||||
@name = getDefaultName if @name == ""
|
||||
updateDisplayedName(getOptionIndex(OPTION_NAME))
|
||||
end
|
||||
end
|
||||
|
||||
def getDefaultName()
|
||||
return DEFAULT_NAMES[@gender]
|
||||
end
|
||||
|
||||
def updateDisplayedName(current_index)
|
||||
@view.displayText(NAME_TEXT_ID, @name, current_index)
|
||||
end
|
||||
|
||||
def applyAllSelectedValues
|
||||
applyGender(@gender)
|
||||
pbSet(VAR_TRAINER_AGE, @gender)
|
||||
$Trainer.skin_tone = @skinTone
|
||||
$Trainer.name = @name
|
||||
end
|
||||
|
||||
def getOptionIndex(option_name)
|
||||
i = 0
|
||||
for option in @options
|
||||
return i if option == option_name
|
||||
i += 1
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
#VERTICAL NAVIGATION
|
||||
|
||||
def move_menu_vertical(offset)
|
||||
pbSEPlay("GUI sel decision", 80, 100)
|
||||
@current_index += offset
|
||||
@current_index = 0 if @current_index > @options.length - 1
|
||||
@current_index = @options.length - 1 if @current_index <= -1
|
||||
|
||||
update_cursor(@current_index)
|
||||
return @current_index
|
||||
end
|
||||
|
||||
def update_cursor(index)
|
||||
@view.sprites["select"].y = @view.get_cursor_y_position(index)
|
||||
@view.sprites["select"].x = @view.get_cursor_x_position(index)
|
||||
|
||||
set_custom_cursor(index)
|
||||
end
|
||||
|
||||
def close_menu
|
||||
@trainerPreview.erase()
|
||||
Kernel.pbClearNumber()
|
||||
Kernel.pbClearText()
|
||||
pbDisposeSpriteHash(@view.sprites)
|
||||
pbDisposeSpriteHash(@view.textValues)
|
||||
@closed = true
|
||||
end
|
||||
|
||||
def set_custom_cursor(index)
|
||||
selected_option = @options[index]
|
||||
case selected_option
|
||||
when OPTION_GENDER
|
||||
@view.showSideArrows(index)
|
||||
when OPTION_AGE
|
||||
@view.showSideArrows(index)
|
||||
when OPTION_HAIR
|
||||
@view.showSideArrows(index)
|
||||
when OPTION_SKIN
|
||||
@view.showSideArrows(index)
|
||||
else
|
||||
@view.hideSideArrows
|
||||
end
|
||||
end
|
||||
|
||||
#HORIZONTAL NAVIGATION
|
||||
def move_menu_horizontal(current_index, incr)
|
||||
pbSEPlay("GUI sel cursor", 80, 100)
|
||||
selected_option = @options[current_index]
|
||||
case selected_option
|
||||
when OPTION_GENDER then
|
||||
setGender(current_index, incr)
|
||||
when OPTION_HAIR then
|
||||
setHairColor(current_index, incr)
|
||||
when OPTION_SKIN then
|
||||
setSkinColor(current_index, incr)
|
||||
when OPTION_AGE then
|
||||
setAge(current_index, incr)
|
||||
end
|
||||
updateTrainerPreview()
|
||||
end
|
||||
|
||||
def setGender(current_index, incr)
|
||||
@gender += incr
|
||||
@gender = 0 if @gender >= 2
|
||||
@gender = 1 if @gender <= -1
|
||||
applyGender(@gender)
|
||||
label = GENDERS_IDS[@gender]
|
||||
@view.displayText(GENDERS_IDS, label, current_index)
|
||||
end
|
||||
|
||||
def setSkinColor(current_index, incr)
|
||||
@skinTone += incr
|
||||
@skinTone = MIN_SKIN_COLOR if @skinTone > MAX_SKIN_COLOR
|
||||
@skinTone = MAX_SKIN_COLOR if @skinTone < MIN_SKIN_COLOR
|
||||
$Trainer.skin_tone = @skinTone
|
||||
label = SKIN_COLOR_IDS[@skinTone - 1]
|
||||
@view.displayText(SKIN_TEXT_ID, label, current_index)
|
||||
end
|
||||
|
||||
def setHairColor(current_index, incr)
|
||||
max_id = HAIR_COLOR_IDS.length - 1
|
||||
@hairColor += incr
|
||||
@hairColor = 0 if @hairColor > max_id
|
||||
@hairColor = max_id if @hairColor <= -1
|
||||
applyHair()
|
||||
@view.displayText(HAIR_TEXT_ID, HAIR_COLOR_NAMES[@hairColor], current_index)
|
||||
end
|
||||
|
||||
def applyHair()
|
||||
hairColorId = HAIR_COLOR_IDS[@hairColor]
|
||||
hairId = hairColorId.to_s + "_" + @hairstyle.to_s
|
||||
$Trainer.hair = hairId
|
||||
end
|
||||
|
||||
def applyGender(gender_index)
|
||||
# outfitId = gender + 1
|
||||
pbSet(VAR_TRAINER_GENDER, gender_index)
|
||||
|
||||
outfitId = get_outfit_id_from_index(gender_index)
|
||||
@hairstyle = outfitId
|
||||
applyHair()
|
||||
#$Trainer.hair = outfitId
|
||||
$Trainer.clothes = outfitId
|
||||
$Trainer.hat = outfitId
|
||||
end
|
||||
|
||||
def get_outfit_id_from_index(gender_index)
|
||||
if gender_index == 1 #Male
|
||||
return "red"
|
||||
else
|
||||
#Female
|
||||
return "leaf"
|
||||
end
|
||||
end
|
||||
|
||||
#AGE
|
||||
def setAge(y_index, incr)
|
||||
@age += incr
|
||||
@age = MIN_AGE if @age > MAX_AGE
|
||||
@age = MAX_AGE if @age < MIN_AGE
|
||||
|
||||
@view.displayAge(@age, y_index)
|
||||
end
|
||||
|
||||
def setInitialValues()
|
||||
genderIndex = getOptionIndex(OPTION_GENDER)
|
||||
hairIndex = getOptionIndex(OPTION_HAIR)
|
||||
skinIndex = getOptionIndex(OPTION_SKIN)
|
||||
ageIndex = getOptionIndex(OPTION_AGE)
|
||||
|
||||
setGender(genderIndex, 0)
|
||||
setAge(ageIndex, 0)
|
||||
setHairColor(hairIndex, 0)
|
||||
setSkinColor(skinIndex, 0)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
|
||||
end
|
||||
209
Data/Scripts/050_Outfits/UI/LayeredClothes_Menus.rb
Normal file
209
Data/Scripts/050_Outfits/UI/LayeredClothes_Menus.rb
Normal file
@@ -0,0 +1,209 @@
|
||||
|
||||
def playOutfitRemovedAnimation()
|
||||
pbSEPlay("shiny", 80, 60)
|
||||
$scene.spriteset.addUserAnimation(Settings::OW_SHINE_ANIMATION_ID, $game_player.x, $game_player.y, true)
|
||||
end
|
||||
|
||||
def playOutfitChangeAnimation()
|
||||
pbSEPlay("shiny", 80, 100)
|
||||
$scene.spriteset.addUserAnimation(Settings::OW_SHINE_ANIMATION_ID, $game_player.x, $game_player.y, true)
|
||||
end
|
||||
|
||||
def selectHairstyle(all_unlocked=false)
|
||||
selector = OutfitSelector.new
|
||||
display_outfit_preview()
|
||||
hat = $Trainer.hat
|
||||
commands = ["Next style", "Previous style", "Toggle hat", "Back"]
|
||||
previous_input = 0
|
||||
# To enable turning the common event that lets you turn around while in the dialog box
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextHairstyle(1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextHairstyle(-1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 2 #Toggle hat
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
if hat == $Trainer.hat
|
||||
$Trainer.hat = nil
|
||||
else
|
||||
$Trainer.hat = hat
|
||||
end
|
||||
display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
$Trainer.hat = hat
|
||||
end
|
||||
|
||||
def selectHairColor
|
||||
display_outfit_preview()
|
||||
hat = $Trainer.hat
|
||||
commands = ["Shift up", "Shift down", "Toggle hat", "Reset", "Back"]
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
#playOutfitChangeAnimation()
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHairColor(10)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHairColor(-10)
|
||||
display_outfit_preview()
|
||||
when 2 #Toggle hat
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
if hat == $Trainer.hat
|
||||
$Trainer.hat = nil
|
||||
else
|
||||
$Trainer.hat = hat
|
||||
end
|
||||
display_outfit_preview()
|
||||
when 3 #Reset
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
$Trainer.hair_color = 0
|
||||
display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
$Trainer.hat = hat
|
||||
end
|
||||
|
||||
def selectHatColor
|
||||
display_outfit_preview()
|
||||
commands = ["Shift up", "Shift down", "Reset", "Back"]
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHatColor(10)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftHatColor(-10)
|
||||
display_outfit_preview()
|
||||
when 2 #Reset
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
$Trainer.hat_color = 0
|
||||
display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
end
|
||||
|
||||
def selectClothesColor
|
||||
display_outfit_preview()
|
||||
commands = ["Shift up", "Shift down", "Reset", "Back"]
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftClothesColor(10)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
shiftClothesColor(-10)
|
||||
display_outfit_preview()
|
||||
when 2 #Reset
|
||||
pbSEPlay("GUI storage pick up", 80, 100)
|
||||
$Trainer.clothes_color = 0
|
||||
display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
end
|
||||
|
||||
def selectHat(all_unlocked=false)
|
||||
selector = OutfitSelector.new
|
||||
display_outfit_preview()
|
||||
commands = ["Next hat", "Previous hat", "Remove hat", "Back"]
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextHat(1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextHat(-1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 2 #REMOVE HAT
|
||||
playOutfitRemovedAnimation()
|
||||
$Trainer.hat = nil
|
||||
selector.display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
end
|
||||
|
||||
def spinCharacter
|
||||
pbSEPlay("GUI party switch", 80, 100)
|
||||
|
||||
end
|
||||
|
||||
def selectClothes(all_unlocked=false)
|
||||
selector = OutfitSelector.new
|
||||
display_outfit_preview()
|
||||
commands = ["Next", "Previous"]
|
||||
#commands << "Remove clothes (DEBUG)" if $DEBUG
|
||||
commands << "Remove" if $DEBUG
|
||||
commands << "Back"
|
||||
previous_input = 0
|
||||
while (true)
|
||||
choice = pbShowCommands(nil, commands, commands.length, previous_input)
|
||||
previous_input = choice
|
||||
case choice
|
||||
when 0 #NEXT
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextClothes(1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 1 #PREVIOUS
|
||||
playOutfitChangeAnimation()
|
||||
selector.changeToNextClothes(-1,all_unlocked)
|
||||
display_outfit_preview()
|
||||
when 2 #REMOVE CLOTHES
|
||||
break if !$DEBUG
|
||||
playOutfitRemovedAnimation()
|
||||
$Trainer.clothes = nil
|
||||
display_outfit_preview()
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
hide_outfit_preview()
|
||||
end
|
||||
|
||||
|
||||
|
||||
def place_hat_on_pokemon(pokemon)
|
||||
hatscreen = PokemonHatPresenter.new(nil, pokemon)
|
||||
hatscreen.pbStartScreen()
|
||||
end
|
||||
103
Data/Scripts/050_Outfits/UI/PokemonHatScreenPresenter.rb
Normal file
103
Data/Scripts/050_Outfits/UI/PokemonHatScreenPresenter.rb
Normal file
@@ -0,0 +1,103 @@
|
||||
class PokemonHatPresenter
|
||||
PIXELS_PER_MOVEMENT = 4
|
||||
|
||||
def initialize(view, pokemon)
|
||||
@view = view
|
||||
@pokemon = pokemon
|
||||
@hatFilename = "Graphics/Characters/player/hat/trainer/hat_trainer_1"
|
||||
@sprites = {}
|
||||
|
||||
@x_pos = pokemon.hat_x ? pokemon.hat_x : 0
|
||||
@y_pos = pokemon.hat_y ? pokemon.hat_y : 0
|
||||
@hat_id = pokemon.hat ? pokemon.hat : 1
|
||||
@viewport = nil
|
||||
@previewwindow = nil
|
||||
|
||||
@original_pokemon_bitmap = nil
|
||||
end
|
||||
|
||||
def getPicturePath()
|
||||
if @pokemon.isTripleFusion?
|
||||
picturePath = GameData::Species::getSpecialSpriteName(@pokemon.species_data.id_number)
|
||||
elsif @pokemon.isFusion?
|
||||
picturePath = get_fusion_sprite_path(@pokemon.species_data.head_pokemon.id_number, @pokemon.species_data.body_pokemon.id_number)
|
||||
else
|
||||
picturePath = get_unfused_sprite_path(@pokemon.species_data.id_number, @pokemon.spriteform_body)
|
||||
end
|
||||
return picturePath
|
||||
end
|
||||
|
||||
def pbStartScreen
|
||||
@view.init_window(self)
|
||||
cancel if !select_hat()
|
||||
if position_hat()
|
||||
updatePokemonHatPosition()
|
||||
else
|
||||
cancel
|
||||
end
|
||||
@view.hide_move_arrows
|
||||
@view.hide_select_arrows
|
||||
@view.dispose_window()
|
||||
end
|
||||
|
||||
def updatePokemonHatPosition()
|
||||
@pokemon.hat = @hat_id
|
||||
@pokemon.hat_x = @x_pos
|
||||
@pokemon.hat_y = @y_pos
|
||||
end
|
||||
|
||||
def cancel
|
||||
@pokemon.hat = nil
|
||||
end
|
||||
|
||||
def select_hat
|
||||
selector = OutfitSelector.new
|
||||
@view.display_select_arrows
|
||||
outfit_type_path = get_hats_sets_list_path()
|
||||
@pokemon.hat = 0 if !@pokemon.hat
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@hat_id = selector.selectNextOutfit(@hat_id, 1, selector.hats_list, [], false, "hat_trainer") if Input.trigger?(Input::RIGHT)
|
||||
@hat_id = selector.selectNextOutfit(@hat_id, -1, selector.hats_list, [], false, "hat_trainer") if Input.trigger?(Input::LEFT)
|
||||
break if Input.trigger?(Input::USE)
|
||||
return false if Input.trigger?(Input::BACK)
|
||||
@view.update()
|
||||
end
|
||||
@pokemon.hat = @hat_id
|
||||
@view.hide_select_arrows
|
||||
|
||||
end
|
||||
|
||||
def position_hat
|
||||
@view.display_move_arrows
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
@x_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::RIGHT)
|
||||
@x_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::LEFT)
|
||||
@y_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::DOWN)
|
||||
@y_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::UP)
|
||||
break if Input.trigger?(Input::USE)
|
||||
return false if Input.trigger?(Input::BACK)
|
||||
@view.update()
|
||||
end
|
||||
@view.hide_move_arrows
|
||||
return true
|
||||
end
|
||||
|
||||
def initialize_bitmap()
|
||||
picturePath = getPicturePath()
|
||||
@original_pokemon_bitmap = AnimatedBitmap.new(picturePath)
|
||||
@original_pokemon_bitmap.scale_bitmap(Settings::FRONTSPRITE_SCALE)
|
||||
end
|
||||
|
||||
def getPokemonHatBitmap()
|
||||
@hatFilename = getTrainerSpriteHatFilename(@hat_id)
|
||||
hatBitmapWrapper = AnimatedBitmap.new(@hatFilename, 0) if pbResolveBitmap(@hatFilename)
|
||||
pokemon_bitmap = @original_pokemon_bitmap.bitmap.clone
|
||||
pokemon_bitmap.blt(@x_pos, @y_pos, hatBitmapWrapper.bitmap, hatBitmapWrapper.bitmap.rect) if hatBitmapWrapper
|
||||
return pokemon_bitmap
|
||||
end
|
||||
|
||||
end
|
||||
136
Data/Scripts/050_Outfits/UI/PokemonHatScreenView.rb
Normal file
136
Data/Scripts/050_Outfits/UI/PokemonHatScreenView.rb
Normal file
@@ -0,0 +1,136 @@
|
||||
class PokemonHatView
|
||||
WINDOW_POS_X = Graphics.width / 4
|
||||
WINDOW_POS_Y = Graphics.height / 8
|
||||
|
||||
attr_accessor :x_pos
|
||||
attr_accessor :y_pos
|
||||
|
||||
def initialize(x_pos = nil, y_pos = nil, windowed = true)
|
||||
@x_pos = x_pos ? x_pos : WINDOW_POS_X
|
||||
@y_pos = y_pos ? y_pos : WINDOW_POS_Y
|
||||
@windowed = windowed
|
||||
|
||||
end
|
||||
|
||||
def init_window(presenter)
|
||||
@presenter = presenter
|
||||
|
||||
|
||||
presenter.initialize_bitmap()
|
||||
pokemon_bitmap = presenter.getPokemonHatBitmap()
|
||||
|
||||
@previewwindow = PictureWindow.new(pokemon_bitmap)
|
||||
@previewwindow.opacity = 0 if !@windowed
|
||||
update_window_position()
|
||||
@previewwindow.z = 9999999
|
||||
|
||||
@viewport = Viewport.new(@previewwindow.x, @previewwindow.y, @previewwindow.width, @previewwindow.height)
|
||||
@viewport.z = 9999999
|
||||
@sprites = {}
|
||||
|
||||
initialize_arrows()
|
||||
|
||||
end
|
||||
|
||||
def initialize_arrows()
|
||||
middle_horizontal = 100
|
||||
width_horizontal = 90
|
||||
|
||||
middle_vertical = 100
|
||||
width_vertical = 90
|
||||
|
||||
@sprites["uparrow"] = AnimatedSprite.new("Graphics/Pictures/uparrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["uparrow"].x = middle_horizontal
|
||||
@sprites["uparrow"].y = middle_vertical - width_vertical
|
||||
@sprites["uparrow"].z = 100
|
||||
@sprites["uparrow"].visible=true
|
||||
|
||||
|
||||
@sprites["downarrow"] = AnimatedSprite.new("Graphics/Pictures/downarrow", 8, 28, 40, 2, @viewport)
|
||||
@sprites["downarrow"].x = middle_horizontal
|
||||
@sprites["downarrow"].y = middle_vertical + width_vertical
|
||||
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = middle_horizontal - width_horizontal -10
|
||||
@sprites["leftarrow"].y = middle_vertical
|
||||
|
||||
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = middle_horizontal + width_horizontal
|
||||
@sprites["rightarrow"].y = middle_vertical
|
||||
|
||||
@sprites["uparrow"].visible=false
|
||||
@sprites["downarrow"].visible=false
|
||||
@sprites["leftarrow"].visible=false
|
||||
@sprites["rightarrow"].visible=false
|
||||
|
||||
end
|
||||
|
||||
def update_window_position()
|
||||
@previewwindow.x = @x_pos
|
||||
@previewwindow.y = @y_pos
|
||||
end
|
||||
|
||||
#TODO
|
||||
def display_select_arrows
|
||||
hide_move_arrows
|
||||
@sprites["rightarrow"].visible=true
|
||||
@sprites["leftarrow"].visible=true
|
||||
|
||||
@sprites["rightarrow"].play
|
||||
@sprites["leftarrow"].play
|
||||
echoln @sprites["rightarrow"].frame
|
||||
end
|
||||
|
||||
def hide_select_arrows
|
||||
@sprites["rightarrow"].visible=false
|
||||
@sprites["leftarrow"].visible=false
|
||||
@sprites["rightarrow"].stop
|
||||
@sprites["leftarrow"].stop
|
||||
@sprites["rightarrow"].reset
|
||||
@sprites["leftarrow"].reset
|
||||
end
|
||||
|
||||
def display_move_arrows
|
||||
hide_move_arrows
|
||||
@sprites["rightarrow"].visible=true
|
||||
@sprites["leftarrow"].visible=true
|
||||
@sprites["uparrow"].visible=true
|
||||
@sprites["downarrow"].visible=true
|
||||
|
||||
@sprites["rightarrow"].play
|
||||
@sprites["leftarrow"].play
|
||||
@sprites["uparrow"].play
|
||||
@sprites["downarrow"].play
|
||||
end
|
||||
|
||||
def hide_move_arrows
|
||||
@sprites["rightarrow"].visible=false
|
||||
@sprites["leftarrow"].visible=false
|
||||
@sprites["uparrow"].visible=false
|
||||
@sprites["downarrow"].visible=false
|
||||
|
||||
@sprites["rightarrow"].stop
|
||||
@sprites["leftarrow"].stop
|
||||
@sprites["uparrow"].stop
|
||||
@sprites["downarrow"].stop
|
||||
end
|
||||
|
||||
def dispose_window
|
||||
@previewwindow.dispose
|
||||
@viewport.dispose
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@sprites = nil
|
||||
end
|
||||
|
||||
def update
|
||||
@sprites["rightarrow"].update
|
||||
@sprites["leftarrow"].update
|
||||
@sprites["uparrow"].update
|
||||
@sprites["downarrow"].update
|
||||
|
||||
@previewwindow.clearBitmaps
|
||||
@previewwindow.setBitmap(@presenter.getPokemonHatBitmap())
|
||||
@previewwindow.update
|
||||
end
|
||||
end
|
||||
52
Data/Scripts/050_Outfits/UI/TrainerClothesPreview.rb
Normal file
52
Data/Scripts/050_Outfits/UI/TrainerClothesPreview.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
class TrainerClothesPreview
|
||||
attr_writer :pokeball, :clothes, :hat, :hair, :skin_tone, :hair_color, :hat_color, :clothes_color
|
||||
|
||||
def initialize(x = 0, y = 0, windowed = true, pokeball = nil)
|
||||
@playerBitmap = nil
|
||||
@playerSprite = nil
|
||||
@x_pos = x
|
||||
@y_pos = y
|
||||
@windowed = windowed
|
||||
|
||||
@pokeball = pokeball
|
||||
resetOutfits()
|
||||
end
|
||||
|
||||
def resetOutfits()
|
||||
@clothes = $Trainer.clothes
|
||||
@hat = $Trainer.hat
|
||||
@hair = $Trainer.hair
|
||||
@skin_tone = $Trainer.skin_tone
|
||||
@hair_color = $Trainer.hair_color
|
||||
@hat_color = $Trainer.hat_color
|
||||
@clothes_color = $Trainer.clothes_color
|
||||
end
|
||||
|
||||
def show()
|
||||
@playerBitmap = generate_front_trainer_sprite_bitmap(@pokeball,
|
||||
@clothes, @hat, @hair,
|
||||
@skin_tone,
|
||||
@hair_color, @hat_color, @clothes_color)
|
||||
initialize_preview()
|
||||
end
|
||||
|
||||
def updatePreview()
|
||||
erase()
|
||||
show()
|
||||
end
|
||||
|
||||
def initialize_preview()
|
||||
@playerSprite = PictureWindow.new(@playerBitmap)
|
||||
@playerSprite.opacity = 0 if !@windowed
|
||||
|
||||
@playerSprite.x = @x_pos
|
||||
@playerSprite.y = @y_pos
|
||||
@playerSprite.z = 9999
|
||||
@playerSprite.update
|
||||
end
|
||||
|
||||
def erase()
|
||||
@playerSprite.dispose if @playerSprite
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,98 @@
|
||||
class OutfitsMartAdapter < PokemonMartAdapter
|
||||
WORN_ITEM_BASE_COLOR = MessageConfig::BLUE_TEXT_MAIN_COLOR
|
||||
WORN_ITEM_SHADOW_COLOR = MessageConfig::BLUE_TEXT_SHADOW_COLOR
|
||||
|
||||
def initialize(stock = [], isShop = true)
|
||||
@items = stock
|
||||
@worn_clothes = get_current_clothes()
|
||||
@isShop = isShop
|
||||
@version = nil
|
||||
end
|
||||
|
||||
def toggleText()
|
||||
return ""
|
||||
end
|
||||
|
||||
def switchVersion(item,delta=1)
|
||||
return
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
return
|
||||
end
|
||||
|
||||
def isWornItem?(item)
|
||||
return false
|
||||
end
|
||||
|
||||
def isShop?()
|
||||
return @isShop
|
||||
end
|
||||
|
||||
def getPrice(item, selling = nil)
|
||||
return 0 if !@isShop
|
||||
return nil if itemOwned(item)
|
||||
return item.price.to_i
|
||||
end
|
||||
|
||||
def getDisplayPrice(item, selling = nil)
|
||||
return "" if !@isShop
|
||||
return "-" if itemOwned(item)
|
||||
super
|
||||
end
|
||||
|
||||
def updateStock()
|
||||
updated_items = []
|
||||
for item in @items
|
||||
updated_items << item if !get_unlocked_items_list().include?(item.id)
|
||||
end
|
||||
@items = updated_items
|
||||
end
|
||||
|
||||
def removeItem(item)
|
||||
super
|
||||
end
|
||||
|
||||
def itemOwned(item)
|
||||
owned_list = get_unlocked_items_list()
|
||||
return owned_list.include?(item.id)
|
||||
end
|
||||
|
||||
def canSell?(item)
|
||||
super
|
||||
end
|
||||
|
||||
def getBaseColorOverride(item)
|
||||
return WORN_ITEM_BASE_COLOR if isWornItem?(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
def getShadowColorOverride(item)
|
||||
return WORN_ITEM_SHADOW_COLOR if isWornItem?(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
def getMoney
|
||||
super
|
||||
end
|
||||
|
||||
def getMoneyString
|
||||
super
|
||||
end
|
||||
|
||||
def setMoney(value)
|
||||
super
|
||||
end
|
||||
|
||||
def getItemIconRect(_item)
|
||||
super
|
||||
end
|
||||
|
||||
def getQuantity(item)
|
||||
super
|
||||
end
|
||||
|
||||
def showQuantity?(item)
|
||||
super
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
class ClothesMartAdapter < OutfitsMartAdapter
|
||||
DEFAULT_NAME = "[unknown]"
|
||||
DEFAULT_DESCRIPTION = "A piece of clothing that trainers can wear."
|
||||
|
||||
def initialize(stock = nil, isShop = nil)
|
||||
super
|
||||
end
|
||||
|
||||
def getName(item)
|
||||
return item.id
|
||||
end
|
||||
|
||||
def getDisplayName(item)
|
||||
return getName(item) if !item.name
|
||||
return item.name
|
||||
end
|
||||
|
||||
def getDescription(item)
|
||||
return DEFAULT_DESCRIPTION if !item.description
|
||||
return item.description
|
||||
end
|
||||
|
||||
def getItemIcon(item)
|
||||
return Settings::BACK_ITEM_ICON_PATH if !item
|
||||
return getOverworldOutfitFilename(item.id)
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
return if !item
|
||||
previewWindow.clothes = item.id
|
||||
$Trainer.clothes = item.id
|
||||
pbRefreshSceneMap
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
|
||||
|
||||
def addItem(item)
|
||||
changed_clothes = obtainNewClothes(item.id)
|
||||
if changed_clothes
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
end
|
||||
|
||||
def get_current_clothes()
|
||||
return $Trainer.clothes
|
||||
end
|
||||
|
||||
def putOnOutfit(item)
|
||||
putOnClothes(item.id)
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.clothes = @worn_clothes
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
return $Trainer.unlocked_clothes
|
||||
end
|
||||
|
||||
def isWornItem?(item)
|
||||
super
|
||||
end
|
||||
end
|
||||
115
Data/Scripts/050_Outfits/UI/clothesShop/ClothesShop.rb
Normal file
115
Data/Scripts/050_Outfits/UI/clothesShop/ClothesShop.rb
Normal file
@@ -0,0 +1,115 @@
|
||||
def genericOutfitsShopMenu(stock = [], itemType = nil, versions = false)
|
||||
commands = []
|
||||
commands[cmdBuy = commands.length] = _INTL("Buy")
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
cmd = pbMessage(_INTL("Welcome! How may I serve you?"), commands, cmdQuit + 1)
|
||||
loop do
|
||||
if cmdBuy >= 0 && cmd == cmdBuy
|
||||
adapter = getAdapter(itemType, stock, true)
|
||||
view = ClothesShopView.new()
|
||||
presenter = getPresenter(itemType, view, stock, adapter, versions)
|
||||
presenter.pbBuyScreen
|
||||
break
|
||||
else
|
||||
pbMessage(_INTL("Please come again!"))
|
||||
break
|
||||
end
|
||||
cmd = pbMessage(_INTL("Is there anything else I can help you with?"),
|
||||
commands, cmdQuit + 1)
|
||||
end
|
||||
end
|
||||
|
||||
def getPresenter(itemType, view, stock, adapter, versions)
|
||||
case itemType
|
||||
when :HAIR
|
||||
return HairShopPresenter.new(view, stock, adapter, versions)
|
||||
else
|
||||
return ClothesShopPresenter.new(view, stock, adapter, versions)
|
||||
end
|
||||
end
|
||||
|
||||
def getAdapter(itemType, stock, isShop)
|
||||
case itemType
|
||||
when :CLOTHES
|
||||
return ClothesMartAdapter.new(stock, isShop)
|
||||
when :HAT
|
||||
return HatsMartAdapter.new(stock, isShop)
|
||||
when :HAIR
|
||||
return HairMartAdapter.new(stock, isShop)
|
||||
end
|
||||
end
|
||||
|
||||
def list_all_possible_outfits() end
|
||||
|
||||
def clothesShop(outfits_list = [])
|
||||
stock = []
|
||||
outfits_list.each { |outfit_id|
|
||||
outfit = get_clothes_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
genericOutfitsShopMenu(stock, :CLOTHES)
|
||||
end
|
||||
|
||||
def hatShop(outfits_list = [])
|
||||
stock = []
|
||||
outfits_list.each { |outfit_id|
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
genericOutfitsShopMenu(stock, :HAT)
|
||||
end
|
||||
|
||||
def hairShop(outfits_list = [])
|
||||
stock = []
|
||||
outfits_list.each { |outfit_id|
|
||||
echoln outfit_id
|
||||
outfit = get_hair_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
genericOutfitsShopMenu(stock, :HAIR, true)
|
||||
end
|
||||
|
||||
def openSelectOutfitMenu(stock = [], itemType)
|
||||
adapter = getAdapter(itemType, stock, false)
|
||||
view = ClothesShopView.new()
|
||||
presenter = ClothesShopPresenter.new(view, stock, adapter)
|
||||
presenter.pbBuyScreen
|
||||
end
|
||||
|
||||
def changeClothesMenu()
|
||||
stock = []
|
||||
$Trainer.unlocked_clothes.each { |outfit_id|
|
||||
outfit = get_clothes_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
openSelectOutfitMenu(stock, :CLOTHES)
|
||||
end
|
||||
|
||||
def changeHatMenu()
|
||||
stock = []
|
||||
$Trainer.unlocked_hats.each { |outfit_id|
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
stock << outfit if outfit
|
||||
}
|
||||
openSelectOutfitMenu(stock, :HAT)
|
||||
end
|
||||
|
||||
def changeOutfit()
|
||||
commands = []
|
||||
commands[cmdClothes = commands.length] = _INTL("Change clothes")
|
||||
commands[cmdHat = commands.length] = _INTL("Change hat")
|
||||
commands[cmdQuit = commands.length] = _INTL("Quit")
|
||||
|
||||
cmd = pbMessage(_INTL("What would you like to do?"), commands, cmdQuit + 1)
|
||||
loop do
|
||||
if cmd == cmdClothes
|
||||
changeClothesMenu()
|
||||
break
|
||||
elsif cmd == cmdHat
|
||||
changeHatMenu()
|
||||
break
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
class ClothesShopPresenter < PokemonMartScreen
|
||||
def pbChooseBuyItem
|
||||
|
||||
end
|
||||
|
||||
def initialize(scene, stock, adapter = nil, versions=false)
|
||||
super(scene,stock,adapter)
|
||||
@use_versions = versions
|
||||
end
|
||||
|
||||
|
||||
def pbBuyScreen
|
||||
@scene.pbStartBuyScene(@stock, @adapter)
|
||||
item = nil
|
||||
loop do
|
||||
item = @scene.pbChooseBuyItem
|
||||
break if !item
|
||||
|
||||
if !@adapter.isShop?
|
||||
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
|
||||
@adapter.putOnOutfit(item)
|
||||
@scene.pbEndBuyScene
|
||||
return
|
||||
end
|
||||
next
|
||||
|
||||
end
|
||||
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
price = @adapter.getPrice(item)
|
||||
if !price.is_a?(Integer)
|
||||
pbDisplayPaused(_INTL("You already own this item!"))
|
||||
if pbConfirm(_INTL("Would you like to put on the {1}?", item.name))
|
||||
@adapter.putOnOutfit(item)
|
||||
end
|
||||
next
|
||||
end
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
|
||||
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
|
||||
itemname, price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
quantity = 1
|
||||
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
added = 0
|
||||
|
||||
@adapter.setMoney(@adapter.getMoney - price)
|
||||
@stock.compact!
|
||||
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
|
||||
@adapter.addItem(item)
|
||||
#break
|
||||
end
|
||||
@scene.pbEndBuyScene
|
||||
end
|
||||
|
||||
end
|
||||
144
Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopView.rb
Normal file
144
Data/Scripts/050_Outfits/UI/clothesShop/ClothesShopView.rb
Normal file
@@ -0,0 +1,144 @@
|
||||
class ClothesShopView < PokemonMart_Scene
|
||||
|
||||
|
||||
def initialize(currency_name="Money")
|
||||
@currency_name = currency_name
|
||||
end
|
||||
|
||||
def pbStartBuyOrSellScene(buying, stock, adapter)
|
||||
super(buying, stock, adapter)
|
||||
@initial_direction = $game_player.direction
|
||||
@sprites["icon"].visible=false
|
||||
if @adapter.isShop?
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/martScreenOutfit")
|
||||
else
|
||||
@sprites["background"].setBitmap("Graphics/Pictures/changeOutfitScreen")
|
||||
end
|
||||
|
||||
preview_y = @adapter.isShop? ? 80 : 0
|
||||
@sprites["trainerPreview"] = TrainerClothesPreview.new(0, preview_y, true,"WALLET")
|
||||
|
||||
@sprites["trainerPreview"].show()
|
||||
@sprites["moneywindow"].visible = false if !@adapter.isShop?
|
||||
|
||||
Kernel.pbDisplayText(@adapter.toggleText, 80, 200, 99999) if @adapter.toggleText
|
||||
|
||||
end
|
||||
|
||||
def scroll_map
|
||||
pbScrollMap(DIRECTION_UP, 5, 5)
|
||||
pbScrollMap(DIRECTION_RIGHT, 7, 5)
|
||||
$game_player.turn_down
|
||||
pbRefreshSceneMap
|
||||
end
|
||||
|
||||
def scroll_back_map
|
||||
@adapter.reset_player_clothes()
|
||||
pbScrollMap(DIRECTION_LEFT, 7, 5)
|
||||
pbScrollMap(DIRECTION_DOWN, 5, 5)
|
||||
$game_player.turn_generic(@initial_direction)
|
||||
pbRefreshSceneMap
|
||||
end
|
||||
|
||||
def refreshStock(adapter)
|
||||
@adapter = adapter
|
||||
@sprites["itemwindow"].dispose
|
||||
@sprites["itemwindow"] = Window_PokemonMart.new(@stock, BuyAdapter.new(adapter),
|
||||
Graphics.width - 316 - 16, 12, 330 + 16, Graphics.height - 126)
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
if @subscene
|
||||
@subscene.pbRefresh
|
||||
else
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
#@sprites["icon"].item = itemwindow.item
|
||||
#@sprites["icon"].item = itemwindow.item
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit.")
|
||||
itemwindow.refresh
|
||||
end
|
||||
@sprites["moneywindow"].text = _INTL("{2}:\r\n<r>{1}", @adapter.getMoneyString,@currency_name)
|
||||
end
|
||||
|
||||
def updateTrainerPreview()
|
||||
displayNewItem(@sprites["itemwindow"])
|
||||
end
|
||||
|
||||
def displayNewItem(itemwindow)
|
||||
@adapter.updateTrainerPreview(itemwindow.item,@sprites["trainerPreview"])
|
||||
@sprites["itemtextwindow"].text =
|
||||
(itemwindow.item) ? @adapter.getDescription(itemwindow.item) : _INTL("Quit.")
|
||||
end
|
||||
|
||||
|
||||
|
||||
def pbChooseBuyItem
|
||||
itemwindow = @sprites["itemwindow"]
|
||||
displayNewItem(itemwindow)
|
||||
@sprites["helpwindow"].visible = false
|
||||
pbActivateWindow(@sprites, "itemwindow") {
|
||||
pbRefresh
|
||||
loop do
|
||||
Graphics.update
|
||||
Input.update
|
||||
olditem = itemwindow.item
|
||||
self.update
|
||||
if itemwindow.item != olditem
|
||||
displayNewItem(itemwindow)
|
||||
end
|
||||
if Input.trigger?(Input::AUX1)#L button
|
||||
@adapter.switchVersion(itemwindow.item,-1)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
if Input.trigger?(Input::AUX2)#R button
|
||||
@adapter.switchVersion(itemwindow.item,1)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
if Input.trigger?(Input::SPECIAL)#R button
|
||||
@adapter.toggleEvent(itemwindow.item)
|
||||
updateTrainerPreview()
|
||||
end
|
||||
|
||||
|
||||
if Input.trigger?(Input::BACK)
|
||||
pbPlayCloseMenuSE
|
||||
return nil
|
||||
elsif Input.trigger?(Input::USE)
|
||||
if itemwindow.index < @stock.length
|
||||
pbRefresh
|
||||
return @stock[itemwindow.index]
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
def update
|
||||
if Input.trigger?(Input::LEFT)
|
||||
pbSEPlay("GUI party switch", 80, 100)
|
||||
$game_player.turn_right_90
|
||||
pbRefreshSceneMap
|
||||
end
|
||||
if Input.trigger?(Input::RIGHT)
|
||||
pbSEPlay("GUI party switch", 80, 100)
|
||||
$game_player.turn_left_90
|
||||
pbRefreshSceneMap
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
|
||||
def pbEndBuyScene
|
||||
@sprites["trainerPreview"].erase()
|
||||
@sprites["trainerPreview"]=nil
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
Kernel.pbClearText()
|
||||
# Scroll left after showing screen
|
||||
scroll_back_map()
|
||||
end
|
||||
|
||||
end
|
||||
126
Data/Scripts/050_Outfits/UI/clothesShop/HairMartAdapter.rb
Normal file
126
Data/Scripts/050_Outfits/UI/clothesShop/HairMartAdapter.rb
Normal file
@@ -0,0 +1,126 @@
|
||||
class HairMartAdapter < OutfitsMartAdapter
|
||||
DEFAULT_NAME = "[unknown]"
|
||||
DEFAULT_DESCRIPTION = "A hairstyle for trainers."
|
||||
|
||||
POSSIBLE_VERSIONS = (1..9).to_a
|
||||
|
||||
def initialize(stock = nil, isShop = nil)
|
||||
super
|
||||
@version = getCurrentHairVersion().to_i
|
||||
@worn_hat = $Trainer.hat
|
||||
@hat_visible=false
|
||||
@removable = true
|
||||
end
|
||||
|
||||
def switchVersion(item, delta=1)
|
||||
pbSEPlay("GUI party switch", 80, 100)
|
||||
newVersion = @version+ delta
|
||||
lastVersion = findLastHairVersion(item.id)
|
||||
newVersion = lastVersion if newVersion <= 0
|
||||
newVersion = 1 if newVersion > lastVersion
|
||||
@version = newVersion
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
pbSEPlay("GUI storage put down", 80, 100)
|
||||
toggleHatVisibility()
|
||||
end
|
||||
|
||||
def toggleText()
|
||||
text = ""
|
||||
text << "Color: L / R\n"
|
||||
text << "Hat: D\n"
|
||||
|
||||
end
|
||||
|
||||
def toggleHatVisibility()
|
||||
@hat_visible = !@hat_visible
|
||||
end
|
||||
|
||||
def getPrice(item, selling = nil)
|
||||
return 0 if !@isShop
|
||||
trainerStyleID = getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
|
||||
return 0 if item == trainerStyleID
|
||||
return nil if itemOwned(item)
|
||||
return item.price.to_i
|
||||
end
|
||||
|
||||
def getDisplayPrice(item, selling = nil)
|
||||
trainerStyleID = getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
|
||||
return "-" if item == trainerStyleID
|
||||
super
|
||||
end
|
||||
|
||||
def getCurrentHairVersion()
|
||||
begin
|
||||
return getSplitHairFilenameAndVersionFromID($Trainer.hair)[0]
|
||||
rescue
|
||||
return 1
|
||||
end
|
||||
end
|
||||
|
||||
def getCurrentHairId(itemId)
|
||||
return getFullHairId(itemId, @version)
|
||||
end
|
||||
|
||||
def getName(item)
|
||||
return item.id
|
||||
end
|
||||
|
||||
def getDisplayName(item)
|
||||
return getName(item) if !item.name
|
||||
return item.name
|
||||
end
|
||||
|
||||
def getDescription(item)
|
||||
return DEFAULT_DESCRIPTION if !item.description
|
||||
return item.description
|
||||
end
|
||||
|
||||
def getItemIcon(item)
|
||||
return Settings::BACK_ITEM_ICON_PATH if !item
|
||||
itemId = getCurrentHairId(item.id)
|
||||
return getOverworldHatFilename(item.id)
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
return if !item
|
||||
displayed_hat = @hat_visible ? @worn_hat : nil
|
||||
previewWindow.hat=displayed_hat
|
||||
$Trainer.hat = displayed_hat
|
||||
itemId = getCurrentHairId(item.id)
|
||||
echoln itemId
|
||||
previewWindow.hair = itemId
|
||||
$Trainer.hair = itemId
|
||||
pbRefreshSceneMap
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
|
||||
def addItem(item)
|
||||
itemId = getCurrentHairId(item.id)
|
||||
|
||||
changed_clothes = obtainNewHairstyle(itemId)
|
||||
if changed_clothes
|
||||
@worn_clothes = itemId
|
||||
end
|
||||
end
|
||||
|
||||
def get_current_clothes()
|
||||
return $Trainer.hair
|
||||
end
|
||||
|
||||
def putOnOutfit(item)
|
||||
itemFullId = getCurrentHairId(item.id)
|
||||
putOnHair(item.id, @version)
|
||||
@worn_clothes = itemFullId
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.hair = @worn_clothes
|
||||
$Trainer.hat = @worn_hat
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
return $Trainer.unlocked_hairstyles
|
||||
end
|
||||
end
|
||||
66
Data/Scripts/050_Outfits/UI/clothesShop/HairShopPresenter.rb
Normal file
66
Data/Scripts/050_Outfits/UI/clothesShop/HairShopPresenter.rb
Normal file
@@ -0,0 +1,66 @@
|
||||
class HairShopPresenter < PokemonMartScreen
|
||||
def pbChooseBuyItem
|
||||
|
||||
end
|
||||
|
||||
def initialize(scene, stock, adapter = nil, versions=false)
|
||||
super(scene,stock,adapter)
|
||||
@use_versions = versions
|
||||
end
|
||||
|
||||
|
||||
def pbBuyScreen
|
||||
@scene.pbStartBuyScene(@stock, @adapter)
|
||||
item = nil
|
||||
loop do
|
||||
item = @scene.pbChooseBuyItem
|
||||
break if !item
|
||||
|
||||
if !@adapter.isShop?
|
||||
if pbConfirm(_INTL("Would you like to purchase {1}?", item.name))
|
||||
@adapter.putOnOutfit(item)
|
||||
@scene.pbEndBuyScene
|
||||
return
|
||||
end
|
||||
next
|
||||
|
||||
end
|
||||
|
||||
itemname = @adapter.getDisplayName(item)
|
||||
price = @adapter.getPrice(item)
|
||||
if !price.is_a?(Integer)
|
||||
pbDisplayPaused(_INTL("This is your current hairstyle!"))
|
||||
@adapter.putOnOutfit(item)
|
||||
next
|
||||
end
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
|
||||
if !pbConfirm(_INTL("Certainly. You want {1}. That will be ${2}. OK?",
|
||||
itemname, price.to_s_formatted))
|
||||
next
|
||||
end
|
||||
quantity = 1
|
||||
|
||||
if @adapter.getMoney < price
|
||||
pbDisplayPaused(_INTL("You don't have enough money."))
|
||||
next
|
||||
end
|
||||
added = 0
|
||||
|
||||
@adapter.setMoney(@adapter.getMoney - price)
|
||||
@stock.compact!
|
||||
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }
|
||||
@adapter.addItem(item)
|
||||
#break
|
||||
end
|
||||
@scene.pbEndBuyScene
|
||||
end
|
||||
|
||||
def isWornItem?(item)
|
||||
super
|
||||
end
|
||||
|
||||
end
|
||||
75
Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb
Normal file
75
Data/Scripts/050_Outfits/UI/clothesShop/HatsMartAdapter.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
class HatsMartAdapter < OutfitsMartAdapter
|
||||
DEFAULT_NAME = "[unknown]"
|
||||
DEFAULT_DESCRIPTION = "A headgear that trainers can wear."
|
||||
|
||||
def initialize(stock = nil, isShop = nil)
|
||||
super
|
||||
end
|
||||
|
||||
def toggleEvent(item)
|
||||
if !@isShop
|
||||
if pbConfirmMessage(_INTL("Do you want to take off your hat?"))
|
||||
$Trainer.hat = nil
|
||||
@worn_clothes = nil
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def toggleText()
|
||||
return if @isShop
|
||||
toggleKey = "D"#getMappedKeyFor(Input::SPECIAL)
|
||||
return "Remove hat: #{toggleKey}"
|
||||
end
|
||||
|
||||
def getName(item)
|
||||
return item.id
|
||||
end
|
||||
|
||||
def getDisplayName(item)
|
||||
return getName(item) if !item.name
|
||||
return item.name
|
||||
end
|
||||
|
||||
def getDescription(item)
|
||||
return DEFAULT_DESCRIPTION if !item.description
|
||||
return item.description
|
||||
end
|
||||
|
||||
def getItemIcon(item)
|
||||
return Settings::BACK_ITEM_ICON_PATH if !item
|
||||
return getOverworldHatFilename(item.id)
|
||||
end
|
||||
|
||||
def updateTrainerPreview(item, previewWindow)
|
||||
return if !item
|
||||
previewWindow.hat = item.id
|
||||
$Trainer.hat = item.id unless $Trainer.hat==nil
|
||||
pbRefreshSceneMap
|
||||
previewWindow.updatePreview()
|
||||
end
|
||||
|
||||
def addItem(item)
|
||||
changed_clothes = obtainNewHat(item.id)
|
||||
if changed_clothes
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
end
|
||||
|
||||
def get_current_clothes()
|
||||
return $Trainer.hat
|
||||
end
|
||||
|
||||
def putOnOutfit(item)
|
||||
putOnHat(item.id)
|
||||
@worn_clothes = item.id
|
||||
end
|
||||
|
||||
def reset_player_clothes()
|
||||
$Trainer.hat = @worn_clothes
|
||||
end
|
||||
|
||||
def get_unlocked_items_list()
|
||||
return $Trainer.unlocked_hats
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,160 @@
|
||||
class HairStyleSelectionMenuView
|
||||
attr_accessor :name_sprite
|
||||
attr_accessor :viewport
|
||||
attr_accessor :sprites
|
||||
attr_accessor :textValues
|
||||
|
||||
|
||||
OPTIONS_START_Y = 66
|
||||
CURSOR_Y_MARGIN = 50
|
||||
CURSOR_X_MARGIN = 76
|
||||
|
||||
CHECKMARK_Y_MARGIN = 20
|
||||
CHECKMARK_WIDTH = 50
|
||||
|
||||
OPTIONS_LABEL_X = 50
|
||||
|
||||
|
||||
OPTIONS_LABEL_WIDTH = 100
|
||||
|
||||
OPTIONS_VALUE_X = 194
|
||||
SELECTOR_X = 120
|
||||
SELECTOR_STAGGER_OFFSET=26
|
||||
|
||||
|
||||
ARROW_LEFT_X_POSITION = 75
|
||||
ARROW_RIGHT_X_POSITION = 275
|
||||
ARROWS_Y_OFFSET = 10#20
|
||||
|
||||
CONFIRM_X = 296
|
||||
CONFIRM_Y= 322
|
||||
|
||||
STAGGER_OFFSET_1 = 26
|
||||
STAGGER_OFFSET_2 = 50
|
||||
|
||||
|
||||
|
||||
def initialize
|
||||
@presenter = HairstyleSelectionMenuPresenter.new(self)
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@sprites = {}
|
||||
@textValues={}
|
||||
@max_index=5
|
||||
end
|
||||
|
||||
def init_graphics()
|
||||
@sprites["bg"] = IconSprite.new(@viewport)
|
||||
#@sprites["bg"].setBitmap("Graphics/Pictures/trainer_application_form")
|
||||
@sprites["bg"].setBitmap("")
|
||||
|
||||
|
||||
@sprites["select"] = IconSprite.new(@viewport)
|
||||
@sprites["select"].setBitmap("Graphics/Pictures/cc_selection_box")
|
||||
@sprites["select"].x = get_cursor_x_position(0)#OPTIONS_LABEL_X + OPTIONS_LABEL_WIDTH + CURSOR_X_MARGIN
|
||||
@sprites["select"].y = OPTIONS_START_Y
|
||||
@sprites["select"].visible = true
|
||||
|
||||
@sprites["leftarrow"] = AnimatedSprite.new("Graphics/Pictures/leftarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["leftarrow"].x = ARROW_LEFT_X_POSITION
|
||||
@sprites["leftarrow"].y = 0
|
||||
@sprites["leftarrow"].visible = false
|
||||
@sprites["leftarrow"].play
|
||||
|
||||
|
||||
@sprites["rightarrow"] = AnimatedSprite.new("Graphics/Pictures/rightarrow", 8, 40, 28, 2, @viewport)
|
||||
@sprites["rightarrow"].x = ARROW_RIGHT_X_POSITION
|
||||
@sprites["rightarrow"].y = 0
|
||||
@sprites["rightarrow"].visible = false
|
||||
@sprites["rightarrow"].play
|
||||
end
|
||||
|
||||
def setMaxIndex(maxIndex)
|
||||
@max_index=maxIndex
|
||||
end
|
||||
|
||||
def init_labels()
|
||||
Kernel.pbDisplayText("Confirm", (CONFIRM_X+CURSOR_X_MARGIN), CONFIRM_Y)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def start
|
||||
init_graphics()
|
||||
init_labels()
|
||||
@presenter.main()
|
||||
end
|
||||
|
||||
def get_cursor_y_position(index)
|
||||
return CONFIRM_Y if index == @max_index
|
||||
return index * CURSOR_Y_MARGIN + OPTIONS_START_Y
|
||||
end
|
||||
|
||||
def get_cursor_x_position(index)
|
||||
return CONFIRM_X if index == @max_index
|
||||
return SELECTOR_X + getTextBoxStaggerOffset(index)
|
||||
end
|
||||
|
||||
def get_value_x_position(index)
|
||||
return (OPTIONS_VALUE_X + getTextBoxStaggerOffset(index))
|
||||
end
|
||||
|
||||
def getTextBoxStaggerOffset(index)
|
||||
case index
|
||||
when 1
|
||||
return STAGGER_OFFSET_1
|
||||
when 2
|
||||
return STAGGER_OFFSET_2
|
||||
when 3
|
||||
return STAGGER_OFFSET_1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
def showSideArrows(y_index)
|
||||
y_position = get_cursor_y_position(y_index)
|
||||
|
||||
@sprites["rightarrow"].y=y_position+ARROWS_Y_OFFSET
|
||||
@sprites["leftarrow"].y=y_position+ARROWS_Y_OFFSET
|
||||
|
||||
@sprites["leftarrow"].x=getTextBoxStaggerOffset(y_index)+ARROW_LEFT_X_POSITION
|
||||
@sprites["rightarrow"].x= getTextBoxStaggerOffset(y_index)+ARROW_RIGHT_X_POSITION
|
||||
|
||||
@sprites["rightarrow"].visible=true
|
||||
@sprites["leftarrow"].visible=true
|
||||
end
|
||||
|
||||
def hideSideArrows()
|
||||
@sprites["rightarrow"].visible=false
|
||||
@sprites["leftarrow"].visible=false
|
||||
end
|
||||
|
||||
def displayText(spriteId,text,y_index)
|
||||
@textValues[spriteId].dispose if @textValues[spriteId]
|
||||
yposition = get_cursor_y_position(y_index)
|
||||
xposition = get_value_x_position(y_index)
|
||||
|
||||
baseColor= baseColor ? baseColor : Color.new(72,72,72)
|
||||
shadowColor= shadowColor ? shadowColor : Color.new(160,160,160)
|
||||
@textValues[spriteId] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
|
||||
text1=_INTL(text)
|
||||
textPosition=[
|
||||
[text1,xposition,yposition,2,baseColor,shadowColor],
|
||||
]
|
||||
pbSetSystemFont(@textValues[spriteId].bitmap)
|
||||
pbDrawTextPositions(@textValues[spriteId].bitmap,textPosition)
|
||||
|
||||
end
|
||||
|
||||
|
||||
def updateGraphics()
|
||||
Graphics.update
|
||||
Input.update
|
||||
if @sprites
|
||||
@sprites["rightarrow"].update
|
||||
@sprites["leftarrow"].update
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,187 @@
|
||||
class HairstyleSelectionMenuPresenter
|
||||
attr_accessor :options
|
||||
attr_reader :current_index
|
||||
|
||||
OPTION_STYLE = 'Hairstyle'
|
||||
OPTION_BASE_COLOR = "Base color"
|
||||
OPTION_DYE = "Dye"
|
||||
|
||||
HAIR_COLOR_NAMES = ["Blonde", "Light Brown", "Dark Brown", "Black"]
|
||||
HAIR_COLOR_IDS = [1, 2, 3, 4]
|
||||
|
||||
#ids for displayed text sprites
|
||||
STYLE_TEXT_ID = "style"
|
||||
BASECOLOR_TEXT_ID = "baseCplor"
|
||||
DYE_TEXT_ID = "dye"
|
||||
|
||||
def initialize(view)
|
||||
@view = view
|
||||
@hairstyle_full_id = $Trainer.hair
|
||||
|
||||
hairstyle_split = getSplitHairFilenameAndVersionFromID(@hairstyle_full_id)
|
||||
@hairstyle = hairstyle_split[0] if hairstyle_split[0]
|
||||
@hair_version = hairstyle_split[1] if hairstyle_split[1]
|
||||
@hairColor = $Trainer.hair_color
|
||||
|
||||
@available_styles= $Trainer.unlocked_hairstyles
|
||||
@selected_hairstyle_index = 0
|
||||
|
||||
echoln @available_styles
|
||||
|
||||
@options = [OPTION_STYLE, OPTION_BASE_COLOR, OPTION_DYE]
|
||||
|
||||
@trainerPreview = TrainerClothesPreview.new(300, 80, false)
|
||||
@trainerPreview.show()
|
||||
@closed = false
|
||||
@current_index = 0
|
||||
@view.setMaxIndex(@options.length - 1)
|
||||
end
|
||||
|
||||
def main()
|
||||
pbSEPlay("GUI naming tab swap start", 80, 100)
|
||||
@current_index = 0
|
||||
loop do
|
||||
@view.updateGraphics()
|
||||
if Input.trigger?(Input::DOWN)
|
||||
@current_index = move_menu_vertical(1)
|
||||
elsif Input.trigger?(Input::UP)
|
||||
@current_index = move_menu_vertical(-1)
|
||||
elsif Input.trigger?(Input::RIGHT)
|
||||
move_menu_horizontal(@current_index, 1)
|
||||
elsif Input.trigger?(Input::LEFT)
|
||||
move_menu_horizontal(@current_index, -1)
|
||||
elsif Input.trigger?(Input::ACTION) || Input.trigger?(Input::USE)
|
||||
action_button_pressed(@current_index)
|
||||
end
|
||||
break if @closed
|
||||
end
|
||||
end
|
||||
|
||||
def updateTrainerPreview
|
||||
@trainerPreview.resetOutfits
|
||||
@trainerPreview.updatePreview
|
||||
end
|
||||
|
||||
def action_button_pressed(current_index)
|
||||
pbSEPlay("GUI save choice", 80, 100)
|
||||
@current_index = @options.length - 1
|
||||
update_cursor(@current_index)
|
||||
end
|
||||
|
||||
def getDefaultName()
|
||||
return DEFAULT_NAMES[@gender]
|
||||
end
|
||||
|
||||
|
||||
def applyAllSelectedValues
|
||||
$Trainer.hair = getFullHairId(@hairstyle,@hair_version)
|
||||
$Trainer.hair_color = @hairColor
|
||||
end
|
||||
|
||||
def getOptionIndex(option_name)
|
||||
i = 0
|
||||
for option in @options
|
||||
return i if option == option_name
|
||||
i += 1
|
||||
end
|
||||
return -1
|
||||
end
|
||||
|
||||
#VERTICAL NAVIGATION
|
||||
|
||||
def move_menu_vertical(offset)
|
||||
pbSEPlay("GUI sel decision", 80, 100)
|
||||
@current_index += offset
|
||||
@current_index = 0 if @current_index > @options.length - 1
|
||||
@current_index = @options.length - 1 if @current_index <= -1
|
||||
|
||||
update_cursor(@current_index)
|
||||
return @current_index
|
||||
end
|
||||
|
||||
def update_cursor(index)
|
||||
@view.sprites["select"].y = @view.get_cursor_y_position(index)
|
||||
@view.sprites["select"].x = @view.get_cursor_x_position(index)
|
||||
|
||||
set_custom_cursor(index)
|
||||
end
|
||||
|
||||
def close_menu
|
||||
@trainerPreview.erase()
|
||||
Kernel.pbClearNumber()
|
||||
Kernel.pbClearText()
|
||||
pbDisposeSpriteHash(@view.sprites)
|
||||
pbDisposeSpriteHash(@view.textValues)
|
||||
@closed = true
|
||||
end
|
||||
|
||||
def set_custom_cursor(index)
|
||||
# selected_option = @options[index]
|
||||
# case selected_option
|
||||
# when OPTION_GENDER
|
||||
# @view.showSideArrows(index)
|
||||
# when OPTION_AGE
|
||||
# @view.showSideArrows(index)
|
||||
# when OPTION_HAIR
|
||||
# @view.showSideArrows(index)
|
||||
# when OPTION_SKIN
|
||||
# @view.showSideArrows(index)
|
||||
# else
|
||||
# @view.hideSideArrows
|
||||
# end
|
||||
end
|
||||
|
||||
#HORIZONTAL NAVIGATION
|
||||
def move_menu_horizontal(current_index, incr)
|
||||
pbSEPlay("GUI sel cursor", 80, 100)
|
||||
selected_option = @options[current_index]
|
||||
case selected_option
|
||||
when OPTION_STYLE then
|
||||
setHairstyle(@selected_hairstyle_index,incr)
|
||||
end
|
||||
|
||||
# case selected_option
|
||||
# when OPTION_GENDER then
|
||||
# setGender(current_index, incr)
|
||||
# when OPTION_HAIR then
|
||||
# setHairColor(current_index, incr)
|
||||
# when OPTION_SKIN then
|
||||
# setSkinColor(current_index, incr)
|
||||
# when OPTION_AGE then
|
||||
# setAge(current_index, incr)
|
||||
# end
|
||||
updateTrainerPreview()
|
||||
end
|
||||
|
||||
|
||||
|
||||
def setHairstyle(current_index, incr)
|
||||
@selected_hairstyle_index += incr
|
||||
@selected_hairstyle_index = 0 if @selected_hairstyle_index > @available_styles.length
|
||||
@selected_hairstyle_index = @available_styles.length-1 if @selected_hairstyle_index < 0
|
||||
|
||||
@hairstyle = @available_styles[@selected_hairstyle_index]
|
||||
|
||||
applyHair()
|
||||
echoln @hairstyle
|
||||
echoln "hairstyle: #{@hairstyle}, full list: #{@available_styles}, index: #{current_index}"
|
||||
|
||||
@view.displayText(STYLE_TEXT_ID, @hairstyle, @selected_hairstyle_index)
|
||||
end
|
||||
|
||||
def setBaseColor(current_index, incr)
|
||||
max_id = HAIR_COLOR_IDS.length - 1
|
||||
@hairColor += incr
|
||||
@hairColor = 0 if @hairColor > max_id
|
||||
@hairColor = max_id if @hairColor <= -1
|
||||
applyHair()
|
||||
@view.displayText(BASECOLOR_TEXT_ID, HAIR_COLOR_NAMES[@hairColor], current_index)
|
||||
end
|
||||
|
||||
def applyHair()
|
||||
hairstyle = @hairstyle
|
||||
hair_version =@hair_version
|
||||
hairId = getFullHairId(hairstyle,hair_version)
|
||||
$Trainer.hair = hairId
|
||||
end
|
||||
end
|
||||
131
Data/Scripts/050_Outfits/utils/OutfitFilenameUtils.rb
Normal file
131
Data/Scripts/050_Outfits/utils/OutfitFilenameUtils.rb
Normal file
@@ -0,0 +1,131 @@
|
||||
#Naked sprites
|
||||
BASE_FOLDER = "base"
|
||||
BASE_OVERWORLD_FOLDER = "overworld"
|
||||
BASE_TRAINER_FOLDER = "trainer"
|
||||
|
||||
def getBaseOverworldSpriteFilename(action = "walk", skinTone = "default")
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + BASE_FOLDER + "/" + BASE_OVERWORLD_FOLDER
|
||||
dynamic_path = _INTL("/{1}/{2}_{1}", skinTone, action)
|
||||
full_path = base_path + dynamic_path
|
||||
return full_path if pbResolveBitmap(full_path)
|
||||
return getBaseOverworldSpriteFilename(action) if skinTone != "default" #try again with default skintone
|
||||
return nil
|
||||
end
|
||||
|
||||
def getBaseTrainerSpriteFilename(skinTone = "default")
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + BASE_FOLDER + "/" + BASE_TRAINER_FOLDER
|
||||
dynamic_path = _INTL("/{1}_{2}", BASE_TRAINER_FOLDER, skinTone)
|
||||
full_path = base_path + dynamic_path
|
||||
return full_path if pbResolveBitmap(full_path)
|
||||
return getBaseTrainerSpriteFilename() #default skintone
|
||||
end
|
||||
|
||||
### OUTFIT #
|
||||
|
||||
def get_clothes_sets_list_path()
|
||||
return Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_CLOTHES_FOLDER
|
||||
end
|
||||
|
||||
def getOverworldOutfitFilename(outfit_id, action="walk")
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_CLOTHES_FOLDER
|
||||
dynamic_path = _INTL("/{1}/", outfit_id)
|
||||
filename = _INTL(Settings::PLAYER_CLOTHES_FOLDER + "_{1}_{2}", action, outfit_id)
|
||||
full_path = base_path + dynamic_path + filename
|
||||
#echoln full_path
|
||||
return full_path
|
||||
end
|
||||
|
||||
def getTrainerSpriteOutfitFilename(outfit_id)
|
||||
return getOverworldOutfitFilename(outfit_id, BASE_TRAINER_FOLDER)
|
||||
end
|
||||
|
||||
#### HAIR
|
||||
|
||||
def get_hair_sets_list_path()
|
||||
return Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER
|
||||
end
|
||||
|
||||
|
||||
# Input: red_a
|
||||
# Output: ["1","red"]
|
||||
def getSplitHairFilenameAndVersionFromID(hairstyle_id)
|
||||
return "" if !hairstyle_id
|
||||
hairstyle_id= hairstyle_id.to_s
|
||||
return hairstyle_id.split("_")
|
||||
end
|
||||
|
||||
def getFullHairId(hairstyle,version)
|
||||
return _INTL("{1}_{2}",version,hairstyle)
|
||||
|
||||
end
|
||||
|
||||
def getOverworldHairFilename(hairstyle_id)
|
||||
# matches = hairstyle_id.to_s.match(/\A(\d+)([A-Za-z])?\z/)
|
||||
# return "" if !matches
|
||||
# hair_id = matches[1]
|
||||
# version = matches.length > 1 ? matches[2] : "a"
|
||||
hairstyle_split = getSplitHairFilenameAndVersionFromID(hairstyle_id)
|
||||
name= hairstyle_split[-1]
|
||||
version= hairstyle_split[-2]
|
||||
|
||||
# match_data = hairstyle_id.match(/(\d+)_/)
|
||||
# version = match_data[0].to_i if match_data
|
||||
|
||||
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER
|
||||
dynamic_path = _INTL("/{1}/", name)
|
||||
filename = _INTL(Settings::PLAYER_HAIR_FOLDER + "_{1}_{2}",version, name)
|
||||
#filename += version if version
|
||||
full_path = base_path + dynamic_path + filename
|
||||
return full_path
|
||||
end
|
||||
|
||||
def getTrainerSpriteHairFilename(hairstyle_id)
|
||||
# matches = hairstyle_id.to_s.match(/\A(\d+)([A-Za-z])?\z/)
|
||||
# return "" if !matches
|
||||
# hair_id = matches[1]
|
||||
# version = matches.length > 1 ? matches[2] : "a"
|
||||
return "" if !hairstyle_id
|
||||
hairstyle_id= hairstyle_id.to_s
|
||||
hairstyle_split= hairstyle_id.split("_")
|
||||
name= hairstyle_split[-1]
|
||||
version= hairstyle_split[-2]
|
||||
|
||||
# match_data = hairstyle_id.match(/(\d+)_/)
|
||||
# version = match_data[0].to_i if match_data
|
||||
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAIR_FOLDER
|
||||
dynamic_path = _INTL("/{1}/", name)
|
||||
filename = _INTL(Settings::PLAYER_HAIR_FOLDER + "_trainer_{1}_{2}",version, name)
|
||||
#filename += version if version
|
||||
full_path = base_path + dynamic_path + filename
|
||||
return full_path
|
||||
end
|
||||
|
||||
#### HATS
|
||||
#
|
||||
def get_hats_sets_list_path()
|
||||
return Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAT_FOLDER
|
||||
end
|
||||
|
||||
def getOverworldHatFilename(hat_id)
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAT_FOLDER
|
||||
dynamic_path = _INTL("/{1}/", hat_id)
|
||||
filename = _INTL(Settings::PLAYER_HAT_FOLDER + "_{1}", hat_id)
|
||||
full_path = base_path + dynamic_path + filename
|
||||
return full_path
|
||||
end
|
||||
|
||||
def getTrainerSpriteHatFilename(hat_id)
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_HAT_FOLDER
|
||||
dynamic_path = _INTL("/{1}/", hat_id)
|
||||
filename = _INTL(Settings::PLAYER_HAT_FOLDER + "_trainer_{1}", hat_id)
|
||||
full_path = base_path + dynamic_path + filename
|
||||
return full_path
|
||||
end
|
||||
|
||||
def getTrainerSpriteBallFilename(pokeball)
|
||||
base_path = Settings::PLAYER_GRAPHICS_FOLDER + Settings::PLAYER_BALL_FOLDER
|
||||
|
||||
return base_path + "/" + pokeball.to_s
|
||||
end
|
||||
96
Data/Scripts/050_Outfits/utils/OutfitsGameplayUtils.rb
Normal file
96
Data/Scripts/050_Outfits/utils/OutfitsGameplayUtils.rb
Normal file
@@ -0,0 +1,96 @@
|
||||
def obtainNewHat(outfit_id)
|
||||
echoln "obtained new hat: " + outfit_id
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
$Trainer.unlocked_hats << outfit_id if !$Trainer.unlocked_hats.include?(outfit_id)
|
||||
obtainOutfitMessage(outfit)
|
||||
if pbConfirmMessage("Would you like to put it on right now?")
|
||||
putOnHat(outfit_id)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def obtainNewClothes(outfit_id)
|
||||
echoln "obtained new clothes: " + outfit_id
|
||||
outfit = get_clothes_by_id(outfit_id)
|
||||
$Trainer.unlocked_clothes << outfit_id if !$Trainer.unlocked_clothes.include?(outfit_id)
|
||||
obtainOutfitMessage(outfit)
|
||||
if pbConfirmMessage("Would you like to put it on right now?")
|
||||
putOnClothes(outfit_id)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def obtainNewHairstyle(full_outfit_id)
|
||||
split_outfit_id =getSplitHairFilenameAndVersionFromID(full_outfit_id)
|
||||
hairstyle_id =split_outfit_id[1]
|
||||
hairstyle_version= split_outfit_id[0]
|
||||
outfit = get_hair_by_id(hairstyle_id)
|
||||
$Trainer.unlocked_clothes << hairstyle_id if !$Trainer.unlocked_hairstyles.include?(hairstyle_id)
|
||||
musical_effect = "Key item get"
|
||||
pbMessage(_INTL("\\me[{1}]Your hairstyle was changed to \\c[1]{2}\\c[0] hairstyle!\\wtnp[30]", musical_effect, outfit.name))
|
||||
# pbMessage(_INTL("\\me[{1}]You obtained the \\c[1]{2}\\c[0] hairstyle!\\wtnp[30]", musical_effect, outfit.name))
|
||||
# if pbConfirmMessage("Would you like to use this hairstyle right now?")
|
||||
# putOnHair(hairstyle_id,hairstyle_version)
|
||||
# return true
|
||||
# end
|
||||
return false
|
||||
end
|
||||
|
||||
def putOnClothes(outfit_id)
|
||||
outfit = get_clothes_by_id(outfit_id)
|
||||
$Trainer.clothes = outfit_id
|
||||
putOnOutfitMessage(outfit)
|
||||
end
|
||||
|
||||
def putOnHat(outfit_id)
|
||||
outfit = get_hat_by_id(outfit_id)
|
||||
$Trainer.hat = outfit_id
|
||||
putOnOutfitMessage(outfit)
|
||||
end
|
||||
|
||||
def putOnHairFullId(full_outfit_id)
|
||||
outfit_id = getSplitHairFilenameAndVersionFromID(full_outfit_id)[1]
|
||||
outfit = get_hair_by_id(outfit_id)
|
||||
$Trainer.hair = getFullHairId(full_outfit_id)
|
||||
putOnOutfitMessage(outfit)
|
||||
end
|
||||
|
||||
def putOnHair(outfit_id, version)
|
||||
#outfit = get_hair_by_id(outfit_id)
|
||||
$Trainer.hair = getFullHairId(outfit_id,version)
|
||||
#putOnOutfitMessage(outfit)
|
||||
end
|
||||
|
||||
|
||||
#todo: add a little preview window?
|
||||
def obtainOutfitMessage(outfit)
|
||||
musical_effect = "Key item get"
|
||||
pbMessage(_INTL("\\me[{1}]You obtained a \\c[1]{2}\\c[0]!\\wtnp[30]", musical_effect, outfit.name))
|
||||
end
|
||||
|
||||
def putOnOutfitMessage(outfit)
|
||||
playOutfitChangeAnimation()
|
||||
pbMessage(_INTL("You put on the \\c[1]{1}\\c[0]!\\wtnp[30]", outfit.name))
|
||||
end
|
||||
|
||||
def refreshPlayerOutfit()
|
||||
return if !$scene.spritesetGlobal
|
||||
$scene.spritesetGlobal.playersprite.refreshOutfit()
|
||||
end
|
||||
|
||||
def findLastHairVersion(hairId)
|
||||
possible_versions = (1..9).to_a
|
||||
last_version = 0
|
||||
possible_versions.each { |version|
|
||||
hair_id = getFullHairId(hairId, version)
|
||||
if pbResolveBitmap(getOverworldHairFilename(hair_id))
|
||||
last_version = version
|
||||
else
|
||||
return last_version
|
||||
end
|
||||
}
|
||||
return last_version
|
||||
|
||||
end
|
||||
15
Data/Scripts/050_Outfits/wrappers/001_Outfit.rb
Normal file
15
Data/Scripts/050_Outfits/wrappers/001_Outfit.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class Outfit
|
||||
attr_accessor :id
|
||||
attr_accessor :name
|
||||
attr_accessor :description
|
||||
attr_accessor :tags
|
||||
attr_accessor :price
|
||||
|
||||
def initialize(id, name, description = '',price=0, tags = [])
|
||||
@id = id
|
||||
@name = name
|
||||
@description = description
|
||||
@tags = tags
|
||||
@price = price
|
||||
end
|
||||
end
|
||||
5
Data/Scripts/050_Outfits/wrappers/Clothes.rb
Normal file
5
Data/Scripts/050_Outfits/wrappers/Clothes.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Clothes < Outfit
|
||||
def initialize(id, name, description = '',price=0, tags = [])
|
||||
super
|
||||
end
|
||||
end
|
||||
5
Data/Scripts/050_Outfits/wrappers/Hairstyle.rb
Normal file
5
Data/Scripts/050_Outfits/wrappers/Hairstyle.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Hairstyle < Outfit
|
||||
def initialize(id, name, description = '',price=0, tags = [])
|
||||
super
|
||||
end
|
||||
end
|
||||
5
Data/Scripts/050_Outfits/wrappers/Hat.rb
Normal file
5
Data/Scripts/050_Outfits/wrappers/Hat.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Hat < Outfit
|
||||
def initialize(id,name,description='',price=0,tags=[])
|
||||
super
|
||||
end
|
||||
end
|
||||
@@ -21,8 +21,8 @@
|
||||
# :link => "https://reliccastle.com/resources/174/"
|
||||
# })
|
||||
|
||||
def pbBetterRegionMap(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil,fly_anywhere=false)
|
||||
scene = BetterRegionMap.new(-1, show_player, can_fly, wallmap, species,fly_anywhere)
|
||||
def pbBetterRegionMap(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil, fly_anywhere = false)
|
||||
scene = BetterRegionMap.new(-1, show_player, can_fly, wallmap, species, fly_anywhere)
|
||||
return scene.flydata
|
||||
end
|
||||
|
||||
@@ -42,6 +42,8 @@ class PokemonGlobalMetadata
|
||||
end
|
||||
|
||||
class BetterRegionMap
|
||||
KANTO_DEFAULT_POS=[37,7]
|
||||
|
||||
CursorAnimateDelay = 12.0
|
||||
CursorMoveSpeed = 4.0
|
||||
TileWidth = 16.0
|
||||
@@ -51,20 +53,21 @@ class BetterRegionMap
|
||||
|
||||
attr_reader :flydata
|
||||
|
||||
def initialize(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil,fly_anywhere=false)
|
||||
def initialize(region = -1, show_player = true, can_fly = false, wallmap = false, species = nil, fly_anywhere = false)
|
||||
region = 0
|
||||
showBlk
|
||||
map_metadata = GameData::MapMetadata.try_get($game_map.map_id)
|
||||
|
||||
if map_metadata
|
||||
playerpos = $game_map ? map_metadata.town_map_position : nil#pbGetMetadata($game_map.map_id, MetadataMapPosition) : nil
|
||||
playerpos = $game_map ? map_metadata.town_map_position : nil #pbGetMetadata($game_map.map_id, MetadataMapPosition) : nil
|
||||
end
|
||||
if playerpos == nil
|
||||
playerpos = [0,0]
|
||||
playerpos = [0, 0]
|
||||
end
|
||||
@fly_anywhere = fly_anywhere
|
||||
@region = (region < 0) ? playerpos[0] : region
|
||||
@region = 0#(region < 0) ? playerpos[0] : region
|
||||
@species = species
|
||||
@show_player = (show_player && playerpos[0] == @region)
|
||||
@show_player = show_player#(show_player && playerpos[0] == @region)
|
||||
@can_fly = can_fly
|
||||
@data = load_data("Data/town_map.dat")[@region]
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@@ -72,7 +75,7 @@ class BetterRegionMap
|
||||
@mapdata = pbLoadTownMapData
|
||||
@mapvp = Viewport.new(16, 32, 480, 320)
|
||||
@mapvp.z = 100000
|
||||
@mapoverlayvp = Viewport.new(16,32,480,320)
|
||||
@mapoverlayvp = Viewport.new(16, 32, 480, 320)
|
||||
@mapoverlayvp.z = 100001
|
||||
@viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport2.z = 100001
|
||||
@@ -81,7 +84,13 @@ class BetterRegionMap
|
||||
@sprites["bg"].bmp("Graphics/Pictures/mapbg")
|
||||
@window = SpriteHash.new
|
||||
@window["map"] = Sprite.new(@mapvp)
|
||||
@window["map"].bmp("Graphics/Pictures/#{@data[1]}")
|
||||
|
||||
mapFilename = isPostgame?() ? "map_postgame" : "map"
|
||||
# @window["map"].bmp("Graphics/Pictures/#{@data[1]}")
|
||||
@window["map"].bmp("Graphics/Pictures/map/#{mapFilename}")
|
||||
|
||||
|
||||
|
||||
# for hidden in REGION_MAP_EXTRAS
|
||||
# if hidden[0] == @region && ((wallmap && hidden[5]) || # always show if looking at wall map, irrespective of switch
|
||||
# (!wallmap && hidden[1] > 0 && $game_switches[hidden[1]]))
|
||||
@@ -97,12 +106,12 @@ class BetterRegionMap
|
||||
if @show_player
|
||||
if map_metadata
|
||||
player = map_metadata.town_map_position
|
||||
|
||||
if player && player[0] == @region
|
||||
if true#player && player[0] == @region #only use 1 region
|
||||
$PokemonGlobal.regionMapSel[0] = player[1]
|
||||
$PokemonGlobal.regionMapSel[1] = player[2]
|
||||
gender = $Trainer.gender.to_digits(3)
|
||||
@window["player"].bmp("Graphics/Pictures/mapPlayer#{gender}")
|
||||
# @window["player"].bmp("Graphics/Pictures/map/Player#{gender}")
|
||||
@window["player"].bmp("Graphics/Pictures/map/location_icon")
|
||||
@window["player"].x = TileWidth * player[1] + (TileWidth / 2.0)
|
||||
@window["player"].y = TileHeight * player[2] + (TileHeight / 2.0)
|
||||
@window["player"].center_origins
|
||||
@@ -112,66 +121,64 @@ class BetterRegionMap
|
||||
end
|
||||
|
||||
end
|
||||
@window["areahighlight"] = BitmapSprite.new(@window["map"].bitmap.width,@window["map"].bitmap.height,@mapoverlayvp)
|
||||
@window["areahighlight"] = BitmapSprite.new(@window["map"].bitmap.width, @window["map"].bitmap.height, @mapoverlayvp)
|
||||
@window["areahighlight"].y = -8
|
||||
# pokedex highlights
|
||||
if @species != nil
|
||||
@window["areahighlight"].bitmap.clear
|
||||
# Fill the array "points" with all squares of the region map in which the
|
||||
# species can be found
|
||||
|
||||
mapwidth = @window["map"].bitmap.width/BetterRegionMap::TileWidth
|
||||
data = calculatePointsAndCenter(mapwidth)
|
||||
|
||||
points = data[0]
|
||||
minxy = data[1]
|
||||
maxxy = data[2]
|
||||
|
||||
# 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)
|
||||
|
||||
sqwidth = TileWidth.round
|
||||
sqheight = TileHeight.round
|
||||
|
||||
for j in 0...points.length
|
||||
if points[j]
|
||||
x = (j % mapwidth) * sqwidth
|
||||
y = (j / mapwidth) * sqheight
|
||||
@window["areahighlight"].bitmap.fill_rect(x, y, sqwidth, sqheight, pointcolor)
|
||||
if j - mapwidth < 0 || !points[j - mapwidth]
|
||||
@window["areahighlight"].bitmap.fill_rect(x, y - 2, sqwidth, 2, pointcolorhl)
|
||||
end
|
||||
if j + mapwidth >= points.length || !points[j + mapwidth]
|
||||
@window["areahighlight"].bitmap.fill_rect(x, y + sqheight, sqwidth, 2, pointcolorhl)
|
||||
end
|
||||
if j % mapwidth == 0 || !points[j - 1]
|
||||
@window["areahighlight"].bitmap.fill_rect(x - 2, y, 2, sqheight, pointcolorhl)
|
||||
end
|
||||
if (j + 1) % mapwidth == 0 || !points[j + 1]
|
||||
@window["areahighlight"].bitmap.fill_rect(x + sqwidth, y, 2, sqheight, pointcolorhl)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# if @species != nil
|
||||
# @window["areahighlight"].bitmap.clear
|
||||
# # Fill the array "points" with all squares of the region map in which the
|
||||
# # species can be found
|
||||
#
|
||||
# mapwidth = @window["map"].bitmap.width / BetterRegionMap::TileWidth
|
||||
# data = calculatePointsAndCenter(mapwidth)
|
||||
#
|
||||
# points = data[0]
|
||||
# minxy = data[1]
|
||||
# maxxy = data[2]
|
||||
#
|
||||
# # 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)
|
||||
#
|
||||
# sqwidth = TileWidth.round
|
||||
# sqheight = TileHeight.round
|
||||
#
|
||||
# for j in 0...points.length
|
||||
# if points[j]
|
||||
# x = (j % mapwidth) * sqwidth
|
||||
# y = (j / mapwidth) * sqheight
|
||||
# @window["areahighlight"].bitmap.fill_rect(x, y, sqwidth, sqheight, pointcolor)
|
||||
# if j - mapwidth < 0 || !points[j - mapwidth]
|
||||
# @window["areahighlight"].bitmap.fill_rect(x, y - 2, sqwidth, 2, pointcolorhl)
|
||||
# end
|
||||
# if j + mapwidth >= points.length || !points[j + mapwidth]
|
||||
# @window["areahighlight"].bitmap.fill_rect(x, y + sqheight, sqwidth, 2, pointcolorhl)
|
||||
# end
|
||||
# if j % mapwidth == 0 || !points[j - 1]
|
||||
# @window["areahighlight"].bitmap.fill_rect(x - 2, y, 2, sqheight, pointcolorhl)
|
||||
# end
|
||||
# if (j + 1) % mapwidth == 0 || !points[j + 1]
|
||||
# @window["areahighlight"].bitmap.fill_rect(x + sqwidth, y, 2, sqheight, pointcolorhl)
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
@sprites["cursor"] = Sprite.new(@viewport2)
|
||||
@sprites["cursor"].bmp("Graphics/Pictures/mapCursor")
|
||||
@sprites["cursor"].src_rect.width = @sprites["cursor"].bmp.height
|
||||
|
||||
if !$PokemonGlobal.regionMapSel
|
||||
$PokemonGlobal.regionMapSel = [0,0]
|
||||
$PokemonGlobal.regionMapSel = [0, 0]
|
||||
end
|
||||
if @species != nil && minxy[0] != nil && maxxy[1] != nil
|
||||
$PokemonGlobal.regionMapSel[0] = ((minxy[0] + maxxy[0]) / 2).round
|
||||
$PokemonGlobal.regionMapSel[1] = ((minxy[1] + maxxy[1]) / 2).round
|
||||
end
|
||||
|
||||
@sprites["cursor"].x = 16 + TileWidth * $PokemonGlobal.regionMapSel[0]
|
||||
@sprites["cursor"].y = 32 + TileHeight * $PokemonGlobal.regionMapSel[1]
|
||||
|
||||
@sprites["cursor"].z = 11
|
||||
|
||||
|
||||
# Center the window on the cursor
|
||||
# windowminx = -1 * (@window["map"].bmp.width - Settings::SCREEN_WIDTH)
|
||||
# windowminx = 0 if windowminx > 0
|
||||
@@ -241,10 +248,97 @@ class BetterRegionMap
|
||||
end
|
||||
end
|
||||
|
||||
initial_position = calculate_initial_position(player)
|
||||
set_cursor_position(initial_position[0], initial_position[1])
|
||||
center_window()
|
||||
|
||||
hideBlk { update(false) }
|
||||
main
|
||||
end
|
||||
|
||||
def calculate_initial_position(player)
|
||||
if player
|
||||
x_pos = player[1] if player[1]
|
||||
y_pos = player[2] if player[2]
|
||||
return [x_pos,y_pos]
|
||||
end
|
||||
|
||||
return KANTO_DEFAULT_POS
|
||||
|
||||
end
|
||||
|
||||
def set_cursor_position(x, y)
|
||||
$PokemonGlobal.regionMapSel[0] = x
|
||||
$PokemonGlobal.regionMapSel[1] = y
|
||||
|
||||
@sprites["cursor"].x = 16 + TileWidth * $PokemonGlobal.regionMapSel[0]
|
||||
@sprites["cursor"].y = 32 + TileHeight * $PokemonGlobal.regionMapSel[1]
|
||||
|
||||
|
||||
# @sprites["cursor"].x = x + TileWidth * $PokemonGlobal.regionMapSel[0]
|
||||
# @sprites["cursor"].y = y + TileHeight * $PokemonGlobal.regionMapSel[1]
|
||||
#
|
||||
# @window["player"].x = TileWidth * player[1] + (TileWidth / 2.0)
|
||||
# @window["player"].y = TileHeight * player[2] + (TileHeight / 2.0)
|
||||
end
|
||||
|
||||
def been_to_johto()
|
||||
first_visited_map = 248 #goldenrod train station
|
||||
return $PokemonGlobal.visitedMaps[first_visited_map]
|
||||
end
|
||||
|
||||
def been_to_sevii()
|
||||
offshore_road_map = 762 #offshore road
|
||||
knot_island_map = 526
|
||||
return $PokemonGlobal.visitedMaps[offshore_road_map] || $PokemonGlobal.visitedMaps[knot_island_map]
|
||||
end
|
||||
|
||||
def center_window()
|
||||
# Center the window on the cursor
|
||||
windowminx = -1 * (@window["map"].bmp.width - Settings::SCREEN_WIDTH)
|
||||
windowminx = 0 if windowminx > 0
|
||||
windowminy = -1 * (@window["map"].bmp.height - Settings::SCREEN_HEIGHT)
|
||||
windowminy = 0 if windowminy > 0
|
||||
|
||||
if @sprites["cursor"].x > (Settings::SCREEN_WIDTH / 2)
|
||||
@window.x = (Settings::SCREEN_WIDTH / 2 ) - @sprites["cursor"].x
|
||||
if (@window.x < windowminx)
|
||||
@window.x = windowminx
|
||||
end
|
||||
@sprites["cursor"].x += @window.x
|
||||
end
|
||||
if @sprites["cursor"].y > (Settings::SCREEN_HEIGHT / 2)
|
||||
@window.y = (Settings::SCREEN_HEIGHT / 2 ) - @sprites["cursor"].y
|
||||
if @window.y < windowminy
|
||||
@window.y = windowminy
|
||||
end
|
||||
@sprites["cursor"].y += @window.y
|
||||
end
|
||||
adjust_window_if_not_visited_regions()
|
||||
end
|
||||
|
||||
def adjust_window_if_not_visited_regions()
|
||||
if !been_to_johto()
|
||||
baseline = -352
|
||||
if @window.x >= baseline
|
||||
old_window_x = @window.x
|
||||
@window.x=baseline
|
||||
difference = baseline-old_window_x
|
||||
@sprites["cursor"].x+= difference
|
||||
end
|
||||
end
|
||||
|
||||
if !been_to_sevii()
|
||||
baseline = 0
|
||||
if @window.y < baseline
|
||||
old_window_y = @window.y
|
||||
@window.y =baseline
|
||||
difference = baseline-old_window_y
|
||||
@sprites["cursor"].y+= difference
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def can_fly_to_location(healspot)
|
||||
return true if healspot && @fly_anywhere
|
||||
return healspot && $PokemonGlobal.visitedMaps[healspot[0]]
|
||||
@@ -271,47 +365,48 @@ class BetterRegionMap
|
||||
if @sprites["cursor"].x < 480
|
||||
$PokemonGlobal.regionMapSel[0] += 1
|
||||
@sx = @sprites["cursor"].x
|
||||
@dirs << 6
|
||||
@dirs << DIRECTION_RIGHT
|
||||
elsif @window.x > -1 * (@window["map"].bmp.width - 480)
|
||||
$PokemonGlobal.regionMapSel[0] += 1
|
||||
@mx = @window.x
|
||||
@mdirs << 6
|
||||
@mdirs << DIRECTION_RIGHT
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::LEFT) && ![4, 6].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||
if @sprites["cursor"].x > 16
|
||||
$PokemonGlobal.regionMapSel[0] -= 1
|
||||
@sx = @sprites["cursor"].x
|
||||
@dirs << 4
|
||||
elsif @window.x < 0
|
||||
@dirs << DIRECTION_LEFT
|
||||
elsif @window.x < 0 && been_to_johto()
|
||||
$PokemonGlobal.regionMapSel[0] -= 1
|
||||
@mx = @window.x
|
||||
@mdirs << 4
|
||||
@mdirs << DIRECTION_LEFT
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::DOWN) && ![2, 8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||
if Input.press?(Input::DOWN) && ![DIRECTION_DOWN, DIRECTION_UP].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||
if @sprites["cursor"].y <= 320
|
||||
$PokemonGlobal.regionMapSel[1] += 1
|
||||
@sy = @sprites["cursor"].y
|
||||
@dirs << 2
|
||||
elsif @window.y > -1 * (@window["map"].bmp.height - 320)
|
||||
@dirs << DIRECTION_DOWN
|
||||
elsif @window.y > -1 * (@window["map"].bmp.height - 320) && been_to_sevii()
|
||||
$PokemonGlobal.regionMapSel[1] += 1
|
||||
@my = @window.y
|
||||
@mdirs << 2
|
||||
@mdirs << DIRECTION_DOWN
|
||||
end
|
||||
end
|
||||
if Input.press?(Input::UP) && ![2, 8].any? { |e| @dirs.include?(e) || @mdirs.include?(e) }
|
||||
if @sprites["cursor"].y > 32
|
||||
$PokemonGlobal.regionMapSel[1] -= 1
|
||||
@sy = @sprites["cursor"].y
|
||||
@dirs << 8
|
||||
@dirs << DIRECTION_UP
|
||||
elsif @window.y < 0
|
||||
$PokemonGlobal.regionMapSel[1] -= 1
|
||||
@my = @window.y
|
||||
@mdirs << 8
|
||||
@mdirs << DIRECTION_UP
|
||||
end
|
||||
end
|
||||
if Input.trigger?(Input::C)
|
||||
print_current_position()
|
||||
x, y = $PokemonGlobal.regionMapSel
|
||||
if @spots && @spots[[x, y]]
|
||||
@flydata = @spots[[x, y]]
|
||||
@@ -324,10 +419,10 @@ class BetterRegionMap
|
||||
end
|
||||
|
||||
def update(update_gfx = true)
|
||||
@sprites["arrowLeft"].visible = @window.x < 0
|
||||
@sprites["arrowLeft"].visible = @window.x < 0 && been_to_johto()
|
||||
@sprites["arrowRight"].visible = @window.x > -1 * (@window["map"].bmp.width - 480)
|
||||
@sprites["arrowUp"].visible = @window.y < 0
|
||||
@sprites["arrowDown"].visible = @window.y > -1 * (@window["map"].bmp.height - 320)
|
||||
@sprites["arrowDown"].visible = @window.y > -1 * (@window["map"].bmp.height - 320) && been_to_sevii()
|
||||
|
||||
if update_gfx
|
||||
Graphics.update
|
||||
@@ -372,7 +467,7 @@ class BetterRegionMap
|
||||
end
|
||||
|
||||
# Cursor movement
|
||||
if @dirs.include?(6)
|
||||
if @dirs.include?(DIRECTION_RIGHT)
|
||||
@hor_count ||= 0
|
||||
@hor_count += 1
|
||||
update_text if @hor_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -382,8 +477,9 @@ class BetterRegionMap
|
||||
@hor_count = nil
|
||||
@sx = nil
|
||||
end
|
||||
#print_current_position()
|
||||
end
|
||||
if @dirs.include?(4)
|
||||
if @dirs.include?(DIRECTION_LEFT)
|
||||
@hor_count ||= 0
|
||||
@hor_count += 1
|
||||
update_text if @hor_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -393,8 +489,9 @@ class BetterRegionMap
|
||||
@hor_count = nil
|
||||
@sx = nil
|
||||
end
|
||||
#print_current_position()
|
||||
end
|
||||
if @dirs.include?(8)
|
||||
if @dirs.include?(DIRECTION_UP)
|
||||
@ver_count ||= 0
|
||||
@ver_count += 1
|
||||
update_text if @ver_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -404,8 +501,9 @@ class BetterRegionMap
|
||||
@ver_count = nil
|
||||
@sy = nil
|
||||
end
|
||||
#print_current_position()
|
||||
end
|
||||
if @dirs.include?(2)
|
||||
if @dirs.include?(DIRECTION_DOWN)
|
||||
@ver_count ||= 0
|
||||
@ver_count += 1
|
||||
update_text if @ver_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -415,10 +513,11 @@ class BetterRegionMap
|
||||
@ver_count = nil
|
||||
@sy = nil
|
||||
end
|
||||
#print_current_position()
|
||||
end
|
||||
|
||||
# Map movement
|
||||
if @mdirs.include?(6)
|
||||
if @mdirs.include?(DIRECTION_RIGHT)
|
||||
@hor_count ||= 0
|
||||
@hor_count += 1
|
||||
update_text if @hor_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -429,7 +528,7 @@ class BetterRegionMap
|
||||
@mx = nil
|
||||
end
|
||||
end
|
||||
if @mdirs.include?(4)
|
||||
if @mdirs.include?(DIRECTION_LEFT)
|
||||
@hor_count ||= 0
|
||||
@hor_count += 1
|
||||
update_text if @hor_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -440,7 +539,7 @@ class BetterRegionMap
|
||||
@mx = nil
|
||||
end
|
||||
end
|
||||
if @mdirs.include?(8)
|
||||
if @mdirs.include?(DIRECTION_UP)
|
||||
@ver_count ||= 0
|
||||
@ver_count += 1
|
||||
update_text if @ver_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -451,7 +550,7 @@ class BetterRegionMap
|
||||
@my = nil
|
||||
end
|
||||
end
|
||||
if @mdirs.include?(2)
|
||||
if @mdirs.include?(DIRECTION_DOWN)
|
||||
@ver_count ||= 0
|
||||
@ver_count += 1
|
||||
update_text if @ver_count == (CursorMoveSpeed / 2.0).round
|
||||
@@ -464,6 +563,22 @@ class BetterRegionMap
|
||||
end
|
||||
end
|
||||
|
||||
def print_current_position()
|
||||
echoln _INTL("({1}, {2})", $PokemonGlobal.regionMapSel[0],$PokemonGlobal.regionMapSel[1])
|
||||
end
|
||||
|
||||
def setCursorStartingPosition()
|
||||
#echoln @data
|
||||
|
||||
# @sprites["cursor"].x = 256
|
||||
# @sprites["cursor"].y = 160
|
||||
#
|
||||
#
|
||||
# @window.x=-256
|
||||
# @window.y=0
|
||||
# update_text
|
||||
end
|
||||
|
||||
def update_text
|
||||
location = @data[2].find do |e|
|
||||
e[0] == $PokemonGlobal.regionMapSel[0] &&
|
||||
@@ -502,11 +617,11 @@ ItemHandlers::UseInField.add(:TOWNMAP, proc { |item|
|
||||
next 1
|
||||
})
|
||||
|
||||
def pbShowMap(region = -1, wallmap = true) # pokegear
|
||||
pbBetterRegionMap(region, true, false, wallmap)
|
||||
def pbShowMap(region = -1, wallmap = true)
|
||||
# pokegear
|
||||
pbBetterRegionMap(region, true, false, wallmap)
|
||||
end
|
||||
|
||||
|
||||
def calculatePointsAndCenter(mapwidth)
|
||||
# Fill the array "points" with all squares of the region map in which the
|
||||
# species can be found
|
||||
@@ -522,7 +637,7 @@ def calculatePointsAndCenter(mapwidth)
|
||||
if pbFindEncounter(enctypes, @species)
|
||||
mappos = GameData::MapMetadata.get(enc).town_map_position
|
||||
|
||||
if mappos && mappos[0] == @region
|
||||
if true#mappos && mappos[0] == @region #only use 1 region heheh
|
||||
showpoint = true
|
||||
for loc in @mapdata[@region][2]
|
||||
showpoint = false if loc[0] == mappos[1] && loc[1] == mappos[2] &&
|
||||
@@ -533,16 +648,16 @@ def calculatePointsAndCenter(mapwidth)
|
||||
mapsize = GameData::MapMetadata.get(enc).town_map_size
|
||||
|
||||
if mapsize && mapsize[0] && mapsize[0] > 0
|
||||
sqwidth = mapsize[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
|
||||
# work out the upper-leftmost and lower-rightmost tiles
|
||||
minxy[0] = (minxy[0] == nil || minxy[0] > mappos[1]+i) ? mappos[1]+i : minxy[0]
|
||||
minxy[1] = (minxy[1] == nil || minxy[1] > mappos[2]+j) ? mappos[2]+j : minxy[1]
|
||||
maxxy[0] = (maxxy[0] == nil || maxxy[0] < mappos[1]+i) ? mappos[1]+i : maxxy[0]
|
||||
maxxy[1] = (maxxy[1] == nil || maxxy[1] < mappos[2]+j) ? mappos[2]+j : maxxy[1]
|
||||
minxy[0] = (minxy[0] == nil || minxy[0] > mappos[1] + i) ? mappos[1] + i : minxy[0]
|
||||
minxy[1] = (minxy[1] == nil || minxy[1] > mappos[2] + j) ? mappos[2] + j : minxy[1]
|
||||
maxxy[0] = (maxxy[0] == nil || maxxy[0] < mappos[1] + i) ? mappos[1] + i : maxxy[0]
|
||||
maxxy[1] = (maxxy[1] == nil || maxxy[1] < mappos[2] + j) ? mappos[2] + j : maxxy[1]
|
||||
points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true
|
||||
end
|
||||
end
|
||||
@@ -563,21 +678,21 @@ def calculatePointsAndCenter(mapwidth)
|
||||
end
|
||||
|
||||
class PokemonReadyMenu
|
||||
def pbStartReadyMenu(moves,items)
|
||||
commands = [[],[]] # Moves, items
|
||||
def pbStartReadyMenu(moves, items)
|
||||
commands = [[], []] # Moves, items
|
||||
for i in moves
|
||||
commands[0].push([i[0], GameData::Move.get(i[0]).name, true, i[1]])
|
||||
end
|
||||
commands[0].sort! { |a,b| a[1]<=>b[1] }
|
||||
commands[0].sort! { |a, b| a[1] <=> b[1] }
|
||||
for i in items
|
||||
commands[1].push([i, GameData::Item.get(i).name, false])
|
||||
end
|
||||
commands[1].sort! { |a,b| a[1]<=>b[1] }
|
||||
commands[1].sort! { |a, b| a[1] <=> b[1] }
|
||||
@scene.pbStartScene(commands)
|
||||
loop do
|
||||
command = @scene.pbShowCommands
|
||||
break if command==-1
|
||||
if command[0]==0 # Use a move
|
||||
break if command == -1
|
||||
if command[0] == 0 # Use a move
|
||||
move = commands[0][command[1]][0]
|
||||
user = $Trainer.party[commands[0][command[1]][3]]
|
||||
if move == :FLY || move == :TELEPORT
|
||||
@@ -594,22 +709,23 @@ class PokemonReadyMenu
|
||||
end
|
||||
else
|
||||
pbHideMenu
|
||||
if pbConfirmUseHiddenMove(user,move)
|
||||
if pbConfirmUseHiddenMove(user, move)
|
||||
$game_temp.in_menu = false
|
||||
pbUseHiddenMove(user,move)
|
||||
pbUseHiddenMove(user, move)
|
||||
break
|
||||
else
|
||||
pbShowMenu
|
||||
end
|
||||
end
|
||||
else # Use an item
|
||||
item = commands[1][command[1]][0]
|
||||
pbHideMenu
|
||||
if ItemHandlers.triggerConfirmUseInField(item)
|
||||
$game_temp.in_menu = false
|
||||
break if pbUseKeyItemInField(item)
|
||||
$game_temp.in_menu = true
|
||||
end
|
||||
else
|
||||
# Use an item
|
||||
item = commands[1][command[1]][0]
|
||||
pbHideMenu
|
||||
if ItemHandlers.triggerConfirmUseInField(item)
|
||||
$game_temp.in_menu = false
|
||||
break if pbUseKeyItemInField(item)
|
||||
$game_temp.in_menu = true
|
||||
end
|
||||
end
|
||||
pbShowMenu
|
||||
end
|
||||
@@ -172,6 +172,7 @@ class Pokemon
|
||||
if !@ability
|
||||
sp_data = species_data
|
||||
abil_index = ability_index
|
||||
#echoln abil_index
|
||||
if abil_index >= 2 # Hidden ability
|
||||
@ability = sp_data.hidden_abilities[abil_index - 2]
|
||||
abil_index = (@personalID & 1) if !@ability
|
||||
@@ -214,22 +215,17 @@ end
|
||||
|
||||
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]
|
||||
end
|
||||
def pbChooseAbility(ability1Id,ability2Id)
|
||||
ability1 = GameData::Ability.get(ability1Id)
|
||||
ability2 = GameData::Ability.get(ability2Id)
|
||||
availableNatures = []
|
||||
availableNatures << @pokemon1.nature
|
||||
availableNatures << @pokemon2.nature
|
||||
|
||||
setAbilityAndNatureAndNickname([GameData::Ability.get(abID1), GameData::Ability.get(abID2)], availableNatures)
|
||||
setAbilityAndNatureAndNickname([ability1,ability2], availableNatures)
|
||||
end
|
||||
|
||||
|
||||
def setAbilityAndNatureAndNickname(abilitiesList, naturesList)
|
||||
clearUIForMoves
|
||||
if $game_switches[SWITCH_DOUBLE_ABILITIES]
|
||||
@@ -243,7 +239,13 @@ class PokemonFusionScene
|
||||
scene = FusionSelectOptionsScene.new(abilitiesList, naturesList, @pokemon1, @pokemon2)
|
||||
screen = PokemonOptionScreen.new(scene)
|
||||
screen.pbStartScreen
|
||||
@pokemon1.ability = scene.selectedAbility
|
||||
|
||||
selectedAbility = scene.selectedAbility
|
||||
@pokemon1.body_original_ability_index = @pokemon1.ability_index
|
||||
@pokemon1.head_original_ability_index = @pokemon2.ability_index
|
||||
|
||||
@pokemon1.ability = selectedAbility
|
||||
@pokemon1.ability_index = getAbilityIndexFromID(selectedAbility.id,@pokemon1)
|
||||
end
|
||||
|
||||
@pokemon1.nature = scene.selectedNature
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user