update 6.7

This commit is contained in:
chardub
2025-09-28 15:53:01 -04:00
parent ef5e023ae0
commit 318ff90d8d
696 changed files with 111759 additions and 198230 deletions
+27 -9
View File
@@ -5,10 +5,13 @@
#==============================================================================#
module Settings
# The version of your game. It has to adhere to the MAJOR.MINOR.PATCH format.
GAME_VERSION = '6.6.2'
GAME_VERSION_NUMBER = "6.6.2"
GAME_VERSION = '6.7.0'
GAME_VERSION_NUMBER = "6.7.0"
LATEST_GAME_RELEASE = "6.6"
KANTO = GAME_ID == :IF_KANTO
HOENN = GAME_ID == :IF_HOENN
POKERADAR_LIGHT_ANIMATION_RED_ID = 17
POKERADAR_LIGHT_ANIMATION_GREEN_ID = 18
POKERADAR_HIDDEN_ABILITY_POKE_CHANCE = 32
@@ -33,7 +36,7 @@ module Settings
BATTLERS_FOLDER = "Graphics/Battlers/Autogens/"
DOWNLOADED_SPRITES_FOLDER = "Graphics/temp/"
DEFAULT_SPRITE_PATH = "Graphics/Battlers/Special/000.png"
CREDITS_FILE_PATH = "Data/sprites/Sprite Credits.csv"
CREDITS_FILE_PATH = "Data/sprites/Sprite_Credits.csv"
VERSION_FILE_PATH = "Data/VERSION"
CUSTOM_SPRITES_FILE_PATH = "Data/sprites/CUSTOM_SPRITES"
BASE_SPRITES_FILE_PATH = "Data/sprites/BASE_SPRITES"
@@ -66,9 +69,13 @@ module Settings
SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/CUSTOM_SPRITES"
BASE_SPRITES_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/infinitefusion-e18/main/Data/sprites/BASE_SPRITES"
CREDITS_FILE_URL = "https://infinitefusion.net/Sprite Credits.csv"
CREDITS_FILE_URL = "https://infinitefusion.net/customsprites/Sprite_Credits.csv"
CUSTOM_DEX_FILE_URL = "https://raw.githubusercontent.com/infinitefusion/pif-downloadables/refs/heads/master/dex.json"
SECRETBASE_UPLOAD_URL = "http://secretbases-upload.pkmninfinitefusion.workers.dev"
SECRETBASE_DOWNLOAD_URL = "https://secretbase-download.pkmninfinitefusion.workers.dev"
STARTUP_MESSAGES = ""
LEVEL_CAPS=[12,22,26,35,38,45,51,54,62,62,63,64,64,65,67,68]
@@ -175,12 +182,19 @@ 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]
KALOS_STARTERS = [:CHESPIN, :FENNEKIN, :FROAKIE]
DEFAULT_STARTERS = Settings::GAME_ID == :IF_KANTO ? KANTO_STARTERS : HOENN_STARTERS
GRASS_STARTERS = [:BULBASAUR,:CHIKORITA,:TREECKO,:TURTWIG,:CHESPIN]
FIRE_STARTERS = [:CHARMANDER,:CYNDAQUIL, :TORCHIC, :CHIMCHAR, :FENNEKIN]
WATER_STARTERS = [:SQUIRTLE, :TOTODILE, :MUDKIP, :PIPLUP, :FROAKIE]
#=============================================================================
@@ -345,7 +359,7 @@ module Settings
# Dex list, no matter which region the player is currently in.
def self.pokedex_names
return [
# [_INTL("Kanto Pokédex"), 0]
# ["Kanto Pokédex", 0]
]
end
@@ -543,11 +557,15 @@ module Settings
# file in the Data folder. Edit only if you have 2 or more languages to choose
# from.
LANGUAGES = [
# ["English", "english.dat"],
# ["Deutsch", "deutsch.dat"]
["English", "english.dat"],
["Français", "french.dat"]
]
#Experimental
REMOTE_BATTLES_CONTROL = false
REMOTE_NPC_DIALOG = false
REMOTE_BATTLE_CONTROL_SERVER_URL = "http://127.0.0.1:5000/choose_move"
REMOTE_NPC_DIALOG_SERVER_URL = "http://127.0.0.1:5000"
#Technical
SPRITE_CACHE_MAX_NB=100
NEWEST_SPRITEPACK_MONTH = 12
@@ -576,7 +594,7 @@ module Settings
"speech hgss 18",
"speech hgss 19",
"speech hgss 20",
"speech pl 18"
"speech pl 18",
]
# Available menu frames. These are graphic files in "Graphics/Windowskins/".
@@ -3,42 +3,42 @@
# HTTP utility functions
#
#############################
#
def pbPostData(url, postdata, filename=nil, depth=0)
if url[/^http:\/\/([^\/]+)(.*)$/]
host = $1
path = $2
path = "/" if path.length==0
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
body = postdata.map { |key, value|
keyString = key.to_s
valueString = value.to_s
keyString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf('%%%02x', s[0]) }
valueString.gsub!(/[^a-zA-Z0-9_\.\-]/n) { |s| sprintf('%%%02x', s[0]) }
next "#{keyString}=#{valueString}"
}.join('&')
ret = HTTPLite.post_body(
url,
body,
"application/x-www-form-urlencoded",
{
"Host" => host, # might not be necessary
"Proxy-Connection" => "Close",
"Content-Length" => body.bytesize.to_s,
"Pragma" => "no-cache",
"User-Agent" => userAgent
}
) rescue ""
return ret if !ret.is_a?(Hash)
return "" if ret[:status] != 200
return ret[:body] if !filename
File.open(filename, "wb"){|f|f.write(ret[:body])}
return "" unless url =~ /^https?:\/\/([^\/]+)(.*)$/
host = $1
path = $2
path = "/" if path.empty?
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
# Serialize as JSON
body = serialize_json(postdata)
ret = HTTPLite.post_body(
url,
body,
"application/json",
{
"Host" => host,
"Proxy-Connection" => "Close",
"Content-Length" => body.bytesize.to_s,
"Pragma" => "no-cache",
"User-Agent" => userAgent
}
) rescue ""
return "" if !ret.is_a?(Hash)
return "" if ret[:status] != 200
if filename
File.open(filename, "wb") { |f| f.write(ret[:body]) }
return ""
end
return ""
ret[:body]
end
def pbDownloadData(url, filename = nil, authorization = nil, depth = 0, &block)
return nil if !downloadAllowed?()
echoln "downloading data from #{url}"
@@ -73,15 +73,21 @@ def pbDownloadToFile(url, file)
end
end
def pbPostToString(url, postdata)
def pbPostToString(url, postdata, timeout = 30)
safe_postdata = postdata.transform_values(&:to_s)
begin
data = pbPostData(url, postdata)
return data
rescue
data = pbPostData(url, safe_postdata)
return data || ""
rescue MKXPError => e
echoln("[Remote AI] Exception: #{e.message}")
return ""
end
end
def pbPostToFile(url, postdata, file)
begin
pbPostData(url, postdata,file)
@@ -89,7 +95,7 @@ def pbPostToFile(url, postdata, file)
end
end
def serialize_value(value)
def serialize_value_legacy(value)
if value.is_a?(Hash)
serialize_json(value)
elsif value.is_a?(String)
@@ -102,17 +108,47 @@ end
def serialize_json(data)
#echoln data
# Manually serialize the JSON data into a string
parts = ["{"]
data.each_with_index do |(key, value), index|
parts << "\"#{key}\":#{serialize_value(value)}"
parts << "," unless index == data.size - 1
if data.is_a?(Hash)
parts = ["{"]
data.each_with_index do |(key, value), index|
parts << "\"#{key}\":#{serialize_value(value)}"
parts << "," unless index == data.size - 1
end
parts << "}"
return parts.join
else
return serialize_value(data)
end
parts << "}"
return parts.join
end
def serialize_value(value)
case value
when String
"\"#{escape_json_string(value)}\""
when Numeric
value.to_s
when TrueClass, FalseClass
value.to_s
when NilClass
"null"
when Array
"[" + value.map { |v| serialize_value(v) }.join(",") + "]"
when Hash
serialize_json(value)
else
raise "Unsupported type: #{value.class}"
end
end
def escape_json_string(str)
# Minimal escape handling
str.gsub(/["\\]/) { |m| "\\#{m}" }
.gsub("\n", "\\n")
.gsub("\t", "\\t")
.gsub("\r", "\\r")
end
def downloadAllowed?()
return $PokemonSystem.download_sprites==0
@@ -141,6 +177,42 @@ def clean_json_string(str)
end
# json.rb - lightweight JSON parser for MKXP/RGSS XP
# Lightweight JSON for MKXP/RGSS XP
module JSON
module_function
# Convert Ruby object (hash/array/etc) into JSON string
def generate(obj)
case obj
when Hash
"{" + obj.map { |k, v| "\"#{k}\":#{generate(v)}" }.join(",") + "}"
when Array
"[" + obj.map { |v| generate(v) }.join(",") + "]"
when String, Symbol
"\"#{obj.to_s}\""
when TrueClass, FalseClass
obj.to_s
when NilClass
"null"
when Numeric
obj.to_s
else
raise "Unsupported type #{obj.class}"
end
end
# Simple parser (not full JSON) — optional
def parse(str)
return nil if str.nil? || str.strip.empty?
eval(str)
end
end
File diff suppressed because it is too large Load Diff
@@ -202,6 +202,7 @@ module Game
$PokemonMap.updateMap
$scene = Scene_Map.new
onLoadExistingGame()
end
# Loads and validates the map. Called when loading a saved game.
@@ -234,9 +235,15 @@ module Game
end
$PokemonEncounters = PokemonEncounters.new
$PokemonEncounters.setup($game_map.map_id)
self.load_secret_bases if Settings::HOENN
pbUpdateVehicle
end
def self.load_secret_bases
loader = SecretBaseLoader.new
loader.load_visitor_bases
end
# Saves the game. Returns whether the operation was successful.
# @param save_file [String] the save file path
# @param safe [Boolean] whether $PokemonGlobal.safesave should be set to true
@@ -218,6 +218,12 @@ class Scene_Map
end
return if $game_temp.message_window_showing
if !pbMapInterpreterRunning?
if $game_temp.moving_furniture
placeFurnitureMenu() if Input.trigger?(Input::USE)
rotate__held_furniture_left if Input.trigger?(Input::JUMPDOWN)
rotate_held_furniture_right if Input.trigger?(Input::JUMPUP)
end
if Input.trigger?(Input::USE)
$PokemonTemp.hiddenMoveEventCalling = true
elsif Input.trigger?(Input::BACK)
@@ -225,7 +231,7 @@ class Scene_Map
$game_temp.menu_calling = true
$game_temp.menu_beep = true
dayOfWeek = getDayOfTheWeek().to_s
$scene.spriteset.addUserSprite(LocationWindow.new($game_map.name+ "\n"+ pbGetTimeNow.strftime("%I:%M %p") + "\n" + dayOfWeek))
$scene.spriteset.addUserSprite(LocationWindow.new($game_map.name+ "\n"+ pbGetTimeNow.strftime(_INTL("%I:%M %p")) + "\n" + dayOfWeek))
end
elsif Input.trigger?(Input::SPECIAL)
unless $game_system.menu_disabled || $game_player.moving?
@@ -25,11 +25,6 @@ class Game_Temp
attr_accessor :fadestate # for sprite hashes
attr_accessor :background_bitmap
attr_accessor :mart_prices
attr_accessor :unimportedSprites
attr_accessor :nb_imported_sprites
attr_accessor :loading_screen
attr_accessor :custom_sprites_list
attr_accessor :base_sprites_list
#-----------------------------------------------------------------------------
# * Object Initialization
@@ -57,9 +52,6 @@ class Game_Temp
@message_window_showing = false
@transition_processing = false
@mart_prices = {}
@custom_sprites_list ={}
@base_sprites_list ={}
end
def clear_mart_prices
@@ -12,8 +12,8 @@ class Game_Picture
attr_reader :number # picture number
attr_accessor :name # file name
attr_reader :origin # starting point
attr_reader :x # x-coordinate
attr_reader :y # y-coordinate
attr_accessor :x # x-coordinate
attr_accessor :y # y-coordinate
attr_accessor :zoom_x # x directional zoom rate
attr_accessor :zoom_y # y directional zoom rate
attr_accessor :opacity # opacity level
@@ -25,7 +25,10 @@ class Game_Character
attr_reader :move_speed
attr_accessor :walk_anime
attr_writer :bob_height
attr_accessor :under_everything
attr_accessor :under_everything #under even grass
attr_accessor :under_player #always under the player, but over grass, etc.
attr_accessor :direction_fix
attr_accessor :always_on_top
def initialize(map = nil)
@map = map
@@ -77,6 +80,7 @@ class Game_Character
@locked = false
@prelock_direction = 0
@under_everything=false
@under_player = false
@forced_z=nil
end
@@ -339,6 +343,7 @@ class Game_Character
def screen_z(height = 0)
return -1 if @under_everything
return 0 if @under_player
return 999 if @always_on_top
return @forced_z if @forced_z
z = screen_y_ground
@@ -354,6 +359,17 @@ class Game_Character
return z + ((height > Game_Map::TILE_HEIGHT) ? Game_Map::TILE_HEIGHT - 1 : 0)
end
def opposite_direction
case @direction
when DIRECTION_LEFT; return DIRECTION_RIGHT
when DIRECTION_RIGHT; return DIRECTION_LEFT
when DIRECTION_UP; return DIRECTION_DOWN
when DIRECTION_DOWN; return DIRECTION_UP
else
return DIRECTION_ALL
end
end
#=============================================================================
# Movement
#=============================================================================
@@ -899,6 +915,27 @@ class Game_Character
@direction_fix = last_direction_fix
end
def jump_forward
case $game_player.direction
when DIRECTION_DOWN
x_direction = 0
y_direction = 1
when DIRECTION_UP
x_direction = 0
y_direction = -1
when DIRECTION_LEFT
x_direction = -1
y_direction = 0
when DIRECTION_RIGHT
x_direction = 1
y_direction = 0
else
x_direction = 0
y_direction = 0
end
jump(x_direction, y_direction)
end
def jump(x_plus, y_plus)
if x_plus != 0 || y_plus != 0
if x_plus.abs > y_plus.abs
@@ -1,10 +1,13 @@
class Game_Event < Game_Character
attr_reader :map_id
attr_reader :trigger
attr_accessor :trigger
attr_reader :list
attr_reader :starting
attr_reader :tempSwitches # Temporary self-switches
attr_reader :character_name
attr_accessor :need_refresh
attr_accessor :opacity
attr_accessor :through
def initialize(map_id, event, map=nil)
super(map)
@@ -33,40 +33,34 @@ class Game_Player < Game_Character
return moving? && !@move_route_forcing && pbCanRun?
end
#Override the player's graphics
# Path from Graphics/Characters/player/
def setPlayerGraphicsOverride(path)
@defaultCharacterName=path
end
def removeGraphicsOverride
@defaultCharacterName = ""
end
def hasGraphicsOverride?
return @defaultCharacterName!=""
end
def character_name
@defaultCharacterName = "" if !@defaultCharacterName
return @defaultCharacterName if @defaultCharacterName!=""
return @defaultCharacterName if hasGraphicsOverride?
if !@move_route_forcing && $Trainer.character_ID>=0
meta = GameData::Metadata.get_player($Trainer.character_ID)
if meta && !$PokemonGlobal.bicycle && !$PokemonGlobal.diving && !$PokemonGlobal.surfing
charset = 1 # Display normal character sprite
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 = player_is_moving
end
@@ -127,7 +127,9 @@ class Sprite_Wearable < RPG::Sprite
end
def update(action, filename,color)
@sprite.opacity = @player_sprite.opacity if @wearableBitmap
@sprite.opacity=0 if $game_player.hasGraphicsOverride?
if filename != @filename || color != @color
if pbResolveBitmap(filename)
#echoln pbResolveBitmap(filename)
@@ -60,6 +60,13 @@ class Sprite_Player < Sprite_Character
@charbitmap.bitmap.clone #nekkid sprite
baseBitmap = @charbitmap.bitmap.clone #nekkid sprite
if $game_player.hasGraphicsOverride?
@hair.update(@character_name, "", 0) if @hair
@hat.update(@character_name, "", 0) if @hat
@hat2.update(@character_name, "", 0) if @hat2
return baseBitmap
end
outfitFilename = getOverworldOutfitFilename($Trainer.clothes, @character_name) #
outfitFilename = getOverworldOutfitFilename(Settings::PLAYER_TEMP_OUTFIT_FALLBACK) if !pbResolveBitmap(outfitFilename)
hairFilename = getOverworldHairFilename($Trainer.hair)
@@ -78,6 +78,18 @@ class TilemapRenderer
},
5 => { #Rustboro
996 => "flowers_orange[10]",
991 => "flowers_pink[10]",
999 => "flowers_yellow[10]",
1007 => "flowers_blue[10]",
1015 => "flowers_purple[10]",
1023 => "flowers_red[10]",
1031 => "flowers_grey[10]",
1039 => "flowers_white[10]",
},
6 => { #Dewford Town
#water cliffs
@@ -92,7 +104,8 @@ class TilemapRenderer
},
7 => { #Sea Route
#water rocks
1173 => "water_rock_medium[15]",
#water cliffs
1363 => "water_rock10", 1364 => "water_rock11",
1389 => "water_rock01", 1391 => "water_rock09",
@@ -154,6 +167,38 @@ class TilemapRenderer
881 => "tree_sway_single_6",
866 => "tree_sway_group_1",
867 => "tree_sway_group_2",
874 => "tree_sway_group_3",
875 => "tree_sway_group_4",
},
5 => { #Rustboro
#trees
864 => "tree_sway_single_1",
865 => "tree_sway_single_2",
872 => "tree_sway_single_3",
873 => "tree_sway_single_4",
880 => "tree_sway_single_5",
881 => "tree_sway_single_6",
866 => "tree_sway_group_1",
867 => "tree_sway_group_2",
874 => "tree_sway_group_3",
875 => "tree_sway_group_4",
},
9 => { #Route Forest
#trees
864 => "tree_sway_single_1",
865 => "tree_sway_single_2",
872 => "tree_sway_single_3",
873 => "tree_sway_single_4",
880 => "tree_sway_single_5",
881 => "tree_sway_single_6",
866 => "tree_sway_group_1",
867 => "tree_sway_group_2",
874 => "tree_sway_group_3",
@@ -129,22 +129,49 @@ class AnimatedBitmap
@bitmap.bitmap = new_bitmap
end
# def mirror
# for x in 0..@bitmap.bitmap.width / 2
# for y in 0..@bitmap.bitmap.height - 2
# temp = @bitmap.bitmap.get_pixel(x, y)
# newPix = @bitmap.bitmap.get_pixel((@bitmap.bitmap.width - x), y)
#
# @bitmap.bitmap.set_pixel(x, y, newPix)
# @bitmap.bitmap.set_pixel((@bitmap.bitmap.width - x), y, temp)
# end
# end
# end
def mirror
@bitmap.bitmap
mirror_horizontally
end
def mirror_horizontally
bmp = @bitmap.bitmap
half_width = bmp.width / 2
height = bmp.height
(0...half_width).each do |x|
(0...height).each do |y|
left_pixel = bmp.get_pixel(x, y)
right_pixel = bmp.get_pixel(bmp.width - 1 - x, y)
bmp.set_pixel(x, y, right_pixel)
bmp.set_pixel(bmp.width - 1 - x, y, left_pixel)
end
end
end
def mirror_vertically
bmp = @bitmap.bitmap
width = bmp.width
half_height = bmp.height / 2
(0...half_height).each do |y|
(0...width).each do |x|
top_pixel = bmp.get_pixel(x, y)
bottom_pixel = bmp.get_pixel(x, bmp.height - 1 - y)
bmp.set_pixel(x, y, bottom_pixel)
bmp.set_pixel(x, bmp.height - 1 - y, top_pixel)
end
end
end
# def mirror
# @bitmap.bitmap
# end
end
@@ -396,9 +396,9 @@ def pbGetGoldString
moneyString = _INTL("${1}", $Trainer.money.to_s_formatted)
rescue
if $data_system.respond_to?("words")
moneyString = _INTL("{1} {2}", $game_party.gold, $data_system.words.gold)
moneyString = "#{$game_party.gold} #{$data_system.words.gold}"
else
moneyString = _INTL("{1} {2}", $game_party.gold, Vocab.gold)
moneyString = "#{$game_party.gold} #{Vocab.gold}"
end
end
return moneyString
@@ -474,6 +474,8 @@ def pbDisplayHeartScalesWindow(msgwindow)
return pointswindow
end
def pbDisplayCoinsWindow(msgwindow, goldwindow)
coinString = ($Trainer) ? $Trainer.coins.to_s_formatted : "0"
coinwindow = Window_AdvancedTextPokemon.new(_INTL("Coins:\n<ar>{1}</ar>", coinString))
@@ -506,6 +508,22 @@ def pbDisplayBattlePointsWindow(msgwindow)
return pointswindow
end
def pbDisplayQuestPointsWindow(msgwindow)
pointsString = ($Trainer) ? $Trainer.quest_points.to_s_formatted : "0"
pointswindow = Window_AdvancedTextPokemon.new(_INTL("Quest Points:\n<ar>{1}</ar>", pointsString))
pointswindow.setSkin("Graphics/Windowskins/goldskin")
pointswindow.resizeToFit(pointswindow.text, Graphics.width)
pointswindow.width = 160 if pointswindow.width <= 160
if msgwindow.y == 0
pointswindow.y = Graphics.height - pointswindow.height
else
pointswindow.y = 0
end
pointswindow.viewport = msgwindow.viewport
pointswindow.z = msgwindow.z
return pointswindow
end
#===============================================================================
#
#===============================================================================
@@ -594,6 +612,12 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
text.gsub!(/\\pog/i, "")
text.gsub!(/\\b/i, "<c3=3050C8,D0D0C8>")
text.gsub!(/\\r/i, "<c3=E00808,D0D0C8>")
text.gsub!(/\\mu\[(.*?)\]/i) do
$Trainer && isPlayerMale() ? $1 : ""
end
text.gsub!(/\\fu\[(.*?)\]/i) do
$Trainer && isPlayerFemale() ? $1 : ""
end
text.gsub!(/\\[Ww]\[([^\]]*)\]/) {
w = $1.to_s
if w == ""
@@ -632,7 +656,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
### Controls
textchunks = []
controls = []
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i]
while text[/(?:\\(f|ff|ts|cl|me|se|wt|wtnp|ch)\[([^\]]*)\]|\\(g|cn|pt|ft|qp|hs|wd|wm|op|cl|wu|\.|\||\!|\^))/i]
textchunks.push($~.pre_match)
if $~[1]
controls.push([$~[1].downcase, $~[2], -1])
@@ -757,6 +781,9 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
when "hs" # Display heartscakes
goldwindow.dispose if goldwindow
goldwindow = pbDisplayHeartScalesWindow(msgwindow)
when "qp" # Display quest points
goldwindow.dispose if goldwindow
goldwindow = pbDisplayQuestPointsWindow(msgwindow)
when "cn" # Display coins window
coinwindow.dispose if coinwindow
coinwindow = pbDisplayCoinsWindow(msgwindow, goldwindow)
-1
View File
@@ -101,7 +101,6 @@ end
# volume -- Volume of the file, up to 100
# pitch -- Pitch of the file, normally 100
def pbMEPlay(param,volume=nil,pitch=nil)
echoln param
return if !param
param=pbResolveAudioFile(param,volume,pitch)
if param.name && param.name!=""
+5 -7
View File
@@ -54,14 +54,12 @@ module GameData
end
if !self::DATA.has_key?(other)
#echoln _INTL("Unknown ID {1}.", other)
return self::get(:PIKACHU)
if self == GameData::Item
return nil
else
return self::get(:PIKACHU)
end
end
#if other == :Species
# end
return self::DATA[other]
end
@@ -27,10 +27,16 @@ module GameData
attr_reader :flowerYellow
attr_reader :flowerBlue
attr_reader :flower
attr_reader :trashcan
attr_reader :sharpedoObstacle
attr_reader :underwater #only visible when diving
attr_reader :secretBase_tree
attr_reader :secretBase_cave
attr_reader :secretBase_bush
DATA = {}
extend ClassMethods
@@ -82,11 +88,20 @@ module GameData
@sharpedoObstacle = hash[:sharpedoObstacle] || false
@underwater = hash[:underwater] || false
@secretBase_tree = hash[:secretBase_tree] || false
@secretBase_cave = hash[:secretBase_cave] || false
@secretBase_bush = hash[:secretBase_bush] || false
end
def can_surf_freely
return @can_surf && !@waterfall && !@waterfall_crest
end
def can_secret_base
return false if Settings::GAME_ID != :IF_HOENN
return @secretBase_tree || @secretBase_cave || @secretBase_bush
end
end
end
@@ -299,4 +314,23 @@ GameData::TerrainTag.register({
:id_number => 28,
:battle_environment => :underwater,
:underwater => true,
})
GameData::TerrainTag.register({
:id => :Secretbase_Tree,
:id_number => 29,
:secretBase_tree => true,
})
GameData::TerrainTag.register({
:id => :Secretbase_Cave,
:id_number => 30,
:secretBase_cave => true,
})
GameData::TerrainTag.register({
:id => :Secretbase_Bush,
:id_number => 31,
:secretBase_bush => true,
})
@@ -63,7 +63,7 @@ module GameData
# return (ret) ? ret : pbResolveBitmap("Graphics/Pokemon/Eggs/000")
# end
def self.egg_sprite_filename(species, form)
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.use_custom_eggs
return "Graphics/Battlers/Eggs/000" if $PokemonSystem.hide_custom_eggs
dexNum = getDexNumberForSpecies(species)
bitmapFileName = sprintf("Graphics/Battlers/Eggs/%d", dexNum) rescue nil
if !pbResolveBitmap(bitmapFileName)
@@ -197,7 +197,8 @@ module GameData
gym_type = GameData::Type.get(type_id)
while true
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
if new_species.hasType?(gym_type)
if new_species.hasType?(gym_type) || $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] || $game_switches[SWITCH_LEGENDARY_MODE]
# Note: gym Type validation is handled in-house for legendary mode
return new_species
end
end
@@ -218,6 +219,9 @@ module GameData
end
end
new_species = generateRandomGymSpecies(species)
if !new_species
return species
end
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
add_generated_species_to_gym_array(new_species, trainerId)
end
@@ -392,7 +396,7 @@ module GameData
secondary_ability_index = pkmn.ability_index == 0 ? 1 : 0
pkmn.ability2_index = secondary_ability_index
pkmn.ability2 = pkmn.getAbilityList[secondary_ability_index][0]
#print _INTL("Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id)
#print "Primary: {1}, Secondary: {2}",pkmn.ability.id, pkmn.ability2.id
end
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
@@ -1,369 +1,5 @@
module GameData
class TrainerModern
attr_reader :id
attr_reader :id_number
attr_reader :trainer_type
attr_reader :real_name
attr_reader :version
attr_reader :items
attr_reader :real_lose_text
attr_reader :pokemon
DATA = {}
class TrainerModern < Trainer
DATA_FILENAME = "trainers_remix.dat"
SCHEMA = {
"Items" => [:items, "*e", :Item],
"LoseText" => [:lose_text, "s"],
"Pokemon" => [:pokemon, "ev", :Species], # Species, level
"Form" => [:form, "u"],
"Name" => [:name, "s"],
"Moves" => [:moves, "*e", :Move],
"Ability" => [:ability, "s"],
"AbilityIndex" => [:ability_index, "u"],
"Item" => [:item, "e", :Item],
"Gender" => [:gender, "e", { "M" => 0, "m" => 0, "Male" => 0, "male" => 0, "0" => 0,
"F" => 1, "f" => 1, "Female" => 1, "female" => 1, "1" => 1 }],
"Nature" => [:nature, "e", :Nature],
"IV" => [:iv, "uUUUUU"],
"EV" => [:ev, "uUUUUU"],
"Happiness" => [:happiness, "u"],
"Shiny" => [:shininess, "b"],
"Shadow" => [:shadowness, "b"],
"Ball" => [:poke_ball, "s"],
}
extend ClassMethods
include InstanceMethods
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [Boolean] whether the given other is defined as a self
def self.exists?(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
return !self::DATA[key].nil?
end
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [self]
def self.get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
raise "Unknown trainer #{tr_type} #{tr_name} #{tr_version}." unless self::DATA.has_key?(key)
return self::DATA[key]
end
# @param tr_type [Symbol, String]
# @param tr_name [String]
# @param tr_version [Integer, nil]
# @return [self, nil]
def self.try_get(tr_type, tr_name, tr_version = 0)
validate tr_type => [Symbol, String]
validate tr_name => [String]
key = [tr_type.to_sym, tr_name, tr_version]
return (self::DATA.has_key?(key)) ? self::DATA[key] : nil
end
def self.list_all()
return self::DATA
end
def initialize(hash)
@id = hash[:id]
@id_number = hash[:id_number]
@trainer_type = hash[:trainer_type]
@real_name = hash[:name] || "Unnamed"
@version = hash[:version] || 0
@items = hash[:items] || []
@real_lose_text = hash[:lose_text] || "..."
@pokemon = hash[:pokemon] || []
@pokemon.each do |pkmn|
GameData::Stat.each_main do |s|
pkmn[:iv][s.id] ||= 0 if pkmn[:iv]
pkmn[:ev][s.id] ||= 0 if pkmn[:ev]
end
end
end
# @return [String] the translated name of this trainer
def name
return pbGetMessageFromHash(MessageTypes::TrainerNames, @real_name)
end
# @return [String] the translated in-battle lose message of this trainer
def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
end
def replace_species_with_placeholder(species)
case species
when Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES
return pbGet(Settings::RIVAL_STARTER_PLACEHOLDER_VARIABLE)
when Settings::VAR_1_PLACEHOLDER_SPECIES
return pbGet(1)
when Settings::VAR_2_PLACEHOLDER_SPECIES
return pbGet(2)
when Settings::VAR_3_PLACEHOLDER_SPECIES
return pbGet(3)
end
end
def generateRandomChampionSpecies(old_species)
customsList = getCustomSpeciesList()
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
#every pokemon should be fully evolved
evolved_species_id = getEvolution(new_species)
evolved_species_id = getEvolution(evolved_species_id)
evolved_species_id = getEvolution(evolved_species_id)
evolved_species_id = getEvolution(evolved_species_id)
return getSpecies(evolved_species_id)
end
def generateRandomGymSpecies(old_species)
gym_index = pbGet(VAR_CURRENT_GYM_TYPE)
return old_species if gym_index == -1
return generateRandomChampionSpecies(old_species) if gym_index == 999
type_id = pbGet(VAR_GYM_TYPES_ARRAY)[gym_index]
return old_species if type_id == -1
customsList = getCustomSpeciesList()
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
gym_type = GameData::Type.get(type_id)
while true
new_species = $game_switches[SWITCH_RANDOM_GYM_CUSTOMS] ? getSpecies(getNewCustomSpecies(old_species, customsList, bst_range)) : getSpecies(getNewSpecies(old_species, bst_range))
if new_species.hasType?(gym_type)
return new_species
end
end
end
def replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
if $PokemonGlobal.randomGymTrainersHash == nil
$PokemonGlobal.randomGymTrainersHash = {}
end
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS] && $PokemonGlobal.randomGymTrainersHash != nil
if $PokemonGlobal.randomGymTrainersHash[trainerId] != nil && $PokemonGlobal.randomGymTrainersHash[trainerId].length >= $PokemonGlobal.randomTrainersHash[trainerId].length
return getSpecies($PokemonGlobal.randomGymTrainersHash[trainerId][pokemonIndex])
end
end
new_species = generateRandomGymSpecies(species)
if $game_switches[SWITCH_RANDOM_GYM_PERSIST_TEAMS]
add_generated_species_to_gym_array(new_species, trainerId)
end
return new_species
end
def add_generated_species_to_gym_array(new_species, trainerId)
if (new_species.is_a?(Symbol))
id = new_species
else
id = new_species.id_number
end
expected_team_length = 1
expected_team_length = $PokemonGlobal.randomTrainersHash[trainerId].length if $PokemonGlobal.randomTrainersHash[trainerId]
new_team = []
if $PokemonGlobal.randomGymTrainersHash[trainerId]
new_team = $PokemonGlobal.randomGymTrainersHash[trainerId]
end
if new_team.length < expected_team_length
new_team << id
end
$PokemonGlobal.randomGymTrainersHash[trainerId] = new_team
end
def replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
if $PokemonGlobal.randomTrainersHash[trainerId] == nil
Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
Kernel.pbShuffleTrainers()
end
new_species_dex = $PokemonGlobal.randomTrainersHash[trainerId][pokemonIndex]
return getSpecies(new_species_dex)
end
def isGymBattle
return ($game_switches[SWITCH_RANDOM_TRAINERS] && ($game_variables[VAR_CURRENT_GYM_TYPE] != -1) || ($game_switches[SWITCH_FIRST_RIVAL_BATTLE] && $game_switches[SWITCH_RANDOM_STARTERS]))
end
def replace_species_to_randomized(species, trainerId, pokemonIndex)
return species if $game_switches[SWITCH_FIRST_RIVAL_BATTLE]
return species if $game_switches[SWITCH_DONT_RANDOMIZE]
if isGymBattle() && $game_switches[SWITCH_RANDOMIZE_GYMS_SEPARATELY]
return replace_species_to_randomized_gym(species, trainerId, pokemonIndex)
end
return replace_species_to_randomized_regular(species, trainerId, pokemonIndex)
end
def replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[SWITCH_SINGLE_POKEMON_MODE]
if $game_switches[SWITCH_SINGLE_POKEMON_MODE_HEAD]
return replaceFusionsHeadWithSpecies(species)
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_BODY]
return replaceFusionsBodyWithSpecies(species)
elsif $game_switches[SWITCH_SINGLE_POKEMON_MODE_RANDOM]
if (rand(2) == 0)
return replaceFusionsHeadWithSpecies(species)
else
return replaceFusionsBodyWithSpecies(species)
end
end
end
return species
end
def replaceFusionsHeadWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = getBodyID(speciesId)
headPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
newSpecies = bodyPoke * NB_POKEMON + headPoke
return getPokemon(newSpecies)
end
return species
end
def replaceFusionsBodyWithSpecies(species)
speciesId = getDexNumberForSpecies(species)
if speciesId > NB_POKEMON
bodyPoke = pbGet(VAR_SINGLE_POKEMON_MODE)
headPoke = getHeadID(species)
newSpecies = bodyPoke * NB_POKEMON + headPoke
return getPokemon(newSpecies)
end
return species
end
def to_trainer
placeholder_species = [Settings::RIVAL_STARTER_PLACEHOLDER_SPECIES,
Settings::VAR_1_PLACEHOLDER_SPECIES,
Settings::VAR_2_PLACEHOLDER_SPECIES,
Settings::VAR_3_PLACEHOLDER_SPECIES]
# Determine trainer's name
tr_name = self.name
Settings::RIVAL_NAMES.each do |rival|
next if rival[0] != @trainer_type || !$game_variables[rival[1]].is_a?(String)
tr_name = $game_variables[rival[1]]
break
end
# Create trainer object
trainer = NPCTrainer.new(tr_name, @trainer_type)
trainer.id = $Trainer.make_foreign_ID
trainer.items = @items.clone
trainer.lose_text = self.lose_text
isRematch = $game_switches[SWITCH_IS_REMATCH]
isPlayingRandomized = $game_switches[SWITCH_RANDOM_TRAINERS] && !$game_switches[SWITCH_FIRST_RIVAL_BATTLE]
rematchId = getRematchId(trainer.name, trainer.trainer_type)
# Create each Pokémon owned by the trainer
index = 0
@pokemon.each do |pkmn_data|
#replace placeholder species infinite fusion edit
species = GameData::Species.get(pkmn_data[:species]).species
original_species = species
if placeholder_species.include?(species)
species = replace_species_with_placeholder(species)
else
species = replace_species_to_randomized(species, self.id, index) if isPlayingRandomized
end
species = replaceSingleSpeciesModeIfApplicable(species)
if $game_switches[SWITCH_REVERSED_MODE]
species = reverseFusionSpecies(species)
end
level = pkmn_data[:level]
if $game_switches[SWITCH_GAME_DIFFICULTY_HARD]
level = (level * Settings::HARD_MODE_LEVEL_MODIFIER).ceil
if level > Settings::MAXIMUM_LEVEL
level = Settings::MAXIMUM_LEVEL
end
end
if $game_switches[Settings::OVERRIDE_BATTLE_LEVEL_SWITCH]
override_level = $game_variables[Settings::OVERRIDE_BATTLE_LEVEL_VALUE_VAR]
if override_level.is_a?(Integer)
level = override_level
end
end
####
#trainer rematch infinite fusion edit
if isRematch
nbRematch = getNumberRematch(rematchId)
level = getRematchLevel(level, nbRematch)
species = evolveRematchPokemon(nbRematch, species)
end
pkmn = Pokemon.new(species, level, trainer, false)
trainer.party.push(pkmn)
# Set Pokémon's properties if defined
if pkmn_data[:form]
pkmn.forced_form = pkmn_data[:form] if MultipleForms.hasFunction?(species, "getForm")
pkmn.form_simple = pkmn_data[:form]
end
if $game_switches[SWITCH_RANDOM_HELD_ITEMS]
pkmn.item = pbGetRandomHeldItem().id
else
pkmn.item = pkmn_data[:item]
end
if pkmn_data[:moves] && pkmn_data[:moves].length > 0 && original_species == species
pkmn_data[:moves].each { |move| pkmn.learn_move(move) }
else
pkmn.reset_moves
end
pkmn.ability_index = pkmn_data[:ability_index]
pkmn.ability = pkmn_data[:ability]
pkmn.gender = pkmn_data[:gender] || ((trainer.male?) ? 0 : 1)
pkmn.shiny = (pkmn_data[:shininess]) ? true : false
if pkmn_data[:nature]
pkmn.nature = pkmn_data[:nature]
else
nature = pkmn.species_data.id_number + GameData::TrainerType.get(trainer.trainer_type).id_number
pkmn.nature = nature % (GameData::Nature::DATA.length / 2)
end
GameData::Stat.each_main do |s|
if pkmn_data[:iv]
pkmn.iv[s.id] = pkmn_data[:iv][s.id]
else
pkmn.iv[s.id] = [pkmn_data[:level] / 2, Pokemon::IV_STAT_LIMIT].min
end
if pkmn_data[:ev]
pkmn.ev[s.id] = pkmn_data[:ev][s.id]
else
pkmn.ev[s.id] = [pkmn_data[:level] * 3 / 2, Pokemon::EV_LIMIT / 6].min
end
end
pkmn.happiness = pkmn_data[:happiness] if pkmn_data[:happiness]
pkmn.name = pkmn_data[:name] if pkmn_data[:name] && !pkmn_data[:name].empty?
if pkmn_data[:shadowness]
pkmn.makeShadow
pkmn.update_shadow_moves(true)
pkmn.shiny = false
end
pkmn.poke_ball = pkmn_data[:poke_ball] if pkmn_data[:poke_ball]
pkmn.calc_stats
index += 1
end
return trainer
end
end
end
#===============================================================================
# Deprecated methods
#===============================================================================
# @deprecated This alias is slated to be removed in v20.
def pbGetTrainerData(tr_type, tr_name, tr_version = 0)
Deprecation.warn_method('pbGetTrainerData', 'v20', 'GameData::Trainer.get(tr_type, tr_name, tr_version)')
return GameData::Trainer.get(tr_type, tr_name, tr_version)
end
end
@@ -2542,7 +2542,7 @@ end
# class PokeBattle_Move_XXX < PokeBattle_Move
# def pbMoveFailed?(user,targets)
# if targets[0].effects[PBEffects::Transform]
# @battle.pbDisplay(_INTL("But it failed!"))
# @battle.pbDisplay("But it failed!")
# return true
# end
# return false
@@ -2552,7 +2552,7 @@ end
# if target.effects[PBEffects::Transform] ||
# target.effects[PBEffects::Illusion] ||
# !target.pokemon.isFusion?
# @battle.pbDisplay(_INTL("But it failed!"))
# @battle.pbDisplay("But it failed!")
# return true
# end
# return false
@@ -275,7 +275,7 @@ def pbHiddenPower(pkmn,forcedType=nil)
if Settings::MECHANICS_GENERATION <= 5
powerMin = 30
powerMax = 70
power |= (iv[:HP]&2)>>1
power = (iv[:HP]&2)>>1
power |= (iv[:ATTACK]&2)
power |= (iv[:DEFENSE]&2)<<1
power |= (iv[:SPEED]&2)<<2
@@ -2995,7 +2995,7 @@ class PokeBattle_Move_0EB < PokeBattle_Move
return true
end
# if @battle.wildBattle? && target.level>user.level
# @battle.pbDisplay(_INTL("But it failed!"))
# @battle.pbDisplay("But it failed!")
# return true
# end
if @battle.trainerBattle?
@@ -70,7 +70,10 @@ module PokeBattle_BattleCommon
# Record a Shadow Pokémon's species as having been caught
pbPlayer.pokedex.set_shadow_pokemon_owned(pkmn.species) if pkmn.shadowPokemon?
# Store caught Pokémon
promptCaughtPokemonAction(pkmn)
gave_away_pokemon = promptGiveToPartner(pkmn) if isPartneredWithAnyTrainer()
promptCaughtPokemonAction(pkmn) if !gave_away_pokemon
if $game_switches[AUTOSAVE_CATCH_SWITCH]
Kernel.tryAutosave()
end
@@ -84,8 +87,8 @@ module PokeBattle_BattleCommon
# return pbStorePokemon(pokemon) if !$Trainer.party_full?
#
# while !pickedOption
# command = pbMessage(_INTL("\\ts[]Your team is full!"),
# [_INTL("Add to your party"), _INTL("Store to PC"),], 2)
# command = pbMessage("\\ts[]Your team is full!"),
# ["Add to your party", "Store to PC",], 2)
# echoln ("command " + command.to_s)
# case command
# when 0 #SWAP
@@ -99,7 +99,9 @@ class PokeBattle_Battle
end
@scene = scene
@peer = PokeBattle_BattlePeer.create
@battleAI = PokeBattle_AI.new(self)
@battleAI = Settings::REMOTE_BATTLES_CONTROL ? RemotePokeBattle_AI.new(self) : PokeBattle_AI.new(self)
#TODO
@field = PokeBattle_ActiveField.new # Whole field (gravity/rooms)
@sides = [PokeBattle_ActiveSide.new, # Player's side
PokeBattle_ActiveSide.new] # Foe's side
@@ -55,10 +55,10 @@ class PokeBattle_Battle
requireds[idxTrainer] += 1
end
# Compare the have values with the need values
if requireds.length>sideCounts.length
raise _INTL("Error: def pbGetOwnerIndexFromBattlerIndex gives invalid owner index ({1} for battle type {2}v{3}, trainers {4}v{5})",
requireds.length-1,@sideSizes[0],@sideSizes[1],side1counts.length,side2counts.length)
end
# if requireds.length>sideCounts.length
# raise "Error: def pbGetOwnerIndexFromBattlerIndex gives invalid owner index ({1} for battle type {2}v{3}, trainers {4}v{5}",
# requireds.length-1,@sideSizes[0],@sideSizes[1],side1counts.length,side2counts.length)
# end
sideCounts.each_with_index do |_count,i|
if !requireds[i] || requireds[i]==0
raise _INTL("Player-side trainer {1} has no battler position for their Pokémon to go (trying {2}v{3} battle)",
@@ -179,7 +179,7 @@ class PokeBattle_Battle
dontAnimate = true
# debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
# raise RuntimeError.new(
# echoln _INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
# echoln "{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
# pkmn.name, debugInfo)
pbDisplayPaused(_INTL("{1}'s growth rate has changed to '{2}''. Its level will be adjusted to reflect its current exp.", pkmn.name, pkmn.growth_rate.real_name))
end
@@ -74,7 +74,7 @@ class PokeBattle_Battle
end
# NOTE: Add your own Mega objects for particular NPC trainers here.
# if pbGetOwnerFromBattlerIndex(idxBattler).trainer_type == :BUGCATCHER
# return _INTL("Mega Net")
# return "Mega Net"
# end
return _INTL("Mega Ring")
end
@@ -57,13 +57,13 @@ class PokeBattle_Battle
weather_data = GameData::BattleWeather.try_get(@field.weather)
pbCommonAnimation(weather_data.animation) if weather_data
case @field.weather
# when :Sun then pbDisplay(_INTL("The sunlight is strong."))
# when :Rain then pbDisplay(_INTL("Rain continues to fall."))
# when :Sun then pbDisplay("The sunlight is strong.")
# when :Rain then pbDisplay("Rain continues to fall.")
when :Sandstorm then pbDisplay(_INTL("The sandstorm is raging."))
when :Hail then pbDisplay(_INTL("The hail is crashing down."))
# when :HarshSun then pbDisplay(_INTL("The sunlight is extremely harsh."))
# when :HeavyRain then pbDisplay(_INTL("It is raining heavily."))
# when :StrongWinds then pbDisplay(_INTL("The wind is strong."))
# when :HarshSun then pbDisplay("The sunlight is extremely harsh.")
# when :HeavyRain then pbDisplay("It is raining heavily.")
# when :StrongWinds then pbDisplay("The wind is strong.")
when :ShadowSky then pbDisplay(_INTL("The shadow sky continues."))
end
# Effects due to weather
+101 -101
View File
@@ -8,11 +8,11 @@ class PokeBattle_AI
return false if !item
# Determine target of item (always the Pokémon choosing the action)
useType = GameData::Item.get(item).battle_use
if [1, 2, 3, 6, 7, 8].include?(useType) # Use on Pokémon
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
if [1, 2, 3, 6, 7, 8].include?(useType) # Use on Pokémon
idxTarget = @battle.battlers[idxTarget].pokemonIndex # Party Pokémon
end
# Register use of item
@battle.pbRegisterItem(idxBattler,item,idxTarget)
@battle.pbRegisterItem(idxBattler, item, idxTarget)
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will use item #{GameData::Item.get(item).name}")
return true
end
@@ -22,33 +22,33 @@ class PokeBattle_AI
def pbEnemyItemToUse(idxBattler)
return nil if !@battle.internalBattle
items = @battle.pbGetOwnerItems(idxBattler)
return nil if !items || items.length==0
return nil if !items || items.length == 0
# Determine target of item (always the Pokémon choosing the action)
idxTarget = idxBattler # Battler using the item
idxTarget = idxBattler # Battler using the item
battler = @battle.battlers[idxTarget]
pkmn = battler.pokemon
# Item categories
hpItems = {
:POTION => 20,
:SUPERPOTION => 50,
:HYPERPOTION => 200,
:MAXPOTION => 999,
:BERRYJUICE => 20,
:SWEETHEART => 20,
:FRESHWATER => 50,
:SODAPOP => 60,
:LEMONADE => 80,
:MOOMOOMILK => 100,
:ORANBERRY => 10,
:SITRUSBERRY => battler.totalhp/4,
:ENERGYPOWDER => 50,
:ENERGYROOT => 200
:POTION => 20,
:SUPERPOTION => 50,
:HYPERPOTION => 200,
:MAXPOTION => 999,
:BERRYJUICE => 20,
:SWEETHEART => 20,
:FRESHWATER => 50,
:SODAPOP => 60,
:LEMONADE => 80,
:MOOMOOMILK => 100,
:ORANBERRY => 10,
:SITRUSBERRY => battler.totalhp / 4,
:ENERGYPOWDER => 50,
:ENERGYROOT => 200
}
hpItems[:RAGECANDYBAR] = 20 if !Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
fullRestoreItems = [
:FULLRESTORE
:FULLRESTORE
]
oneStatusItems = [ # Preferred over items that heal all status problems
oneStatusItems = [# Preferred over items that heal all status problems
:AWAKENING, :CHESTOBERRY, :BLUEFLUTE,
:ANTIDOTE, :PECHABERRY,
:BURNHEAL, :RAWSTBERRY,
@@ -56,112 +56,112 @@ class PokeBattle_AI
:ICEHEAL, :ASPEARBERRY
]
allStatusItems = [
:FULLHEAL, :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE,
:SHALOURSABLE, :BIGMALASADA, :LUMBERRY, :HEALPOWDER
:FULLHEAL, :LAVACOOKIE, :OLDGATEAU, :CASTELIACONE, :LUMIOSEGALETTE,
:SHALOURSABLE, :BIGMALASADA, :LUMBERRY, :HEALPOWDER
]
allStatusItems.push(:RAGECANDYBAR) if Settings::RAGE_CANDY_BAR_CURES_STATUS_PROBLEMS
xItems = {
:XATTACK => [:ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XATTACK2 => [:ATTACK, 2],
:XATTACK3 => [:ATTACK, 3],
:XATTACK6 => [:ATTACK, 6],
:XDEFENSE => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFENSE2 => [:DEFENSE, 2],
:XDEFENSE3 => [:DEFENSE, 3],
:XDEFENSE6 => [:DEFENSE, 6],
:XDEFEND => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFEND2 => [:DEFENSE, 2],
:XDEFEND3 => [:DEFENSE, 3],
:XDEFEND6 => [:DEFENSE, 6],
:XSPATK => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPATK2 => [:SPECIAL_ATTACK, 2],
:XSPATK3 => [:SPECIAL_ATTACK, 3],
:XSPATK6 => [:SPECIAL_ATTACK, 6],
:XSPECIAL => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPECIAL2 => [:SPECIAL_ATTACK, 2],
:XSPECIAL3 => [:SPECIAL_ATTACK, 3],
:XSPECIAL6 => [:SPECIAL_ATTACK, 6],
:XSPDEF => [:SPECIAL_DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPDEF2 => [:SPECIAL_DEFENSE, 2],
:XSPDEF3 => [:SPECIAL_DEFENSE, 3],
:XSPDEF6 => [:SPECIAL_DEFENSE, 6],
:XSPEED => [:SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPEED2 => [:SPEED, 2],
:XSPEED3 => [:SPEED, 3],
:XSPEED6 => [:SPEED, 6],
:XACCURACY => [:ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XACCURACY2 => [:ACCURACY, 2],
:XACCURACY3 => [:ACCURACY, 3],
:XACCURACY6 => [:ACCURACY, 6]
:XATTACK => [:ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XATTACK2 => [:ATTACK, 2],
:XATTACK3 => [:ATTACK, 3],
:XATTACK6 => [:ATTACK, 6],
:XDEFENSE => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFENSE2 => [:DEFENSE, 2],
:XDEFENSE3 => [:DEFENSE, 3],
:XDEFENSE6 => [:DEFENSE, 6],
:XDEFEND => [:DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XDEFEND2 => [:DEFENSE, 2],
:XDEFEND3 => [:DEFENSE, 3],
:XDEFEND6 => [:DEFENSE, 6],
:XSPATK => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPATK2 => [:SPECIAL_ATTACK, 2],
:XSPATK3 => [:SPECIAL_ATTACK, 3],
:XSPATK6 => [:SPECIAL_ATTACK, 6],
:XSPECIAL => [:SPECIAL_ATTACK, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPECIAL2 => [:SPECIAL_ATTACK, 2],
:XSPECIAL3 => [:SPECIAL_ATTACK, 3],
:XSPECIAL6 => [:SPECIAL_ATTACK, 6],
:XSPDEF => [:SPECIAL_DEFENSE, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPDEF2 => [:SPECIAL_DEFENSE, 2],
:XSPDEF3 => [:SPECIAL_DEFENSE, 3],
:XSPDEF6 => [:SPECIAL_DEFENSE, 6],
:XSPEED => [:SPEED, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XSPEED2 => [:SPEED, 2],
:XSPEED3 => [:SPEED, 3],
:XSPEED6 => [:SPEED, 6],
:XACCURACY => [:ACCURACY, (Settings::X_STAT_ITEMS_RAISE_BY_TWO_STAGES) ? 2 : 1],
:XACCURACY2 => [:ACCURACY, 2],
:XACCURACY3 => [:ACCURACY, 3],
:XACCURACY6 => [:ACCURACY, 6]
}
# Determine lost HP
losthp = battler.totalhp - battler.hp
preferFullRestore = (battler.hp <= battler.totalhp * 2 / 3 &&
(battler.status != :NONE || battler.effects[PBEffects::Confusion] > 0))
# Decide if Full Restore is actually preferred
preferFullRestore = (battler.hp <= battler.totalhp / 2 &&
(battler.status != :NONE || battler.effects[PBEffects::Confusion] > 0))
# Find all usable items
usableHPItems = []
usableHPItems = []
usableStatusItems = []
usableXItems = []
usableXItems = []
items.each do |i|
next if !i
next if !@battle.pbCanUseItemOnPokemon?(i,pkmn,battler,@battle.scene,false)
next if !ItemHandlers.triggerCanUseInBattle(i,pkmn,battler,nil,
false,self,@battle.scene,false)
# Log HP healing items
if losthp > 0
power = hpItems[i]
if power
usableHPItems.push([i, 5, power])
next
end
next if !@battle.pbCanUseItemOnPokemon?(i, pkmn, battler, @battle.scene, false)
next if !ItemHandlers.triggerCanUseInBattle(i, pkmn, battler, nil, false, self, @battle.scene, false)
itemQuantity = @battle.pbGetOwnerItems(idxBattler).count(i)
# Healing items (potions, berries, etc.)
if hpItems[i] && losthp > 0
priority = 5
# Use lower priority if only 1 or 2 left
priority += 3 if itemQuantity <= 2
usableHPItems.push([i, priority, hpItems[i]])
next
end
# Log Full Restores (HP healer and status curer)
if losthp > 0 || battler.status != :NONE
if fullRestoreItems.include?(i)
usableHPItems.push([i, (preferFullRestore) ? 3 : 7, 999])
usableStatusItems.push([i, (preferFullRestore) ? 3 : 9])
next
# Full Restore items
if fullRestoreItems.include?(i)
if losthp >= battler.totalhp / 4 || battler.status != :NONE || battler.effects[PBEffects::Confusion] > 0
# Only consider Full Restore if HP is below 25% or has status/confusion
priority = preferFullRestore ? 3 : 7
# Raise priority if stock is low to discourage waste
priority += 5 if itemQuantity <= 2
usableHPItems.push([i, priority, battler.totalhp])
usableStatusItems.push([i, preferFullRestore ? 3 : 9])
end
next
end
# Log single status-curing items
if oneStatusItems.include?(i)
# Single-status curers
if oneStatusItems.include?(i) && battler.status != :NONE
usableStatusItems.push([i, 5])
next
end
# Log Full Heal-type items
if allStatusItems.include?(i)
# Full heal-type items
if allStatusItems.include?(i) && battler.status != :NONE
usableStatusItems.push([i, 7])
next
end
# Log stat-raising items
# Stat-raising items
if xItems[i]
data = xItems[i]
usableXItems.push([i, battler.stages[data[0]], data[1]])
next
end
end
# Prioritise using a HP restoration item
if usableHPItems.length>0 && (battler.hp<=battler.totalhp/4 ||
(battler.hp<=battler.totalhp/2 && pbAIRandom(100)<30))
usableHPItems.sort! { |a,b| (a[1]==b[1]) ? a[2]<=>b[2] : a[1]<=>b[1] }
# Prioritise using HP items (including Full Restore if really needed)
if usableHPItems.length > 0 && (battler.hp <= battler.totalhp / 4 ||
(battler.hp <= battler.totalhp / 2 && pbAIRandom(100) < 30))
usableHPItems.sort! { |a, b| (a[1] == b[1]) ? a[2] <=> b[2] : a[1] <=> b[1] }
prevItem = nil
usableHPItems.each do |i|
return i[0], idxTarget if i[2]>=losthp
prevItem = i
end
return prevItem[0], idxTarget
end
# Next prioritise using a status-curing item
if usableStatusItems.length>0 && pbAIRandom(100)<40
usableStatusItems.sort! { |a,b| a[1]<=>b[1] }
return usableStatusItems[0][0], idxTarget
end
# Next try using an X item
if usableXItems.length>0 && pbAIRandom(100)<30
usableXItems.sort! { |a,b| (a[1]==b[1]) ? a[2]<=>b[2] : a[1]<=>b[1] }
prevItem = nil
usableXItems.each do |i|
break if prevItem && i[1]>prevItem[1]
return i[0], idxTarget if i[1]+i[2]>=6
return i[0], idxTarget if i[2] >= losthp
prevItem = i
end
return prevItem[0], idxTarget
+97 -92
View File
@@ -4,77 +4,77 @@ class PokeBattle_AI
# chosen)
#=============================================================================
def pbChooseMoves(idxBattler)
user = @battle.battlers[idxBattler]
user = @battle.battlers[idxBattler]
wildBattler = (@battle.wildBattle? && @battle.opposes?(idxBattler))
skill = 0
skill = 0
if !wildBattler
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill_level || 0
skill = @battle.pbGetOwnerFromBattlerIndex(user.index).skill_level || 0
end
# Get scores and targets for each move
# NOTE: A move is only added to the choices array if it has a non-zero
# score.
choices = []
user.eachMoveWithIndex do |_m,i|
next if !@battle.pbCanChooseMove?(idxBattler,i,false)
choices = []
user.eachMoveWithIndex do |_m, i|
next if !@battle.pbCanChooseMove?(idxBattler, i, false)
if wildBattler
pbRegisterMoveWild(user,i,choices)
pbRegisterMoveWild(user, i, choices)
else
pbRegisterMoveTrainer(user,i,choices,skill)
pbRegisterMoveTrainer(user, i, choices, skill)
end
end
# Figure out useful information about the choices
totalScore = 0
maxScore = 0
maxScore = 0
choices.each do |c|
totalScore += c[1]
maxScore = c[1] if maxScore<c[1]
maxScore = c[1] if maxScore < c[1]
end
# Log the available choices
if $INTERNAL
logMsg = "[AI] Move choices for #{user.pbThis(true)} (#{user.index}): "
choices.each_with_index do |c,i|
choices.each_with_index do |c, i|
logMsg += "#{user.moves[c[0]].name}=#{c[1]}"
logMsg += " (target #{c[2]})" if c[2]>=0
logMsg += ", " if i<choices.length-1
logMsg += " (target #{c[2]})" if c[2] >= 0
logMsg += ", " if i < choices.length - 1
end
PBDebug.log(logMsg)
end
# Find any preferred moves and just choose from them
if !wildBattler && skill>=PBTrainerAI.highSkill && maxScore>100
if !wildBattler && skill >= PBTrainerAI.highSkill && maxScore > 100
stDev = pbStdDev(choices)
if stDev>=40 && pbAIRandom(100)<90
if stDev >= 40 && pbAIRandom(100) < 90
preferredMoves = []
choices.each do |c|
next if c[1]<200 && c[1]<maxScore*0.8
next if c[1] < 200 && c[1] < maxScore * 0.8
preferredMoves.push(c)
preferredMoves.push(c) if c[1]==maxScore # Doubly prefer the best move
preferredMoves.push(c) if c[1] == maxScore # Doubly prefer the best move
end
if preferredMoves.length>0
if preferredMoves.length > 0
m = preferredMoves[pbAIRandom(preferredMoves.length)]
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) prefers #{user.moves[m[0]].name}")
@battle.pbRegisterMove(idxBattler,m[0],false)
@battle.pbRegisterTarget(idxBattler,m[2]) if m[2]>=0
@battle.pbRegisterMove(idxBattler, m[0], false)
@battle.pbRegisterTarget(idxBattler, m[2]) if m[2] >= 0
return
end
end
end
# Decide whether all choices are bad, and if so, try switching instead
if !wildBattler && skill>=PBTrainerAI.highSkill
if !wildBattler && skill >= PBTrainerAI.highSkill
badMoves = false
if (maxScore<=20 && user.turnCount>2) ||
(maxScore<=40 && user.turnCount>5)
badMoves = true if pbAIRandom(100)<80
if (maxScore <= 20 && user.turnCount > 2) ||
(maxScore <= 40 && user.turnCount > 5)
badMoves = true if pbAIRandom(100) < 80
end
if !badMoves && totalScore<100 && user.turnCount>1
if !badMoves && totalScore < 100 && user.turnCount > 1
badMoves = true
choices.each do |c|
next if !user.moves[c[0]].damagingMove?
badMoves = false
break
end
badMoves = false if badMoves && pbAIRandom(100)<10
badMoves = false if badMoves && pbAIRandom(100) < 10
end
if badMoves && pbEnemyShouldWithdrawEx?(idxBattler,true)
if badMoves && pbEnemyShouldWithdrawEx?(idxBattler, true)
if $INTERNAL
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) will switch due to terrible moves")
end
@@ -82,13 +82,13 @@ class PokeBattle_AI
end
end
# If there are no calculated choices, pick one at random
if choices.length==0
if choices.length == 0
PBDebug.log("[AI] #{user.pbThis} (#{user.index}) doesn't want to use any moves; picking one at random")
user.eachMoveWithIndex do |_m,i|
next if !@battle.pbCanChooseMove?(idxBattler,i,false)
choices.push([i,100,-1]) # Move index, score, target
user.eachMoveWithIndex do |_m, i|
next if !@battle.pbCanChooseMove?(idxBattler, i, false)
choices.push([i, 100, -1]) # Move index, score, target
end
if choices.length==0 # No moves are physically possible to use; use Struggle
if choices.length == 0 # No moves are physically possible to use; use Struggle
@battle.pbAutoChooseMove(user.index)
end
end
@@ -96,9 +96,9 @@ class PokeBattle_AI
randNum = pbAIRandom(totalScore)
choices.each do |c|
randNum -= c[1]
next if randNum>=0
@battle.pbRegisterMove(idxBattler,c[0],false)
@battle.pbRegisterTarget(idxBattler,c[2]) if c[2]>=0
next if randNum >= 0
@battle.pbRegisterMove(idxBattler, c[0], false)
@battle.pbRegisterTarget(idxBattler, c[2]) if c[2] >= 0
break
end
# Log the result
@@ -111,40 +111,40 @@ class PokeBattle_AI
# Get scores for the given move against each possible target
#=============================================================================
# Wild Pokémon choose their moves randomly.
def pbRegisterMoveWild(_user,idxMove,choices)
choices.push([idxMove,100,-1]) # Move index, score, target
def pbRegisterMoveWild(_user, idxMove, choices)
choices.push([idxMove, 100, -1]) # Move index, score, target
end
# Trainer Pokémon calculate how much they want to use each of their moves.
def pbRegisterMoveTrainer(user,idxMove,choices,skill)
def pbRegisterMoveTrainer(user, idxMove, choices, skill)
move = user.moves[idxMove]
target_data = move.pbTarget(user)
if target_data.num_targets > 1
# If move affects multiple battlers and you don't choose a particular one
totalScore = 0
@battle.eachBattler do |b|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
score = pbGetMoveScore(move,user,b,skill)
next if !@battle.pbMoveCanTarget?(user.index, b.index, target_data)
score = pbGetMoveScore(move, user, b, skill)
totalScore += ((user.opposes?(b)) ? score : -score)
end
choices.push([idxMove,totalScore,-1]) if totalScore>0
choices.push([idxMove, totalScore, -1]) if totalScore > 0
elsif target_data.num_targets == 0
# If move has no targets, affects the user, a side or the whole field
score = pbGetMoveScore(move,user,user,skill)
choices.push([idxMove,score,-1]) if score>0
score = pbGetMoveScore(move, user, user, skill)
choices.push([idxMove, score, -1]) if score > 0
else
# If move affects one battler and you have to choose which one
scoresAndTargets = []
@battle.eachBattler do |b|
next if !@battle.pbMoveCanTarget?(user.index,b.index,target_data)
next if !@battle.pbMoveCanTarget?(user.index, b.index, target_data)
next if target_data.targets_foe && !user.opposes?(b)
score = pbGetMoveScore(move,user,b,skill)
scoresAndTargets.push([score,b.index]) if score>0
score = pbGetMoveScore(move, user, b, skill)
scoresAndTargets.push([score, b.index]) if score > 0
end
if scoresAndTargets.length>0
if scoresAndTargets.length > 0
# Get the one best target for the move
scoresAndTargets.sort! { |a,b| b[0]<=>a[0] }
choices.push([idxMove,scoresAndTargets[0][0],scoresAndTargets[0][1]])
scoresAndTargets.sort! { |a, b| b[0] <=> a[0] }
choices.push([idxMove, scoresAndTargets[0][0], scoresAndTargets[0][1]])
end
end
end
@@ -152,38 +152,38 @@ class PokeBattle_AI
#=============================================================================
# Get a score for the given move being used against the given target
#=============================================================================
def pbGetMoveScore(move,user,target,skill=100)
skill = PBTrainerAI.minimumSkill if skill<PBTrainerAI.minimumSkill
def pbGetMoveScore(move, user, target, skill = 100)
skill = PBTrainerAI.minimumSkill if skill < PBTrainerAI.minimumSkill
score = 100
score = pbGetMoveScoreFunctionCode(score,move,user,target,skill)
score = pbGetMoveScoreFunctionCode(score, move, user, target, skill)
# A score of 0 here means it absolutely should not be used
return 0 if score<=0
if skill>=PBTrainerAI.mediumSkill
return 0 if score <= 0
if skill >= PBTrainerAI.mediumSkill
# Prefer damaging moves if AI has no more Pokémon or AI is less clever
if @battle.pbAbleNonActiveCount(user.idxOwnSide)==0
if !(skill>=PBTrainerAI.highSkill && @battle.pbAbleNonActiveCount(target.idxOwnSide)>0)
if @battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
if !(skill >= PBTrainerAI.highSkill && @battle.pbAbleNonActiveCount(target.idxOwnSide) > 0)
if move.statusMove?
score /= 1.5
elsif target.hp<=target.totalhp/2
elsif target.hp <= target.totalhp / 2
score *= 1.5
end
end
end
# Don't prefer attacking the target if they'd be semi-invulnerable
if skill>=PBTrainerAI.highSkill && move.accuracy>0 &&
(target.semiInvulnerable? || target.effects[PBEffects::SkyDrop]>=0)
if skill >= PBTrainerAI.highSkill && move.accuracy > 0 &&
(target.semiInvulnerable? || target.effects[PBEffects::SkyDrop] >= 0)
miss = true
miss = false if user.hasActiveAbility?(:NOGUARD) || target.hasActiveAbility?(:NOGUARD)
if miss && pbRoughStat(user,:SPEED,skill)>pbRoughStat(target,:SPEED,skill)
if miss && pbRoughStat(user, :SPEED, skill) > pbRoughStat(target, :SPEED, skill)
# Knows what can get past semi-invulnerability
if target.effects[PBEffects::SkyDrop]>=0
if target.effects[PBEffects::SkyDrop] >= 0
miss = false if move.hitsFlyingTargets?
else
if target.inTwoTurnAttack?("0C9","0CC","0CE") # Fly, Bounce, Sky Drop
if target.inTwoTurnAttack?("0C9", "0CC", "0CE") # Fly, Bounce, Sky Drop
miss = false if move.hitsFlyingTargets?
elsif target.inTwoTurnAttack?("0CA") # Dig
elsif target.inTwoTurnAttack?("0CA") # Dig
miss = false if move.hitsDiggingTargets?
elsif target.inTwoTurnAttack?("0CB") # Dive
elsif target.inTwoTurnAttack?("0CB") # Dive
miss = false if move.hitsDivingTargets?
end
end
@@ -191,11 +191,15 @@ class PokeBattle_AI
score -= 80 if miss
end
# Pick a good move for the Choice items
if user.hasActiveItem?([:CHOICEBAND,:CHOICESPECS,:CHOICESCARF])
if move.baseDamage>=60; score += 60
elsif move.damagingMove?; score += 30
elsif move.function=="0F2"; score += 70 # Trick
else; score -= 60
if user.hasActiveItem?([:CHOICEBAND, :CHOICESPECS, :CHOICESCARF])
if move.baseDamage >= 60;
score += 60
elsif move.damagingMove?;
score += 30
elsif move.function == "0F2";
score += 70 # Trick
else
; score -= 60
end
end
# If user is asleep, prefer moves that are usable while asleep
@@ -229,17 +233,18 @@ class PokeBattle_AI
end
# Adjust score based on how much damage it can deal
if move.damagingMove?
score = pbGetMoveScoreDamage(score,move,user,target,skill)
else # Status moves
score = pbGetMoveScoreDamage(score, move, user, target, skill)
else
# Status moves
# Don't prefer attacks which don't deal damage
score -= 10
# Account for accuracy of move
accuracy = pbRoughAccuracy(move,user,target,skill)
score *= accuracy/100.0
score = 0 if score<=10 && skill>=PBTrainerAI.highSkill
accuracy = pbRoughAccuracy(move, user, target, skill)
score *= accuracy / 100.0
score = 0 if score <= 10 && skill >= PBTrainerAI.highSkill
end
score = score.to_i
score = 0 if score<0
score = 0 if score < 0
return score
end
@@ -247,27 +252,27 @@ class PokeBattle_AI
# Add to a move's score based on how much damage it will deal (as a percentage
# of the target's current HP)
#=============================================================================
def pbGetMoveScoreDamage(score,move,user,target,skill)
def pbGetMoveScoreDamage(score, move, user, target, skill)
# Don't prefer moves that are ineffective because of abilities or effects
return 0 if score<=0 || pbCheckMoveImmunity(score,move,user,target,skill)
return 0 if score <= 0 || pbCheckMoveImmunity(score, move, user, target, skill)
# Calculate how much damage the move will do (roughly)
baseDmg = pbMoveBaseDamage(move,user,target,skill)
realDamage = pbRoughDamage(move,user,target,skill,baseDmg)
baseDmg = pbMoveBaseDamage(move, user, target, skill)
realDamage = pbRoughDamage(move, user, target, skill, baseDmg)
# Account for accuracy of move
accuracy = pbRoughAccuracy(move,user,target,skill)
realDamage *= accuracy/100.0
accuracy = pbRoughAccuracy(move, user, target, skill)
realDamage *= accuracy / 100.0
# Two-turn attacks waste 2 turns to deal one lot of damage
if move.chargingTurnMove? || move.function=="0C2" # Hyper Beam
realDamage *= 2/3 # Not halved because semi-invulnerable during use or hits first turn
if move.chargingTurnMove? || move.function == "0C2" # Hyper Beam
realDamage *= 2 / 3 # Not halved because semi-invulnerable during use or hits first turn
end
# Prefer flinching external effects (note that move effects which cause
# flinching are dealt with in the function code part of score calculation)
if skill>=PBTrainerAI.mediumSkill
if skill >= PBTrainerAI.mediumSkill
if !target.hasActiveAbility?(:INNERFOCUS) &&
!target.hasActiveAbility?(:SHIELDDUST) &&
target.effects[PBEffects::Substitute]==0
!target.hasActiveAbility?(:SHIELDDUST) &&
target.effects[PBEffects::Substitute] == 0
canFlinch = false
if move.canKingsRock? && user.hasActiveItem?([:KINGSROCK,:RAZORFANG])
if move.canKingsRock? && user.hasActiveItem?([:KINGSROCK, :RAZORFANG])
canFlinch = true
end
if user.hasActiveAbility?(:STENCH) && !move.flinchingMove?
@@ -277,14 +282,14 @@ class PokeBattle_AI
end
end
# Convert damage to percentage of target's remaining HP
damagePercentage = realDamage*100.0/target.hp
damagePercentage = realDamage * 100.0 / target.hp
# Don't prefer weak attacks
# damagePercentage /= 2 if damagePercentage<20
# damagePercentage /= 2 if damagePercentage<20
# Prefer damaging attack if level difference is significantly high
damagePercentage *= 1.2 if user.level-10>target.level
damagePercentage *= 1.2 if user.level - 10 > target.level
# Adjust score
damagePercentage = 120 if damagePercentage>120 # Treat all lethal moves the same
damagePercentage += 40 if damagePercentage>100 # Prefer moves likely to be lethal
damagePercentage = 120 if damagePercentage > 120 # Treat all lethal moves the same
damagePercentage += 40 if damagePercentage > 100 # Prefer moves likely to be lethal
score += damagePercentage.to_i
return score
end
@@ -177,7 +177,8 @@ BallHandlers::ModifyCatchRate.add(:LEVELBALL,proc { |ball,catchRate,battle,battl
BallHandlers::ModifyCatchRate.add(:LUREBALL,proc { |ball,catchRate,battle,battler,ultraBeast|
multiplier = (Settings::NEW_POKE_BALL_CATCH_RATES) ? 5 : 3
catchRate *= multiplier if GameData::EncounterType.get($PokemonTemp.encounterType).type == :fishing
encounterType = GameData::EncounterType.try_get($PokemonTemp.encounterType)
catchRate *= multiplier if encounterType.is_a?(GameData::EncounterType) && encounterType.type == :fishing
next [catchRate,255].min
})
@@ -93,9 +93,9 @@ class PokemonDataBox < SpriteWrapper
def initializeOtherGraphics(viewport)
# Create other bitmaps
@numbersBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/icon_numbers"))
@hpBarBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/overlay_hp"))
@expBarBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/overlay_exp"))
@numbersBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/icon_numbers")
@hpBarBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/overlay_hp")
@expBarBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/overlay_exp")
# Create sprite to draw HP numbers on
@hpNumbers = BitmapSprite.new(124,16,viewport)
pbSetSmallFont(@hpNumbers.bitmap)
@@ -235,9 +235,9 @@ class PokemonDataBox < SpriteWrapper
# Draw Pokémon's gender symbol
case @battler.displayGender
when 0 # Male
textPos.push([_INTL(""),@spriteBaseX+126,0,false,MALE_BASE_COLOR,MALE_SHADOW_COLOR])
textPos.push(["",@spriteBaseX+126,0,false,MALE_BASE_COLOR,MALE_SHADOW_COLOR])
when 1 # Female
textPos.push([_INTL(""),@spriteBaseX+126,0,false,FEMALE_BASE_COLOR,FEMALE_SHADOW_COLOR])
textPos.push(["",@spriteBaseX+126,0,false,FEMALE_BASE_COLOR,FEMALE_SHADOW_COLOR])
end
pbDrawTextPositions(self.bitmap,textPos)
# Draw Pokémon's level
@@ -450,7 +450,7 @@ class AbilitySplashBar < SpriteWrapper
@side = side
@battler = nil
# Create sprite wrapper that displays background graphic
@bgBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/ability_bar"))
@bgBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/ability_bar")
@bgSprite = SpriteWrapper.new(viewport)
@bgSprite.bitmap = @bgBitmap.bitmap
@bgSprite.src_rect.y = (side==0) ? 0 : @bgBitmap.height/2
@@ -129,7 +129,7 @@ class CommandMenuDisplay < BattleMenuBase
background.setBitmap("Graphics/Pictures/Battle/overlay_command")
addSprite("background",background)
# Create bitmaps
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_command"))
@buttonBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_command")
# Create action buttons
@buttons = Array.new(4) do |i| # 4 command options, therefore 4 buttons
button = SpriteWrapper.new(viewport)
@@ -229,10 +229,10 @@ class FightMenuDisplay < BattleMenuBase
# 0=don't show, 1=show unpressed, 2=show pressed
if USE_GRAPHICS
# Create bitmaps
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_fight"))
@typeBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
@megaEvoBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_mega"))
@shiftBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_shift"))
@buttonBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_fight")
@typeBitmap = AnimatedBitmap.new("Graphics/Pictures/types")
@megaEvoBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_mega")
@shiftBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_shift")
# Create background graphic
background = IconSprite.new(0,Graphics.height-96,viewport)
background.setBitmap("Graphics/Pictures/Battle/overlay_fight")
@@ -468,7 +468,7 @@ class TargetMenuDisplay < BattleMenuBase
# NOTE: @mode is for which buttons are shown as selected.
# 0=select 1 button (@index), 1=select all buttons with text
# Create bitmaps
@buttonBitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Battle/cursor_target"))
@buttonBitmap = AnimatedBitmap.new("Graphics/Pictures/Battle/cursor_target")
# Create target buttons
@buttons = Array.new(maxIndex+1) do |i|
numButtons = @sideSizes[i%2]
@@ -124,7 +124,7 @@ class PokeBattle_Scene
time = getBackdropTimeSuffix()
base_path = getBackdropBasePath(backdrop_type)
default_name = base_path + filename
time_adjusted_name = _INTL("{1}{2}_{3}",base_path,filename,time)
time_adjusted_name = "#{base_path}#{filename}_#{time}"
if pbResolveBitmap(time_adjusted_name)
return time_adjusted_name
end
@@ -85,7 +85,7 @@ def pbStartOver(gameover=false)
$game_variables[VAR_CURRENT_GYM_TYPE]=-1
$game_switches[SWITCH_LOCK_PLAYER_MOVEMENT]=false
$game_switches[SWITCH_TEAMED_WITH_ERIKA_SEWERS]=false
$PokemonTemp.enteredSecretBaseController=nil
clear_all_images()
$game_player.set_opacity(255)
$game_system.menu_disabled=false
+11 -12
View File
@@ -339,7 +339,7 @@ Events.onMapChange += proc { |_sender, e|
# 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 "{1} is on map {2}",roamer_id,$game_map.map_id
# echoln $PokemonGlobal.roamPokemon
# if roamerOnCurrentMap
# next if $PokemonGlobal.roamPokemonCaught[roamer_id]
@@ -844,7 +844,7 @@ def pbItemBall(item, quantity = 1, item_name = "", canRandom = true)
pocket = item.pocket
move = item.move
if $PokemonBag.pbStoreItem(item, quantity) # If item can be picked up
meName = (item.is_key_item?) ? "Key item get" : "Item get"
meName = (item.is_key_item?) ? _INTL("Key item get") : _INTL("Item get")
text_color = item.is_key_item? ? "\\c[3]" : "\\c[1]"
if item == :LEFTOVERS
@@ -852,11 +852,11 @@ def pbItemBall(item, quantity = 1, item_name = "", canRandom = true)
elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
elsif quantity > 1
pbMessage(_INTL("\\me[{1}]You found {2} #{text_color}{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
pbMessage(_INTL("\\me[{1}]You found {2} {4}{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname, text_color))
elsif itemname.starts_with_vowel?
pbMessage(_INTL("\\me[{1}]You found an #{text_color}{2}\\c[0]!\\wtnp[30]", meName, itemname))
pbMessage(_INTL("\\me[{1}]You found an {3}{2}\\c[0]!\\wtnp[30]", meName, itemname, text_color))
else
pbMessage(_INTL("\\me[{1}]You found a #{text_color}{2}\\c[0]!\\wtnp[30]", meName, itemname))
pbMessage(_INTL("\\me[{1}]You found a {3}{2}\\c[0]!\\wtnp[30]", meName, itemname, text_color))
end
pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
itemname, pocket, PokemonBag.pocketNames()[pocket]))
@@ -907,7 +907,7 @@ def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = t
itemname = (quantity > 1) ? item.name_plural : item.name
pocket = item.pocket
move = item.move
meName = (item.is_key_item?) ? "Key item get" : "Item get"
meName = (item.is_key_item?) ? _INTL("Key item get") : _INTL("Item get")
text_color = item.is_key_item? ? "\\c[3]" : "\\c[1]"
if item == :LEFTOVERS || item == :MUSHROOMSPORES
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
@@ -917,16 +917,15 @@ def pbReceiveItem(item, quantity = 1, item_name = "", music = nil, canRandom = t
# end
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
elsif quantity > 1
pbMessage(_INTL("\\me[{1}]You obtained {2} #{text_color}{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname))
pbMessage(_INTL("\\me[{1}]You obtained {2} {4}{3}\\c[0]!\\wtnp[30]", meName, quantity, itemname, text_color))
elsif itemname.starts_with_vowel?
pbMessage(_INTL("\\me[{1}]You obtained an #{text_color}{2}\\c[0]!\\wtnp[30]", meName, itemname))
pbMessage(_INTL("\\me[{1}]You obtained an {3}{2}\\c[0]!\\wtnp[30]", meName, itemname, text_color))
else
pbMessage(_INTL("\\me[{1}]You obtained a #{text_color}{2}\\c[0]!\\wtnp[30]", meName, itemname))
pbMessage(_INTL("\\me[{1}]You obtained a {3}{2}\\c[0]!\\wtnp[30]", meName, itemname, text_color))
end
promptRegisterItem(item)
if $PokemonBag.pbStoreItem(item, quantity) # If item can be added
pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].",
itemname, pocket, PokemonBag.pocketNames()[pocket]))
pbMessage(_INTL("You put the {1} away\\nin the <icon=bagPocket{2}>\\c[1]{3} Pocket\\c[0].", itemname, pocket, PokemonBag.pocketNames()[pocket]))
updatePinkanBerryDisplay()
return true
end
@@ -959,4 +958,4 @@ def randomizeGymTM(old_item)
return old_item if !typed_tms_array
return old_item if idx > typed_tms_array.size
return typed_tms_array[idx]
end
end
@@ -567,7 +567,7 @@ end
#party: array of pokemon team
# [[:SPECIES,level], ... ]
#
def customTrainerBattle(trainerName, trainerType, party_array, default_level=50, endSpeech="", sprite_override=nil,custom_appearance=nil)
def customTrainerBattle(trainerName, trainerType, party_array, default_level=50, endSpeech="", sprite_override=nil,custom_appearance=nil, items = [])
# trainerID= "customTrainer"
@@ -584,6 +584,7 @@ def customTrainerBattle(trainerName, trainerType, party_array, default_level=50,
#trainer = GameData::Trainer.new(trainer_info_hash)
trainer = NPCTrainer.new(trainerName,trainerType,sprite_override,custom_appearance)
trainer.lose_text=endSpeech
trainer.items = items
party = []
party_array.each { |pokemon|
if pokemon.is_a?(Pokemon)
@@ -31,7 +31,6 @@ class PokemonEncounters
if $game_switches && $game_switches[SWITCH_RANDOM_WILD] && $game_switches[SWITCH_RANDOM_WILD_AREA]
mode= GameData::EncounterRandom
end
echoln mode
return mode
end
@@ -379,7 +379,7 @@ def pbSurfacing
move = :DIVE
movefinder = $Trainer.get_pokemon_with_move(move)
# if !pbCheckHiddenMoveBadge(Settings::BADGE_FOR_DIVE, false) || (!$DEBUG && !movefinder)
# pbMessage(_INTL("Light is filtering down from above. A Pokémon may be able to surface here."))
# pbMessage("Light is filtering down from above. A Pokémon may be able to surface here.")
# return false
# end
if pbConfirmMessage(_INTL("Light is filtering down from above. Would you like to use Dive?"))
@@ -587,6 +587,33 @@ def pbFly(move, pokemon)
return true
end
Events.onAction += proc { |_sender, _e|
terrain = $game_player.pbFacingTerrainTag
if terrain.can_secret_base
pbSecretPower(terrain)
end
}
def pbSecretPower(terrain)
return if $PokemonGlobal.surfing
return unless $game_player.direction == DIRECTION_UP
move = :SECRETPOWER
movefinder = $Trainer.get_pokemon_with_move(move)
return if !movefinder
speciesname = (movefinder) ? movefinder.name : $Trainer.name
biomeType = getSecretBaseBiome(terrain)
baseLayoutType = pickSecretBaseLayout(biomeType)
if biomeType && baseLayoutType
pbMessage(_INTL("{1} used {2}!", speciesname, GameData::Move.get(move).name))
pbHiddenMoveAnimation(movefinder)
pbSecretBase(biomeType,baseLayoutType)
end
end
#===============================================================================
# Headbutt
#===============================================================================
@@ -647,6 +674,13 @@ HiddenMoveHandlers::UseMove.add(:HEADBUTT, proc { |move, pokemon|
pbHeadbuttEffect(facingEvent)
})
HiddenMoveHandlers::UseMove.add(:SECRETPOWER, proc { |move, pokemon|
if !pbHiddenMoveAnimation(pokemon)
pbMessage(_INTL("{1} used {2}!", pokemon.name, GameData::Move.get(move).name))
end
})
HiddenMoveHandlers::CanUseMove.add(:RELICSONG, proc { |move, pokemon, showmsg|
if !(pokemon.isFusionOf(:MELOETTA_A) || pokemon.isFusionOf(:MELOETTA_P))
pbMessage(_INTL("It won't have any effect")) if showmsg
@@ -754,7 +788,7 @@ HiddenMoveHandlers::UseMove.add(:ROCKSMASH, proc { |move, pokemon|
#===============================================================================
def pbStrength
if $PokemonMap.strengthUsed
#pbMessage(_INTL("Strength made it possible to move boulders around."))
#pbMessage("Strength made it possible to move boulders around.")
return false
end
move = :STRENGTH
@@ -942,6 +976,10 @@ Events.onAction += proc { |_sender, _e|
pbWildBattle(:TRUBBISH, 10)
$PokemonGlobal.stepcount += 1
end
else
if Settings::GAME_ID == :IF_HOENN
pbMessage(_INTL("There's nothing but trash..."))
end
end
}
@@ -1071,17 +1109,17 @@ HiddenMoveHandlers::UseMove.add(:WHIRLWIND, proc { |move, pokemon|
# HiddenMoveHandlers::CanUseMove.add(:TELEPORT,proc { |move,pkmn,showmsg|
# if !GameData::MapMetadata.exists?($game_map.map_id) ||
# !GameData::MapMetadata.get($game_map.map_id).outdoor_map
# pbMessage(_INTL("Can't use that here.")) if showmsg
# pbMessage("Can't use that here.") if showmsg
# next false
# end
# healing = $PokemonGlobal.healingSpot
# healing = GameData::Metadata.get.home if !healing # Home
# if !healing
# pbMessage(_INTL("Can't use that here.")) if showmsg
# pbMessage("Can't use that here.") if showmsg
# next false
# end
# if $game_player.pbHasDependentEvents?
# pbMessage(_INTL("It can't be used when you have someone with you.")) if showmsg
# pbMessage("It can't be used when you have someone with you.") if showmsg
# next false
# end
# next true
@@ -1092,7 +1130,7 @@ HiddenMoveHandlers::UseMove.add(:WHIRLWIND, proc { |move, pokemon|
# healing = GameData::Metadata.get.home if !healing # Home
# next false if !healing
# mapname = pbGetMapNameFromId(healing[0])
# next pbConfirmMessage(_INTL("Want to return to the healing spot used last in {1}?",mapname))
# next pbConfirmMessage("Want to return to the healing spot used last in {1}?",mapname)
# })
#
# HiddenMoveHandlers::UseMove.add(:TELEPORT,proc { |move,pokemon|
@@ -1100,7 +1138,7 @@ HiddenMoveHandlers::UseMove.add(:WHIRLWIND, proc { |move, pokemon|
# healing = GameData::Metadata.get.home if !healing # Home
# next false if !healing
# if !pbHiddenMoveAnimation(pokemon)
# pbMessage(_INTL("{1} used {2}!",pokemon.name,GameData::Move.get(move).name))
# pbMessage("{1} used {2}!",pokemon.name,GameData::Move.get(move).name)
# end
# pbFadeOutIn {
# $game_temp.player_new_map_id = healing[0]
+59 -59
View File
@@ -868,65 +868,65 @@ ItemHandlers::UseOnPokemon.add(:GRACIDEA, proc { |item, pkmn, scene|
next true
})
ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 0
scene.pbDisplay(_INTL("It had no effect."))
next false
end
if pkmn.fainted?
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
end
pkmn.setForm(0) {
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
next true
})
ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 1
scene.pbDisplay(_INTL("It had no effect."))
next false
end
if pkmn.fainted?
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
end
pkmn.setForm(1) {
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
next true
})
ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 2
scene.pbDisplay(_INTL("It had no effect."))
next false
end
if pkmn.fainted?
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
end
pkmn.setForm(2) {
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
next true
})
ItemHandlers::UseOnPokemon.add(:PURPLENECTAR, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 3
scene.pbDisplay(_INTL("It had no effect."))
next false
end
if pkmn.fainted?
scene.pbDisplay(_INTL("This can't be used on the fainted Pokémon."))
end
pkmn.setForm(3) {
scene.pbRefresh
scene.pbDisplay(_INTL("{1} changed form!", pkmn.name))
}
next true
})
# ItemHandlers::UseOnPokemon.add(:REDNECTAR, proc { |item, pkmn, scene|
# if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 0
# scene.pbDisplay("It had no effect.")
# next false
# end
# if pkmn.fainted?
# scene.pbDisplay("This can't be used on the fainted Pokémon.")
# end
# pkmn.setForm(0) {
# scene.pbRefresh
# scene.pbDisplay("{1} changed form!", pkmn.name)
# }
# next true
# })
#
# ItemHandlers::UseOnPokemon.add(:YELLOWNECTAR, proc { |item, pkmn, scene|
# if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 1
# scene.pbDisplay("It had no effect.")
# next false
# end
# if pkmn.fainted?
# scene.pbDisplay("This can't be used on the fainted Pokémon.")
# end
# pkmn.setForm(1) {
# scene.pbRefresh
# scene.pbDisplay("{1} changed form!", pkmn.name)
# }
# next true
# })
#
# ItemHandlers::UseOnPokemon.add(:PINKNECTAR, proc { |item, pkmn, scene|
# if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 2
# scene.pbDisplay("It had no effect.")
# next false
# end
# if pkmn.fainted?
# scene.pbDisplay("This can't be used on the fainted Pokémon.")
# end
# pkmn.setForm(2) {
# scene.pbRefresh
# scene.pbDisplay("{1} changed form!", pkmn.name)
# }
# next true
# })
#
# ItemHandlers::UseOnPokemon.add(:PURPLENECTAR, proc { |item, pkmn, scene|
# if !pkmn.isSpecies?(:ORICORIO) || pkmn.form == 3
# scene.pbDisplay("It had no effect.")
# next false
# end
# if pkmn.fainted?
# scene.pbDisplay("This can't be used on the fainted Pokémon.")
# end
# pkmn.setForm(3) {
# scene.pbRefresh
# scene.pbDisplay("{1} changed form!", pkmn.name)
# }
# next true
# })
ItemHandlers::UseOnPokemon.add(:REVEALGLASS, proc { |item, pkmn, scene|
if !pkmn.isSpecies?(:TORNADUS) &&
@@ -53,7 +53,7 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok
# than one unfainted opposing Pokémon. (Snag Balls can be thrown in
# this case, but only in trainer battles, and the trainer will deflect
# them if they are trying to catch a non-Shadow Pokémon.)
if battle.pbOpposingBattlerCount>1 && !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?)
if battle.pbOpposingBattlerCount>1 && $game_switches[SWITCH_SILVERBOSS_BATTLE]# !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?)
if battle.pbOpposingBattlerCount==2
if $game_switches[SWITCH_SILVERBOSS_BATTLE]
scene.pbDisplay(_INTL("It's no good! It's still too agitated to aim!")) if showMessages
+3 -4
View File
@@ -47,8 +47,7 @@ def pbPhoneRegisterBattle(message,event,trainertype,trainername,maxbattles)
return if contact && contact[0] # Existing contact and is visible
message = _INTL("Let me register you.") if !message
return if !pbConfirmMessage(message)
displayname = _INTL("{1} {2}", GameData::TrainerType.get(trainertype).name,
pbGetMessageFromHash(MessageTypes::TrainerNames,trainername))
displayname = "#{GameData::TrainerType.get(trainertype).name} #{pbGetMessageFromHash(MessageTypes::TrainerNames,trainername)}"
if contact # Previously registered, just make visible
contact[0] = true
else # Add new contact
@@ -286,7 +285,7 @@ end
# The phone call itself
#===============================================================================
def pbPhoneCall(call,phonenum)
pbMessage(_INTL("......\\wt[5] ......\\1"))
pbMessage("......\\wt[5] ......\\1")
encspecies = pbEncounterSpecies(phonenum)
trainerspecies = pbTrainerSpecies(phonenum)
trainermap = pbTrainerMapName(phonenum)
@@ -299,5 +298,5 @@ def pbPhoneCall(call,phonenum)
messages[i] += "\\1" if i<messages.length-1
pbMessage(messages[i])
end
pbMessage(_INTL("Click!\\wt[10]\n......\\wt[5] ......\\1"))
pbMessage("Click!\\wt[10]\n......\\wt[5] ......\\1")
end
+3 -3
View File
@@ -15,7 +15,7 @@ def pbCanUsePokeRadar?
# Can't use Radar if not in tall grass
terrain = $game_map.terrain_tag($game_player.x, $game_player.y)
# if !terrain.land_wild_encounters || !terrain.shows_grass_rustle
# pbMessage(_INTL("Can't use that here."))
# pbMessage("Can't use that here.")
# return false
# end
if $PokemonEncounters.encounter_type == nil
@@ -24,12 +24,12 @@ def pbCanUsePokeRadar?
end
# Can't use Radar if map has no grass-based encounters (ignoring Bug Contest)
# if !$PokemonEncounters.has_normal_land_encounters?
# pbMessage(_INTL("Can't use that here."))
# pbMessage("Can't use that here.")
# return false
# end
# Can't use Radar while cycling
# if $PokemonGlobal.bicycle
# pbMessage(_INTL("Can't use that while on a bicycle."))
# pbMessage("Can't use that while on a bicycle.")
# return false
# end
# Debug
+1
View File
@@ -121,6 +121,7 @@ class PokemonBag
def pbQuantity(item)
item = GameData::Item.get(item)
return 0 unless item
pocket = item.pocket
return ItemStorageHelper.pbQuantity(@pockets[pocket], item.id)
end
@@ -54,7 +54,8 @@ end
class PokemonStorage
attr_reader :boxes
attr_accessor :boxes
attr_accessor :transfer_box
attr_accessor :currentBox
attr_writer :unlockedWallpapers
BASICWALLPAPERQTY = 16
@@ -65,6 +66,7 @@ class PokemonStorage
@boxes[i] = PokemonBox.new(_INTL("Box {1}",i+1),maxPokemon)
@boxes[i].background = i % BASICWALLPAPERQTY
end
@boxes
@currentBox = 0
@boxmode = -1
@unlockedWallpapers = []
@@ -79,20 +81,34 @@ class PokemonStorage
def allWallpapers
return [
# Basic wallpapers
_INTL("Forest"),_INTL("City"),_INTL("Desert"),_INTL("Savanna"),
_INTL("Crag"),_INTL("Volcano"),_INTL("Snow"),_INTL("Cave"),
_INTL("Beach"),_INTL("Seafloor"),_INTL("River"),_INTL("Sky"),
_INTL("Poké Center"),_INTL("Machine"),_INTL("Checks"),_INTL("Simple"),
_INTL("Forest"),_INTL("City"),_INTL("Desert"),_INTL("Savanna"), #0-3
_INTL("Crag"),_INTL("Volcano"),_INTL("Snow"),_INTL("Cave"), #4-7
_INTL("Beach"),_INTL("Seafloor"),_INTL("River"),_INTL("Sky"), #8-11
_INTL("Poké Center"),_INTL("Machine"),_INTL("Checks"),_INTL("Simple"), #12-15
# Special wallpapers
_INTL("Space"),_INTL("Backyard"),_INTL("Nostalgic 1"),_INTL("Torchic"),
_INTL("Trio 1"),_INTL("PikaPika 1"),_INTL("Legend 1"),_INTL("Team Galactic 1"),
_INTL("Distortion"),_INTL("Contest"),_INTL("Nostalgic 2"),_INTL("Croagunk"),
_INTL("Trio 2"),_INTL("PikaPika 2"),_INTL("Legend 2"),_INTL("Team Galactic 2"),
_INTL("Heart"),_INTL("Soul"),_INTL("Big Brother"),_INTL("Pokéathlon"),
_INTL("Trio 3"),_INTL("Spiky Pika"),_INTL("Kimono Girl"),_INTL("Revival")
_INTL("Space"),_INTL("Backyard"),_INTL("Nostalgic 1"),_INTL("Torchic"), #16-19
_INTL("Trio 1"),_INTL("PikaPika 1"),_INTL("Legend 1"),_INTL("Team Galactic 1"), #20-23
_INTL("Distortion"),_INTL("Contest"),_INTL("Nostalgic 2"),_INTL("Croagunk"), #24-27
_INTL("Trio 2"),_INTL("PikaPika 2"),_INTL("Legend 2"),_INTL("Team Galactic 2"), #28-31
_INTL("Heart"),_INTL("Soul"),_INTL("Big Brother"),_INTL("Pokéathlon"), #32-35
_INTL("Trio 3"),_INTL("Spiky Pika"),_INTL("Kimono Girl"),_INTL("Rocket"), #36-39
_INTL("Noctowl"),_INTL("Pink Moon"),_INTL("Entree Forest"),_INTL("Poké Ball Mayhem"), #40-43
_INTL("Discord"),_INTL("HELLO"),_INTL("Sky 2"),_INTL("Ice Fishing"), #44-47
_INTL("Rafflesia"),_INTL("Dancing Frog"),_INTL("Crab"),_INTL("Flannery"), #48-51
_INTL("Norman"),_INTL("Roxanne"),_INTL("Tate & Liza"),_INTL("Wallace"), #52-55
_INTL("Rotom Dex 1"),_INTL("Rotom Dex 2"),_INTL("Happy Hypno"),_INTL("Fossil Shark"), #56-59
_INTL("Camping"),_INTL("Swimming"),_INTL("Nostalgic 3"),_INTL("Graffiti"), #60-63
_INTL("Ruins"),_INTL("Digital"),_INTL("Galactic"),_INTL("Sinnoh"), #64-67
_INTL("PC"),_INTL("Ancient Sea"),_INTL("Cat Playroom"),_INTL("Softboiled"), #68-71
_INTL("Electric Mouse"),_INTL("Sailing"),_INTL("Forest 2"),_INTL("Graveyard"), #72-75
_INTL("Eon"),_INTL("Quest"),_INTL("Pink Stars"),_INTL("Party Hard"), #76-79
_INTL("Espurr"),_INTL("Nostalgic 4"),_INTL("Dark Forest"), #80-82
]
end
def unlockedWallpapers
@unlockedWallpapers = [] if !@unlockedWallpapers
return @unlockedWallpapers
@@ -133,7 +149,7 @@ class PokemonStorage
end
def maxPokemon(box)
return 0 if box >= self.maxBoxes
return 0 if box >= self.maxBoxes && !self[box].is_a?(StorageTransferBox)
return (box < 0) ? Settings::MAX_PARTY_SIZE : self[box].length
end
@@ -227,6 +243,11 @@ class PokemonStorage
end
def pbStoreCaught(pkmn)
if self[@currentBox].is_a?(StorageTransferBox)
@currentBox = 0
end
if @currentBox>=0
pkmn.time_form_set = nil
#pkmn.form = 0 if pkmn.isSpecies?(:SHAYMIN)
+8 -2
View File
@@ -25,6 +25,8 @@ class Pokemon
attr_accessor :hat
attr_accessor :hat_x
attr_accessor :hat_y
attr_accessor :hat_mirrored_horizontal
attr_accessor :hat_mirrored_vertical
# @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
@@ -56,7 +58,7 @@ class Pokemon
attr_accessor :moves
# @return [Array<Symbol>] All the move (ids) ever learned by this Pokémon
attr_accessor :learned_moves
attr_reader :learned_moves
# @return [Array<Integer>] the IDs of moves known by this Pokémon when it was obtained
attr_accessor :first_moves
@@ -891,6 +893,7 @@ class Pokemon
end
# Silently learns the given move. Will erase the first known move if it has to.
# @param move_id [Symbol, String, Integer] ID of the move to learn
def learn_move(move_id)
@@ -1244,7 +1247,7 @@ class Pokemon
current_head = @species_data.head_pokemon
choices = [
#_INTL("Evolve both!"),
# "Evolve both!",
_INTL("Evolve head!"),
_INTL("Evolve body!"),
_INTL("Don't evolve")
@@ -1599,6 +1602,9 @@ class Pokemon
@hat = nil
@hat_x = 0
@hat_y = 0
@hat_mirrored_horizontal = false
@hat_mirrored_vertical = false
@size_category = determine_size_category()
@sprite_scale=determine_scale()
calc_stats
@@ -14,6 +14,8 @@ class Trainer
attr_accessor :lowest_difficulty
attr_accessor :selected_difficulty
attr_accessor :game_mode
attr_accessor :quest_points
attr_accessor :secretBase_uuid
def inspect
str = super.chop
@@ -23,7 +25,7 @@ class Trainer
end
def full_name
return _INTL("{1} {2}", trainer_type_name, @name)
return "#{trainer_type_name} #{@name}"
end
#=============================================================================
@@ -225,6 +227,7 @@ class Trainer
@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
@quest_points = 0
end
end
@@ -38,8 +38,7 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
params = ChooseNumberParams.new
params.setRange(1, GameData::GrowthRate.max_level)
params.setDefaultValue(10)
level = pbMessageChooseNumber(_INTL("Set the level for {1} (max. #{params.maxNumber}).",
GameData::Species.get(species).name), params)
level = pbMessageChooseNumber(_INTL("Set the level for {1} (max. {2}).", GameData::Species.get(species).name, params.maxNumber), params)
party.push([species, level])
break
else
@@ -124,7 +123,7 @@ def pbMissingTrainer(tr_type, tr_name, tr_version)
raise _INTL("Trainer type {1} does not exist.", tr_type) if !tr_type_data
tr_type = tr_type_data.id
if !$DEBUG
#raise _INTL("Can't find trainer ({1}, {2}, ID {3})", tr_type.to_s, tr_name, tr_version)
#raise "Can't find trainer ({1}, {2}, ID {3})", tr_type.to_s, tr_name, tr_version
message = ""
if $game_switches[SWITCH_MODERN_MODE]
message << "[MODERN MODE] "
@@ -17,7 +17,7 @@ class TrainerWalkingCharSprite < SpriteWrapper
@animbitmap.dispose if @animbitmap
@animbitmap = nil
outfit_bitmap = _INTL("Graphics/Characters/players/outfits/{1}_{2}",value,$Trainer.outfit) if $Trainer && $Trainer.outfit
outfit_bitmap = "Graphics/Characters/players/outfits/#{value}_#{$Trainer.outfit}" if $Trainer && $Trainer.outfit
@trainer = $Trainer if !@trainer
if $Trainer
@@ -422,12 +422,18 @@ class HallOfFame_Scene
if $game_switches[SWITCH_RANDOMIZED_AT_LEAST_ONCE]
gameMode = "Randomized mode"
end
if $game_switches[SWITCH_LEGENDARY_MODE]
gameMode = "Legendary mode"
end
if $game_switches[ENABLED_DEBUG_MODE_AT_LEAST_ONCE] || $DEBUG
gameMode = "Debug mode"
end
return gameMode
end
def writeGameMode(overlay, x, y, gameMode = nil, difficulty = nil)
gameMode = getCurrentGameMode() if !gameMode
difficulty = getDifficulty() if !difficulty
@@ -78,6 +78,9 @@ Gameplay / Story :
Chardub
Kiwikelly
Title screen and logo
Doctor Miawoo
Custom sprites collecting and handling
Kiwikelly, Payapon, Thornsoflight
@@ -104,6 +107,14 @@ Kiwikelly<s>Knuckles
UnworthyPie<s>Doctor Miawoo
Chardub<s>TCGrunler#4583
Elite 4 rematch teams
duskrd<s>anaconja<s>taraline
French translation
anthonygourmand
locpic_
blood.wolf58 (Willi)
The following free ressources were also used
with their respective authors' consent:
+1 -1
View File
@@ -45,7 +45,7 @@ class PokemonPokedexMenu_Scene
@viewport.z = 99999
@sprites = {}
@sprites["background"] = IconSprite.new(0,0,@viewport)
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_menu"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_menu")
@sprites["headings"]=Window_AdvancedTextPokemon.newWithSize(
_INTL("<c3=F8F8F8,C02028>SEEN<r>OBTAINED</c3>"),286,136,208,64,@viewport)
@sprites["headings"].windowskin = nil
+3 -8
View File
@@ -234,11 +234,11 @@ class PokemonPokedex_Scene
def pbStartScene(filter_owned=false)
@filter_owned=filter_owned
@sliderbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_slider")
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_types")
@shapebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_shapes")
@hwbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_hw")
@selbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_searchsel")
@searchsliderbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_searchslider"))
@searchsliderbitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_searchslider")
@sprites = {}
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z = 99999
@@ -1034,12 +1034,7 @@ class PokemonPokedex_Scene
@orderCommands[MODELIGHTEST] = _INTL("Lightest")
@orderCommands[MODETALLEST] = _INTL("Tallest")
@orderCommands[MODESMALLEST] = _INTL("Smallest")
@nameCommands = [_INTL("A"),_INTL("B"),_INTL("C"),_INTL("D"),_INTL("E"),
_INTL("F"),_INTL("G"),_INTL("H"),_INTL("I"),_INTL("J"),
_INTL("K"),_INTL("L"),_INTL("M"),_INTL("N"),_INTL("O"),
_INTL("P"),_INTL("Q"),_INTL("R"),_INTL("S"),_INTL("T"),
_INTL("U"),_INTL("V"),_INTL("W"),_INTL("X"),_INTL("Y"),
_INTL("Z")]
@nameCommands = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
@typeCommands = []
count = 0
+11 -11
View File
@@ -11,7 +11,7 @@ class PokemonPokedexInfo_Scene
@region = region
@page = 1
@entry_page = 0
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_types")
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["infosprite"] = PokemonSprite.new(@viewport)
@@ -141,7 +141,7 @@ class PokemonPokedexInfo_Scene
@index = 0
@page = 1
@brief = true
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Pokedex/icon_types"))
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/Pokedex/icon_types")
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["infosprite"] = PokemonSprite.new(@viewport)
@@ -239,10 +239,10 @@ class PokemonPokedexInfo_Scene
# # ret.each do |entry|
# # if !entry[0] || entry[0].empty? # Necessarily applies only to form 0
# # case entry[1]
# # when 0 then entry[0] = _INTL("Male")
# # when 1 then entry[0] = _INTL("Female")
# # when 0 then entry[0] = "Male"
# # when 1 then entry[0] = "Female"
# # else
# # entry[0] = (multiple_forms) ? _INTL("One Form") : _INTL("Genderless")
# # entry[0] = multiple_forms ? "One Form" : "Genderless"
# # end
# # end
# # entry[1] = 0 if entry[1] == 2 # Genderless entries are treated as male
@@ -279,14 +279,14 @@ class PokemonPokedexInfo_Scene
end
def drawPageInfo(reloading=false)
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_info"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_info")
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
imagepos = []
if @brief
imagepos.push([_INTL("Graphics/Pictures/Pokedex/overlay_info"), 0, 0])
imagepos.push(["Graphics/Pictures/Pokedex/overlay_info", 0, 0])
end
species_data = GameData::Species.get_species_form(@species, @form)
# Write various bits of text
@@ -298,7 +298,7 @@ class PokemonPokedexInfo_Scene
indexText = sprintf("%03d", indexNumber)
# end
textpos = [
[_INTL("{1}{2} {3}", indexText, " ", species_data.name),
["#{indexText} #{species_data.name}",
246, 36, 0, Color.new(248, 248, 248), Color.new(0, 0, 0)],
[_INTL("Height"), 314, 152, 0, base, shadow],
[_INTL("Weight"), 314, 184, 0, base, shadow]
@@ -380,7 +380,7 @@ class PokemonPokedexInfo_Scene
entryText = @randomEntryText
shadowColor = shadow
else
entryText = "No custom Pokédex entry available for this Pokémon. Please consider submitting an entry for this Pokémon on the game's Discord."
entryText = _INTL("No custom Pokédex entry available for this Pokémon. Please consider submitting an entry for this Pokémon on the game's Discord. Auto-generated Pokédex entries can be enabled in the options menu.")
shadowColor = shadow
end
end
@@ -522,7 +522,7 @@ class PokemonPokedexInfo_Scene
end
def drawPageArea
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_area"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_area")
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
@@ -598,7 +598,7 @@ class PokemonPokedexInfo_Scene
end
def drawPageForms
@sprites["background"].setBitmap(_INTL("Graphics/Pictures/Pokedex/bg_forms"))
@sprites["background"].setBitmap("Graphics/Pictures/Pokedex/bg_forms")
overlay = @sprites["overlay"].bitmap
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
+4 -4
View File
@@ -234,7 +234,7 @@ class PokemonPartyPanel < SpriteWrapper
@overlaysprite = BitmapSprite.new(Graphics.width, Graphics.height, viewport)
@overlaysprite.z = self.z + 4
@hpbar = AnimatedBitmap.new("Graphics/Pictures/Party/overlay_hp")
@statuses = AnimatedBitmap.new(_INTL("Graphics/Pictures/statuses"))
@statuses = AnimatedBitmap.new("Graphics/Pictures/statuses")
@selected = false
@preselected = false
@switching = false
@@ -421,9 +421,9 @@ class PokemonPartyPanel < SpriteWrapper
end
# Draw gender symbol
if @pokemon.male?
textpos.push([_INTL(""), 224, 10, 0, Color.new(0, 112, 248), Color.new(120, 184, 232)])
textpos.push(["", 224, 10, 0, Color.new(0, 112, 248), Color.new(120, 184, 232)])
elsif @pokemon.female?
textpos.push([_INTL(""), 224, 10, 0, Color.new(232, 32, 16), Color.new(248, 168, 184)])
textpos.push(["", 224, 10, 0, Color.new(232, 32, 16), Color.new(248, 168, 184)])
end
# Draw shiny icon
if @pokemon.shiny?
@@ -1322,7 +1322,7 @@ class PokemonPartyScreen
end
end
commands[cmdNickname = commands.length] = _INTL("Nickname") if !pkmn.egg?
#commands[cmdLearnMove = commands.length] = _INTL("Remember moves")
commands[cmdLearnMove = commands.length] = _INTL("Remember moves")
if playerHasFusionItems
if pkmn.isFusion?
+15 -15
View File
@@ -116,7 +116,7 @@ class PokemonSummary_Scene
@pokemon = @party[@partyindex]
@inbattle = inbattle
@page = 1
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/types")
@markingbitmap = AnimatedBitmap.new("Graphics/Pictures/Summary/markings")
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@@ -187,7 +187,7 @@ class PokemonSummary_Scene
@partyindex = partyindex
@pokemon = @party[@partyindex]
@page = 4
@typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
@typebitmap = AnimatedBitmap.new("Graphics/Pictures/types")
@sprites = {}
@sprites["background"] = IconSprite.new(0, 0, @viewport)
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@@ -361,9 +361,9 @@ class PokemonSummary_Scene
end
# Write the gender symbol
if @pokemon.male?
textpos.push([_INTL(""), 178, 56, 0, Color.new(24, 112, 216), Color.new(136, 168, 208)])
textpos.push(["", 178, 56, 0, Color.new(24, 112, 216), Color.new(136, 168, 208)])
elsif @pokemon.female?
textpos.push([_INTL(""), 178, 56, 0, Color.new(248, 56, 32), Color.new(224, 152, 144)])
textpos.push(["", 178, 56, 0, Color.new(248, 56, 32), Color.new(224, 152, 144)])
end
# Draw all text
pbDrawTextPositions(overlay, textpos)
@@ -418,12 +418,12 @@ class PokemonSummary_Scene
end
# Write various bits of text
textpos = [
#[_INTL("Dex No."), 238, dex_no_y, 0, base, shadow],
#["Dex No.", 238, dex_no_y, 0, base, shadow],
[_INTL("Species"), 238, species_y, 0, base, shadow],
[@pokemon.speciesName, 435, species_y, 2, Color.new(64, 64, 64), Color.new(176, 176, 176)],
[_INTL("Type"), 238, type_y, 0, base, shadow],
[_INTL("OT"), 238, ot_y, 0, base, shadow],
# [_INTL("ID No."), 238, id_no_y, 0, base, shadow],
# ["ID No.", 238, id_no_y, 0, base, shadow],
]
if @pokemon.isFusion?
headName = getPokemon(@pokemon.species_data.get_head_species).name
@@ -483,13 +483,13 @@ class PokemonSummary_Scene
end
# Write Exp text OR heart gauge message (if a Shadow Pokémon)
# if @pokemon.shadowPokemon?
# textpos.push([_INTL("Heart Gauge"), 238, 234, 0, base, shadow])
# heartmessage = [_INTL("The door to its heart is open! Undo the final lock!"),
# _INTL("The door to its heart is almost fully open."),
# _INTL("The door to its heart is nearly open."),
# _INTL("The door to its heart is opening wider."),
# _INTL("The door to its heart is opening up."),
# _INTL("The door to its heart is tightly shut.")][@pokemon.heartStage]
# textpos.push(["Heart Gauge", 238, 234, 0, base, shadow])
# heartmessage = ["The door to its heart is open! Undo the final lock!",
# "The door to its heart is almost fully open.",
# "The door to its heart is nearly open.",
# "The door to its heart is opening wider.",
# "The door to its heart is opening up.",
# "The door to its heart is tightly shut."][@pokemon.heartStage]
# memo = sprintf("<c3=404040,B0B0B0>%s\n", heartmessage)
# drawFormattedTextEx(overlay, 234, 304, 264, memo)
# else
@@ -922,7 +922,7 @@ class PokemonSummary_Scene
# @sprites["downarrow"].visible = false
# # Write various bits of text
# textpos = [
# [_INTL("No. of Ribbons:"), 234, 326, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# ["No. of Ribbons:", 234, 326, 0, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# [@pokemon.numRibbons.to_s, 450, 326, 1, Color.new(64, 64, 64), Color.new(176, 176, 176)],
# ]
# # Draw all text
@@ -1496,7 +1496,7 @@ class PokemonSummaryScreen
ret = @scene.pbChooseMoveToForget(move_to_learn)
break if ret < 0 || !move_to_learn
break if party[partyindex].moves[ret]
#pbMessage(_INTL("HM moves can't be forgotten now.")) { @scene.pbUpdate }
#pbMessage("HM moves can't be forgotten now.") { @scene.pbUpdate }
end
@scene.pbEndScene
return ret
+5 -5
View File
@@ -168,8 +168,8 @@ class PokemonBag_Scene
end
end
@bag.lastpocket = lastpocket
@sliderbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Bag/icon_slider"))
@pocketbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Bag/icon_pocket"))
@sliderbitmap = AnimatedBitmap.new("Graphics/Pictures/Bag/icon_slider")
@pocketbitmap = AnimatedBitmap.new("Graphics/Pictures/Bag/icon_pocket")
@sprites = {}
@sprites["background"] = IconSprite.new(0,0,@viewport)
@sprites["overlay"] = BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@@ -537,8 +537,8 @@ class PokemonBagScreen
command = @scene.pbShowCommands(_INTL("How to sort?",itemname),[
_INTL("Alphabetically"),
_INTL("By quantity"),
# _INTL("Recently used"),
# _INTL("Recently obtained"),
# "Recently used",
# "Recently obtained",
_INTL("Cancel")
],0)
case command
@@ -571,7 +571,7 @@ class PokemonBagScreen
params.setRange(0, Settings::BAG_MAX_PER_SLOT)
params.setDefaultValue(qty)
newqty = pbMessageChooseNumber(
_INTL("Choose new quantity of {1} (max. #{Settings::BAG_MAX_PER_SLOT}).",itemplural),params) { @scene.pbUpdate }
_INTL("Choose new quantity of {1} (max. {2}).", itemplural, Settings::BAG_MAX_PER_SLOT),params) { @scene.pbUpdate }
if newqty>qty
@bag.pbStoreItem(item,newqty-qty)
elsif newqty<qty
+1 -3
View File
@@ -67,9 +67,7 @@ class PokemonPhoneScene
@sprites["icon"].src_rect = Rect.new(0,0,charwidth/4,charheight/4)
for trainer in @trainers
if trainer.length==4
displayname = _INTL("{1} {2}", GameData::TrainerType.get(trainer[0]).name,
pbGetMessageFromHash(MessageTypes::TrainerNames,trainer[1])
)
displayname = "#{GameData::TrainerType.get(trainer[0]).name} #{pbGetMessageFromHash(MessageTypes::TrainerNames,trainer[1])}"
commands.push(displayname) # trainer's display name
else
commands.push(trainer[1]) # NPC's display name
+22 -9
View File
@@ -43,11 +43,26 @@ class PokemonTrainerCard_Scene
@sprites["card"].z=-100
end
def trainerCardActions
cmd_swapBackground = _INTL("Swap background")
cmd_copyTrainerID = _INTL("Copy Trainer ID")
cmd_cancel = _INTL("Cancel")
commands = [cmd_swapBackground, cmd_copyTrainerID,cmd_cancel]
choice = optionsMenu(commands)
case commands[choice]
when cmd_swapBackground
promptSwapBackground
when cmd_copyTrainerID
Input.clipboard = $Trainer.id.to_s
pbMessage(_INTL("Your Trainer ID was copied to the clipboard!"))
end
end
def promptSwapBackground()
$Trainer.unlocked_card_backgrounds = [] if !$Trainer.unlocked_card_backgrounds
if $Trainer.unlocked_card_backgrounds.length >= 1
if pbConfirmMessage("Swap your current Trainer Card background")
chosen = pbListScreen("Trainer card", TrainerCardBackgroundLister.new($Trainer.unlocked_card_backgrounds))
if pbConfirmMessage(_INTL("Swap your current Trainer Card background"))
chosen = pbListScreen(_INTL("Trainer card"), TrainerCardBackgroundLister.new($Trainer.unlocked_card_backgrounds))
echoln chosen
if chosen
$Trainer.card_background = chosen
@@ -70,15 +85,13 @@ class PokemonTrainerCard_Scene
min = totalsec / 60 % 60
time = (hour > 0) ? _INTL("{1}h {2}m", hour, min) : _INTL("{1}m", min)
$PokemonGlobal.startTime = pbGetTimeNow if !$PokemonGlobal.startTime
starttime = _INTL("{1} {2}, {3}",
pbGetAbbrevMonthName($PokemonGlobal.startTime.mon),
$PokemonGlobal.startTime.day,
$PokemonGlobal.startTime.year)
starttime = "#{pbGetAbbrevMonthName($PokemonGlobal.startTime.mon)} #{$PokemonGlobal.startTime.day}, #{$PokemonGlobal.startTime.year}"
textPositions = [
[_INTL("Name"), 34, 58, 0, baseColor, shadowColor],
[$Trainer.name, 302, 58, 1, baseColor, shadowColor],
[_INTL("ID No."), 332, 58, 0, baseColor, shadowColor],
[sprintf("%05d", $Trainer.public_ID), 468, 58, 1, baseColor, shadowColor],
[_INTL("Trainer ID"), 352, 28, 0, baseColor, shadowColor], # [_INTL("ID"), 332, 58, 0, baseColor, shadowColor],
[sprintf("%05d", $Trainer.id), 462, 58, 1, baseColor, shadowColor], # [sprintf("%05d", $Trainer.id), 468, 58, 1, baseColor, shadowColor],
[_INTL("Money"), 34, 106, 0, baseColor, shadowColor],
[_INTL("${1}", $Trainer.money.to_s_formatted), 302, 106, 1, baseColor, shadowColor],
[_INTL("Pokédex"), 34, 154, 0, baseColor, shadowColor],
@@ -129,7 +142,7 @@ class PokemonTrainerCard_Scene
Input.update
pbUpdate
if Input.trigger?(Input::USE)
promptSwapBackground()
trainerCardActions()
end
if Input.trigger?(Input::BACK)
pbPlayCloseMenuSE
+5 -3
View File
@@ -65,7 +65,7 @@ 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(["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])
@@ -334,11 +334,13 @@ class PokemonLoadScreen
return
when cmd_new_game
@scene.pbEndScene
Game.start_new
Game.start_new(new_game_plus)
echoln new_game_plus
@save_data[:player].new_game_plus_unlocked=new_game_plus
return
when cmd_new_game_plus
@scene.pbEndScene
Game.start_new(@save_data[:bag],@save_data[:storage_system],@save_data[:player])
Game.start_new(new_game_plus,@save_data[:bag],@save_data[:storage_system],@save_data[:player])
@save_data[:player].new_game_plus_unlocked=true
return
when cmd_mystery_gift
+2 -2
View File
@@ -23,7 +23,7 @@ class PokemonSystem
attr_accessor :on_mobile
attr_accessor :type_icons
attr_accessor :use_generated_dex_entries
attr_accessor :use_custom_eggs
attr_accessor :hide_custom_eggs
attr_accessor :include_alt_sprites_in_random
def initialize
@@ -47,7 +47,7 @@ class PokemonSystem
@on_mobile = false
@type_icons = true
@use_generated_dex_entries = true
@use_custom_eggs = true
@hide_custom_eggs = true
@include_alt_sprites_in_random = false
end
end
+2 -2
View File
@@ -77,10 +77,10 @@ class ReadyMenuButton < SpriteWrapper
if !GameData::Item.get(@command[0]).is_important?
qty = $PokemonBag.pbQuantity(@command[0])
if qty>99
textpos.push([_INTL(">99"),230,16,1,
textpos.push([">99",230,16,1,
Color.new(248,248,248),Color.new(40,40,40),1])
else
textpos.push([_INTL("x{1}",qty),230,16,1,
textpos.push(["x#{qty}",230,16,1,
Color.new(248,248,248),Color.new(40,40,40),1])
end
end
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -27,9 +27,9 @@ class StorageSystemPC
def name
return "Pokemon Storage"
#if $Trainer.seen_storage_creator
# return _INTL("{1}'s PC",pbGetStorageCreator)
# return "{1}'s PC",pbGetStorageCreator
#else
# return _INTL("Someone's PC")
# return "Someone's PC"
#end
end
@@ -260,6 +260,10 @@ def pbPokeCenterPC
break if !PokemonPCList.callCommand(command)
end
pbSEPlay("PC close")
if $game_temp.transfer_box_autosave
Game.save()
$game_temp.transfer_box_autosave=false
end
end
def pbGetStorageCreator
+1 -1
View File
@@ -26,7 +26,7 @@ class PokemonMartAdapter
item_name = getName(item)
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
item_name = "#{item_name} #{GameData::Move.get(machine).name}"
end
return item_name
end
+6 -1
View File
@@ -46,7 +46,7 @@ class MoveRelearner_Scene
@sprites["msgwindow"]=Window_AdvancedTextPokemon.new("")
@sprites["msgwindow"].visible=false
@sprites["msgwindow"].viewport=@viewport
@typebitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
@typebitmap=AnimatedBitmap.new("Graphics/Pictures/types")
pbDrawMoveList
pbDeactivateWindows(@sprites)
# Fade in all sprites
@@ -167,6 +167,11 @@ class MoveRelearnerScreen
next if m[0] > pkmn.level || pkmn.hasMove?(m[1])
moves.push(m[1]) if !moves.include?(m[1])
end
pkmn.learned_moves.each do |move|
moves.push(move) if !moves.include?(move)
end
tmoves = []
if pkmn.first_moves
for i in pkmn.first_moves
+1 -1
View File
@@ -229,7 +229,7 @@ def pbRefreshMGCommands(master, online)
itemname = GameData::Item.get(gift[2]).name + sprintf(" x%d", gift[1])
end
ontext = ["[ ]", "[X]"][(online.include?(gift[0])) ? 1 : 0]
commands.push(_INTL("{1} {2}: {3} ({4})", ontext, gift[0], gift[3], itemname))
commands.push("#{ontext} #{gift[0]}: #{gift[3]} (#{itemname})")
end
commands.push(_INTL("Export selected to file"))
commands.push(_INTL("Cancel"))
+6 -6
View File
@@ -150,9 +150,9 @@ class PokemonEntryScene
pbSetSystemFont(@sprites["gender"].bitmap)
textpos=[]
if pokemon.male?
textpos.push([_INTL(""),0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
textpos.push(["",0,-6,false,Color.new(0,128,248),Color.new(168,184,184)])
elsif pokemon.female?
textpos.push([_INTL(""),0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
textpos.push(["",0,-6,false,Color.new(248,24,24),Color.new(168,184,184)])
end
pbDrawTextPositions(@sprites["gender"].bitmap,textpos)
end
@@ -435,9 +435,9 @@ class PokemonEntryScene2
pbSetSystemFont(@sprites["gender"].bitmap)
textpos = []
if pokemon.male?
textpos.push([_INTL(""), 0, -6, false, Color.new(0, 128, 248), Color.new(168, 184, 184)])
textpos.push(["", 0, -6, false, Color.new(0, 128, 248), Color.new(168, 184, 184)])
elsif pokemon.female?
textpos.push([_INTL(""), 0, -6, false, Color.new(248, 24, 24), Color.new(168, 184, 184)])
textpos.push(["", 0, -6, false, Color.new(248, 24, 24), Color.new(168, 184, 184)])
end
pbDrawTextPositions(@sprites["gender"].bitmap, textpos)
end
@@ -483,7 +483,7 @@ class PokemonEntryScene2
@sprites["controls"] = IconSprite.new(0, 0, @viewport)
@sprites["controls"].x = 16
@sprites["controls"].y = 96
@sprites["controls"].setBitmap(_INTL("Graphics/Pictures/Naming/overlay_controls"))
@sprites["controls"].setBitmap("Graphics/Pictures/Naming/overlay_controls")
@init = true
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
pbDoUpdateOverlay2
@@ -501,7 +501,7 @@ class PokemonEntryScene2
def pbDoUpdateOverlay2
overlay = @sprites["overlay"].bitmap
overlay.clear
modeIcon = [[_INTL("Graphics/Pictures/Naming/icon_mode"), 44 + @mode * 62, 120, @mode * 60, 0, 60, 44]]
modeIcon = [["Graphics/Pictures/Naming/icon_mode", 44 + @mode * 62, 120, @mode * 60, 0, 60, 44]]
pbDrawImagePositions(overlay, modeIcon)
end
@@ -0,0 +1,946 @@
#===============================================================================
# Pokémon storage visuals
#===============================================================================
class PokemonStorageScene
attr_reader :quickswap
attr_accessor :sprites
def initialize
@command = 1
end
def pbReleaseInstant(selected, heldpoke)
box = selected[0]
index = selected[1]
if heldpoke
sprite = @sprites["arrow"].heldPokemon
elsif box == -1
sprite = @sprites["boxparty"].getPokemon(index)
else
sprite = @sprites["box"].getPokemon(index)
end
if sprite
sprite.dispose
end
end
def pbStartBox(screen, command, animate=true)
@screen = screen
@storage = screen.storage
@bgviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@bgviewport.z = 99999
@boxviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@boxviewport.z = 99999
@boxsidesviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@boxsidesviewport.z = 99999
@arrowviewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@arrowviewport.z = 99999
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
@viewport.z = 99999
@selection = 0
@quickswap = false
@sprites = {}
@choseFromParty = false
@command = command
addBackgroundPlane(@sprites, "background", "Storage/bg", @bgviewport)
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport)
@sprites["boxsides"] = IconSprite.new(0, 0, @boxsidesviewport)
@sprites["boxsides"].setBitmap("Graphics/Pictures/Storage/overlay_main")
@sprites["overlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @boxsidesviewport)
pbSetSystemFont(@sprites["overlay"].bitmap)
@sprites["pokemon"] = AutoMosaicPokemonSprite.new(@boxsidesviewport)
@sprites["pokemon"].setOffset(PictureOrigin::Center)
@sprites["pokemon"].x = 90
@sprites["pokemon"].y = 134
@sprites["pokemon"].zoom_y = Settings::FRONTSPRITE_SCALE
@sprites["pokemon"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport)
if command != 2 # Drop down tab only on Deposit
@sprites["boxparty"].x = 182
@sprites["boxparty"].y = Graphics.height
end
@markingbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/markings")
@sprites["markingbg"] = IconSprite.new(292, 68, @boxsidesviewport)
@sprites["markingbg"].setBitmap("Graphics/Pictures/Storage/overlay_marking")
@sprites["markingbg"].visible = false
@sprites["markingoverlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @boxsidesviewport)
@sprites["markingoverlay"].visible = false
pbSetSystemFont(@sprites["markingoverlay"].bitmap)
@sprites["arrow"] = PokemonBoxArrow.new(@arrowviewport)
@sprites["arrow"].z += 1
if command != 2
pbSetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection)
pbSetMosaic(@selection)
else
pbPartySetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection, @storage.party)
pbSetMosaic(@selection)
end
pbSEPlay("PC access") if animate
pbFadeInAndShow(@sprites) if animate
end
def pbCloseBox
pbFadeOutAndHide(@sprites)
pbDisposeSpriteHash(@sprites)
@markingbitmap.dispose if @markingbitmap
@boxviewport.dispose
@boxsidesviewport.dispose
@arrowviewport.dispose
end
def pbDisplay(message)
msgwindow = Window_UnformattedTextPokemon.newWithSize("", 180, 0, Graphics.width - 180, 32)
msgwindow.viewport = @viewport
msgwindow.visible = true
msgwindow.letterbyletter = false
msgwindow.resizeHeightToFit(message, Graphics.width - 180)
msgwindow.text = message
pbBottomRight(msgwindow)
loop do
Graphics.update
Input.update
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE)
break
end
msgwindow.update
self.update
end
msgwindow.dispose
Input.update
end
def pbShowCommands(message, commands, index = 0)
ret = -1
msgwindow = Window_UnformattedTextPokemon.newWithSize("", 180, 0, Graphics.width - 180, 32)
msgwindow.viewport = @viewport
msgwindow.visible = true
msgwindow.letterbyletter = false
msgwindow.text = message
msgwindow.resizeHeightToFit(message, Graphics.width - 180)
pbBottomRight(msgwindow)
cmdwindow = Window_CommandPokemon.new(commands)
cmdwindow.viewport = @viewport
cmdwindow.visible = true
cmdwindow.resizeToFit(cmdwindow.commands)
cmdwindow.height = Graphics.height - msgwindow.height if cmdwindow.height > Graphics.height - msgwindow.height
pbBottomRight(cmdwindow)
cmdwindow.y -= msgwindow.height
cmdwindow.index = index
loop do
Graphics.update
Input.update
msgwindow.update
cmdwindow.update
if Input.trigger?(Input::BACK)
ret = -1
break
elsif Input.trigger?(Input::USE)
ret = cmdwindow.index
break
end
self.update
end
msgwindow.dispose
cmdwindow.dispose
Input.update
return ret
end
def pbSetArrow(arrow, selection)
case selection
when -1, -4, -5 # Box name, move left, move right
arrow.x = 157 * 2
arrow.y = -12 * 2
when -2 # Party Pokémon
arrow.x = 119 * 2
arrow.y = 139 * 2
when -3 # Close Box
arrow.x = 207 * 2
arrow.y = 139 * 2
else
arrow.x = (97 + 24 * (selection % PokemonBox::BOX_WIDTH)) * 2
arrow.y = (8 + 24 * (selection / PokemonBox::BOX_WIDTH)) * 2
end
end
def pbChangeSelection(key, selection)
case key
when Input::UP
if selection == -1 # Box name
selection = -2
elsif selection == -2 # Party
selection = PokemonBox::BOX_SIZE - 1 - PokemonBox::BOX_WIDTH * 2 / 3 # 25
elsif selection == -3 # Close Box
selection = PokemonBox::BOX_SIZE - PokemonBox::BOX_WIDTH / 3 # 28
else
selection -= PokemonBox::BOX_WIDTH
selection = -1 if selection < 0
end
when Input::DOWN
if selection == -1 # Box name
selection = PokemonBox::BOX_WIDTH / 3 # 2
elsif selection == -2 # Party
selection = -1
elsif selection == -3 # Close Box
selection = -1
else
selection += PokemonBox::BOX_WIDTH
if selection >= PokemonBox::BOX_SIZE
if selection < PokemonBox::BOX_SIZE + PokemonBox::BOX_WIDTH / 2
selection = -2 # Party
else
selection = -3 # Close Box
end
end
end
when Input::LEFT
if selection == -1 # Box name
selection = -4 # Move to previous box
elsif selection == -2
selection = -3
elsif selection == -3
selection = -2
elsif (selection % PokemonBox::BOX_WIDTH) == 0 # Wrap around
selection += PokemonBox::BOX_WIDTH - 1
else
selection -= 1
end
when Input::RIGHT
if selection == -1 # Box name
selection = -5 # Move to next box
elsif selection == -2
selection = -3
elsif selection == -3
selection = -2
elsif (selection % PokemonBox::BOX_WIDTH) == PokemonBox::BOX_WIDTH - 1 # Wrap around
selection -= PokemonBox::BOX_WIDTH - 1
else
selection += 1
end
end
return selection
end
def pbPartySetArrow(arrow, selection)
return if selection < 0
xvalues = [] # [200, 272, 200, 272, 200, 272, 236]
yvalues = [] # [2, 18, 66, 82, 130, 146, 220]
for i in 0...Settings::MAX_PARTY_SIZE
xvalues.push(200 + 72 * (i % 2))
yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2))
end
xvalues.push(236)
yvalues.push(220)
arrow.angle = 0
arrow.mirror = false
arrow.ox = 0
arrow.oy = 0
arrow.x = xvalues[selection]
arrow.y = yvalues[selection]
end
def pbPartyChangeSelection(key, selection)
case key
when Input::LEFT
selection -= 1
selection = Settings::MAX_PARTY_SIZE if selection < 0
when Input::RIGHT
selection += 1
selection = 0 if selection > Settings::MAX_PARTY_SIZE
when Input::UP
if selection == Settings::MAX_PARTY_SIZE
selection = Settings::MAX_PARTY_SIZE - 1
else
selection -= 2
selection = Settings::MAX_PARTY_SIZE if selection < 0
end
when Input::DOWN
if selection == Settings::MAX_PARTY_SIZE
selection = 0
else
selection += 2
selection = Settings::MAX_PARTY_SIZE if selection > Settings::MAX_PARTY_SIZE
end
end
return selection
end
def pbSelectBoxInternal(_party)
selection = @selection
pbSetArrow(@sprites["arrow"], selection)
pbUpdateOverlay(selection)
pbSetMosaic(selection)
loop do
Graphics.update
Input.update
key = -1
key = Input::DOWN if Input.repeat?(Input::DOWN)
key = Input::RIGHT if Input.repeat?(Input::RIGHT)
key = Input::LEFT if Input.repeat?(Input::LEFT)
key = Input::UP if Input.repeat?(Input::UP)
if key >= 0
pbPlayCursorSE
selection = pbChangeSelection(key, selection)
pbSetArrow(@sprites["arrow"], selection)
if selection == -4
nextbox = (@storage.currentBox + @storage.maxBoxes - 1) % @storage.maxBoxes
pbSwitchBoxToLeft(nextbox)
@storage.currentBox = nextbox
elsif selection == -5
nextbox = (@storage.currentBox + 1) % @storage.maxBoxes
pbSwitchBoxToRight(nextbox)
@storage.currentBox = nextbox
end
selection = -1 if selection == -4 || selection == -5
pbUpdateOverlay(selection)
pbSetMosaic(selection)
end
self.update
if Input.trigger?(Input::JUMPUP)
pbPlayCursorSE
nextbox = (@storage.currentBox + @storage.maxBoxes - 1) % @storage.maxBoxes
pbSwitchBoxToLeft(nextbox)
@storage.currentBox = nextbox
pbUpdateOverlay(selection)
pbSetMosaic(selection)
elsif Input.trigger?(Input::JUMPDOWN)
pbPlayCursorSE
nextbox = (@storage.currentBox + 1) % @storage.maxBoxes
pbSwitchBoxToRight(nextbox)
@storage.currentBox = nextbox
pbUpdateOverlay(selection)
pbSetMosaic(selection)
elsif Input.trigger?(Input::SPECIAL) # Jump to box name
if selection != -1
pbPlayCursorSE
selection = -1
pbSetArrow(@sprites["arrow"], selection)
pbUpdateOverlay(selection)
pbSetMosaic(selection)
end
elsif Input.trigger?(Input::ACTION) && @command == 0 # Organize only
pbPlayDecisionSE
pbSetQuickSwap(!@quickswap)
elsif Input.trigger?(Input::BACK)
@selection = selection
return nil
elsif Input.trigger?(Input::USE)
@selection = selection
if selection >= 0
return [@storage.currentBox, selection]
elsif selection == -1 # Box name
return [-4, -1]
elsif selection == -2 # Party Pokémon
return [-2, -1]
elsif selection == -3 # Close Box
return [-3, -1]
end
end
end
end
def pbSelectBox(party)
return pbSelectBoxInternal(party) if @command == 1 # Withdraw
ret = nil
loop do
if !@choseFromParty
ret = pbSelectBoxInternal(party)
end
if @choseFromParty || (ret && ret[0] == -2) # Party Pokémon
if !@choseFromParty
pbShowPartyTab
@selection = 0
end
ret = pbSelectPartyInternal(party, false)
if ret < 0
pbHidePartyTab
@selection = 0
@choseFromParty = false
else
@choseFromParty = true
return [-1, ret]
end
else
@choseFromParty = false
return ret
end
end
end
def pbSelectPartyInternal(party, depositing)
selection = @selection
pbPartySetArrow(@sprites["arrow"], selection)
pbUpdateOverlay(selection, party)
pbSetMosaic(selection)
lastsel = 1
loop do
Graphics.update
Input.update
key = -1
key = Input::DOWN if Input.repeat?(Input::DOWN)
key = Input::RIGHT if Input.repeat?(Input::RIGHT)
key = Input::LEFT if Input.repeat?(Input::LEFT)
key = Input::UP if Input.repeat?(Input::UP)
if key >= 0
pbPlayCursorSE
newselection = pbPartyChangeSelection(key, selection)
if newselection == -1
return -1 if !depositing
elsif newselection == -2
selection = lastsel
else
selection = newselection
end
pbPartySetArrow(@sprites["arrow"], selection)
lastsel = selection if selection > 0
pbUpdateOverlay(selection, party)
pbSetMosaic(selection)
end
self.update
if Input.trigger?(Input::ACTION) && @command == 0 # Organize only
pbPlayDecisionSE
pbSetQuickSwap(!@quickswap)
elsif Input.trigger?(Input::BACK)
@selection = selection
return -1
elsif Input.trigger?(Input::USE)
if selection >= 0 && selection < Settings::MAX_PARTY_SIZE
@selection = selection
return selection
elsif selection == Settings::MAX_PARTY_SIZE # Close Box
@selection = selection
return (depositing) ? -3 : -1
end
end
end
end
def pbSelectParty(party)
return pbSelectPartyInternal(party, true)
end
def pbChangeBackground(wp)
@sprites["box"].refreshSprites = false
alpha = 0
Graphics.update
self.update
timeTaken = Graphics.frame_rate * 4 / 10
alphaDiff = (255.0 / timeTaken).ceil
timeTaken.times do
alpha += alphaDiff
Graphics.update
Input.update
@sprites["box"].color = Color.new(248, 248, 248, alpha)
self.update
end
@sprites["box"].refreshBox = true
@storage[@storage.currentBox].background = wp
(Graphics.frame_rate / 10).times do
Graphics.update
Input.update
self.update
end
timeTaken.times do
alpha -= alphaDiff
Graphics.update
Input.update
@sprites["box"].color = Color.new(248, 248, 248, alpha)
self.update
end
@sprites["box"].refreshSprites = true
end
def pbSwitchBoxToRight(newbox)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled)
newbox.x = 520
Graphics.frame_reset
distancePerFrame = 64 * 20 / Graphics.frame_rate
loop do
Graphics.update
Input.update
@sprites["box"].x -= distancePerFrame
newbox.x -= distancePerFrame
self.update
break if newbox.x <= 184
end
diff = newbox.x - 184
newbox.x = 184
@sprites["box"].x -= diff
@sprites["box"].dispose
@sprites["box"] = newbox
newbox.refreshAllBoxSprites
end
def pbSwitchBoxToLeft(newbox)
newbox = PokemonBoxSprite.new(@storage, newbox, @boxviewport, @sprites["box"].isFusionEnabled)
newbox.x = -152
Graphics.frame_reset
distancePerFrame = 64 * 20 / Graphics.frame_rate
loop do
Graphics.update
Input.update
@sprites["box"].x += distancePerFrame
newbox.x += distancePerFrame
self.update
break if newbox.x >= 184
end
diff = newbox.x - 184
newbox.x = 184
@sprites["box"].x -= diff
@sprites["box"].dispose
@sprites["box"] = newbox
newbox.refreshAllBoxSprites
end
def pbJumpToBox(newbox)
if @storage.currentBox != newbox
if newbox > @storage.currentBox
pbSwitchBoxToRight(newbox)
else
pbSwitchBoxToLeft(newbox)
end
@storage.currentBox = newbox
end
end
def pbSetMosaic(selection)
if !@screen.pbHeldPokemon
if @boxForMosaic != @storage.currentBox || @selectionForMosaic != selection
@sprites["pokemon"].mosaic = Graphics.frame_rate / 4
@boxForMosaic = @storage.currentBox
@selectionForMosaic = selection
end
end
end
def pbSetQuickSwap(value)
@quickswap = value
@sprites["arrow"].quickswap = value
end
def pbShowPartyTab
pbSEPlay("GUI storage show party panel")
distancePerFrame = 48 * 20 / Graphics.frame_rate
loop do
Graphics.update
Input.update
@sprites["boxparty"].y -= distancePerFrame
self.update
break if @sprites["boxparty"].y <= Graphics.height - 352
end
@sprites["boxparty"].y = Graphics.height - 352
end
def pbHidePartyTab
pbSEPlay("GUI storage hide party panel")
distancePerFrame = 48 * 20 / Graphics.frame_rate
loop do
Graphics.update
Input.update
@sprites["boxparty"].y += distancePerFrame
self.update
break if @sprites["boxparty"].y >= Graphics.height
end
@sprites["boxparty"].y = Graphics.height
end
def pbHold(selected)
pbSEPlay("GUI storage pick up")
if selected[0] == -1
@sprites["boxparty"].grabPokemon(selected[1], @sprites["arrow"])
else
@sprites["box"].grabPokemon(selected[1], @sprites["arrow"])
end
while @sprites["arrow"].grabbing?
Graphics.update
Input.update
self.update
end
end
def pbSwap(selected, _heldpoke)
pbSEPlay("GUI storage pick up")
heldpokesprite = @sprites["arrow"].heldPokemon
boxpokesprite = nil
if selected[0] == -1
boxpokesprite = @sprites["boxparty"].getPokemon(selected[1])
else
boxpokesprite = @sprites["box"].getPokemon(selected[1])
end
if selected[0] == -1
@sprites["boxparty"].setPokemon(selected[1], heldpokesprite)
else
@sprites["box"].setPokemon(selected[1], heldpokesprite)
end
@sprites["arrow"].setSprite(boxpokesprite)
@sprites["pokemon"].mosaic = 10
@boxForMosaic = @storage.currentBox
@selectionForMosaic = selected[1]
end
def pbPlace(selected, _heldpoke)
pbSEPlay("GUI storage put down")
heldpokesprite = @sprites["arrow"].heldPokemon
@sprites["arrow"].place
while @sprites["arrow"].placing?
Graphics.update
Input.update
self.update
end
if selected[0] == -1
@sprites["boxparty"].setPokemon(selected[1], heldpokesprite)
else
@sprites["box"].setPokemon(selected[1], heldpokesprite)
end
@boxForMosaic = @storage.currentBox
@selectionForMosaic = selected[1]
end
def pbWithdraw(selected, heldpoke, partyindex)
pbHold(selected) if !heldpoke
pbShowPartyTab
pbPartySetArrow(@sprites["arrow"], partyindex)
pbPlace([-1, partyindex], heldpoke)
pbHidePartyTab
end
def pbStore(selected, heldpoke, destbox, firstfree)
if heldpoke
if destbox == @storage.currentBox
heldpokesprite = @sprites["arrow"].heldPokemon
@sprites["box"].setPokemon(firstfree, heldpokesprite)
@sprites["arrow"].setSprite(nil)
else
@sprites["arrow"].deleteSprite
end
else
sprite = @sprites["boxparty"].getPokemon(selected[1])
if destbox == @storage.currentBox
@sprites["box"].setPokemon(firstfree, sprite)
@sprites["boxparty"].setPokemon(selected[1], nil)
else
@sprites["boxparty"].deletePokemon(selected[1])
end
end
end
def pbRelease(selected, heldpoke)
box = selected[0]
index = selected[1]
if heldpoke
sprite = @sprites["arrow"].heldPokemon
elsif box == -1
sprite = @sprites["boxparty"].getPokemon(index)
else
sprite = @sprites["box"].getPokemon(index)
end
if sprite
sprite.release
while sprite.releasing?
Graphics.update
sprite.update
self.update
end
end
end
def pbChooseBox(msg)
commands = []
for i in 0...@storage.maxBoxes
box = @storage[i]
if box
commands.push(_INTL("{1} ({2}/{3})", box.name, box.nitems, box.length))
end
end
return pbShowCommands(msg, commands, @storage.currentBox)
end
def pbBoxName(helptext, minchars, maxchars)
oldsprites = pbFadeOutAndHide(@sprites)
ret = pbEnterBoxName(helptext, minchars, maxchars)
if ret.length > 0
@storage[@storage.currentBox].name = ret
end
@sprites["box"].refreshBox = true
pbRefresh
pbFadeInAndShow(@sprites, oldsprites)
end
def pbChooseItem(bag)
ret = nil
pbFadeOutIn {
scene = PokemonBag_Scene.new
screen = PokemonBagScreen.new(scene, bag)
ret = screen.pbChooseItemScreen(Proc.new { |item| GameData::Item.get(item).can_hold? })
}
return ret
end
def pbSummary(selected, heldpoke)
oldsprites = pbFadeOutAndHide(@sprites)
scene = PokemonSummary_Scene.new
screen = PokemonSummaryScreen.new(scene)
if heldpoke
screen.pbStartScreen([heldpoke], 0)
elsif selected[0] == -1
@selection = screen.pbStartScreen(@storage.party, selected[1])
pbPartySetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection, @storage.party)
else
@selection = screen.pbStartScreen(@storage.boxes[selected[0]], selected[1])
pbSetArrow(@sprites["arrow"], @selection)
pbUpdateOverlay(@selection)
end
pbFadeInAndShow(@sprites, oldsprites)
end
def pbMarkingSetArrow(arrow, selection)
if selection >= 0
xvalues = [162, 191, 220, 162, 191, 220, 184, 184]
yvalues = [24, 24, 24, 49, 49, 49, 77, 109]
arrow.angle = 0
arrow.mirror = false
arrow.ox = 0
arrow.oy = 0
arrow.x = xvalues[selection] * 2
arrow.y = yvalues[selection] * 2
end
end
def pbMarkingChangeSelection(key, selection)
case key
when Input::LEFT
if selection < 6
selection -= 1
selection += 3 if selection % 3 == 2
end
when Input::RIGHT
if selection < 6
selection += 1
selection -= 3 if selection % 3 == 0
end
when Input::UP
if selection == 7;
selection = 6
elsif selection == 6;
selection = 4
elsif selection < 3;
selection = 7
else
; selection -= 3
end
when Input::DOWN
if selection == 7;
selection = 1
elsif selection == 6;
selection = 7
elsif selection >= 3;
selection = 6
else
; selection += 3
end
end
return selection
end
def pbMark(selected, heldpoke)
@sprites["markingbg"].visible = true
@sprites["markingoverlay"].visible = true
msg = _INTL("Mark your Pokémon.")
msgwindow = Window_UnformattedTextPokemon.newWithSize("", 180, 0, Graphics.width - 180, 32)
msgwindow.viewport = @viewport
msgwindow.visible = true
msgwindow.letterbyletter = false
msgwindow.text = msg
msgwindow.resizeHeightToFit(msg, Graphics.width - 180)
pbBottomRight(msgwindow)
base = Color.new(248, 248, 248)
shadow = Color.new(80, 80, 80)
pokemon = heldpoke
if heldpoke
pokemon = heldpoke
elsif selected[0] == -1
pokemon = @storage.party[selected[1]]
else
pokemon = @storage.boxes[selected[0]][selected[1]]
end
markings = pokemon.markings
index = 0
redraw = true
markrect = Rect.new(0, 0, 16, 16)
loop do
# Redraw the markings and text
if redraw
@sprites["markingoverlay"].bitmap.clear
for i in 0...6
markrect.x = i * 16
markrect.y = (markings & (1 << i) != 0) ? 16 : 0
@sprites["markingoverlay"].bitmap.blt(336 + 58 * (i % 3), 106 + 50 * (i / 3), @markingbitmap.bitmap, markrect)
end
textpos = [
[_INTL("OK"), 402, 208, 2, base, shadow, 1],
[_INTL("Cancel"), 402, 272, 2, base, shadow, 1]
]
pbDrawTextPositions(@sprites["markingoverlay"].bitmap, textpos)
pbMarkingSetArrow(@sprites["arrow"], index)
redraw = false
end
Graphics.update
Input.update
key = -1
key = Input::DOWN if Input.repeat?(Input::DOWN)
key = Input::RIGHT if Input.repeat?(Input::RIGHT)
key = Input::LEFT if Input.repeat?(Input::LEFT)
key = Input::UP if Input.repeat?(Input::UP)
if key >= 0
oldindex = index
index = pbMarkingChangeSelection(key, index)
pbPlayCursorSE if index != oldindex
pbMarkingSetArrow(@sprites["arrow"], index)
end
self.update
if Input.trigger?(Input::BACK)
pbPlayCancelSE
break
elsif Input.trigger?(Input::USE)
pbPlayDecisionSE
if index == 6 # OK
pokemon.markings = markings
break
elsif index == 7 # Cancel
break
else
mask = (1 << index)
if (markings & mask) == 0
markings |= mask
else
markings &= ~mask
end
redraw = true
end
end
end
@sprites["markingbg"].visible = false
@sprites["markingoverlay"].visible = false
msgwindow.dispose
end
def pbRefresh
@sprites["box"].refresh
@sprites["boxparty"].refresh
end
def pbHardRefresh
oldPartyY = @sprites["boxparty"].y
@sprites["box"].dispose
@sprites["box"] = PokemonBoxSprite.new(@storage, @storage.currentBox, @boxviewport)
@sprites["boxparty"].dispose
@sprites["boxparty"] = PokemonBoxPartySprite.new(@storage.party, @boxsidesviewport)
@sprites["boxparty"].y = oldPartyY
end
def drawMarkings(bitmap, x, y, _width, _height, markings)
markrect = Rect.new(0, 0, 16, 16)
for i in 0...8
markrect.x = i * 16
markrect.y = (markings & (1 << i) != 0) ? 16 : 0
bitmap.blt(x + i * 16, y, @markingbitmap.bitmap, markrect)
end
end
def pbUpdateOverlay(selection, party = nil)
overlay = @sprites["overlay"].bitmap
overlay.clear
buttonbase = Color.new(248, 248, 248)
buttonshadow = Color.new(80, 80, 80)
pbDrawTextPositions(overlay, [
[_INTL("Party: {1}", (@storage.party.length rescue 0)), 270, 326, 2, buttonbase, buttonshadow, 1],
[_INTL("Exit"), 446, 326, 2, buttonbase, buttonshadow, 1],
])
pokemon = nil
if @screen.pbHeldPokemon && !@screen.fusionMode
pokemon = @screen.pbHeldPokemon
elsif selection >= 0
pokemon = (party) ? party[selection] : @storage[@storage.currentBox, selection]
end
if !pokemon
@sprites["pokemon"].visible = false
return
end
@sprites["pokemon"].visible = true
base = Color.new(88, 88, 80)
shadow = Color.new(168, 184, 184)
nonbase = Color.new(208, 208, 208)
nonshadow = Color.new(224, 224, 224)
pokename = pokemon.name
textstrings = [
[pokename, 10, 2, false, base, shadow]
]
if !pokemon.egg?
imagepos = []
if pokemon.male?
textstrings.push([_INTL(""), 148, 2, false, Color.new(24, 112, 216), Color.new(136, 168, 208)])
elsif pokemon.female?
textstrings.push([_INTL(""), 148, 2, false, Color.new(248, 56, 32), Color.new(224, 152, 144)])
end
imagepos.push(["Graphics/Pictures/Storage/overlay_lv", 6, 246])
textstrings.push([pokemon.level.to_s, 28, 228, false, base, shadow])
if pokemon.ability
textstrings.push([pokemon.ability.name, 86, 300, 2, base, shadow])
else
textstrings.push([_INTL("No ability"), 86, 300, 2, nonbase, nonshadow])
end
if pokemon.item
textstrings.push([pokemon.item.name, 86, 336, 2, base, shadow])
else
textstrings.push([_INTL("No item"), 86, 336, 2, nonbase, nonshadow])
end
if pokemon.shiny?
addShinyStarsToGraphicsArray(imagepos, 156, 198, pokemon.bodyShiny?, pokemon.headShiny?, pokemon.debugShiny?, nil, nil, nil, nil, false, true)
# imagepos.push(["Graphics/Pictures/shiny", 156, 198])
end
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
type1_number = GameData::Type.get(pokemon.type1).id_number
type2_number = GameData::Type.get(pokemon.type2).id_number
type1rect = Rect.new(0, type1_number * 28, 64, 28)
type2rect = Rect.new(0, type2_number * 28, 64, 28)
if pokemon.type1 == pokemon.type2
overlay.blt(52, 272, typebitmap.bitmap, type1rect)
else
overlay.blt(18, 272, typebitmap.bitmap, type1rect)
overlay.blt(88, 272, typebitmap.bitmap, type2rect)
end
drawMarkings(overlay, 70, 240, 128, 20, pokemon.markings)
pbDrawImagePositions(overlay, imagepos)
end
pbDrawTextPositions(overlay, textstrings)
@sprites["pokemon"].setPokemonBitmap(pokemon)
if pokemon.egg?
@sprites["pokemon"].zoom_x = Settings::EGGSPRITE_SCALE
@sprites["pokemon"].zoom_y = Settings::EGGSPRITE_SCALE
else
@sprites["pokemon"].zoom_x = Settings::FRONTSPRITE_SCALE
@sprites["pokemon"].zoom_y = Settings::FRONTSPRITE_SCALE
end
end
def update
pbUpdateSpriteHash(@sprites)
end
def setFusing(fusing, item = 0)
sprite = @sprites["arrow"].setFusing(fusing)
if item == :INFINITESPLICERS
@sprites["arrow"].setSplicerType(2)
elsif item == :SUPERSPLICERS
@sprites["arrow"].setSplicerType(1)
else
@sprites["arrow"].setSplicerType(0)
end
pbRefresh
end
end
@@ -0,0 +1,887 @@
#===============================================================================
# Pokémon storage mechanics
#===============================================================================
class PokemonStorageScreen
attr_reader :scene
attr_reader :storage
attr_accessor :heldpkmn
attr_accessor :fusionMode
def initialize(scene, storage)
@scene = scene
@storage = storage
@pbHeldPokemon = nil
@command =0
end
def pbStartScreen(command,animate=true)
@heldpkmn = nil
@command = command
if command == 0 # Organise
@scene.pbStartBox(self, command, animate)
pcOrganizeCommand
elsif command == 1 # Withdraw
@scene.pbStartBox(self, command, animate)
pcWithdrawCommand
elsif command == 2 # Deposit
@scene.pbStartBox(self, command, animate)
pcDepositCommand
elsif command == 3
@scene.pbStartBox(self, command, animate)
@scene.pbCloseBox
end
end
def pcOrganizeCommand()
isTransferBox = @storage[@storage.currentBox].is_a?(StorageTransferBox)
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected == nil
if pbHeldPokemon
pbDisplay(_INTL("You're holding a Pokémon!"))
next
end
next if pbConfirm(_INTL("Continue Box operations?"))
break
elsif selected[0] == -3 # Close box
if pbHeldPokemon
pbDisplay(_INTL("You're holding a Pokémon!"))
next
end
if pbConfirm(_INTL("Exit from the Box?"))
pbSEPlay("PC close")
break
end
next
elsif selected[0] == -4 # Box name
pbBoxCommands
else
pokemon = @storage[selected[0], selected[1]]
heldpoke = pbHeldPokemon
next if !pokemon && !heldpoke
if @scene.quickswap
quickSwap(selected, pokemon)
else
if @fusionMode
pbFusionCommands(selected)
else
organizeActions(selected, pokemon, heldpoke, isTransferBox)
end
end
end
end
@scene.pbCloseBox
end
def organizeActions(selected, pokemon, heldpoke, isTransferBox)
commands = []
cmdMove = -1
cmdSummary = -1
cmdWithdraw = -1
cmdItem = -1
cmdFuse = -1
cmdUnfuse = -1
cmdReverse = -1
cmdRelease = -1
cmdDebug = -1
cmdCancel = -1
cmdNickname = -1
echoln selected
if heldpoke
helptext = _INTL("{1} is selected.", heldpoke.name)
commands[cmdMove = commands.length] = (pokemon) ? _INTL("Shift") : _INTL("Place")
elsif pokemon
helptext = _INTL("{1} is selected.", pokemon.name)
commands[cmdMove = commands.length] = _INTL("Move")
end
commands[cmdSummary = commands.length] = _INTL("Summary")
if pokemon != nil && !isTransferBox
if dexNum(pokemon.species) > NB_POKEMON
commands[cmdUnfuse = commands.length] = _INTL("Unfuse")
commands[cmdReverse = commands.length] = _INTL("Reverse") if $PokemonBag.pbQuantity(:DNAREVERSER) > 0 || $PokemonBag.pbQuantity(:INFINITEREVERSERS) > 0
else
commands[cmdFuse = commands.length] = _INTL("Fuse") if !@heldpkmn
end
end
commands[cmdNickname = commands.length] = _INTL("Nickname") if !@heldpkmn && !isTransferBox
commands[cmdWithdraw = commands.length] = (selected[0] == -1) ? _INTL("Store") : _INTL("Withdraw")
commands[cmdItem = commands.length] = _INTL("Item") if !isTransferBox
commands[cmdRelease = commands.length] = _INTL("Release") if !isTransferBox
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
commands[cmdCancel = commands.length] = _INTL("Cancel")
command = pbShowCommands(helptext, commands)
if cmdMove >= 0 && command == cmdMove # Move/Shift/Place
#@scene.pbSetCursorMode("default")
if @heldpkmn
(pokemon) ? pbSwap(selected) : pbPlace(selected)
else
if @scene.cursormode == "multiselect"
pbHoldMulti(selected[0], selected[1])
else
pbHold(selected)
end
end
elsif cmdSummary >= 0 && command == cmdSummary # Summary
pbSummary(selected, @heldpkmn)
elsif cmdNickname >= 0 && command == cmdNickname # Summary
renamePokemon(selected)
elsif cmdWithdraw >= 0 && command == cmdWithdraw # Store/Withdraw
(selected[0] == -1) ? pbStore(selected, @heldpkmn) : pbWithdraw(selected, @heldpkmn)
elsif cmdItem >= 0 && command == cmdItem # Item
pbItem(selected, @heldpkmn)
elsif cmdFuse >= 0 && command == cmdFuse # fuse
pbFuseFromPC(selected, @heldpkmn)
elsif cmdUnfuse >= 0 && command == cmdUnfuse # unfuse
pbUnfuseFromPC(selected)
elsif cmdReverse >= 0 && command == cmdReverse # unfuse
reverseFromPC(selected)
elsif cmdRelease >= 0 && command == cmdRelease # Release
pbRelease(selected, @heldpkmn)
elsif cmdDebug >= 0 && command == cmdDebug # Debug
pbPokemonDebug((@heldpkmn) ? @heldpkmn : pokemon, selected, heldpoke)
end
end
def quickSwap(selected, pokemon)
if @heldpkmn
(pokemon) ? pbSwap(selected) : pbPlace(selected)
else
pbHold(selected)
end
end
def pcWithdrawCommand
isTransferBox = @storage[@storage.currentBox].is_a?(StorageTransferBox)
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected == nil
next if pbConfirm(_INTL("Continue Box operations?"))
break
else
case selected[0]
when -2 # Party Pokémon
pbDisplay(_INTL("Which one will you take?"))
next
when -3 # Close box
if pbConfirm(_INTL("Exit from the Box?"))
pbSEPlay("PC close")
break
end
next
when -4 # Box name
pbBoxCommands
next
end
if @fusionMode
pbFusionCommands(selected)
else
pokemon = @storage[selected[0], selected[1]]
next if !pokemon
command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), [
_INTL("Withdraw"),
_INTL("Summary"),
_INTL("Release"),
_INTL("Cancel")
])
case command
when 0 then
pbWithdraw(selected, nil)
when 1 then
pbSummary(selected, nil)
# when 2 then pbMark(selected, nil)
when 2 then
pbRelease(selected, nil)
end
end
end
end
@scene.pbCloseBox
end
def pcDepositCommand
isTransferBox = @storage[@storage.currentBox].is_a?(StorageTransferBox)
loop do
selected = @scene.pbSelectParty(@storage.party)
if selected == -3 # Close box
if pbConfirm(_INTL("Exit from the Box?"))
pbSEPlay("PC close")
break
end
next
elsif selected < 0
next if pbConfirm(_INTL("Continue Box operations?"))
break
else
pokemon = @storage[-1, selected]
next if !pokemon
command = pbShowCommands(_INTL("{1} is selected.", pokemon.name), [
_INTL("Store"),
_INTL("Summary"),
_INTL("Mark"),
_INTL("Release"),
_INTL("Cancel")
])
case command
when 0 then
pbStore([-1, selected], nil)
when 1 then
pbSummary([-1, selected], nil)
when 2 then
pbMark([-1, selected], nil)
when 3 then
pbRelease([-1, selected], nil)
end
end
end
@scene.pbCloseBox
end
def renamePokemon(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
if pokemon.egg?
pbDisplay(_INTL("You cannot rename an egg!"))
return
end
speciesname = PBSpecies.getName(pokemon.species)
hasNickname = speciesname == pokemon.name
if hasNickname
pbDisplay(_INTL("{1} has no nickname.", speciesname))
else
pbDisplay(_INTL("{1} has the nickname {2}.", speciesname, pokemon.name))
end
commands = [
_INTL("Rename"),
_INTL("Quit")
]
command = pbShowCommands(
_INTL("What do you want to do?"), commands)
case command
when 0
newname = pbEnterPokemonName(_INTL("{1}'s nickname?", speciesname), 0, Pokemon::MAX_NAME_SIZE, "", pokemon)
pokemon.name = (newname == "") ? speciesname : newname
pbDisplay(_INTL("{1} is now named {2}!", speciesname, pokemon.name))
when 1
return
end
end
def pbUpdate # For debug
@scene.update
end
def pbHardRefresh # For debug
@scene.pbHardRefresh
end
def pbRefreshSingle(i)
# For debug
@scene.pbUpdateOverlay(i[1], (i[0] == -1) ? @storage.party : nil)
@scene.pbHardRefresh
end
def pbDisplay(message)
@scene.pbDisplay(message)
end
def pbConfirm(str)
return pbShowCommands(str, [_INTL("Yes"), _INTL("No")]) == 0
end
def pbShowCommands(msg, commands, index = 0)
return @scene.pbShowCommands(msg, commands, index)
end
def pbAble?(pokemon)
pokemon && !pokemon.egg? && pokemon.hp > 0
end
def pbAbleCount
count = 0
for p in @storage.party
count += 1 if pbAble?(p)
end
return count
end
def pbHeldPokemon
return @heldpkmn
end
def pbWithdraw(selected, heldpoke)
box = selected[0]
index = selected[1]
if box == -1
raise _INTL("Can't withdraw from party...");
end
if @storage.party_full?
pbDisplay(_INTL("Your party's full!"))
return false
end
if @storage[box].is_a?(StorageTransferBox)
unless verifyTransferBoxAutosave
return
end
end
@scene.pbWithdraw(selected, heldpoke, @storage.party.length)
if heldpoke
@storage.pbMoveCaughtToParty(heldpoke)
@heldpkmn = nil
else
@storage.pbMove(-1, -1, box, index)
end
@scene.pbRefresh
return true
end
def pbStore(selected, heldpoke)
box = selected[0]
index = selected[1]
if box != -1
raise _INTL("Can't deposit from box...")
end
if pbAbleCount <= 1 && pbAble?(@storage[box, index]) && !heldpoke
pbPlayBuzzerSE
pbDisplay(_INTL("That's your last Pokémon!"))
elsif heldpoke && heldpoke.mail
pbDisplay(_INTL("Please remove the Mail."))
elsif !heldpoke && @storage[box, index].mail
pbDisplay(_INTL("Please remove the Mail."))
else
loop do
destbox = @scene.pbChooseBox(_INTL("Deposit in which Box?"))
if destbox >= 0
firstfree = @storage.pbFirstFreePos(destbox)
if firstfree < 0
pbDisplay(_INTL("The Box is full."))
next
end
if heldpoke || selected[0] == -1
p = (heldpoke) ? heldpoke : @storage[-1, index]
p.time_form_set = nil
# p.form = 0 if p.isSpecies?(:SHAYMIN)
# p.heal
end
@scene.pbStore(selected, heldpoke, destbox, firstfree)
if heldpoke
@storage.pbMoveCaughtToBox(heldpoke, destbox)
@heldpkmn = nil
else
@storage.pbMove(destbox, -1, -1, index)
end
end
break
end
@scene.pbRefresh
end
end
def pbHold(selected)
box = selected[0]
index = selected[1]
if @storage[box].is_a?(StorageTransferBox)
unless verifyTransferBoxAutosave
return
end
end
if box == -1 && pbAble?(@storage[box, index]) && pbAbleCount <= 1
pbPlayBuzzerSE
pbDisplay(_INTL("That's your last Pokémon!"))
return
end
@scene.pbHold(selected)
@heldpkmn = @storage[box, index]
@storage.pbDelete(box, index)
@scene.pbRefresh
end
def pbPlace(selected)
box = selected[0]
index = selected[1]
if @storage[box].is_a?(StorageTransferBox)
if @heldpkmn.owner.name == "RENTAL"
pbMessage(_INTL("This Pokémon cannot be transferred."))
return
end
unless verifyTransferBoxAutosave
return
end
end
if @storage[box, index]
pbDisplay(_INTL("Can't place that there."))
return
echoln _INTL("Position {1},{2} is not empty...", box, index)
end
if box != -1 && index >= @storage.maxPokemon(box)
pbDisplay(_INTL("Can't place that there."))
return
end
if box != -1 && @heldpkmn.mail
pbDisplay(_INTL("Please remove the mail."))
return
end
if box >= 0
@heldpkmn.time_form_set = nil
@heldpkmn.form = 0 if @heldpkmn.isSpecies?(:SHAYMIN)
#@heldpkmn.heal
end
@scene.pbPlace(selected, @heldpkmn)
@storage[box, index] = @heldpkmn
if box == -1
@storage.party.compact!
end
@scene.pbRefresh
@heldpkmn = nil
end
def pbSwap(selected)
box = selected[0]
index = selected[1]
if !@storage[box, index]
raise _INTL("Position {1},{2} is empty...", box, index)
end
if @storage[box].is_a?(StorageTransferBox)
if @heldpkmn.owner.name == "RENTAL"
pbMessage(_INTL("This Pokémon cannot be transferred."))
return
end
unless verifyTransferBoxAutosave
return
end
end
if box == -1 && pbAble?(@storage[box, index]) && pbAbleCount <= 1 && !pbAble?(@heldpkmn)
pbPlayBuzzerSE
pbDisplay(_INTL("That's your last Pokémon!"))
return false
end
if box != -1 && @heldpkmn.mail
pbDisplay(_INTL("Please remove the mail."))
return false
end
if box >= 0
@heldpkmn.time_form_set = nil
@heldpkmn.form = 0 if @heldpkmn.isSpecies?(:SHAYMIN)
#@heldpkmn.heal
end
@scene.pbSwap(selected, @heldpkmn)
tmp = @storage[box, index]
@storage[box, index] = @heldpkmn
@heldpkmn = tmp
@scene.pbRefresh
return true
end
def pbRelease(selected, heldpoke)
box = selected[0]
index = selected[1]
pokemon = (heldpoke) ? heldpoke : @storage[box, index]
return if !pokemon
if pokemon.egg?
pbDisplay(_INTL("You can't release an Egg."))
return false
elsif pokemon.mail
pbDisplay(_INTL("Please remove the mail."))
return false
end
if box == -1 && pbAbleCount <= 1 && pbAble?(pokemon) && !heldpoke
pbPlayBuzzerSE
pbDisplay(_INTL("That's your last Pokémon!"))
return
end
command = pbShowCommands(_INTL("Release this Pokémon?"), [_INTL("No"), _INTL("Yes")])
if command == 1
if pokemon.owner.name == "RENTAL"
pbDisplay(_INTL("This Pokémon cannot be released"))
return
end
pkmnname = pokemon.name
@scene.pbRelease(selected, heldpoke)
if heldpoke
@heldpkmn = nil
else
@storage.pbDelete(box, index)
end
@scene.pbRefresh
pbDisplay(_INTL("{1} was released.", pkmnname))
pbDisplay(_INTL("Bye-bye, {1}!", pkmnname))
@scene.pbRefresh
end
return
end
def pbChooseMove(pkmn, helptext, index = 0)
movenames = []
for i in pkmn.moves
if i.total_pp <= 0
movenames.push(_INTL("{1} (PP: ---)", i.name))
else
movenames.push(_INTL("{1} (PP: {2}/{3})", i.name, i.pp, i.total_pp))
end
end
return @scene.pbShowCommands(helptext, movenames, index)
end
def pbSummary(selected, heldpoke)
@scene.pbSummary(selected, heldpoke)
end
def pbMark(selected, heldpoke)
@scene.pbMark(selected, heldpoke)
end
def pbItem(selected, heldpoke)
box = selected[0]
index = selected[1]
pokemon = (heldpoke) ? heldpoke : @storage[box, index]
if pokemon.egg?
pbDisplay(_INTL("Eggs can't hold items."))
return
elsif pokemon.mail
pbDisplay(_INTL("Please remove the mail."))
return
end
if pokemon.item
itemname = pokemon.item.name
if pbConfirm(_INTL("Take this {1}?", itemname))
if !$PokemonBag.pbStoreItem(pokemon.item)
pbDisplay(_INTL("Can't store the {1}.", itemname))
else
pbDisplay(_INTL("Took the {1}.", itemname))
pokemon.item = nil
@scene.pbHardRefresh
end
end
else
item = scene.pbChooseItem($PokemonBag)
if item
itemname = GameData::Item.get(item).name
pokemon.item = item
$PokemonBag.pbDeleteItem(item)
pbDisplay(_INTL("{1} is now being held.", itemname))
@scene.pbHardRefresh
end
end
end
def pbBoxCommands
cmd_jump = _INTL("Jump")
cmd_wallpaper = _INTL("Wallpaper")
cmd_name = _INTL("Name")
cmd_info = _INTL("Info")
cmd_cancel = _INTL("Cancel")
commands = []
commands << cmd_jump
commands << cmd_wallpaper
commands << cmd_name if !@storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_info if @storage[@storage.currentBox].is_a?(StorageTransferBox)
commands << cmd_cancel
command = pbShowCommands(
_INTL("What do you want to do?"), commands)
case commands[command]
when cmd_jump
boxCommandJump
when cmd_wallpaper
boxCommandSetWallpaper
when cmd_name
boxCommandName
when cmd_info
boxCommandTransferInfo
end
end
def boxCommandTransferInfo
pbMessage(_INTL("This is the Transfer Box. It's used to transfer Pokémon between savefiles!"))
pbMessage(_INTL("Any Pokémon that is placed in this box will be shared between all savefiles of Pokémon Infinite Fusion 1 and Pokémon Infinite Fusion 2."))
end
def boxCommandName
@scene.pbBoxName(_INTL("Box name?"), 0, 20)
end
def boxCommandJump
destbox = @scene.pbChooseBox(_INTL("Jump to which Box?"))
if destbox >= 0
@scene.pbJumpToBox(destbox)
end
end
def boxCommandSetWallpaper
papers = @storage.availableWallpapers
index = 0
for i in 0...papers[1].length
if papers[1][i] == @storage[@storage.currentBox].background
index = i; break
end
end
wpaper = pbShowCommands(_INTL("Pick the wallpaper."), papers[0], index)
if wpaper >= 0
@scene.pbChangeBackground(papers[1][wpaper])
end
end
def pbChoosePokemon(_party = nil)
@heldpkmn = nil
@scene.pbStartBox(self, 1)
retval = nil
loop do
selected = @scene.pbSelectBox(@storage.party)
if selected && selected[0] == -3 # Close box
if pbConfirm(_INTL("Exit from the Box?"))
pbSEPlay("PC close")
break
end
next
end
if selected == nil
next if pbConfirm(_INTL("Continue Box operations?"))
break
elsif selected[0] == -4 # Box name
pbBoxCommands
else
pokemon = @storage[selected[0], selected[1]]
next if !pokemon
commands = [
_INTL("Select"),
_INTL("Summary"),
_INTL("Withdraw"),
_INTL("Item"),
_INTL("Mark")
]
commands.push(_INTL("Cancel"))
commands[2] = _INTL("Store") if selected[0] == -1
helptext = _INTL("{1} is selected.", pokemon.name)
command = pbShowCommands(helptext, commands)
case command
when 0 # Select
if pokemon
retval = selected
break
end
when 1
pbSummary(selected, nil)
when 2 # Store/Withdraw
if selected[0] == -1
pbStore(selected, nil)
else
pbWithdraw(selected, nil)
end
when 3
pbItem(selected, nil)
when 4
pbMark(selected, nil)
end
end
end
@scene.pbCloseBox
return retval
end
#
# Fusion stuff
#
def pbFuseFromPC(selected, heldpoke)
@scene.pbSetCursorMode("default")
box = selected[0]
index = selected[1]
poke_body = @storage[box, index]
poke_head = heldpoke
if heldpoke
if dexNum(heldpoke.species) > NB_POKEMON
pbDisplay(_INTL("{1} is already fused!", heldpoke.name))
return
end
if (heldpoke.egg?)
pbDisplay(_INTL("It's impossible to fuse an egg!"))
return
end
end
splicerItem = selectSplicer()
if splicerItem == nil
cancelFusion()
return
end
if !heldpoke
@fusionMode = true
@fusionItem = splicerItem
@scene.setFusing(true, @fusionItem)
pbHold(selected)
pbDisplay(_INTL("Select a Pokémon to fuse it with"))
@scene.sprites["box"].disableFusions()
return
end
if !poke_body
pbDisplay(_INTL("Select a Pokémon to fuse it with"))
@fusionMode = true
@fusionItem = splicerItem
@scene.setFusing(true, @fusionItem)
return
end
end
def deleteHeldPokemon(heldpoke, selected)
@scene.pbReleaseInstant(selected, heldpoke)
@heldpkmn = nil
end
def deleteSelectedPokemon(heldpoke, selected)
pbSwap(selected)
deleteHeldPokemon(heldpoke, selected)
end
def cancelFusion
@splicerItem = nil
@scene.setFusing(false)
@fusionMode = false
@scene.sprites["box"].enableFusions()
end
def canDeleteItem(item)
return item == :SUPERSPLICERS || item == :DNASPLICERS
end
def isSuperSplicer?(item)
return item == :SUPERSPLICERS || item == :INFINITESPLICERS2
end
def pbFusionCommands(selected)
heldpoke = pbHeldPokemon
pokemon = @storage[selected[0], selected[1]]
if !pokemon
command = pbShowCommands(_INTL("Select an action"), [_INTL("Continue fusing"), _INTL("Stop fusing")])
case command
when 1 # stop
cancelFusion()
end
else
commands = [
_INTL("Fuse"),
_INTL("Swap")
]
commands.push(_INTL("Stop fusing"))
commands.push(_INTL("Continue fusing"))
if !heldpoke
pbPlace(selected)
@fusionMode = false
@scene.setFusing(false)
return
end
command = pbShowCommands(_INTL("Select an action"), commands)
case command
when 0 # Fuse
if !pokemon
pbDisplay(_INTL("No Pokémon selected!"))
return
else
if dexNum(pokemon.species) > NB_POKEMON
pbDisplay(_INTL("This Pokémon is already fused!"))
return
end
end
isSuperSplicer = isSuperSplicer?(@fusionItem)
selectedHead = selectFusion(pokemon, heldpoke, isSuperSplicer)
if selectedHead == nil
pbDisplay(_INTL("It won't have any effect."))
return false
end
if selectedHead == -1 # cancelled out
return false
end
selectedBase = selectedHead == pokemon ? heldpoke : pokemon
firstOptionSelected = selectedBase == pokemon
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
playingBGM = $game_system.getPlayingBGM
pbFuse(selectedHead, selectedBase, @fusionItem)
if canDeleteItem(@fusionItem)
$PokemonBag.pbDeleteItem(@fusionItem)
end
if firstOptionSelected
deleteSelectedPokemon(heldpoke, selected)
else
deleteHeldPokemon(heldpoke, selected)
end
@scene.setFusing(false)
@fusionMode = false
@scene.sprites["box"].enableFusions()
pbBGMPlay(playingBGM)
return
else
# print "fusion cancelled"
# @fusionMode = false
end
when 1 # swap
if pokemon
if dexNum(pokemon.species) <= NB_POKEMON
pbSwap(selected)
else
pbDisplay(_INTL("This Pokémon is already fused!"))
end
else
pbDisplay(_INTL("Select a Pokémon!"))
end
when 2 # cancel
cancelFusion()
return
end
end
end
def reverseFromPC(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
if !pokemon.isFusion?
scene.pbDisplay(_INTL("It won't have any effect."))
return
end
if Kernel.pbConfirmMessageSerious(_INTL("Should {1} be reversed?", pokemon.name))
reverseFusion(pokemon)
$PokemonBag.pbDeleteItem(:DNAREVERSER) if $PokemonBag.pbQuantity(:INFINITEREVERSERS) <= 0
end
@scene.pbHardRefresh
end
def pbUnfuseFromPC(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
if pbConfirm(_INTL("Unfuse {1}?", pokemon.name))
item = selectSplicer()
return if item == nil
isSuperSplicer = isSuperSplicer?(item)
if pbUnfuse(pokemon, @scene, isSuperSplicer, selected)
if canDeleteItem(item)
$PokemonBag.pbDeleteItem(item)
end
end
@scene.pbHardRefresh
end
end
end
@@ -0,0 +1,195 @@
class PokemonStorageScreen
attr_accessor :fusionMode
#
# Fusion stuff
#
def pbFuseFromPC(selected, heldpoke)
@scene.pbSetCursorMode("default")
box = selected[0]
index = selected[1]
poke_body = @storage[box, index]
poke_head = heldpoke
if heldpoke
if dexNum(heldpoke.species) > NB_POKEMON
pbDisplay(_INTL("{1} is already fused!", heldpoke.name))
return
end
if (heldpoke.egg?)
pbDisplay(_INTL("It's impossible to fuse an egg!"))
return
end
end
splicerItem = selectSplicer()
if splicerItem == nil
cancelFusion()
return
end
if !heldpoke
@fusionMode = true
@fusionItem = splicerItem
@scene.setFusing(true, @fusionItem)
pbHold(selected)
pbDisplay(_INTL("Select a Pokémon to fuse it with"))
@scene.sprites["box"].disableFusions()
return
end
if !poke_body
pbDisplay(_INTL("Select a Pokémon to fuse it with"))
@fusionMode = true
@fusionItem = splicerItem
@scene.setFusing(true, @fusionItem)
return
end
end
def deleteHeldPokemon(heldpoke, selected)
@scene.pbReleaseInstant(selected, heldpoke)
@heldpkmn = nil
end
def deleteSelectedPokemon(heldpoke, selected)
pbSwap(selected)
deleteHeldPokemon(heldpoke, selected)
end
def cancelFusion
pbSEPlay("GUI storage put down")
@splicerItem = nil
@scene.setFusing(false)
@fusionMode = false
@scene.sprites["box"].enableFusions()
end
def canDeleteItem(item)
return item == :SUPERSPLICERS || item == :DNASPLICERS
end
def isSuperSplicer?(item)
return item == :SUPERSPLICERS || item == :INFINITESPLICERS2
end
def pbFusionCommands(selected)
heldpoke = pbHeldPokemon
pokemon = @storage[selected[0], selected[1]]
if !pokemon
command = pbShowCommands(_INTL("Select an action"), [_INTL("Continue fusing"), _INTL("Stop fusing")])
case command
when 1 # stop
cancelFusion
end
else
commands = [
_INTL("Fuse"),
_INTL("Swap")
]
commands.push(_INTL("Stop fusing"))
commands.push(_INTL("Cancel"))
if !heldpoke
pbPlace(selected)
@fusionMode = false
@scene.setFusing(false)
return
end
command = pbShowCommands(_INTL("Select an action"), commands)
case command
when 0 # Fuse
if !pokemon
pbDisplay(_INTL("No Pokémon selected!"))
return
else
if dexNum(pokemon.species) > NB_POKEMON
pbDisplay(_INTL("This Pokémon is already fused!"))
return
end
end
isSuperSplicer = isSuperSplicer?(@fusionItem)
selectedHead = selectFusion(pokemon, heldpoke, isSuperSplicer)
if selectedHead == nil
pbDisplay(_INTL("It won't have any effect."))
return false
end
if selectedHead == -1 # cancelled out
return false
end
selectedBase = selectedHead == pokemon ? heldpoke : pokemon
firstOptionSelected = selectedBase == pokemon
if (Kernel.pbConfirmMessage(_INTL("Fuse the two Pokémon?")))
playingBGM = $game_system.getPlayingBGM
pbFuse(selectedHead, selectedBase, @fusionItem)
if canDeleteItem(@fusionItem)
$PokemonBag.pbDeleteItem(@fusionItem)
end
if firstOptionSelected
deleteSelectedPokemon(heldpoke, selected)
else
deleteHeldPokemon(heldpoke, selected)
end
@scene.setFusing(false)
@fusionMode = false
@scene.sprites["box"].enableFusions()
pbBGMPlay(playingBGM)
return
else
# print "fusion cancelled"
# @fusionMode = false
end
when 1 # swap
if pokemon
if dexNum(pokemon.species) <= NB_POKEMON
pbSwap(selected)
else
pbDisplay(_INTL("This Pokémon is already fused!"))
end
else
pbDisplay(_INTL("Select a Pokémon!"))
end
when 2 # cancel
cancelFusion()
return
end
end
end
def reverseFromPC(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
if !pokemon.isFusion?
scene.pbDisplay(_INTL("It won't have any effect."))
return
end
if Kernel.pbConfirmMessageSerious(_INTL("Should {1} be reversed?", pokemon.name))
reverseFusion(pokemon)
$PokemonBag.pbDeleteItem(:DNAREVERSER) if $PokemonBag.pbQuantity(:INFINITEREVERSERS) <= 0
end
@scene.pbHardRefresh
end
def pbUnfuseFromPC(selected)
box = selected[0]
index = selected[1]
pokemon = @storage[box, index]
if pbConfirm(_INTL("Unfuse {1}?", pokemon.name))
item = selectSplicer()
return if item == nil
isSuperSplicer = isSuperSplicer?(item)
if pbUnfuse(pokemon, @scene, isSuperSplicer, selected)
if canDeleteItem(item)
$PokemonBag.pbDeleteItem(item)
end
end
@scene.pbHardRefresh
end
end
end
@@ -0,0 +1,209 @@
#===============================================================================
# Cursor
#===============================================================================
class PokemonBoxArrow < SpriteWrapper
attr_accessor :quickswap
def initialize(viewport = nil)
super(viewport)
@frame = 0
@holding = false
@updating = false
@quickswap = false
@grabbingState = 0
@placingState = 0
@heldpkmn = nil
@handsprite = ChangelingSprite.new(0, 0, viewport)
@handsprite.addBitmap("point1", "Graphics/Pictures/Storage/cursor_point_1")
@handsprite.addBitmap("point2", "Graphics/Pictures/Storage/cursor_point_2")
@handsprite.addBitmap("grab", "Graphics/Pictures/Storage/cursor_grab")
@handsprite.addBitmap("fist", "Graphics/Pictures/Storage/cursor_fist")
@handsprite.addBitmap("point1q", "Graphics/Pictures/Storage/cursor_point_1_q")
@handsprite.addBitmap("point2q", "Graphics/Pictures/Storage/cursor_point_2_q")
@handsprite.addBitmap("grabq", "Graphics/Pictures/Storage/cursor_grab_q")
@handsprite.addBitmap("fistq", "Graphics/Pictures/Storage/cursor_fist_q")
@handsprite.addBitmap("fusion_dnasplicer", "Graphics/Pictures/Storage/cursor_dnasplicer")
@handsprite.addBitmap("fusion_supersplicer", "Graphics/Pictures/Storage/cursor_supersplicer")
@handsprite.addBitmap("fusion_infinitesplicer", "Graphics/Pictures/Storage/cursor_infinitesplicer")
@handsprite.addBitmap("fusion_infinitesplicer2", "Graphics/Pictures/Storage/cursor_infinitesplicer2")
@handsprite.changeBitmap("fist")
@spriteX = self.x
@spriteY = self.y
@splicerType = 0
end
def dispose
@handsprite.dispose
@heldpkmn.dispose if @heldpkmn
super
end
# 0 :DNASPLICERS
# 1: SUPERSPLICERS
# 2: INFINITESPLICERS
# 3: INFINITESPLICERS2
def getSplicerIcon
case @splicerType
when 3
return "fusion_dnasplicer"
when 2
return "fusion_infinitesplicer"
when 1
return "fusion_supersplicer"
else
return "fusion_dnasplicer"
end
end
def setSplicerType(type)
@splicerType = type
end
def setFusing(fusing)
@fusing = fusing
end
def fusing?
return @fusing
end
def heldPokemon
@heldpkmn = nil if @heldpkmn && @heldpkmn.disposed?
@holding = false if !@heldpkmn
return @heldpkmn
end
def visible=(value)
super
@handsprite.visible = value
sprite = heldPokemon
sprite.visible = value if sprite
end
def color=(value)
super
@handsprite.color = value
sprite = heldPokemon
sprite.color = value if sprite
end
def holding?
return self.heldPokemon && @holding
end
def grabbing?
return @grabbingState > 0
end
def placing?
return @placingState > 0
end
def x=(value)
super
@handsprite.x = self.x
@spriteX = x if !@updating
heldPokemon.x = self.x if holding?
end
def y=(value)
super
@handsprite.y = self.y
@spriteY = y if !@updating
heldPokemon.y = self.y + 16 if holding?
end
def z=(value)
super
@handsprite.z = value
end
def setSprite(sprite)
if holding?
@heldpkmn = sprite
@heldpkmn.viewport = self.viewport if @heldpkmn
@heldpkmn.z = 1 if @heldpkmn
@holding = false if !@heldpkmn
self.z = 2
end
end
def deleteSprite
@holding = false
if @heldpkmn
@heldpkmn.dispose
@heldpkmn = nil
end
end
def grab(sprite)
@grabbingState = 1
@heldpkmn = sprite
@heldpkmn.viewport = self.viewport
@heldpkmn.z = 1
self.z = 2
end
def place
@placingState = 1
end
def release
@heldpkmn.release if @heldpkmn
end
def update
@updating = true
super
heldpkmn = heldPokemon
heldpkmn.update if heldpkmn
@handsprite.update
@holding = false if !heldpkmn
if @fusionMode
@handsprite.changeBitmap(getSplicerIcon)
elsif @grabbingState > 0
if @grabbingState <= 4 * Graphics.frame_rate / 20
@handsprite.changeBitmap((@quickswap) ? "grabq" : "grab")
self.y = @spriteY + 4.0 * @grabbingState * 20 / Graphics.frame_rate
@grabbingState += 1
elsif @grabbingState <= 8 * Graphics.frame_rate / 20
@holding = true
@handsprite.changeBitmap((@quickswap) ? "fistq" : "fist")
self.y = @spriteY + 4 * (8 * Graphics.frame_rate / 20 - @grabbingState) * 20 / Graphics.frame_rate
@grabbingState += 1
else
@grabbingState = 0
end
elsif @placingState > 0
if @placingState <= 4 * Graphics.frame_rate / 20
@handsprite.changeBitmap((@quickswap) ? "fistq" : "fist")
self.y = @spriteY + 4.0 * @placingState * 20 / Graphics.frame_rate
@placingState += 1
elsif @placingState <= 8 * Graphics.frame_rate / 20
@holding = false
@heldpkmn = nil
@handsprite.changeBitmap((@quickswap) ? "grabq" : "grab")
self.y = @spriteY + 4 * (8 * Graphics.frame_rate / 20 - @placingState) * 20 / Graphics.frame_rate
@placingState += 1
else
@placingState = 0
end
elsif holding?
@handsprite.changeBitmap((@quickswap) ? "fistq" : "fist")
else
self.x = @spriteX
self.y = @spriteY
if @frame < Graphics.frame_rate / 2
@handsprite.changeBitmap((@quickswap) ? "point1q" : "point1")
else
@handsprite.changeBitmap((@quickswap) ? "point2q" : "point2")
end
end
@frame += 1
@frame = 0 if @frame >= Graphics.frame_rate
@updating = false
end
end
@@ -0,0 +1,99 @@
#===============================================================================
# Pokémon icons
#===============================================================================
class PokemonBoxIcon < IconSprite
attr_accessor :pokemon
def initialize(pokemon, viewport = nil)
super(0, 0, viewport)
@pokemon = pokemon
@release = Interpolator.new
@startRelease = false
refresh
end
def releasing?
return @release.tweening?
end
def useRegularIcon(species)
dexNum = getDexNumberForSpecies(species)
return true if dexNum <= Settings::NB_POKEMON
return false if $game_variables == nil
return true if $game_variables[VAR_FUSION_ICON_STYLE] != 0
bitmapFileName = sprintf("Graphics/Icons/icon%03d", dexNum)
return true if pbResolveBitmap(bitmapFileName)
return false
end
def createFusionIcon(species, spriteform_head = nil, spriteform_body = nil)
bodyPoke_number = getBodyID(species)
headPoke_number = getHeadID(species, bodyPoke_number)
bodyPoke = GameData::Species.get(bodyPoke_number).species
headPoke = GameData::Species.get(headPoke_number).species
icon1 = AnimatedBitmap.new(GameData::Species.icon_filename(headPoke, spriteform_head))
icon2 = AnimatedBitmap.new(GameData::Species.icon_filename(bodyPoke, spriteform_body))
dexNum = getDexNumberForSpecies(species)
ensureFusionIconExists
bitmapFileName = sprintf("Graphics/Pokemon/FusionIcons/icon%03d", dexNum)
headPokeFileName = GameData::Species.icon_filename(headPoke, spriteform_head)
bitmapPath = sprintf("%s.png", bitmapFileName)
generated_new_icon = generateFusionIcon(headPokeFileName, bitmapPath)
result_icon = generated_new_icon ? AnimatedBitmap.new(bitmapPath) : icon1
for i in 0..icon1.width - 1
for j in ((icon1.height / 2) + Settings::FUSION_ICON_SPRITE_OFFSET)..icon1.height - 1
temp = icon2.bitmap.get_pixel(i, j)
result_icon.bitmap.set_pixel(i, j, temp)
end
end
return result_icon
end
def release
self.ox = self.src_rect.width / 2 # 32
self.oy = self.src_rect.height / 2 # 32
self.x += self.src_rect.width / 2 # 32
self.y += self.src_rect.height / 2 # 32
@release.tween(self, [
[Interpolator::ZOOM_X, 0],
[Interpolator::ZOOM_Y, 0],
[Interpolator::OPACITY, 0]
], 100)
@startRelease = true
end
def refresh(fusion_enabled = true)
return if !@pokemon
if useRegularIcon(@pokemon.species) || @pokemon.egg?
self.setBitmap(GameData::Species.icon_filename_from_pokemon(@pokemon))
else
self.setBitmapDirectly(createFusionIcon(@pokemon.species, @pokemon.spriteform_head, @pokemon.spriteform_body))
if fusion_enabled
self.visible = true
else
self.opacity = false
end
end
self.src_rect = Rect.new(0, 0, self.bitmap.height, self.bitmap.height)
end
def update
super
@release.update
self.color = Color.new(0, 0, 0, 0)
dispose if @startRelease && !releasing?
end
end
@@ -0,0 +1,121 @@
#===============================================================================
# Party pop-up panel
#===============================================================================
class PokemonBoxPartySprite < SpriteWrapper
def initialize(party, viewport = nil)
super(viewport)
@party = party
@boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/overlay_party")
@pokemonsprites = []
for i in 0...Settings::MAX_PARTY_SIZE
@pokemonsprites[i] = nil
pokemon = @party[i]
if pokemon
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon, viewport)
end
end
@contents = BitmapWrapper.new(172, 352)
self.bitmap = @contents
self.x = 182
self.y = Graphics.height - 352
pbSetSystemFont(self.bitmap)
refresh
end
def dispose
for i in 0...Settings::MAX_PARTY_SIZE
@pokemonsprites[i].dispose if @pokemonsprites[i]
end
@boxbitmap.dispose
@contents.dispose
super
end
def x=(value)
super
refresh
end
def y=(value)
super
refresh
end
def color=(value)
super
for i in 0...Settings::MAX_PARTY_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = pbSrcOver(@pokemonsprites[i].color, value)
end
end
end
def visible=(value)
super
for i in 0...Settings::MAX_PARTY_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value
end
end
end
def getPokemon(index)
return @pokemonsprites[index]
end
def setPokemon(index, sprite)
@pokemonsprites[index] = sprite
@pokemonsprites.compact!
refresh
end
def grabPokemon(index, arrow)
sprite = @pokemonsprites[index]
if sprite
arrow.grab(sprite)
@pokemonsprites[index] = nil
@pokemonsprites.compact!
refresh
end
end
def deletePokemon(index)
@pokemonsprites[index].dispose
@pokemonsprites[index] = nil
@pokemonsprites.compact!
refresh
end
def refresh
@contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 172, 352))
pbDrawTextPositions(self.bitmap, [
[_INTL("Back"), 86, 240, 2, Color.new(248, 248, 248), Color.new(80, 80, 80), 1]
])
xvalues = [] # [18, 90, 18, 90, 18, 90]
yvalues = [] # [2, 18, 66, 82, 130, 146]
for i in 0...Settings::MAX_PARTY_SIZE
xvalues.push(18 + 72 * (i % 2))
yvalues.push(2 + 16 * (i % 2) + 64 * (i / 2))
end
for j in 0...Settings::MAX_PARTY_SIZE
@pokemonsprites[j] = nil if @pokemonsprites[j] && @pokemonsprites[j].disposed?
end
@pokemonsprites.compact!
for j in 0...Settings::MAX_PARTY_SIZE
sprite = @pokemonsprites[j]
next if sprite.nil? || sprite.disposed?
sprite.viewport = self.viewport
sprite.x = self.x + xvalues[j]
sprite.y = self.y + yvalues[j]
sprite.z = 1
end
end
def update
super
for i in 0...Settings::MAX_PARTY_SIZE
@pokemonsprites[i].update if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
end
end
end
@@ -0,0 +1,180 @@
#===============================================================================
# Box
#===============================================================================
class PokemonBoxSprite < SpriteWrapper
attr_accessor :refreshBox
attr_accessor :refreshSprites
def initialize(storage, boxnumber, viewport = nil, fusionsEnabled = true)
super(viewport)
@storage = storage
@boxnumber = boxnumber
@refreshBox = true
@refreshSprites = true
@pokemonsprites = []
for i in 0...PokemonBox::BOX_SIZE
@pokemonsprites[i] = nil
pokemon = @storage[boxnumber, i]
@pokemonsprites[i] = PokemonBoxIcon.new(pokemon, viewport)
end
@contents = BitmapWrapper.new(324, 296)
self.bitmap = @contents
self.x = 184
self.y = 18
@fusions_enabled = fusionsEnabled
refresh
end
def disableFusions()
@fusions_enabled = false
refreshAllBoxSprites()
end
def enableFusions()
@fusions_enabled = true
refreshAllBoxSprites()
end
def isFusionEnabled
return @fusions_enabled
end
def dispose
if !disposed?
for i in 0...PokemonBox::BOX_SIZE
@pokemonsprites[i].dispose if @pokemonsprites[i]
@pokemonsprites[i] = nil
end
@boxbitmap.dispose
@contents.dispose
super
end
end
def x=(value)
super
refresh
end
def y=(value)
super
refresh
end
def color=(value)
super
if @refreshSprites
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].color = value
end
end
end
refresh
end
def visible=(value)
super
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].visible = value
end
end
refresh
end
def getBoxBitmap
if !@bg || @bg != @storage[@boxnumber].background
curbg = @storage[@boxnumber].background
if !curbg || (curbg.is_a?(String) && curbg.length == 0)
@bg = @boxnumber % PokemonStorage::BASICWALLPAPERQTY
else
if curbg.is_a?(String) && curbg[/^box(\d+)$/]
curbg = $~[1].to_i
@storage[@boxnumber].background = curbg
end
@bg = curbg
end
if !@storage.isAvailableWallpaper?(@bg)
@bg = @boxnumber % PokemonStorage::BASICWALLPAPERQTY
@storage[@boxnumber].background = @bg
end
@boxbitmap.dispose if @boxbitmap
@boxbitmap = AnimatedBitmap.new("Graphics/Pictures/Storage/Wallpapers/box_#{@bg}")
end
end
def getPokemon(index)
return @pokemonsprites[index]
end
def setPokemon(index, sprite)
@pokemonsprites[index] = sprite
@pokemonsprites[index].refresh
refresh
end
def grabPokemon(index, arrow)
sprite = @pokemonsprites[index]
if sprite
arrow.grab(sprite)
@pokemonsprites[index] = nil
update
end
end
def deletePokemon(index)
@pokemonsprites[index].dispose
@pokemonsprites[index] = nil
update
end
def refresh
if @refreshBox
boxname = @storage[@boxnumber].name
getBoxBitmap
@contents.blt(0, 0, @boxbitmap.bitmap, Rect.new(0, 0, 324, 296))
pbSetSystemFont(@contents)
widthval = @contents.text_size(boxname).width
xval = 162 - (widthval / 2)
pbDrawShadowText(@contents, xval, 8, widthval, 32,
boxname, Color.new(248, 248, 248), Color.new(40, 48, 48))
@refreshBox = false
end
yval = self.y + 30
for j in 0...PokemonBox::BOX_HEIGHT
xval = self.x + 10
for k in 0...PokemonBox::BOX_WIDTH
sprite = @pokemonsprites[j * PokemonBox::BOX_WIDTH + k]
if sprite && !sprite.disposed?
sprite.viewport = self.viewport
sprite.x = xval
sprite.y = yval
sprite.z = 1
end
xval += 48
end
yval += 48
end
end
def refreshAllBoxSprites
# spriteLoader = BattleSpriteLoader.new
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].refresh(@fusions_enabled)
end
# spriteLoader.preload_sprite_from_pokemon(@pokemonsprites[i].pokemon) if @pokemonsprites[i].pokemon
end
end
def update
super
for i in 0...PokemonBox::BOX_SIZE
if @pokemonsprites[i] && !@pokemonsprites[i].disposed?
@pokemonsprites[i].update
end
end
end
end
@@ -0,0 +1,72 @@
#===============================================================================
# Pokémon sprite
#===============================================================================
class MosaicPokemonSprite < PokemonSprite
attr_reader :mosaic
def initialize(*args)
super(*args)
@mosaic = 0
@inrefresh = false
@mosaicbitmap = nil
@mosaicbitmap2 = nil
@oldbitmap = self.bitmap
end
def dispose
super
@mosaicbitmap.dispose if @mosaicbitmap
@mosaicbitmap = nil
@mosaicbitmap2.dispose if @mosaicbitmap2
@mosaicbitmap2 = nil
end
def bitmap=(value)
super
mosaicRefresh(value)
end
def mosaic=(value)
@mosaic = value
@mosaic = 0 if @mosaic < 0
mosaicRefresh(@oldbitmap)
end
def mosaicRefresh(bitmap)
return if @inrefresh
@inrefresh = true
@oldbitmap = bitmap
if @mosaic <= 0 || !@oldbitmap
@mosaicbitmap.dispose if @mosaicbitmap
@mosaicbitmap = nil
@mosaicbitmap2.dispose if @mosaicbitmap2
@mosaicbitmap2 = nil
self.bitmap = @oldbitmap
else
newWidth = [(@oldbitmap.width / @mosaic), 1].max
newHeight = [(@oldbitmap.height / @mosaic), 1].max
@mosaicbitmap2.dispose if @mosaicbitmap2
@mosaicbitmap = pbDoEnsureBitmap(@mosaicbitmap, newWidth, newHeight)
@mosaicbitmap.clear
@mosaicbitmap2 = pbDoEnsureBitmap(@mosaicbitmap2, @oldbitmap.width, @oldbitmap.height)
@mosaicbitmap2.clear
@mosaicbitmap.stretch_blt(Rect.new(0, 0, newWidth, newHeight), @oldbitmap, @oldbitmap.rect)
@mosaicbitmap2.stretch_blt(
Rect.new(-@mosaic / 2 + 1, -@mosaic / 2 + 1,
@mosaicbitmap2.width, @mosaicbitmap2.height),
@mosaicbitmap, Rect.new(0, 0, newWidth, newHeight))
self.bitmap = @mosaicbitmap2
end
@inrefresh = false
end
end
#===============================================================================
#
#===============================================================================
class AutoMosaicPokemonSprite < MosaicPokemonSprite
def update
super
self.mosaic -= 1
end
end
@@ -79,12 +79,12 @@ class TriadCard
def self.createBack(type = nil, noback = false)
bitmap = BitmapWrapper.new(80, 96)
if !noback
cardbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/triad_card_opponent"))
cardbitmap = AnimatedBitmap.new("Graphics/Pictures/triad_card_opponent")
bitmap.blt(0, 0, cardbitmap.bitmap, Rect.new(0, 0, cardbitmap.width, cardbitmap.height))
cardbitmap.dispose
end
if type
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
typebitmap = AnimatedBitmap.new("Graphics/Pictures/types")
type_number = GameData::Type.get(type).id_number
typerect = Rect.new(0, type_number * 28, 64, 28)
bitmap.blt(8, 50, typebitmap.bitmap, typerect, 192)
@@ -97,13 +97,13 @@ class TriadCard
return TriadCard.createBack if owner == 0
bitmap = BitmapWrapper.new(80, 96)
if owner == 2 # Opponent
cardbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/triad_card_opponent"))
cardbitmap = AnimatedBitmap.new("Graphics/Pictures/triad_card_opponent")
else # Player
cardbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/triad_card_player"))
cardbitmap = AnimatedBitmap.new("Graphics/Pictures/triad_card_player")
end
typebitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/types"))
typebitmap = AnimatedBitmap.new("Graphics/Pictures/types")
iconbitmap = AnimatedBitmap.new(GameData::Species.icon_filename(@species, @form))
numbersbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/triad_numbers"))
numbersbitmap = AnimatedBitmap.new("Graphics/Pictures/triad_numbers")
# Draw card background
bitmap.blt(0, 0, cardbitmap.bitmap, Rect.new(0, 0, cardbitmap.width, cardbitmap.height))
# Draw type icon
@@ -32,8 +32,8 @@ class SlotMachineReel < BitmapSprite
@stopping=false
@slipping=0
@index=rand(@reel.length)
@images=AnimatedBitmap.new(_INTL("Graphics/Pictures/Slot Machine/images"))
@shading=AnimatedBitmap.new(_INTL("Graphics/Pictures/Slot Machine/ReelOverlay"))
@images=AnimatedBitmap.new("Graphics/Pictures/Slot Machine/images")
@shading=AnimatedBitmap.new("Graphics/Pictures/Slot Machine/ReelOverlay")
update
end
@@ -88,7 +88,7 @@ class SlotMachineScore < BitmapSprite
@viewport=Viewport.new(x,y,70,22)
@viewport.z=99999
super(70,22,@viewport)
@numbers=AnimatedBitmap.new(_INTL("Graphics/Pictures/Slot Machine/numbers"))
@numbers=AnimatedBitmap.new("Graphics/Pictures/Slot Machine/numbers")
self.score=score
end
@@ -112,7 +112,7 @@ class VoltorbFlip
pbMessage(_INTL("You've gathered {1} Coins. You cannot gather any more.", Settings::MAX_COINS.to_s_formatted))
$Trainer.coins = Settings::MAX_COINS # As a precaution
@quit=true
# elsif !pbConfirmMessage(_INTL("Play Voltorb Flip Lv. {1}?",@level)) && $Trainer.coins<Settings::MAX_COINS
# elsif !pbConfirmMessage("Play Voltorb Flip Lv. {1}?",@level) && $Trainer.coins<Settings::MAX_COINS
# @quit=true
else
@sprites["curtain"].opacity=0
@@ -364,8 +364,8 @@ class VoltorbFlip
if count==0
@sprites["curtain"].opacity=100
pbMessage(_INTL("\\me[Voltorb Flip Win]Game clear!\\wtnp[40]"))
# pbMessage(_INTL("You've found all of the hidden x2 and x3 cards."))
# pbMessage(_INTL("This means you've found all the Coins in this game, so the game is now over."))
# pbMessage("You've found all of the hidden x2 and x3 cards.")
# pbMessage("This means you've found all the Coins in this game, so the game is now over.")
pbMessage(_INTL("\\se[Voltorb Flip Gain Coins]{1} received {2} Coins!",$Trainer.name,@points.to_s_formatted))
# Update level text
@sprites["level"].bitmap.clear
@@ -386,8 +386,8 @@ class VoltorbFlip
@level+=1
pbMessage(_INTL("\\se[Voltorb Flip Level Up]Advanced to Game Lv. {1}!",@level.to_s))
# if @firstRound
# pbMessage(_INTL("Congratulations!"))
# pbMessage(_INTL("You can receive even more Coins in the next game!"))
# pbMessage("Congratulations!")
# pbMessage("You can receive even more Coins in the next game!")
@firstRound=false
#
end
@@ -407,7 +407,7 @@ class VoltorbFlip
elsif Input.trigger?(Input::BACK)
@sprites["curtain"].opacity=100
if @points==0
if pbConfirmMessage("You haven't found any Coins! Are you sure you want to quit?")
if pbConfirmMessage(_INTL("You haven't found any Coins! Are you sure you want to quit?"))
@sprites["curtain"].opacity=0
pbShowAndDispose
@quit=true
@@ -12,7 +12,7 @@ class MiningGameCounter < BitmapSprite
@viewport.z=99999
super(416,60,@viewport)
@hits=0
@image=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/cracks"))
@image=AnimatedBitmap.new("Graphics/Pictures/Mining/cracks")
update
end
@@ -48,7 +48,7 @@ class MiningGameTile < BitmapSprite
elsif r<85; @layer = 5 # 25%
else; @layer = 6 # 15%
end
@image=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/tiles"))
@image=AnimatedBitmap.new("Graphics/Pictures/Mining/tiles")
update
end
@@ -83,9 +83,9 @@ class MiningGameCursor < BitmapSprite
@mode = mode
@hit = 0 # 0=regular, 1=hit item, 2=hit iron
@counter = 0
@cursorbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/cursor"))
@toolbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/tools"))
@hitsbitmap = AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/hits"))
@cursorbitmap = AnimatedBitmap.new("Graphics/Pictures/Mining/cursor")
@toolbitmap = AnimatedBitmap.new("Graphics/Pictures/Mining/tools")
@hitsbitmap = AnimatedBitmap.new("Graphics/Pictures/Mining/hits")
update
end
@@ -223,8 +223,8 @@ class MiningGameScene
@viewport.z=99999
addBackgroundPlane(@sprites,"bg","Mining/miningbg",@viewport)
@sprites["itemlayer"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
@itembitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/items"))
@ironbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Mining/irons"))
@itembitmap=AnimatedBitmap.new("Graphics/Pictures/Mining/items")
@ironbitmap=AnimatedBitmap.new("Graphics/Pictures/Mining/irons")
@items=[]
@itemswon=[]
@iron=[]
@@ -35,7 +35,7 @@ class TilePuzzleCursor < BitmapSprite
@arrows=[]
@selected=false
@holding=false
@cursorbitmap=AnimatedBitmap.new(_INTL("Graphics/Pictures/Tile Puzzle/cursor"))
@cursorbitmap=AnimatedBitmap.new("Graphics/Pictures/Tile Puzzle/cursor")
update
end
@@ -177,7 +177,7 @@ class SpritePositioner
species_data = GameData::Species.get(@species)
if pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s_%d", species_data.species, species_data.form)) ||
pbResolveBitmap(sprintf("Graphics/Pokemon/Shadow/%s", species_data.species))
pbMessage("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited.")
pbMessage(_INTL("This species has its own shadow sprite in Graphics/Pokemon/Shadow/. The shadow size metric cannot be edited."))
return false
end
oldval = species_data.shadow_size
@@ -100,7 +100,7 @@ def pbAnimName(animation,cmdwin)
Input.update
window.update
if window.changed?(okbutton) || Input.triggerex?(:RETURN)
cmdwin.commands[cmdwin.index]=_INTL("{1} {2}",cmdwin.index,window.controls[0].text)
cmdwin.commands[cmdwin.index]= "#{cmdwin.index} #{window.controls[0].text}"
animation.name=window.controls[0].text
break
end
@@ -117,7 +117,7 @@ def pbAnimList(animations,canvas,animwin)
commands=[]
for i in 0...animations.length
animations[i]=PBAnimation.new if !animations[i]
commands[commands.length]=_INTL("{1} {2}",i,animations[i].name)
commands[commands.length]="#{i} #{animations[i].name}"
end
cmdwin=pbListWindow(commands,320)
cmdwin.height=416
@@ -143,7 +143,7 @@ def pbAnimList(animations,canvas,animwin)
animations.resize(newsize)
commands.clear
for i in 0...animations.length
commands[commands.length]=_INTL("{1} {2}",i,animations[i].name)
commands[commands.length]= "#{i} #{animations[i].name}"
end
cmdwin.commands=commands
cmdwin.index=animations.selected
@@ -166,7 +166,7 @@ def pbAnimList(animations,canvas,animwin)
elsif cmd2==2 # Delete
if pbConfirmMessage(_INTL("Are you sure you want to delete this animation?"))
animations[cmdwin.index]=PBAnimation.new
cmdwin.commands[cmdwin.index]=_INTL("{1} {2}",cmdwin.index,animations[cmdwin.index].name)
cmdwin.commands[cmdwin.index]= "#{cmdwin.index} #{animations[cmdwin.index].name}"
cmdwin.refresh
end
end
@@ -130,7 +130,7 @@ DebugMenuCommands.register("togglewallpapers", {
paperscmds.push(_INTL("Unlock all"))
paperscmds.push(_INTL("Lock all"))
for i in PokemonStorage::BASICWALLPAPERQTY...w.length
paperscmds.push(_INTL("{1} {2}", unlockarray[i] ? "[Y]" : "[ ]", w[i]))
paperscmds.push("#{unlockarray[i] ? '[Y]' : '[ ]'} #{w[i]}")
end
paperscmd = pbShowCommands(nil, paperscmds, -1, paperscmd)
break if paperscmd < 0
@@ -782,7 +782,7 @@ DebugMenuCommands.register("dexlists", {
for i in 0...dex_names.length
name = (dex_names[i].is_a?(Array)) ? dex_names[i][0] : dex_names[i]
unlocked = $Trainer.pokedex.unlocked?(i)
dexescmds.push(_INTL("{1} {2}", unlocked ? "[Y]" : "[ ]", name))
dexescmds.push("#{unlocked ? "[Y]" : '[ ]'} #{name}")
end
dexescmd = pbShowCommands(nil, dexescmds, -1, dexescmd)
break if dexescmd < 0
@@ -822,15 +822,15 @@ DebugMenuCommands.register("setplayer", {
# break
# end
# if limit <= 1
# pbMessage(_INTL("There is only one player defined."))
# pbMessage("There is only one player defined.")
# else
# params = ChooseNumberParams.new
# params.setRange(0, limit - 1)
# params.setDefaultValue($Trainer.character_ID)
# newid = pbMessageChooseNumber(_INTL("Choose the new player character."), params)
# newid = pbMessageChooseNumber("Choose the new player character."), params
# if newid != $Trainer.character_ID
# pbChangePlayer(newid)
# pbMessage(_INTL("The player character was changed."))
# pbMessage("The player character was changed.")
# end
# end
}
@@ -877,6 +877,7 @@ DebugMenuCommands.register("randomid", {
"effect" => proc {
$Trainer.id = rand(2 ** 16) | rand(2 ** 16) << 16
pbMessage(_INTL("The player's ID was changed to {1} (full ID: {2}).", $Trainer.public_ID, $Trainer.id))
$Trainer.secretBase_uuid = nil
}
})
@@ -20,7 +20,7 @@ def pbWarpToMapFly
end
def pbWarpToMap
choice = pbMessage("type", [_INTL("List"),_INTL("Map id"), _INTL("Town map")], 0)
choice = pbMessage(_INTL("type"), [_INTL("List"),_INTL("Map id"), _INTL("Town map")], 0)
if choice == 0
map = pbWarpToMapList
elsif choice == 1
@@ -251,7 +251,7 @@ module SpriteRenamer
end
def convert_files
return if !pbConfirmMessage("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?")
return if !pbConfirmMessage(_INTL("Check for Pokémon/item/trainer files in their old folders that need renaming and moving?"))
any_changed = false
# Rename and move Pokémon sprites/icons
dest_dir = "Graphics/Pokemon/"
@@ -272,7 +272,7 @@ module SpriteRenamer
# Rename trainer sprites
convert_trainer_sprites("Graphics/Trainers/")
pbSetWindowText(nil)
if pbConfirmMessage("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly.")
if pbConfirmMessage(_INTL("Rename all trainer charsets? This will also edit map data to change events' charsets accordingly."))
convert_trainer_sprites("Graphics/Characters/")
convert_player_metadata_charsets
pbSetWindowText(nil)
@@ -900,7 +900,7 @@ PokemonDebugMenuCommands.register("speciesform", {
pbMessage('Body species?')
body_species = pbChooseSpeciesList(old_body_dex,NB_POKEMON)
fused_species_dex = getFusionSpecies(body_species.species,head_species.species)
fused_species_dex = getFusionSpecies(body_species.species, head_species.species)
species = GameData::Species.get(fused_species_dex)
if species && species != pkmn.species
@@ -919,21 +919,21 @@ PokemonDebugMenuCommands.register("speciesform", {
# GameData::Species.each do |sp|
# next if sp.species != pkmn.species
# form_name = sp.form_name
# form_name = _INTL("Unnamed form") if !form_name || form_name.empty?
# form_name = "Unnamed form" if !form_name || form_name.empty?
# form_name = sprintf("%d: %s", sp.form, form_name)
# formcmds[0].push(sp.form)
# formcmds[1].push(form_name)
# cmd2 = sp.form if pkmn.form == sp.form
# end
# if formcmds[0].length <= 1
# screen.pbDisplay(_INTL("Species {1} only has one form.", pkmn.speciesName))
# screen.pbDisplay("Species {1} only has one form.", pkmn.speciesName)
# else
# cmd2 = screen.pbShowCommands(_INTL("Set the Pokémon's form."), formcmds[1], cmd2)
# cmd2 = screen.pbShowCommands("Set the Pokémon's form."), formcmds[1], cmd2
# next if cmd2 < 0
# f = formcmds[0][cmd2]
# if f != pkmn.form
# if MultipleForms.hasFunction?(pkmn, "getForm")
# next if !screen.pbConfirm(_INTL("This species decides its own form. Override?"))
# next if !screen.pbConfirm("This species decides its own form. Override?")
# pkmn.forced_form = f
# end
# pkmn.form = f
@@ -1066,8 +1066,7 @@ PokemonDebugMenuCommands.register("setribbons", {
commands = []
ids = []
GameData::Ribbon.each do |ribbon_data|
commands.push(_INTL("{1} {2}",
(pkmn.hasRibbon?(ribbon_data.id)) ? "[Y]" : "[ ]", ribbon_data.name))
commands.push("#{pkmn.hasRibbon?(ribbon_data.id) ? '[Y]' : '[ ]'} #{ribbon_data.name}")
ids.push(ribbon_data.id)
end
commands.push(_INTL("Give all"))
@@ -953,7 +953,7 @@ module Compiler
# Raise an error if a map/version combo is used twice
key = sprintf("%s_%d", map_number, map_version).to_sym
# if GameData::Encounter::DATA[key]
# raise _INTL("Encounters for map '{1}' are defined twice.\r\n{2}", map_number, FileLineData.linereport)
# raise "Encounters for map '{1}' are defined twice.\r\n{2}", map_number, FileLineData.linereport
# end
step_chances = {}
# Construct encounter hash
@@ -59,7 +59,7 @@
# basestatsum += $pkmn_dex[species][5][4] # Special Attack
# basestatsum += $pkmn_dex[species][5][5] # Special Defense
# end
# #Kernel.pbMessage(_INTL("total = {1}, {2}",basestatsum, PBSpecies.getName(species)))
# #Kernel.pbMessage("total = {1}, {2}",basestatsum, PBSpecies.getName(species))
# else
# if $game_switches[841]
# species = getRandomCustomSprite()
@@ -164,7 +164,7 @@ 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")],
# options << EnumOption.new("Allow legendaries", ["On", "Off"],
# proc { $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] ? 0 : 1 },
# proc { |value|
# $game_switches[SWITCH_RANDOM_TRAINER_LEGENDARIES] = value == 0
@@ -361,7 +361,7 @@ class RandomizerGymOptionsScene < PokemonOption_Scene
}, "Shuffle the gym types"
)
# options << EnumOption.new(_INTL("Allow legendaries"), [_INTL("On"), _INTL("Off")],
# options << EnumOption.new("Allow legendaries", ["On", "Off"],
# proc { $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] ? 0 : 1 },
# proc { |value|
# $game_switches[SWITCH_RANDOM_GYM_LEGENDARIES] = value == 0
@@ -124,3 +124,18 @@ def pbGetRandomTM()
return newItem
end
def displayRandomizerErrorMessage()
echoln caller
Kernel.pbMessage(_INTL("The randomizer has encountered an error. You should try to re-randomize your game as soon as possible."))
Kernel.pbMessage(_INTL("You can do this on the top floor of Pokémon Centers."))
end
def ensureRandomHashInitialized()
if $PokemonGlobal.psuedoBSTHash == nil
psuedoHash = Hash.new
for i in 0..NB_POKEMON
psuedoHash[i] = i
end
$PokemonGlobal.psuedoBSTHash = psuedoHash
end
end
@@ -109,7 +109,7 @@ end
# def displayProgress(current,total,bst)
# return if bst >= 100
# return if bst >= 20 && current % 10 != 0
# Kernel.pbMessageNoSound(_INTL("\\ts[]Generating encounters file...\\n Map {1}/{2}\\^",current,total))
# Kernel.pbMessageNoSound("\\ts[]Generating encounters file...\\n Map {1}/{2}\\^",current,total)
# end
#
@@ -145,7 +145,7 @@ end
#
# def pbMapEncounter(mapID,enctype)
# if enctype<0 || enctype>EncounterTypes::EnctypeChances.length
# raise ArgumentError.new(_INTL("Encounter type out of range"))
# raise ArgumentError.new("Encounter type out of range")
# end
# data=load_data(getEncountersFilePath())
# if data.is_a?(Hash) && data[mapID]
@@ -150,10 +150,10 @@ end
def getLeaderType()
currentGym = $game_variables[VAR_CURRENT_GYM_TYPE]
if currentGym > $game_variables[151].length
if currentGym > $game_variables[VAR_GYM_TYPES_ARRAY].length
return nil
else
typeIndex = $game_variables[151][currentGym]
typeIndex = $game_variables[VAR_GYM_TYPES_ARRAY][currentGym]
type = PBTypes.getName(typeIndex)
end
return typeIndex
@@ -266,16 +266,24 @@ def Kernel.pbRandomizeTM()
for item in $itemData
#machine=$ItemData[item][ITEMMACHINE]
#movename=PBMoves.getName(machine)
#Kernel.pbMessage(_INTL("It contained {1}.\1",item))
#Kernel.pbMessage("It contained {1}.\1",item)
tmList << item if pbIsHiddenMachine?(item)
end
end
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
if $game_switches[SWITCH_LEGENDARY_MODE]
new_species= convert_species_to_legendary(oldSpecies)
newspecies_dex = dexNum(new_species)
return newspecies_dex
end
newspecies_dex = rand(maxDexNumber - 1) + 1
i = 0
while bstNotOk(newspecies_dex, oldSpecies_dex, bst_range) || !(legendaryOk(oldSpecies_dex,newspecies_dex,includeLegendaries))
@@ -289,6 +297,15 @@ def getNewSpecies(oldSpecies, bst_range = 50, ignoreRivalPlaceholder = false, ma
end
def getNewCustomSpecies(oldSpecies, customSpeciesList, bst_range = 50, ignoreRivalPlaceholder = false,includeLegendaries=true)
if $game_switches[SWITCH_LEGENDARY_MODE]
new_species= convert_species_to_legendary(oldSpecies)
echoln "CHOSEN #{get_readable_fusion_name(oldSpecies)} -> #{get_readable_fusion_name(new_species)}"
newspecies_dex = dexNum(new_species)
return newspecies_dex
end
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
@@ -330,9 +347,13 @@ def Kernel.pbShuffleTrainers(bst_range = 50, customsOnly = false, customsList =
customsOnly = false
end
randomTrainersHash = Hash.new
trainers_data = GameData::Trainer.list_all
trainers_data = getTrainersDataMode.list_all
trainers_data.each do |key, value|
trainer = trainers_data[key]
echoln "------"
echoln "Processing [#{trainer.id}#] {trainer.trainer_type} ##{trainer.real_name}"
i = 0
new_party = []
for poke in trainer.pokemon
@@ -365,9 +386,9 @@ end
# i += 1
# if i % 2 == 0
# n = (i.to_f/trainers.length)*100
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling trainers...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
# Kernel.pbMessageNoSound("\\ts[]Shuffling trainers...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue)
# end
# #Kernel.pbMessage(_INTL("pushing trainer {1}: {2} ",i,trainer))
# #Kernel.pbMessage("pushing trainer {1}: {2} ",i,trainer)
# end
# $PokemonGlobal.randomTrainersHash = randomTrainersHash
# end
@@ -376,12 +397,12 @@ def Kernel.pbShuffleTrainersCustom(bst_range = 50)
randomTrainersHash = Hash.new
bst_range = pbGet(VAR_RANDOMIZER_TRAINER_BST)
Kernel.pbMessage(_INTL("Parsing custom sprites folder"))
Kernel.pbMessage(_INTL("Parsing custom sprites folder..."))
customsList = getCustomSpeciesList(true, true)
Kernel.pbMessage(_INTL("{1} sprites found", customsList.length.to_s))
Kernel.pbMessage(_INTL("{1} sprites found. Shuffling...", customsList.length.to_s))
if customsList.length == 0
Kernel.pbMessage(_INTL("To use custom sprites, please place correctly named sprites in the /CustomBattlers folder. See readMe.txt for more information"))
Kernel.pbMessage(_INTL("To use custom sprites, please place correctly named sprites in the /CustomBattlers folder. See readMe.txt for more information."))
Kernel.pbMessage(_INTL("Trainer Pokémon will include auto-generated sprites."))
return Kernel.pbShuffleTrainers(bst_range)
elsif customsList.length < 200
@@ -410,9 +431,9 @@ end
# i += 1
# if i % 2 == 0
# n = (i.to_f/trainers.length)*100
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling trainers (custom sprites only)...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
# Kernel.pbMessageNoSound("\\ts[]Shuffling trainers (custom sprites only)...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue)
# end
# #Kernel.pbMessage(_INTL("pushing trainer {1}: {2} ",i,trainer))
# #Kernel.pbMessage("pushing trainer {1}: {2} ",i,trainer)
# end
# $PokemonGlobal.randomTrainersHash = randomTrainersHash
@@ -447,7 +468,7 @@ def getCustomSpeciesList(allowOnline = true, redownload_file = false)
end
# if speciesList.length <= 20000 && allowOnline
# if redownload_file && Kernel.pbConfirmMessage(_INTL("Not enough local sprites found. Attempt to fetch list from the internet?"))
# if redownload_file && Kernel.pbConfirmMessage("Not enough local sprites found. Attempt to fetch list from the internet?")
# updateOnlineCustomSpritesFile
# end
#try to get list from github
@@ -518,39 +539,34 @@ def Kernel.getBaseStats(species)
end
def Kernel.gymLeaderRematchHint()
hints = [
"I heard that Brock has a huge interest in Pokémon fossils. He donated a lot of fossils he excavated to the Pewter City Museum.",
"Misty is a pro at swimming. I heard she trains every single morning.",
"Did you know that Lt. Surge used the magnetic fields generated by his Pokémon to navigate his plane back when he was in the army. He still loves a good magnetic field.",
"Erika is a lover of nature. She loves going to parks to relax during the day.",
"Koga has been seen leaving Fuschia city in the evenings. The rumors say he's preparing for a new job somewhere else...",
"People say that Sabrina never sleeps. I wonder where she goes when she leaves her gym at night.",
"The hot-headed Blaine is a man of extremes. He likes to explore around his hometown during the day.",
"Giovanni is a mysterious man. I wonder where he goes in the evening. Probably somewhere as remote as possible to meditate in peace...",
"I heard that Whitney went to school in one of the towns near Goldenrod before becoming a Gym Leader. She kept in touch with her old teacher and she goes to visit sometimes in the evening.",
"Kurt is always on the lookout for Bug-type Pokémon. He goes hunting early in the morning.",
"Falkner rises up early in the morning. You can usually find him in high places.",
"Clair is a member of a famous clan of dragon masters. She goes to a special place to pray at night.",
"Chuck is a martial arts pro. I've seen him train with Saffron City's dojo master back in the days.",
"Morty is a mysterious man. He's been known to be one of the few people who dare enter Pokémon Tower at night.",
"Pryce is an ice-type expert who has been around for a long time. He used to train in the Ice Tunnel between Mahogany Town and Blackthorn City before it froze over.",
"Jasmine is on vacation in the Sevii Islands. She likes to rise up early to explore around the islands when no one's around."
]
arr = []
n = 0
for i in 426..437
if !$game_switches[i]
arr.push(n)
end
n += 1
hints = {
426 =>_INTL("I heard that Brock has a huge interest in Pokémon fossils. He donated a lot of fossils he excavated to the Pewter City Museum."),
427 =>_INTL("Misty is a pro at swimming. I heard she trains every single morning."),
428 =>_INTL("Did you know that Lt. Surge used the magnetic fields generated by his Pokémon to navigate his plane back when he was in the army? He still loves a good magnetic field."),
429 =>_INTL("Erika is a lover of nature. She loves going to parks to relax during the day."),
430 =>_INTL("Koga has been seen leaving Fuschia city in the evenings. The rumors say he's preparing for a new job somewhere else..."),
431 =>_INTL("People say that Sabrina never sleeps. I wonder where she goes when she leaves her gym at night."),
432 =>_INTL("The hot-headed Blaine is a man of extremes. He likes to explore around his hometown during the day."),
433 =>_INTL("Giovanni is a mysterious man. I wonder where he goes in the evening. Probably somewhere as remote as possible to meditate in peace..."),
434 =>_INTL("I heard that Whitney went to school in one of the towns near Goldenrod before becoming a Gym Leader. She kept in touch with her old teacher and she goes to visit sometimes in the evening."),
435 =>_INTL("Kurt is always on the lookout for Bug-type Pokémon. He goes hunting early in the morning."),
436 =>_INTL("Falkner rises up early in the morning. You can usually find him in high places."),
437 =>_INTL("Clair is a member of a famous clan of dragon masters. She goes to a special place to pray at night."),
510 =>_INTL("Chuck is a martial arts pro. I've seen him train with Saffron City's dojo master back in the days."),
508 =>_INTL("Morty is a mysterious man. He's been known to be one of the few people who dare enter Pokémon Tower at night."),
509 =>_INTL("Pryce is an ice-type expert who has been around for a long time. He used to train in the Ice Tunnel between Mahogany Town and Blackthorn City before it froze over."),
511 =>_INTL("Jasmine is on vacation in the Sevii Islands. She likes to rise up early to explore around the islands when no one's around.")
}
remaining_leaders = []
for switch_nb in hints.keys
remaining_leaders << switch_nb unless $game_switches[switch_nb]
end
arr.push(508); arr.push(509); arr.push(510); arr.push(511);
n += 4
if arr.length > 0
return hints[arr[rand(arr.length)]]
if remaining_leaders.empty?
return "You got every Gym Leader to come here. This place is more popular than ever!\nNow go and battle them!"
else
key = remaining_leaders.sample
return hints[key]
end
return "You got every Gym Leader to come here. This place is more popular than ever!\nNow go and battle them!"
end
def getTrainerParty(trainer)
@@ -606,7 +622,7 @@ end
# def pbLoadTrainer(trainerid,trainername,partyid=0)
# if trainerid.is_a?(String) || trainerid.is_a?(Symbol)
# if !hasConst?(PBTrainers,trainerid)
# raise _INTL("Trainer type does not exist ({1}, {2}, ID {3})",trainerid,trainername,partyid)
# raise "Trainer type does not exist ({1}, {2}, ID {3})",trainerid,trainername,partyid
# end
# trainerid=getID(PBTrainers,trainerid)
# end
@@ -643,7 +659,7 @@ end
# #use le random Array si randomized starters (et pas 1ere rival battle)
# isPlayingRandomized = $game_switches[987] && !$game_switches[46]
# if isPlayingRandomized && $PokemonGlobal.randomTrainersHash[trainerIndex] == nil
# Kernel.pbMessage(_INTL("The trainers need to be re-shuffled."))
# Kernel.pbMessage("The trainers need to be re-shuffled.")
# Kernel.pbShuffleTrainers()
# end
# trainerParty = isPlayingRandomized ? $PokemonGlobal.randomTrainersHash[trainerIndex][3] : getTrainerParty(trainer)
+8 -7
View File
@@ -1,9 +1,10 @@
LEGENDARIES_LIST = [:ARTICUNO, :ZAPDOS, :MOLTRES, :MEWTWO, :MEW,
:ENTEI, :RAIKOU, :SUICUNE, :HOOH, :LUGIA, :CELEBI,
:GROUDON, :KYOGRE, :RAYQUAZA, :DEOXYS, :JIRACHI, :LATIAS, :LATIOS,
:REGIROCK, :REGICE, :REGISTEEL,
:REGIGIGAS, :DIALGA, :PALKIA, :GIRATINA, :DARKRAI, :CRESSELIA, :ARCEUS,
:GENESECT, :RESHIRAM, :ZEKROM, :KYUREM, :MELOETTA,
:NECROZMA]
:GENESECT, :RESHIRAM, :ZEKROM, :KYUREM, :MELOETTA_A,:MELOETTA_P,
:NECROZMA, :U_NECROZMA, :DIANCIE]
class PokemonGlobalMetadata
attr_accessor :psuedoHash
@@ -31,7 +32,7 @@ def get_pokemon_list(include_fusions = false)
#Create array of all pokemon dex numbers
pokeArray = []
monLimit = include_fusions ? PBSpecies.maxValue : NB_POKEMON - 1
monLimit = include_fusions ? PBSpecies.maxValue : NB_POKEMON
for i in 1..monLimit
pokeArray.push(i)
end
@@ -41,7 +42,7 @@ end
def get_randomized_bst_hash(poke_list, bst_range, show_progress = true)
bst_hash = Hash.new
for i in 1..NB_POKEMON - 1
for i in 1..NB_POKEMON
show_shuffle_progress(i) if show_progress
baseStats = getBaseStatsFormattedForRandomizer(i)
statsTotal = getStatsTotal(baseStats)
@@ -99,7 +100,7 @@ def is_legendary(dex_num,printInfo=false)
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
#echoln "{1} ({2}) {3}",dex_num,pokemon_id,is_legendary) if printInfo
return is_legendary
end
@@ -223,7 +224,7 @@ end
# pokeArrayRand.delete(pokeArrayRand[j])
# if i % 2 == 0 && type == 1
# n = (i.to_f/NB_POKEMON)*100
# Kernel.pbMessageNoSound(_INTL("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON))
# Kernel.pbMessageNoSound("\\ts[]Shuffling wild Pokémon...\\n {1}%\\^",sprintf('%.2f', n),NB_POKEMON)
# end
# break
# end
@@ -302,7 +303,7 @@ end
# for i in 1..PBSpecies.maxValue
# if i % 20 == 0
# n = (i.to_f/PBSpecies.maxValue)*100
# #Kernel.pbMessage(_INTL("\\ts[]Shuffling...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue))
# #Kernel.pbMessage("\\ts[]Shuffling...\\n {1}%\\^",sprintf('%.2f', n),PBSpecies.maxValue)
# end
#
# baseStats=calcBaseStats(i)
+3
View File
@@ -44,6 +44,8 @@ HAT_SILPHSCOPE = "silphscope"
HAT_BRENDAN = "brendanRSE"
HAT_MAY = "mayRSE"
HAT_ORAN = "orange"
HAT_FLOWERS = "grassexpert"
HAT_LUCHA = "hawluchamask"
HAT_PARASHROOM = "parashroom"
@@ -156,6 +158,7 @@ HAIR_LATIAS="SpecialLatias"
HAIR_GARDEVOIR="gardevoir"
HAIR_EEVEE="eeveetail"
HAIR_LEAFEON="leafeonbob"
HAIR_ORICORIO="oricoriopuffs"
HAIR_BRENDAN = "buzzcut"
HAIR_MAY = "may"
@@ -85,7 +85,7 @@ class CharacterSelectMenuPresenter
update_cursor(@current_index)
@name = getDefaultName if @name == ""
updateDisplayedName(getOptionIndex(OPTION_NAME))
cmd = pbMessage("Is this information correct?", [_INTL("Yes"), _INTL("No")])
cmd = pbMessage(_INTL("Is 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")
@@ -9,11 +9,19 @@ class PokemonHatPresenter
@x_pos = pokemon.hat_x ? pokemon.hat_x : 0
@y_pos = pokemon.hat_y ? pokemon.hat_y : 0
@hat_mirrored_horizontal = pokemon.hat_mirrored_horizontal ? pokemon.hat_mirrored_horizontal : false
@hat_mirrored_vertical = pokemon.hat_mirrored_vertical ? pokemon.hat_mirrored_vertical : false
@hat_id = pokemon.hat ? pokemon.hat : 1
@viewport = nil
@previewwindow = nil
@original_pokemon_bitmap = nil
@min_x, @max_x = -64, 88
@min_y, @max_y = -120, 120 # Safe symmetric range
@hatBitmapWrapper = AnimatedBitmap.new(@hatFilename, 0) if pbResolveBitmap(@hatFilename)
end
def pbStartScreen
@@ -31,6 +39,8 @@ class PokemonHatPresenter
def updatePokemonHatPosition()
@pokemon.hat = @hat_id
@pokemon.hat_mirrored_horizontal=@hat_mirrored_horizontal
@pokemon.hat_mirrored_vertical=@hat_mirrored_vertical
@pokemon.hat_x = @x_pos
@pokemon.hat_y = @y_pos
end
@@ -49,6 +59,9 @@ class PokemonHatPresenter
Input.update
@hat_id = selector.selectNextOutfit(@hat_id, 1, selector.hats_list, [], false, "hat",$Trainer.unlocked_hats,false) if Input.trigger?(Input::RIGHT)
@hat_id = selector.selectNextOutfit(@hat_id, -1, selector.hats_list, [], false, "hat",$Trainer.unlocked_hats,false) if Input.trigger?(Input::LEFT)
flipHatVertically if Input.trigger?(Input::JUMPUP)
flipHatHorizontally if Input.trigger?(Input::JUMPDOWN)
resetHatPosition if Input.trigger?(Input::SPECIAL)
break if Input.trigger?(Input::USE)
return false if Input.trigger?(Input::BACK)
@view.update()
@@ -60,15 +73,18 @@ class PokemonHatPresenter
def position_hat
@view.display_move_arrows
min_x, max_x = -64, 88
min_y, max_y = -20, 140
loop do
Graphics.update
Input.update
@x_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::RIGHT) && @x_pos < max_x
@x_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::LEFT) && @x_pos > min_x
@y_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::DOWN) && @y_pos < max_y
@y_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::UP) && @y_pos > min_y
@x_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::RIGHT) && @x_pos < @max_x
@x_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::LEFT) && @x_pos > @min_x
@y_pos += PIXELS_PER_MOVEMENT if Input.repeat?(Input::DOWN) && @y_pos < @max_y
@y_pos -= PIXELS_PER_MOVEMENT if Input.repeat?(Input::UP) && @y_pos > @min_y
flipHatHorizontally if Input.trigger?(Input::JUMPDOWN)
flipHatVertically if Input.trigger?(Input::JUMPUP)
resetHatPosition if Input.trigger?(Input::SPECIAL)
break if Input.trigger?(Input::USE)
return false if Input.trigger?(Input::BACK)
@view.update()
@@ -77,6 +93,46 @@ class PokemonHatPresenter
return true
end
def flipHatHorizontally()
@hat_mirrored_horizontal = !@hat_mirrored_horizontal
pbSEPlay("GUI storage pick up")
@hatBitmapWrapper.mirror_horizontally
pbWait(8)
end
def flipHatVertically()
pbSEPlay("GUI storage pick up")
@hat_mirrored_vertical = !@hat_mirrored_vertical
@hatBitmapWrapper.mirror_vertically
# Compensate for visual shift after vertical flip
hat_height = @hatBitmapWrapper.bitmap.height
offset = hat_height - 40
if @hat_mirrored_vertical
@y_pos -= offset
else
@y_pos += offset
end
@y_pos = [[@y_pos, @min_y].max, @max_y].min
pbWait(8)
end
def resetHatPosition
if pbConfirmMessage(_INTL("Reset hat position?"))
pbSEPlay("GUI naming tab swap end")
@x_pos=0
@y_pos=0
@hatBitmapWrapper.mirror_horizontally if @hat_mirrored_horizontal
@hatBitmapWrapper.mirror_vertically if @hat_mirrored_vertical
@hat_mirrored_horizontal = false
@hat_mirrored_vertical = false
end
end
def initialize_bitmap()
spriteLoader = BattleSpriteLoader.new
@@ -94,9 +150,9 @@ class PokemonHatPresenter
def getPokemonHatBitmap()
@hatFilename = getTrainerSpriteHatFilename(@hat_id)
hatBitmapWrapper = AnimatedBitmap.new(@hatFilename, 0) if pbResolveBitmap(@hatFilename)
@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
pokemon_bitmap.blt(@x_pos, @y_pos, @hatBitmapWrapper.bitmap, @hatBitmapWrapper.bitmap.rect) if @hatBitmapWrapper
return pokemon_bitmap
end
@@ -16,7 +16,7 @@ class ClothesShopPresenter < PokemonMartScreen
def dyeClothes()
original_color = $Trainer.clothes_color
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
options = [_INTL("Shift up"), _INTL("Shift down"), _INTL("Reset"), _INTL("Confirm"), _INTL("Never Mind")]
previous_input = 0
ret = false
while (true)
@@ -50,13 +50,13 @@ class ClothesShopPresenter < PokemonMartScreen
# returns true if should stay in the menu
def playerClothesActionsMenu(item)
cmd_wear = "Wear"
cmd_dye = "Dye Kit"
cmd_wear = _INTL("Wear")
cmd_dye = _INTL("Dye Kit")
options = []
options << cmd_wear
options << cmd_dye if $PokemonBag.pbHasItem?(:CLOTHESDYEKIT)
options << "Cancel"
choice = pbMessage("What would you like to do?", options, -1)
options << _INTL("Cancel")
choice = pbMessage(_INTL("What would you like to do?"), options, -1)
if options[choice] == cmd_wear
putOnClothes(item,false)
@@ -77,11 +77,11 @@ class ClothesShopPresenter < PokemonMartScreen
boolean_changes_detected = @adapter.player_changed_clothes?
return true if !boolean_changes_detected
pbPlayCancelSE
cmd_confirm = "Set outfit"
cmd_discard = "Discard changes"
cmd_cancel = "Cancel"
cmd_confirm = _INTL("Set outfit")
cmd_discard = _INTL("Discard changes")
cmd_cancel = _INTL("Cancel")
options = [cmd_discard,cmd_confirm,cmd_cancel]
choice = pbMessage("You have unsaved changes!",options,3)
choice = pbMessage(_INTL("You have unsaved changes!"),options,3)
case options[choice]
when cmd_confirm
@adapter.putOnSelectedOutfit
@@ -81,7 +81,7 @@ class ClothesShopPresenter < PokemonMartScreen
def dyeOptions(secondary_hat=false,item)
original_color = secondary_hat ? $Trainer.hat2_color : $Trainer.hat_color
options = ["Shift up", "Shift down", "Reset", "Confirm", "Never Mind"]
options = [_INTL("Shift up"), _INTL("Shift down"), _INTL("Reset"), _INTL("Confirm"), _INTL("Never Mind")]
previous_input = 0
while (true)
choice = pbShowCommands(nil, options, options.length, previous_input,200)
@@ -125,14 +125,14 @@ class ClothesShopPresenter < PokemonMartScreen
end
def playerHatActionsMenu(item)
cmd_confirm = "Confirm"
cmd_remove = "Remove hat"
cmd_cancel = "Cancel"
cmd_dye = "Dye Kit"
cmd_swap = "Swap hat positions"
cmd_confirm = _INTL("Confirm")
cmd_remove = _INTL("Remove hat")
cmd_cancel = _INTL("Cancel")
cmd_dye = _INTL("Dye Kit")
cmd_swap = _INTL("Swap hat positions")
options = build_options_menu(item,cmd_confirm,cmd_remove,cmd_dye,cmd_swap,cmd_cancel)
choice = pbMessage("What would you like to do?", options, -1,nil,0)
choice = pbMessage(_INTL("What would you like to do?"), options, -1,nil,0)
if options[choice] == cmd_remove
removeHat(item)
return true

Some files were not shown because too many files have changed in this diff Show More