More tweaks from the Rubocop overlord

This commit is contained in:
Maruno17
2021-12-19 17:28:59 +00:00
parent 33781493f4
commit 65b1a8d6c3
161 changed files with 2839 additions and 2967 deletions
@@ -17,9 +17,10 @@ def pbGetExceptionMessage(e, _script = "")
return e.event_message.dup if e.is_a?(EventScriptError) # Message with map/event ID generated elsewhere
emessage = e.message.dup
emessage.force_encoding(Encoding::UTF_8)
if e.is_a?(Hangup)
case e
when Hangup
emessage = "The script is taking too long. The game will restart."
elsif e.is_a?(Errno::ENOENT)
when Errno::ENOENT
filename = emessage.sub("No such file or directory - ", "")
emessage = "File #{filename} not found."
end
@@ -67,7 +67,7 @@ module FileInputMixin
self.pos = 0
offset = fgetdw >> 3
return 0 if index >= offset
self.pos = index * 8 + 4
self.pos = (index * 8) + 4
return fgetdw
end
@@ -412,7 +412,8 @@ class Messages
def self.writeObject(f, msgs, secname, origMessages = nil)
return if !msgs
if msgs.is_a?(Array)
case msgs
when Array
f.write("[#{secname}]\r\n")
for j in 0...msgs.length
next if nil_or_empty?(msgs[j])
@@ -427,7 +428,7 @@ class Messages
f.write(origValue + "\r\n")
f.write(value + "\r\n")
end
elsif msgs.is_a?(OrderedHash)
when OrderedHash
f.write("[#{secname}]\r\n")
keys = msgs.keys
for key in keys
@@ -212,11 +212,12 @@ module PluginManager
dependencies = value
dependencies = [dependencies] if !dependencies.is_a?(Array) || !dependencies[0].is_a?(Array)
for dep in value
if dep.is_a?(String) # "plugin name"
case dep
when String # "plugin name"
if !self.installed?(dep)
self.error("Plugin '#{name}' requires plugin '#{dep}' to be installed above it.")
end
elsif dep.is_a?(Array)
when Array
case dep.size
when 1 # ["plugin name"]
if dep[0].is_a?(String)
@@ -428,8 +429,8 @@ module PluginManager
return 1 if !c2
return 1 if c1.to_i(16) > c2.to_i(16)
return -1 if c1.to_i(16) < c2.to_i(16)
else
return -1 if c2
elsif c2
return -1
end
end
return 0
+6 -6
View File
@@ -187,7 +187,7 @@ class SpriteAnimation
sprite_y = self.viewport.rect.height - 160
end
else
sprite_x = self.x - self.ox + self.src_rect.width / 2
sprite_x = self.x - self.ox + (self.src_rect.width / 2)
sprite_y = self.y - self.oy
sprite_y += self.src_rect.height / 2 if position == 1
sprite_y += self.src_rect.height if position == 2
@@ -370,7 +370,7 @@ module RPG
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.y = self.y - (self.oy / 2)
@_damage_sprite.z = 3000
@_damage_duration = 40
end
@@ -450,7 +450,7 @@ module RPG
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
self.color.alpha = 128 - ((16 - @_whiten_duration) * 10)
end
if @_appear_duration > 0
@_appear_duration -= 1
@@ -458,11 +458,11 @@ module RPG
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
self.opacity = 256 - ((32 - @_escape_duration) * 10)
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
self.opacity = 256 - ((48 - @_collapse_duration) * 6)
end
if @_damage_duration > 0
@_damage_duration -= 1
@@ -476,7 +476,7 @@ module RPG
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
@_damage_sprite.opacity = 256 - ((12 - @_damage_duration) * 32)
if @_damage_duration == 0
dispose_damage
end
@@ -57,8 +57,8 @@ class Scene_Map
if playingBGM && map.autoplay_bgm
if (PBDayNight.isNight? rescue false)
pbBGMFade(0.8) if playingBGM.name != map.bgm.name && playingBGM.name != map.bgm.name + "_n"
else
pbBGMFade(0.8) if playingBGM.name != map.bgm.name
elsif playingBGM.name != map.bgm.name
pbBGMFade(0.8)
end
end
if playingBGS && map.autoplay_bgs
@@ -452,8 +452,8 @@ class Interpreter
$game_temp.mart_prices[item][0] = buy_price if buy_price > 0
if sell_price >= 0 # 0=can't sell
$game_temp.mart_prices[item][1] = sell_price * 2
else
$game_temp.mart_prices[item][1] = buy_price if buy_price > 0
elsif buy_price > 0
$game_temp.mart_prices[item][1] = buy_price
end
end
@@ -97,15 +97,15 @@ class Game_Screen
end
if @fadein_duration && @fadein_duration >= 1
d = @fadein_duration
@brightness = (@brightness * (d - 1) + 255) / d
@brightness = ((@brightness * (d - 1)) + 255) / d
@fadein_duration -= 1
end
if @tone_duration >= 1
d = @tone_duration
@tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
@tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
@tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
@tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
@tone.red = ((@tone.red * (d - 1)) + @tone_target.red) / d
@tone.green = ((@tone.green * (d - 1)) + @tone_target.green) / d
@tone.blue = ((@tone.blue * (d - 1)) + @tone_target.blue) / d
@tone.gray = ((@tone.gray * (d - 1)) + @tone_target.gray) / d
@tone_duration -= 1
end
if @flash_duration >= 1
@@ -131,19 +131,19 @@ class Game_Picture
def update
if @duration >= 1
d = @duration
@x = (@x * (d - 1) + @target_x) / d
@y = (@y * (d - 1) + @target_y) / d
@zoom_x = (@zoom_x * (d - 1) + @target_zoom_x) / d
@zoom_y = (@zoom_y * (d - 1) + @target_zoom_y) / d
@opacity = (@opacity * (d - 1) + @target_opacity) / d
@x = ((@x * (d - 1)) + @target_x) / d
@y = ((@y * (d - 1)) + @target_y) / d
@zoom_x = ((@zoom_x * (d - 1)) + @target_zoom_x) / d
@zoom_y = ((@zoom_y * (d - 1)) + @target_zoom_y) / d
@opacity = ((@opacity * (d - 1)) + @target_opacity) / d
@duration -= 1
end
if @tone_duration >= 1
d = @tone_duration
@tone.red = (@tone.red * (d - 1) + @tone_target.red) / d
@tone.green = (@tone.green * (d - 1) + @tone_target.green) / d
@tone.blue = (@tone.blue * (d - 1) + @tone_target.blue) / d
@tone.gray = (@tone.gray * (d - 1) + @tone_target.gray) / d
@tone.red = ((@tone.red * (d - 1)) + @tone_target.red) / d
@tone.green = ((@tone.green * (d - 1)) + @tone_target.green) / d
@tone.blue = ((@tone.blue * (d - 1)) + @tone_target.blue) / d
@tone.gray = ((@tone.gray * (d - 1)) + @tone_target.gray) / d
@tone_duration -= 1
end
if @rotate_speed != 0
+10 -10
View File
@@ -147,7 +147,7 @@ class Game_Map
def passable?(x, y, d, self_event = nil)
return false if !valid?(x, y)
bit = (1 << (d / 2 - 1)) & 0x0f
bit = (1 << ((d / 2) - 1)) & 0x0f
for event in events.values
next if event.tile_id <= 0
next if event == self_event
@@ -224,7 +224,7 @@ class Game_Map
end
def playerPassable?(x, y, d, self_event = nil)
bit = (1 << (d / 2 - 1)) & 0x0f
bit = (1 << ((d / 2) - 1)) & 0x0f
for i in [2, 1, 0]
tile_id = data[x, y, i]
terrain = GameData::TerrainTag.try_get(@terrain_tags[tile_id])
@@ -323,7 +323,7 @@ class Game_Map
return if @display_x == value
@display_x = value
if metadata&.snap_edges
max_x = (self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X
max_x = (self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X
@display_x = [0, [@display_x, max_x].min].max
end
$map_factory.setMapsInRange if $map_factory
@@ -333,7 +333,7 @@ class Game_Map
return if @display_y == value
@display_y = value
if metadata&.snap_edges
max_y = (self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y
max_y = (self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y
@display_y = [0, [@display_y, max_y].min].max
end
$map_factory.setMapsInRange if $map_factory
@@ -378,7 +378,7 @@ class Game_Map
end
def start_fog_opacity_change(opacity, duration)
@fog_opacity_target = opacity * 1.0
@fog_opacity_target = opacity.to_f
@fog_opacity_duration = duration
if @fog_opacity_duration == 0
@fog_opacity = @fog_opacity_target
@@ -437,15 +437,15 @@ class Game_Map
if @fog_tone_duration >= 1
d = @fog_tone_duration
target = @fog_tone_target
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
@fog_tone.red = ((@fog_tone.red * (d - 1)) + target.red) / d
@fog_tone.green = ((@fog_tone.green * (d - 1)) + target.green) / d
@fog_tone.blue = ((@fog_tone.blue * (d - 1)) + target.blue) / d
@fog_tone.gray = ((@fog_tone.gray * (d - 1)) + target.gray) / d
@fog_tone_duration -= 1
end
if @fog_opacity_duration >= 1
d = @fog_opacity_duration
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity = ((@fog_opacity * (d - 1)) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
end
@@ -87,12 +87,12 @@ class Interpreter
print 'Map Autoscroll: invalid speed (1-6 only)'
return command_skip
end
center_x = (Graphics.width / 2 - Game_Map::TILE_WIDTH / 2) * 4 # X coordinate in the center of the screen
center_y = (Graphics.height / 2 - Game_Map::TILE_HEIGHT / 2) * 4 # Y coordinate in the center of the screen
max_x = ($game_map.width - Graphics.width * 1.0 / Game_Map::TILE_WIDTH) * 4 * Game_Map::TILE_WIDTH
max_y = ($game_map.height - Graphics.height * 1.0 / Game_Map::TILE_HEIGHT) * 4 * Game_Map::TILE_HEIGHT
count_x = ($game_map.display_x - [0, [x * Game_Map::REAL_RES_X - center_x, max_x].min].max) / Game_Map::REAL_RES_X
count_y = ($game_map.display_y - [0, [y * Game_Map::REAL_RES_Y - center_y, max_y].min].max) / Game_Map::REAL_RES_Y
center_x = ((Graphics.width / 2) - (Game_Map::TILE_WIDTH / 2)) * 4 # X coordinate in the center of the screen
center_y = ((Graphics.height / 2) - (Game_Map::TILE_HEIGHT / 2)) * 4 # Y coordinate in the center of the screen
max_x = ($game_map.width - (Graphics.width.to_f / Game_Map::TILE_WIDTH)) * 4 * Game_Map::TILE_WIDTH
max_y = ($game_map.height - (Graphics.height.to_f / Game_Map::TILE_HEIGHT)) * 4 * Game_Map::TILE_HEIGHT
count_x = ($game_map.display_x - [0, [(x * Game_Map::REAL_RES_X) - center_x, max_x].min].max) / Game_Map::REAL_RES_X
count_y = ($game_map.display_y - [0, [(y * Game_Map::REAL_RES_Y) - center_y, max_y].min].max) / Game_Map::REAL_RES_Y
if !@diag
@diag = true
dir = nil
@@ -148,20 +148,20 @@ end
class Game_Map
def scroll_downright(distance)
@display_x = [@display_x + distance,
(self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X].min
(self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X].min
@display_y = [@display_y + distance,
(self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y].min
(self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y].min
end
def scroll_downleft(distance)
@display_x = [@display_x - distance, 0].max
@display_y = [@display_y + distance,
(self.height - Graphics.height * 1.0 / TILE_HEIGHT) * REAL_RES_Y].min
(self.height - (Graphics.height.to_f / TILE_HEIGHT)) * REAL_RES_Y].min
end
def scroll_upright(distance)
@display_x = [@display_x + distance,
(self.width - Graphics.width * 1.0 / TILE_WIDTH) * REAL_RES_X].min
(self.width - (Graphics.width.to_f / TILE_WIDTH)) * REAL_RES_X].min
@display_y = [@display_y - distance, 0].max
end
@@ -122,8 +122,8 @@ class PokemonMapFactory
for conn in conns[id]
if conn[0] == id
mapA = getMap(conn[0])
newdispx = (conn[4] - conn[1]) * Game_Map::REAL_RES_X + mapA.display_x
newdispy = (conn[5] - conn[2]) * Game_Map::REAL_RES_Y + mapA.display_y
newdispx = ((conn[4] - conn[1]) * Game_Map::REAL_RES_X) + mapA.display_x
newdispy = ((conn[5] - conn[2]) * Game_Map::REAL_RES_Y) + mapA.display_y
if hasMap?(conn[3]) || MapFactoryHelper.mapInRangeById?(conn[3], newdispx, newdispy)
mapB = getMap(conn[3])
mapB.display_x = newdispx if mapB.display_x != newdispx
@@ -131,8 +131,8 @@ class PokemonMapFactory
end
else
mapA = getMap(conn[3])
newdispx = (conn[1] - conn[4]) * Game_Map::REAL_RES_X + mapA.display_x
newdispy = (conn[2] - conn[5]) * Game_Map::REAL_RES_Y + mapA.display_y
newdispx = ((conn[1] - conn[4]) * Game_Map::REAL_RES_X) + mapA.display_x
newdispy = ((conn[2] - conn[5]) * Game_Map::REAL_RES_Y) + mapA.display_y
if hasMap?(conn[0]) || MapFactoryHelper.mapInRangeById?(conn[0], newdispx, newdispy)
mapB = getMap(conn[0])
mapB.display_x = newdispx if mapB.display_x != newdispx
@@ -204,8 +204,8 @@ class PokemonMapFactory
if !($DEBUG && Input.press?(Input::CTRL))
return false if !map.passableStrict?(x, y, 0, thisEvent)
end
else
return false if !map.passableStrict?(x, y, 0, thisEvent)
elsif !map.passableStrict?(x, y, 0, thisEvent)
return false
end
for event in map.events.values
next if event == thisEvent || !event.at_coordinate?(x, y)
@@ -488,8 +488,8 @@ module MapFactoryHelper
dispy = map.display_y
return false if dispx >= (map.width + range) * Game_Map::REAL_RES_X
return false if dispy >= (map.height + range) * Game_Map::REAL_RES_Y
return false if dispx <= -(Graphics.width + range * Game_Map::TILE_WIDTH) * Game_Map::X_SUBPIXELS
return false if dispy <= -(Graphics.height + range * Game_Map::TILE_HEIGHT) * Game_Map::Y_SUBPIXELS
return false if dispx <= -(Graphics.width + (range * Game_Map::TILE_WIDTH)) * Game_Map::X_SUBPIXELS
return false if dispy <= -(Graphics.height + (range * Game_Map::TILE_HEIGHT)) * Game_Map::Y_SUBPIXELS
return true
end
@@ -498,8 +498,8 @@ module MapFactoryHelper
dims = MapFactoryHelper.getMapDims(id)
return false if dispx >= (dims[0] + range) * Game_Map::REAL_RES_X
return false if dispy >= (dims[1] + range) * Game_Map::REAL_RES_Y
return false if dispx <= -(Graphics.width + range * Game_Map::TILE_WIDTH) * Game_Map::X_SUBPIXELS
return false if dispy <= -(Graphics.height + range * Game_Map::TILE_HEIGHT) * Game_Map::Y_SUBPIXELS
return false if dispx <= -(Graphics.width + (range * Game_Map::TILE_WIDTH)) * Game_Map::X_SUBPIXELS
return false if dispy <= -(Graphics.height + (range * Game_Map::TILE_HEIGHT)) * Game_Map::Y_SUBPIXELS
return true
end
end
@@ -142,7 +142,7 @@ class Game_Character
# 4 => 64 # 1.6 seconds
# 5 => 30 # 0.75 seconds
# 6 => 0 # 0 seconds, i.e. continuous movement
self.move_frequency_real = (40 - val * 2) * (6 - val)
self.move_frequency_real = (40 - (val * 2)) * (6 - val)
end
def move_frequency_real
@@ -318,7 +318,7 @@ class Game_Character
else
jump_fraction = ((@jump_distance_left / @jump_distance) - 0.5).abs # 0.5 to 0 to 0.5
end
ret += @jump_peak * (4 * jump_fraction**2 - 1)
ret += @jump_peak * ((4 * (jump_fraction**2)) - 1)
end
return ret
end
@@ -328,7 +328,7 @@ class Game_Character
z = screen_y_ground
if @tile_id > 0
begin
return z + self.map.priorities[@tile_id] * 32
return z + (self.map.priorities[@tile_id] * 32)
rescue
raise "Event's graphic is an out-of-range tile (event #{@id}, map #{self.map.map_id})"
end
@@ -405,8 +405,8 @@ class Game_Character
end
def move_type_toward_player
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0))
sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0))
if sx.abs + sy.abs >= 20
move_random
return
@@ -662,8 +662,8 @@ class Game_Character
end
def move_toward_player
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0))
sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0))
return if sx == 0 && sy == 0
abs_sx = sx.abs
abs_sy = sy.abs
@@ -684,8 +684,8 @@ class Game_Character
end
def move_away_from_player
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0))
sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0))
return if sx == 0 && sy == 0
abs_sx = sx.abs
abs_sy = sy.abs
@@ -737,7 +737,7 @@ class Game_Character
end
@x = @x + x_plus
@y = @y + y_plus
real_distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus)
real_distance = Math.sqrt((x_plus * x_plus) + (y_plus * y_plus))
distance = [1, real_distance].max
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
@jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max
@@ -824,8 +824,8 @@ class Game_Character
end
def turn_toward_player
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0))
sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0))
return if sx == 0 && sy == 0
if sx.abs > sy.abs
(sx > 0) ? turn_left : turn_right
@@ -835,8 +835,8 @@ class Game_Character
end
def turn_away_from_player
sx = @x + @width / 2.0 - ($game_player.x + $game_player.width / 2.0)
sy = @y - @height / 2.0 - ($game_player.y - $game_player.height / 2.0)
sx = @x + (@width / 2.0) - ($game_player.x + ($game_player.width / 2.0))
sy = @y - (@height / 2.0) - ($game_player.y - ($game_player.height / 2.0))
return if sx == 0 && sy == 0
if sx.abs > sy.abs
(sx > 0) ? turn_right : turn_left
@@ -110,7 +110,7 @@ class Game_Event < Game_Character
return false if !ontime
now = pbGetTimeNow
elapsed = (now.to_i - ontime) / 86400
elapsed += 1 if (now.to_i - ontime) % 86400 > (now.hour * 3600 + now.min * 60 + now.sec)
elapsed += 1 if (now.to_i - ontime) % 86400 > ((now.hour * 3600) + (now.min * 60) + now.sec)
return elapsed >= days
end
@@ -249,9 +249,9 @@ class Game_Event < Game_Character
return true if @move_route_forcing
return true if @event.name[/update/i]
range = 2 # Number of tiles
return false if self.screen_x - @sprite_size[0] / 2 > Graphics.width + range * Game_Map::TILE_WIDTH
return false if self.screen_x + @sprite_size[0] / 2 < -range * Game_Map::TILE_WIDTH
return false if self.screen_y_ground - @sprite_size[1] > Graphics.height + range * Game_Map::TILE_HEIGHT
return false if self.screen_x - (@sprite_size[0] / 2) > Graphics.width + (range * Game_Map::TILE_WIDTH)
return false if self.screen_x + (@sprite_size[0] / 2) < -range * Game_Map::TILE_WIDTH
return false if self.screen_y_ground - @sprite_size[1] > Graphics.height + (range * Game_Map::TILE_HEIGHT)
return false if self.screen_y_ground < -range * Game_Map::TILE_HEIGHT
return true
end
@@ -10,8 +10,8 @@ class Game_Player < Game_Character
attr_accessor :charsetData
attr_accessor :encounter_count
SCREEN_CENTER_X = (Settings::SCREEN_WIDTH / 2 - Game_Map::TILE_WIDTH / 2) * Game_Map::X_SUBPIXELS
SCREEN_CENTER_Y = (Settings::SCREEN_HEIGHT / 2 - Game_Map::TILE_HEIGHT / 2) * Game_Map::Y_SUBPIXELS
SCREEN_CENTER_X = ((Settings::SCREEN_WIDTH / 2) - (Game_Map::TILE_WIDTH / 2)) * Game_Map::X_SUBPIXELS
SCREEN_CENTER_Y = ((Settings::SCREEN_HEIGHT / 2) - (Game_Map::TILE_HEIGHT / 2)) * Game_Map::Y_SUBPIXELS
@@bobFrameSpeed = 1.0 / 15
@@ -157,7 +157,7 @@ class Game_Player < Game_Character
end
@x = @x + x_plus
@y = @y + y_plus
real_distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus)
real_distance = Math.sqrt((x_plus * x_plus) + (y_plus * y_plus))
distance = [1, real_distance].max
@jump_peak = distance * Game_Map::TILE_HEIGHT * 3 / 8 # 3/4 of tile for ledge jumping
@jump_distance = [x_plus.abs * Game_Map::REAL_RES_X, y_plus.abs * Game_Map::REAL_RES_Y].max
@@ -287,8 +287,8 @@ class Game_Player < Game_Character
# * Set Map Display Position to Center of Screen
#-----------------------------------------------------------------------------
def center(x, y)
self.map.display_x = x * Game_Map::REAL_RES_X - SCREEN_CENTER_X
self.map.display_y = y * Game_Map::REAL_RES_Y - SCREEN_CENTER_Y
self.map.display_x = (x * Game_Map::REAL_RES_X) - SCREEN_CENTER_X
self.map.display_y = (y * Game_Map::REAL_RES_Y) - SCREEN_CENTER_Y
end
#-----------------------------------------------------------------------------
@@ -164,7 +164,7 @@ class Game_Follower < Game_Event
return false if !this_map || !this_map.valid?(x, y)
return true if @through
passed_tile_checks = false
bit = (1 << (direction / 2 - 1)) & 0x0f
bit = (1 << ((direction / 2) - 1)) & 0x0f
# Check all events for ones using tiles as graphics, and see if they're passable
for event in this_map.events.values
next if event.tile_id < 0 || event.through || !event.at_coordinate?(x, y)
+2 -2
View File
@@ -38,8 +38,8 @@ class Sprite_Timer
@timer.text = _ISPRINTF("<ac>{1:02d}:{2:02d}", min, sec)
end
@timer.update
else
@timer.visible = false if @timer
elsif @timer
@timer.visible = false
end
end
end
@@ -57,10 +57,10 @@ class Sprite_Reflection
y += @height * 16
width = @rsprite.src_rect.width
height = @rsprite.src_rect.height
@sprite.x = x + width / 2
@sprite.y = y + height + height / 2
@sprite.x = x + (width / 2)
@sprite.y = y + height + (height / 2)
@sprite.ox = width / 2
@sprite.oy = height / 2 - 2 # Hard-coded 2 pixel shift up
@sprite.oy = (height / 2) - 2 # Hard-coded 2 pixel shift up
@sprite.oy -= @rsprite.character.bob_height * 2
@sprite.z = -50 # Still water is -100, map is 0 and above
@sprite.z += 1 if @event == $game_player
@@ -63,8 +63,8 @@ class Sprite_SurfBase
sy = ((@event.direction - 2) / 2) * ch
@sprite.src_rect.set(sx, sy, cw, ch)
if $game_temp.surf_base_coords
@sprite.x = ($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X - @event.map.display_x + 3) / 4 + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y - @event.map.display_y + 3) / 4 + (Game_Map::TILE_HEIGHT / 2) + 16
@sprite.x = ((($game_temp.surf_base_coords[0] * Game_Map::REAL_RES_X) - @event.map.display_x + 3) / 4) + (Game_Map::TILE_WIDTH / 2)
@sprite.y = ((($game_temp.surf_base_coords[1] * Game_Map::REAL_RES_Y) - @event.map.display_y + 3) / 4) + (Game_Map::TILE_HEIGHT / 2) + 16
else
@sprite.x = @rsprite.x
@sprite.y = @rsprite.y
@@ -9,7 +9,7 @@ class ClippableSprite < Sprite_Character
def update
super
@_src_rect = self.src_rect
tmright = @tilemap.map_data.xsize * Game_Map::TILE_WIDTH - @tilemap.ox
tmright = (@tilemap.map_data.xsize * Game_Map::TILE_WIDTH) - @tilemap.ox
echoln "x=#{self.x},ox=#{self.ox},tmright=#{tmright},tmox=#{@tilemap.ox}"
if @tilemap.ox - self.ox < -self.x
# clipped on left
@@ -18,9 +18,9 @@ class AnimationSprite < RPG::Sprite
end
def setCoords
self.x = ((@tileX * Game_Map::REAL_RES_X - @map.display_x) / Game_Map::X_SUBPIXELS).ceil
self.x = (((@tileX * Game_Map::REAL_RES_X) - @map.display_x) / Game_Map::X_SUBPIXELS).ceil
self.x += Game_Map::TILE_WIDTH / 2
self.y = ((@tileY * Game_Map::REAL_RES_Y - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil
self.y = (((@tileY * Game_Map::REAL_RES_Y) - @map.display_y) / Game_Map::Y_SUBPIXELS).ceil
self.y += Game_Map::TILE_HEIGHT
end
@@ -261,9 +261,9 @@ class ParticleEffect_Event < ParticleEffect
@real_y = newRealY
if @opacityvar > 0 && @viewport
opac = 255.0 / @opacityvar
minX = opac * (-@xgravity * 1.0 / @slowdown).floor + @startingx
maxX = opac * (@xgravity * 1.0 / @slowdown).floor + @startingx
minY = opac * (-@ygravity * 1.0 / @slowdown).floor + @startingy
minX = (opac * (-@xgravity.to_f / @slowdown).floor) + @startingx
maxX = (opac * (@xgravity.to_f / @slowdown).floor) + @startingx
minY = (opac * (-@ygravity.to_f / @slowdown).floor) + @startingy
maxY = @startingy
minX -= @bmwidth
minY -= @bmheight
@@ -309,15 +309,13 @@ class ParticleEffect_Event < ParticleEffect
@particlex[i] = 0.0
@particley[i] = 0.0
end
else
if @opacity[i] <= 0
elsif @opacity[i] <= 0
@opacity[i] = 250
@particles[i].y = @startingy + @yoffset
@particles[i].x = @startingx + @xoffset
@particlex[i] = 0.0
@particley[i] = 0.0
end
end
calcParticlePos(i)
if @randomhue == 1
@hue += 0.5
@@ -333,11 +331,11 @@ class ParticleEffect_Event < ParticleEffect
def calcParticlePos(i)
@leftright = rand(2)
if @leftright == 1
xo = -@xgravity * 1.0 / @slowdown
xo = -@xgravity.to_f / @slowdown
else
xo = @xgravity * 1.0 / @slowdown
xo = @xgravity.to_f / @slowdown
end
yo = -@ygravity * 1.0 / @slowdown
yo = -@ygravity.to_f / @slowdown
@particlex[i] += xo
@particley[i] += yo
@particlex[i] -= @__offsetx
+31 -30
View File
@@ -47,23 +47,23 @@ def getCubicPoint2(src, t)
x1 = src[6]
y1 = src[7]
x1 = cx1 + (x1 - cx1) * t
x0 = x0 + (cx0 - x0) * t
cx0 = cx0 + (cx1 - cx0) * t
cx1 = cx0 + (x1 - cx0) * t
cx0 = x0 + (cx0 - x0) * t
cx = cx0 + (cx1 - cx0) * t
x1 = cx1 + ((x1 - cx1) * t)
x0 = x0 + ((cx0 - x0) * t)
cx0 = cx0 + ((cx1 - cx0) * t)
cx1 = cx0 + ((x1 - cx0) * t)
cx0 = x0 + ((cx0 - x0) * t)
cx = cx0 + ((cx1 - cx0) * t)
# a = x1 - 3 * cx1 + 3 * cx0 - x0
# b = 3 * (cx1 - 2 * cx0 + x0)
# c = 3 * (cx0 - x0)
# d = x0
# cx = a*t*t*t + b*t*t + c*t + d
y1 = cy1 + (y1 - cy1) * t
y0 = y0 + (cy0 - y0) * t
cy0 = cy0 + (cy1 - cy0) * t
cy1 = cy0 + (y1 - cy0) * t
cy0 = y0 + (cy0 - y0) * t
cy = cy0 + (cy1 - cy0) * t
y1 = cy1 + ((y1 - cy1) * t)
y0 = y0 + ((cy0 - y0) * t)
cy0 = cy0 + ((cy1 - cy0) * t)
cy1 = cy0 + ((y1 - cy0) * t)
cy0 = y0 + ((cy0 - y0) * t)
cy = cy0 + ((cy1 - cy0) * t)
# a = y1 - 3 * cy1 + 3 * cy0 - y0
# b = 3 * (cy1 - 2 * cy0 + y0)
# c = 3 * (cy0 - y0)
@@ -121,11 +121,12 @@ class PictureEx
end
def callback(cb)
if cb.is_a?(Proc)
case cb
when Proc
cb.call(self)
elsif cb.is_a?(Array)
when Array
cb[0].method(cb[1]).call(self)
elsif cb.is_a?(Method)
when Method
cb.call(self)
end
end
@@ -390,31 +391,31 @@ class PictureEx
dur = (process[2] == 0) ? 1 : process[2] # Total duration of process
case process[0]
when Processes::XY, Processes::DeltaXY
@x = process[5] + fra * (process[7] - process[5]) / dur
@y = process[6] + fra * (process[8] - process[6]) / dur
@x = process[5] + (fra * (process[7] - process[5]) / dur)
@y = process[6] + (fra * (process[8] - process[6]) / dur)
when Processes::Curve
@x, @y = getCubicPoint2(process[5], fra.to_f / dur)
when Processes::Z
@z = process[5] + fra * (process[6] - process[5]) / dur
@z = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Zoom
@zoom_x = process[5] + fra * (process[7] - process[5]) / dur
@zoom_y = process[6] + fra * (process[8] - process[6]) / dur
@zoom_x = process[5] + (fra * (process[7] - process[5]) / dur)
@zoom_y = process[6] + (fra * (process[8] - process[6]) / dur)
when Processes::Angle
@angle = process[5] + fra * (process[6] - process[5]) / dur
@angle = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Tone
@tone.red = process[5].red + fra * (process[6].red - process[5].red) / dur
@tone.green = process[5].green + fra * (process[6].green - process[5].green) / dur
@tone.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur
@tone.gray = process[5].gray + fra * (process[6].gray - process[5].gray) / dur
@tone.red = process[5].red + (fra * (process[6].red - process[5].red) / dur)
@tone.green = process[5].green + (fra * (process[6].green - process[5].green) / dur)
@tone.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur)
@tone.gray = process[5].gray + (fra * (process[6].gray - process[5].gray) / dur)
when Processes::Color
@color.red = process[5].red + fra * (process[6].red - process[5].red) / dur
@color.green = process[5].green + fra * (process[6].green - process[5].green) / dur
@color.blue = process[5].blue + fra * (process[6].blue - process[5].blue) / dur
@color.alpha = process[5].alpha + fra * (process[6].alpha - process[5].alpha) / dur
@color.red = process[5].red + (fra * (process[6].red - process[5].red) / dur)
@color.green = process[5].green + (fra * (process[6].green - process[5].green) / dur)
@color.blue = process[5].blue + (fra * (process[6].blue - process[5].blue) / dur)
@color.alpha = process[5].alpha + (fra * (process[6].alpha - process[5].alpha) / dur)
when Processes::Hue
@hue = (process[6] - process[5]).to_f / dur
when Processes::Opacity
@opacity = process[5] + fra * (process[6] - process[5]) / dur
@opacity = process[5] + (fra * (process[6] - process[5]) / dur)
when Processes::Visible
@visible = process[5]
when Processes::BlendType
+18 -18
View File
@@ -51,26 +51,26 @@ class Interpolator
def update
if @tweening
t = (@step * 1.0) / @frames
t = @step.to_f / @frames
for i in 0...@tweensteps.length
item = @tweensteps[i]
next if !item
case i
when ZOOM_X
@sprite.zoom_x = item[0] + item[1] * t
@sprite.zoom_x = item[0] + (item[1] * t)
when ZOOM_Y
@sprite.zoom_y = item[0] + item[1] * t
@sprite.zoom_y = item[0] + (item[1] * t)
when X
@sprite.x = item[0] + item[1] * t
@sprite.x = item[0] + (item[1] * t)
when Y
@sprite.y = item[0] + item[1] * t
@sprite.y = item[0] + (item[1] * t)
when OPACITY
@sprite.opacity = item[0] + item[1] * t
@sprite.opacity = item[0] + (item[1] * t)
when COLOR
@sprite.color = Color.new(item[0].red + item[1].red * t,
item[0].green + item[1].green * t,
item[0].blue + item[1].blue * t,
item[0].alpha + item[1].alpha * t)
@sprite.color = Color.new(item[0].red + (item[1].red * t),
item[0].green + (item[1].green * t),
item[0].blue + (item[1].blue * t),
item[0].alpha + (item[1].alpha * t))
end
end
@step += 1
@@ -108,19 +108,19 @@ class RectInterpolator
def update
return if done?
t = (@curframe * 1.0 / @frames)
t = @curframe.to_f / @frames
x1 = @oldrect.x
x2 = @newrect.x
x = x1 + t * (x2 - x1)
x = x1 + (t * (x2 - x1))
y1 = @oldrect.y
y2 = @newrect.y
y = y1 + t * (y2 - y1)
y = y1 + (t * (y2 - y1))
rx1 = @oldrect.x + @oldrect.width
rx2 = @newrect.x + @newrect.width
rx = rx1 + t * (rx2 - rx1)
rx = rx1 + (t * (rx2 - rx1))
ry1 = @oldrect.y + @oldrect.height
ry2 = @newrect.y + @newrect.height
ry = ry1 + t * (ry2 - ry1)
ry = ry1 + (t * (ry2 - ry1))
minx = x < rx ? x : rx
maxx = x > rx ? x : rx
miny = y < ry ? y : ry
@@ -157,13 +157,13 @@ class PointInterpolator
def update
return if done?
t = (@curframe * 1.0 / @frames)
t = @curframe.to_f / @frames
rx1 = @oldx
rx2 = @newx
@x = rx1 + t * (rx2 - rx1)
@x = rx1 + (t * (rx2 - rx1))
ry1 = @oldy
ry2 = @newy
@y = ry1 + t * (ry2 - ry1)
@y = ry1 + (t * (ry2 - ry1))
@curframe += 1
end
end
@@ -372,7 +372,7 @@ class TilemapRenderer
if tile_id < true_tileset_start_id
filename = ""
if tile_id < TILESET_START_ID # Real autotiles
filename = map.autotile_names[tile_id / TILES_PER_AUTOTILE - 1]
filename = map.autotile_names[(tile_id / TILES_PER_AUTOTILE) - 1]
elsif tile_id < single_autotile_start_id # Large extra autotiles
filename = extra_autotile_arrays[0][(tile_id - TILESET_START_ID) / TILES_PER_AUTOTILE]
else # Single extra autotiles
@@ -406,8 +406,8 @@ class TilemapRenderer
# x and y are the positions of tile within @tiles, not a map x/y
def refresh_tile_coordinates(tile, x, y)
tile.x = x * DISPLAY_TILE_WIDTH - @pixel_offset_x
tile.y = y * DISPLAY_TILE_HEIGHT - @pixel_offset_y
tile.x = (x * DISPLAY_TILE_WIDTH) - @pixel_offset_x
tile.y = (y * DISPLAY_TILE_HEIGHT) - @pixel_offset_y
end
def refresh_tile_z(tile, map, y, layer, tile_id)
@@ -417,7 +417,7 @@ class TilemapRenderer
tile.z = 0
else
priority = tile.priority
tile.z = (priority == 0) ? 0 : y * DISPLAY_TILE_HEIGHT + priority * 32 + 32
tile.z = (priority == 0) ? 0 : (y * DISPLAY_TILE_HEIGHT) + (priority * 32) + 32
end
end
@@ -23,7 +23,7 @@ class TilemapRenderer
TILESET_WIDTH = SOURCE_TILE_WIDTH * TILESET_TILES_PER_ROW
# Looks useless, but covers weird numbers given to mkxp.json or a funky driver
MAX_TEX_SIZE = (Bitmap.max_size / 1024) * 1024
MAX_TEX_SIZE_BOOSTED = MAX_TEX_SIZE**2 / TILESET_WIDTH
MAX_TEX_SIZE_BOOSTED = (MAX_TEX_SIZE**2) / TILESET_WIDTH
module_function
@@ -49,7 +49,7 @@ class TilemapRenderer
def getWrappedRect(src_rect)
ret = Rect.new(0, 0, 0, 0)
col = (src_rect.y / MAX_TEX_SIZE.to_f).floor
ret.x = col * TILESET_WIDTH + src_rect.x.clamp(0, TILESET_WIDTH)
ret.x = (col * TILESET_WIDTH) + src_rect.x.clamp(0, TILESET_WIDTH)
ret.y = src_rect.y % MAX_TEX_SIZE
ret.width = src_rect.width.clamp(0, TILESET_WIDTH - src_rect.x)
ret.height = src_rect.height.clamp(0, MAX_TEX_SIZE)
@@ -36,11 +36,11 @@ class TilemapRenderer
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
when 2 # Top right corner
new_bitmap.blt(dest_x, dest_y, bitmap,
Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 4,
Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 4,
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
when 4 # Bottom right corner
new_bitmap.blt(dest_x, dest_y, bitmap,
Rect.new(SOURCE_TILE_WIDTH + frame * SOURCE_TILE_WIDTH * 3, SOURCE_TILE_HEIGHT * 5,
Rect.new(SOURCE_TILE_WIDTH + (frame * SOURCE_TILE_WIDTH * 3), SOURCE_TILE_HEIGHT * 5,
SOURCE_TILE_WIDTH, SOURCE_TILE_HEIGHT))
when 8 # Bottom left corner
new_bitmap.blt(dest_x, dest_y, bitmap,
@@ -89,7 +89,7 @@ class TileDrawingHelper
def bltSmallAutotile(bitmap, x, y, cxTile, cyTile, id, frame)
return if id >= 384 || frame < 0 || !@autotiles
autotile = @autotiles[id / 48 - 1]
autotile = @autotiles[(id / 48) - 1]
return if !autotile || autotile.disposed?
cxTile = [cxTile / 2, 1].max
cyTile = [cyTile / 2, 1].max
@@ -104,8 +104,8 @@ class TileDrawingHelper
src = Rect.new(0, 0, 0, 0)
for i in 0...4
tile_position = tiles[i] - 1
src.set(tile_position % 6 * 16 + anim, tile_position / 6 * 16, 16, 16)
bitmap.stretch_blt(Rect.new(i % 2 * cxTile + x, i / 2 * cyTile + y, cxTile, cyTile),
src.set((tile_position % 6 * 16) + anim, tile_position / 6 * 16, 16, 16)
bitmap.stretch_blt(Rect.new((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, cxTile, cyTile),
autotile, src)
end
end
@@ -180,9 +180,9 @@ def bltMinimapAutotile(dstBitmap, x, y, srcBitmap, id)
src = Rect.new(0, 0, 0, 0)
for i in 0...4
tile_position = tiles[i] - 1
src.set(tile_position % 6 * cxTile + anim,
src.set((tile_position % 6 * cxTile) + anim,
tile_position / 6 * cyTile, cxTile, cyTile)
dstBitmap.blt(i % 2 * cxTile + x, i / 2 * cyTile + y, srcBitmap, src)
dstBitmap.blt((i % 2 * cxTile) + x, (i / 2 * cyTile) + y, srcBitmap, src)
end
end
@@ -146,9 +146,10 @@ module MessageConfig
def self.pbTryFonts(*args)
for a in args
next if !a
if a.is_a?(String)
case a
when String
return a if Font.exist?(a)
elsif a.is_a?(Array)
when Array
for aa in a
ret = MessageConfig.pbTryFonts(aa)
return ret if ret != ""
@@ -177,7 +178,7 @@ end
def pbBottomLeftLines(window, lines, width = nil)
window.x = 0
window.width = width ? width : Graphics.width
window.height = (window.borderY rescue 32) + lines * 32
window.height = (window.borderY rescue 32) + (lines * 32)
window.y = Graphics.height - window.height
end
@@ -230,7 +231,7 @@ end
# internal function
def pbRepositionMessageWindow(msgwindow, linecount = 2)
msgwindow.height = 32 * linecount + msgwindow.borderY
msgwindow.height = (32 * linecount) + msgwindow.borderY
msgwindow.y = (Graphics.height) - (msgwindow.height)
if $game_system
case $game_system.message_position
@@ -278,10 +279,10 @@ def isDarkBackground(background, rect = nil)
return true if rect.width <= 0 || rect.height <= 0
xSeg = (rect.width / 16)
xLoop = (xSeg == 0) ? 1 : 16
xStart = (xSeg == 0) ? rect.x + (rect.width / 2) : rect.x + xSeg / 2
xStart = (xSeg == 0) ? rect.x + (rect.width / 2) : rect.x + (xSeg / 2)
ySeg = (rect.height / 16)
yLoop = (ySeg == 0) ? 1 : 16
yStart = (ySeg == 0) ? rect.y + (rect.height / 2) : rect.y + ySeg / 2
yStart = (ySeg == 0) ? rect.y + (rect.height / 2) : rect.y + (ySeg / 2)
count = 0
y = yStart
r = g = b = 0
@@ -303,7 +304,7 @@ def isDarkBackground(background, rect = nil)
r /= count
g /= count
b /= count
return (r * 0.299 + g * 0.587 + b * 0.114) < 160
return ((r * 0.299) + (g * 0.587) + (b * 0.114)) < 160
end
def isDarkWindowskin(windowskin)
@@ -316,7 +317,7 @@ def isDarkWindowskin(windowskin)
return isDarkBackground(windowskin, Rect.new(32, 16, 16, 16))
else
clr = windowskin.get_pixel(windowskin.width / 2, windowskin.height / 2)
return (clr.red * 0.299 + clr.green * 0.587 + clr.blue * 0.114) < 160
return ((clr.red * 0.299) + (clr.green * 0.587) + (clr.blue * 0.114)) < 160
end
end
@@ -352,14 +353,14 @@ def getSkinColor(windowskin, color, isDarkSkin)
end
# Special colour as listed above
if isDarkSkin && color != 12 # Dark background, light text
return sprintf("<c3=%s,%s>", textcolors[2 * (color - 1) + 1], textcolors[2 * (color - 1)])
return sprintf("<c3=%s,%s>", textcolors[(2 * (color - 1)) + 1], textcolors[2 * (color - 1)])
end
# Light background, dark text
return sprintf("<c3=%s,%s>", textcolors[2 * (color - 1)], textcolors[2 * (color - 1) + 1])
return sprintf("<c3=%s,%s>", textcolors[2 * (color - 1)], textcolors[(2 * (color - 1)) + 1])
else # VX windowskin
color = 0 if color >= 32
x = 64 + (color % 8) * 8
y = 96 + (color / 8) * 8
x = 64 + ((color % 8) * 8)
y = 96 + ((color / 8) * 8)
pixel = windowskin.get_pixel(x, y)
return shadowctagFromColor(pixel)
end
@@ -441,10 +442,10 @@ def pbSrcOver(dstColor, srcColor)
cg = dstColor.green * dstColor.alpha / 255
cb = dstColor.blue * dstColor.alpha / 255
ica = 255 - dstColor.alpha
a = 255 - (iea * ica) / 255
r = (iea * cr) / 255 + er
g = (iea * cg) / 255 + eg
b = (iea * cb) / 255 + eb
a = 255 - ((iea * ica) / 255)
r = ((iea * cr) / 255) + er
g = ((iea * cg) / 255) + eg
b = ((iea * cb) / 255) + eb
r = (a == 0) ? 0 : r * 255 / a
g = (a == 0) ? 0 : g * 255 / a
b = (a == 0) ? 0 : b * 255 / a
@@ -463,7 +463,7 @@ class Window
pauseWidth = 16
pauseHeight = 16
@sprites["pause"].src_rect.set(pauseRects[@pauseframe * 2],
pauseRects[@pauseframe * 2 + 1],
pauseRects[(@pauseframe * 2) + 1],
pauseWidth,
pauseHeight)
@sprites["pause"].x = @x + (@width / 2) - (pauseWidth / 2)
@@ -486,13 +486,13 @@ class Window
@sprites["side2"].y = @y + 16
@sprites["side3"].x = @x + 16
@sprites["side3"].y = @y + @height - 16
@sprites["scroll0"].x = @x + @width / 2 - 8
@sprites["scroll0"].x = @x + (@width / 2) - 8
@sprites["scroll0"].y = @y + 8
@sprites["scroll1"].x = @x + 8
@sprites["scroll1"].y = @y + @height / 2 - 8
@sprites["scroll1"].y = @y + (@height / 2) - 8
@sprites["scroll2"].x = @x + @width - 16
@sprites["scroll2"].y = @y + @height / 2 - 8
@sprites["scroll3"].x = @x + @width / 2 - 8
@sprites["scroll2"].y = @y + (@height / 2) - 8
@sprites["scroll3"].x = @x + (@width / 2) - 8
@sprites["scroll3"].y = @y + @height - 16
@sprites["back"].x = @x + 2
@sprites["back"].y = @y + 2
@@ -575,7 +575,7 @@ class Window
opn = @openness / 255.0
for k in @spritekeys
sprite = @sprites[k]
ratio = (@height <= 0) ? 0 : (sprite.y - @y) * 1.0 / @height
ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f
sprite.zoom_y = opn
sprite.oy = 0
sprite.y = (@y + (@height / 2.0) + (@height * ratio * opn) - (@height / 2 * opn)).floor
@@ -578,23 +578,19 @@ class SpriteWindow < Window
@sprites["scroll2"].src_rect.set(trimX + 40, trimY + 24, 8, 16) # right
cursorX = trimX
cursorY = trimY + 64
sideRects = [
Rect.new(trimX + 16, trimY + 0, 32, 16),
sideRects = [Rect.new(trimX + 16, trimY + 0, 32, 16),
Rect.new(trimX, trimY + 16, 16, 32),
Rect.new(trimX + 48, trimY + 16, 16, 32),
Rect.new(trimX + 16, trimY + 48, 32, 16)
]
pauseRects = [
trimX + 32, trimY + 64,
Rect.new(trimX + 16, trimY + 48, 32, 16)]
pauseRects = [trimX + 32, trimY + 64,
trimX + 48, trimY + 64,
trimX + 32, trimY + 80,
trimX + 48, trimY + 80
]
trimX + 48, trimY + 80]
pauseWidth = 16
pauseHeight = 16
@sprites["pause"].src_rect.set(
pauseRects[@pauseframe * 2],
pauseRects[@pauseframe * 2 + 1],
pauseRects[(@pauseframe * 2) + 1],
pauseWidth, pauseHeight
)
end
@@ -664,13 +660,13 @@ class SpriteWindow < Window
@sprites["side2"].y = @y + startY
@sprites["side3"].x = @x + startX
@sprites["side3"].y = @y + @height - endY
@sprites["scroll0"].x = @x + @width / 2 - 8
@sprites["scroll0"].x = @x + (@width / 2) - 8
@sprites["scroll0"].y = @y + 8
@sprites["scroll1"].x = @x + 8
@sprites["scroll1"].y = @y + @height / 2 - 8
@sprites["scroll1"].y = @y + (@height / 2) - 8
@sprites["scroll2"].x = @x + @width - 16
@sprites["scroll2"].y = @y + @height / 2 - 8
@sprites["scroll3"].x = @x + @width / 2 - 8
@sprites["scroll2"].y = @y + (@height / 2) - 8
@sprites["scroll3"].x = @x + (@width / 2) - 8
@sprites["scroll3"].y = @y + @height - 16
@sprites["cursor"].x = @x + startX + @cursor_rect.x
@sprites["cursor"].y = @y + startY + @cursor_rect.y
@@ -789,7 +785,7 @@ class SpriteWindow < Window
opn = @openness / 255.0
for k in @spritekeys
sprite = @sprites[k]
ratio = (@height <= 0) ? 0 : (sprite.y - @y) * 1.0 / @height
ratio = (@height <= 0) ? 0 : (sprite.y - @y) / @height.to_f
sprite.zoom_y = opn
sprite.zoom_x = 1.0
sprite.oy = 0
@@ -845,8 +841,8 @@ class SpriteWindow_Base < SpriteWindow
end
def __setWindowskin(skin)
if skin && (skin.width == 192 && skin.height == 128) || # RPGXP Windowskin
(skin.width == 128 && skin.height == 128) # RPGVX Windowskin
if skin && ((skin.width == 192 && skin.height == 128) || # RPGXP Windowskin
(skin.width == 128 && skin.height == 128)) # RPGVX Windowskin
self.skinformat = 0
else
self.skinformat = 1
@@ -621,7 +621,7 @@ class Window_InputNumberPokemon < SpriteWindow_Base
@sign = false
@negative = false
super(0, 0, 32, 32)
self.width = digits_max * 24 + 8 + self.borderX
self.width = (digits_max * 24) + 8 + self.borderX
self.height = 32 + self.borderY
colors = getDefaultTextColors(self.windowskin)
@baseColor = colors[0]
@@ -644,16 +644,16 @@ class Window_InputNumberPokemon < SpriteWindow_Base
value = 0 if !value.is_a?(Numeric)
if @sign
@negative = (value < 0)
@number = [value.abs, 10**@digits_max - 1].min
@number = [value.abs, (10**@digits_max) - 1].min
else
@number = [[value, 0].max, 10**@digits_max - 1].min
@number = [[value, 0].max, (10**@digits_max) - 1].min
end
refresh
end
def sign=(value)
@sign = value
self.width = @digits_max * 24 + 8 + self.borderX + (@sign ? 24 : 0)
self.width = (@digits_max * 24) + 8 + self.borderX + (@sign ? 24 : 0)
@index = (@digits_max - 1) + (@sign ? 1 : 0)
refresh
end
@@ -717,9 +717,9 @@ class Window_InputNumberPokemon < SpriteWindow_Base
def textHelper(x, y, text, i)
textwidth = self.contents.text_size(text).width
pbDrawShadowText(self.contents, x + (12 - textwidth / 2), y, textwidth + 4, 32, text, @baseColor, @shadowColor)
pbDrawShadowText(self.contents, x + (12 - (textwidth / 2)), y, textwidth + 4, 32, text, @baseColor, @shadowColor)
if @index == i && @active && @frame / 15 == 0
self.contents.fill_rect(x + (12 - textwidth / 2), y + 30, textwidth, 2, @baseColor)
self.contents.fill_rect(x + (12 - (textwidth / 2)), y + 30, textwidth, 2, @baseColor)
end
end
end
@@ -825,9 +825,9 @@ class SpriteWindow_Selectable < SpriteWindow_Base
item > self.top_item + self.page_item_max
return Rect.new(0, 0, 0, 0)
else
cursor_width = (self.width - self.borderX - (@column_max - 1) * @column_spacing) / @column_max
cursor_width = (self.width - self.borderX - ((@column_max - 1) * @column_spacing)) / @column_max
x = item % @column_max * (cursor_width + @column_spacing)
y = item / @column_max * @row_height - @virtualOy
y = (item / @column_max * @row_height) - @virtualOy
return Rect.new(x, y, cursor_width, @row_height)
end
end
@@ -946,7 +946,7 @@ class SpriteWindow_Selectable < SpriteWindow_Base
# End of code
cursor_width = (self.width - self.borderX) / @column_max
x = self.index % @column_max * (cursor_width + @column_spacing)
y = self.index / @column_max * @row_height - @virtualOy
y = (self.index / @column_max * @row_height) - @virtualOy
self.cursor_rect.set(x, y, cursor_width, @row_height)
self.refresh if dorefresh || force
end
@@ -992,8 +992,8 @@ module UpDownArrowMixin
def adjustForZoom(sprite)
sprite.zoom_x = self.zoom_x
sprite.zoom_y = self.zoom_y
sprite.x = sprite.x * self.zoom_x + self.offset_x / self.zoom_x
sprite.y = sprite.y * self.zoom_y + self.offset_y / self.zoom_y
sprite.x = (sprite.x * self.zoom_x) + (self.offset_x / self.zoom_x)
sprite.y = (sprite.y * self.zoom_y) + (self.offset_y / self.zoom_y)
end
def update
@@ -1093,7 +1093,7 @@ class Window_DrawableCommand < SpriteWindow_SelectableEx
end
# Store suggested width and height of window
dims[0] = [self.borderX + 1,
(width * self.columns) + self.borderX + (self.columns - 1) * self.columnSpacing].max
(width * self.columns) + self.borderX + ((self.columns - 1) * self.columnSpacing)].max
dims[1] = [self.borderY + 1, windowheight].max
dims[1] = [dims[1], Graphics.height].min
end
@@ -94,12 +94,13 @@ class PictureWindow < SpriteWindow_Base
def setBitmap(pathOrBitmap, hue = 0)
clearBitmaps
if pathOrBitmap != nil && pathOrBitmap != ""
if pathOrBitmap.is_a?(Bitmap)
case pathOrBitmap
when Bitmap
@_iconbitmap = pathOrBitmap
self.contents = @_iconbitmap
self.width = @_iconbitmap.width + self.borderX
self.height = @_iconbitmap.height + self.borderY
elsif pathOrBitmap.is_a?(AnimatedBitmap)
when AnimatedBitmap
@_iconbitmap = pathOrBitmap
self.contents = @_iconbitmap.bitmap
self.width = @_iconbitmap.bitmap.width + self.borderX
@@ -98,9 +98,9 @@ def getContrastColor(color)
g = color.green
b = color.blue
yuv = [
r * 0.299 + g * 0.587 + b * 0.114,
r * -0.1687 + g * -0.3313 + b * 0.500 + 0.5,
r * 0.500 + g * -0.4187 + b * -0.0813 + 0.5
(r * 0.299) + (g * 0.587) + (b * 0.114),
(r * -0.1687) + (g * -0.3313) + (b * 0.500) + 0.5,
(r * 0.500) + (g * -0.4187) + (b * -0.0813) + 0.5
]
if yuv[0] < 127.5
yuv[0] += (255 - yuv[0]) / 2
@@ -108,9 +108,9 @@ def getContrastColor(color)
yuv[0] = yuv[0] / 2
end
return Color.new(
yuv[0] + 1.4075 * (yuv[2] - 0.5),
yuv[0] - 0.3455 * (yuv[1] - 0.5) - 0.7169 * (yuv[2] - 0.5),
yuv[0] + 1.7790 * (yuv[1] - 0.5),
yuv[0] + (1.4075 * (yuv[2] - 0.5)),
yuv[0] - (0.3455 * (yuv[1] - 0.5)) - (0.7169 * (yuv[2] - 0.5)),
yuv[0] + (1.7790 * (yuv[1] - 0.5)),
color.alpha
)
end
@@ -198,7 +198,7 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
if textchars[position] == "\n"
if newlineBreaks # treat newline as break
havenl = true
characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false,
characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false,
false, colorclone, nil, false, false, "", 8, position, nil, 0])
y += 1
x = 0
@@ -224,18 +224,16 @@ def getFormattedTextFast(bitmap, xDst, yDst, widthDst, heightDst, text, lineheig
# Push character
if heightDst < 0 || yStart < yDst + heightDst
havenl = true if isWaitChar(textchars[position])
characters.push([
textchars[position],
characters.push([textchars[position],
x + xStart, texty, width + 2, lineheight,
false, bold, italic, colorclone, nil, false, false,
defaultfontname, bitmap.font.size, position, nil, 0
])
defaultfontname, bitmap.font.size, position, nil, 0])
end
x += width
if !explicitBreaksOnly && x + 2 > widthDst && lastword[1] != 0 &&
(!hadnonspace || !hadspace)
havenl = true
characters.insert(lastword[0], ["\n", x, y * lineheight + yDst, 0, lineheight,
characters.insert(lastword[0], ["\n", x, (y * lineheight) + yDst, 0, lineheight,
false, false, false, colorclone, nil, false, false, "", 8, position])
lastword[0] += 1
y += 1
@@ -626,7 +624,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
end
nextline.times do
havenl = true
characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false, false,
characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false,
defaultcolors[0], defaultcolors[1], false, false, "", 8, position, nil, 0])
charactersInternal.push([alignment, y, 0])
y += 1
@@ -640,7 +638,7 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
if newlineBreaks
if nextline == 0
havenl = true
characters.push(["\n", x, y * lineheight + yDst, 0, lineheight, false, false, false,
characters.push(["\n", x, (y * lineheight) + yDst, 0, lineheight, false, false, false,
defaultcolors[0], defaultcolors[1], false, false, "", 8, position, nil, 0])
charactersInternal.push([alignment, y, 0])
y += 1
@@ -675,22 +673,20 @@ def getFormattedText(bitmap, xDst, yDst, widthDst, heightDst, text, lineheight =
if heightDst < 0 || texty < yDst + heightDst
havenl = true if !graphic && isWaitChar(textchars[position])
extraspace = (!graphic && italiccount > 0) ? 2 + (width / 2) : 2
characters.push([
graphic || textchars[position],
characters.push([graphic || textchars[position],
x + xStart, texty, width + extraspace, lineheight,
graphic ? true : false,
(boldcount > 0), (italiccount > 0), colors[0], colors[1],
(underlinecount > 0), (strikecount > 0), fontname, fontsize,
position, graphicRect,
((outlinecount > 0) ? 1 : 0) + ((outline2count > 0) ? 2 : 0)
])
((outlinecount > 0) ? 1 : 0) + ((outline2count > 0) ? 2 : 0)])
charactersInternal.push([alignment, y, xStart, textchars[position], extraspace])
end
x += width
if !explicitBreaksOnly && x + 2 > widthDst && lastword[1] != 0 &&
(!hadnonspace || !hadspace)
havenl = true
characters.insert(lastword[0], ["\n", x, y * lineheight + yDst, 0, lineheight,
characters.insert(lastword[0], ["\n", x, (y * lineheight) + yDst, 0, lineheight,
false, false, false,
defaultcolors[0], defaultcolors[1],
false, false, "", 8, position, nil])
@@ -1045,8 +1041,8 @@ def drawSingleFormattedChar(bitmap, ch)
end
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
bitmap.draw_text(ch[1] + offset, ch[2] + offset, ch[3], ch[4], ch[0])
else
bitmap.font.color = ch[8] if bitmap.font.color != ch[8]
elsif bitmap.font.color != ch[8]
bitmap.font.color = ch[8]
end
if ch[10] # underline
bitmap.fill_rect(ch[1], ch[2] + ch[4] - 4 - [(ch[4] - bitmap.font.size) / 2, 0].max - 2,
@@ -224,10 +224,9 @@ class FaceWindowVX < SpriteWindow_Base
@faceIndex = faceinfo[1].to_i
@facebitmaptmp = AnimatedBitmap.new(facefile)
@facebitmap = BitmapWrapper.new(96, 96)
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap, Rect.new(
(@faceIndex % 4) * 96,
(@faceIndex / 4) * 96, 96, 96
))
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap,
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96)
)
self.contents = @facebitmap
end
@@ -235,10 +234,9 @@ class FaceWindowVX < SpriteWindow_Base
super
if @facebitmaptmp.totalFrames > 1
@facebitmaptmp.update
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap, Rect.new(
(@faceIndex % 4) * 96,
(@faceIndex / 4) * 96, 96, 96
))
@facebitmap.blt(0, 0, @facebitmaptmp.bitmap,
Rect.new((@faceIndex % 4) * 96, (@faceIndex / 4) * 96, 96, 96)
)
end
end
@@ -581,7 +579,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
if atTop
msgwindow.y = -msgwindow.height * signWaitCount / signWaitTime
else
msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime
msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime)
end
end
for i in 0...controls.length
@@ -627,7 +625,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
msgwindow.y = Graphics.height - msgwindow.height
msgback.y = msgwindow.y if msgback
pbPositionNearMsgWindow(facewindow, msgwindow, :left)
msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime
msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - signWaitCount) / signWaitTime)
when "ts" # Change text speed
msgwindow.textspeed = (param == "") ? -999 : param.to_i
when "." # Wait 0.25 seconds
@@ -662,8 +660,8 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
if msgwindow.busy?
pbPlayDecisionSE if msgwindow.pausing?
msgwindow.resume
else
break if signWaitCount == 0
elsif signWaitCount == 0
break
end
end
pbUpdateSceneMap
@@ -692,7 +690,7 @@ def pbMessageDisplay(msgwindow, message, letterbyletter = true, commandProc = ni
if atTop
msgwindow.y = -msgwindow.height * i / signWaitTime
else
msgwindow.y = Graphics.height - msgwindow.height * (signWaitTime - i) / signWaitTime
msgwindow.y = Graphics.height - (msgwindow.height * (signWaitTime - i) / signWaitTime)
end
Graphics.update
Input.update
@@ -453,10 +453,7 @@ class Window_MultilineTextEntry < SpriteWindow_Base
totalColumns = getColumnsInLine(@cursorLine)
@cursorColumn = totalColumns if @cursorColumn > totalColumns
@cursorColumn = 0 if @cursorColumn < 0 # totalColumns can be 0
updateCursorPos(
oldCursorLine != @cursorLine ||
oldCursorColumn != @cursorColumn
)
updateCursorPos(oldCursorLine != @cursorLine || oldCursorColumn != @cursorColumn)
# echoln ["aftermoving",@cursorLine,@cursorColumn]
end
+1 -1
View File
@@ -128,7 +128,7 @@ def getPlayTime2(filename)
data = fgetdw.call(file)
return -1 if data != 0x61746164 # "data"
datasize = fgetdw.call(file)
time = (datasize * 1.0) / bytessec
time = datasize.to_f / bytessec
return time
when 0x5367674F # "OggS"
file.pos = 0
+57 -57
View File
@@ -178,7 +178,7 @@ module Transitions
sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
@sprites[idx_sprite] = new_sprite(i * sprite_width, j * sprite_height, @overworld_bitmap)
@sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height)
end
@@ -189,7 +189,7 @@ module Transitions
@start_y = []
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
@start_y[idx_sprite] = @sprites[idx_sprite].y
@timings[idx_sprite] = 0.5 + rand
end
@@ -199,7 +199,7 @@ module Transitions
def update_anim
proportion = @timer / @duration
@sprites.each_with_index do |sprite, i|
sprite.y = @start_y[i] + Graphics.height * @timings[i] * proportion * proportion
sprite.y = @start_y[i] + (Graphics.height * @timings[i] * proportion * proportion)
sprite.opacity = 255 * (1 - proportion)
end
end
@@ -219,7 +219,7 @@ module Transitions
sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
@sprites[idx_sprite] = new_sprite((i + 0.5) * sprite_width, (j + 0.5) * sprite_height,
@overworld_bitmap, sprite_width / 2, sprite_height / 2)
@sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height)
@@ -230,10 +230,10 @@ module Transitions
def update_anim
proportion = @timer / @duration
@sprites.each_with_index do |sprite, i|
sprite.zoom_x = 1.0 * (1 - proportion)
sprite.zoom_x = (1 - proportion).to_f
sprite.zoom_y = sprite.zoom_x
if @parameters[0] # Rotation
direction = (1 - 2 * ((i / NUM_SPRITES_X + i % NUM_SPRITES_X) % 2))
direction = (1 - (2 * (((i / NUM_SPRITES_X) + (i % NUM_SPRITES_X)) % 2)))
sprite.angle = direction * 360 * 2 * proportion
end
end
@@ -258,7 +258,7 @@ module Transitions
sprite_height = @overworld_bitmap.height / NUM_SPRITES_Y
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
@sprites[idx_sprite] = new_sprite((i + 0.5) * sprite_width, (j + 0.5) * sprite_height,
@overworld_bitmap, sprite_width / 2, sprite_height / 2)
@sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height)
@@ -272,17 +272,17 @@ module Transitions
vague = (@parameters[0] || 9.6) * SPEED
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
spr = @sprites[idx_sprite]
@start_positions[idx_sprite] = [spr.x, spr.y]
dx = spr.x - Graphics.width / 2
dy = spr.y - Graphics.height / 2
dx = spr.x - (Graphics.width / 2)
dy = spr.y - (Graphics.height / 2)
move_x = move_y = 0
if dx == 0 && dy == 0
move_x = (dx == 0) ? rand_sign * vague : dx * SPEED * 1.5
move_y = (dy == 0) ? rand_sign * vague : dy * SPEED * 1.5
else
radius = Math.sqrt(dx**2 + dy**2)
radius = Math.sqrt((dx**2) + (dy**2))
move_x = dx * vague / radius
move_y = dy * vague / radius
end
@@ -296,8 +296,8 @@ module Transitions
def update_anim
proportion = @timer / @duration
@sprites.each_with_index do |sprite, i|
sprite.x = @start_positions[i][0] + @move_vectors[i][0] * proportion
sprite.y = @start_positions[i][1] + @move_vectors[i][1] * proportion
sprite.x = @start_positions[i][0] + (@move_vectors[i][0] * proportion)
sprite.y = @start_positions[i][1] + (@move_vectors[i][1] * proportion)
sprite.opacity = 384 * (1 - proportion)
end
end
@@ -331,7 +331,7 @@ module Transitions
end
for j in 0...num_stripes_y
for i in 0...num_stripes_x
idx_sprite = j * num_stripes_x + i
idx_sprite = (j * num_stripes_x) + i
@sprites[idx_sprite] = new_sprite(i * sprite_width, j * sprite_height, @overworld_bitmap)
@sprites[idx_sprite].src_rect.set(i * sprite_width, j * sprite_height, sprite_width, sprite_height)
end
@@ -367,7 +367,7 @@ module Transitions
def update_anim
proportion = @timer / @duration
@overworld_sprite.zoom_x = 1.0 + 7.0 * proportion
@overworld_sprite.zoom_x = 1 + (7 * proportion)
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
@overworld_sprite.opacity = 255 * (1 - proportion)
end
@@ -410,7 +410,7 @@ module Transitions
def update_anim
proportion = @timer / @duration
inv_proportion = 1 / (1 + proportion * (MAX_PIXELLATION_FACTOR - 1))
inv_proportion = 1 / (1 + (proportion * (MAX_PIXELLATION_FACTOR - 1)))
new_size_rect = Rect.new(0, 0, @overworld_bitmap.width * inv_proportion,
@overworld_bitmap.height * inv_proportion)
# Take all of buffer_original, shrink it and put it into buffer_temp
@@ -420,7 +420,7 @@ module Transitions
@overworld_bitmap.stretch_blt(Rect.new(0, 0, @overworld_bitmap.width, @overworld_bitmap.height),
@buffer_temp, new_size_rect)
if @timer >= @start_black_fade
@overworld_sprite.opacity = 255 * (1 - (@timer - @start_black_fade) / (@duration - @start_black_fade))
@overworld_sprite.opacity = 255 * (1 - ((@timer - @start_black_fade) / (@duration - @start_black_fade)))
end
end
end
@@ -466,7 +466,7 @@ module Transitions
def initialize_sprites
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
if idx_sprite >= TOTAL_SPRITES / 2
sprite_x = ((j.odd?) ? i : (NUM_SPRITES_X - i - 1)) * @black_bitmap.width
else
@@ -485,7 +485,7 @@ module Transitions
time_between_zooms = (@duration - TIME_TO_ZOOM) * 2 / (TOTAL_SPRITES - 1)
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
idx_from_start = (idx_sprite >= TOTAL_SPRITES / 2) ? TOTAL_SPRITES - 1 - idx_sprite : idx_sprite
@timings[idx_sprite] = time_between_zooms * idx_from_start
end
@@ -534,9 +534,9 @@ module Transitions
def initialize_sprites
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
@sprites[idx_sprite] = new_sprite((i * @bitmap.width + @bitmap.width / 2) * @zoom_x_target,
(j * @bitmap.height + @bitmap.height / 2) * @zoom_y_target,
idx_sprite = (j * NUM_SPRITES_X) + i
@sprites[idx_sprite] = new_sprite(((i * @bitmap.width) + (@bitmap.width / 2)) * @zoom_x_target,
((j * @bitmap.height) + (@bitmap.height / 2)) * @zoom_y_target,
@bitmap, @bitmap.width / 2, @bitmap.height / 2)
@sprites[idx_sprite].visible = false
end
@@ -546,16 +546,16 @@ module Transitions
def set_up_timings
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_from_start = j * NUM_SPRITES_X + i # Top left -> bottom right
idx_from_start = (j * NUM_SPRITES_X) + i # Top left -> bottom right
case @parameters[0] # Origin
when 1 # Top right -> bottom left
idx_from_start = j * NUM_SPRITES_X + NUM_SPRITES_X - i - 1
idx_from_start = (j * NUM_SPRITES_X) + NUM_SPRITES_X - i - 1
when 2 # Bottom left -> top right
idx_from_start = TOTAL_SPRITES - 1 - (j * NUM_SPRITES_X + NUM_SPRITES_X - i - 1)
idx_from_start = TOTAL_SPRITES - 1 - ((j * NUM_SPRITES_X) + NUM_SPRITES_X - i - 1)
when 3 # Bottom right -> top left
idx_from_start = TOTAL_SPRITES - 1 - idx_from_start
end
dist = i + j.to_f * (NUM_SPRITES_X - 1) / (NUM_SPRITES_Y - 1)
dist = i + (j.to_f * (NUM_SPRITES_X - 1) / (NUM_SPRITES_Y - 1))
@timings[idx_from_start] = (dist / ((NUM_SPRITES_X - 1) * 2)) * (@duration - TIME_TO_ZOOM)
end
end
@@ -641,16 +641,16 @@ module Transitions
# Make overworld wave strips oscillate
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
@sprites.each_with_index do |sprite, i|
sprite.x = amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING)
sprite.x = amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
end
# Move bubbles sprite up and oscillate side to side
@bubbles_sprite.x = (Graphics.width - @bubble_bitmap.width) / 2
@bubbles_sprite.x += MAX_BUBBLE_AMPLITUDE * Math.sin(@timer * BUBBLES_WAVE_SPEED)
@bubbles_sprite.y = Graphics.height * (1 - @timer * 1.2)
@bubbles_sprite.y = Graphics.height * (1 - (@timer * 1.2))
# Move splash sprite up
if @timer >= @splash_rising_start
proportion = (@timer - @splash_rising_start) / (@duration - @splash_rising_start)
@splash_sprite.y = Graphics.height * (1 - proportion * 2)
@splash_sprite.y = Graphics.height * (1 - (proportion * 2))
end
# Move black sprite up
if @timer >= @black_rising_start
@@ -680,15 +680,15 @@ module Transitions
# Balls that roll across the screen
@ball_sprites = []
for i in 0...2
x = (1 - i) * Graphics.width + (1 - i * 2) * @ball_bitmap.width / 2
y = (Graphics.height + (i * 2 - 1) * @ball_bitmap.width) / 2
x = ((1 - i) * Graphics.width) + ((1 - (i * 2)) * @ball_bitmap.width / 2)
y = (Graphics.height + (((i * 2) - 1) * @ball_bitmap.width)) / 2
@ball_sprites[i] = new_sprite(x, y, @ball_bitmap,
@ball_bitmap.width / 2, @ball_bitmap.height / 2)
@ball_sprites[i].z = 2
end
# Black foreground sprites
for i in 0...2
@sprites[i] = new_sprite((1 - i * 2) * Graphics.width, i * Graphics.height / 2, @black_bitmap)
@sprites[i] = new_sprite((1 - (i * 2)) * Graphics.width, i * Graphics.height / 2, @black_bitmap)
@sprites[i].z = 1
end
@sprites[2] = new_sprite(0, Graphics.height / 2, @black_bitmap, 0, @black_bitmap.height / 2)
@@ -718,8 +718,8 @@ module Transitions
proportion = @timer / @ball_roll_end
total_distance = Graphics.width + @ball_bitmap.width
@ball_sprites.each_with_index do |sprite, i|
sprite.x = @ball_start_x[i] + (2 * i - 1) * (total_distance * proportion)
sprite.angle = (2 * i - 1) * 360 * proportion * 2
sprite.x = @ball_start_x[i] + (((2 * i) - 1) * (total_distance * proportion))
sprite.angle = ((2 * i) - 1) * 360 * proportion * 2
end
else
proportion = (@timer - @ball_roll_end) / (@duration - @ball_roll_end)
@@ -728,11 +728,11 @@ module Transitions
@ball_sprites.each { |s| s.visible = false }
end
# Zoom in overworld sprite
@overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom
@overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
# Slide first two black bars across
@sprites[0].x = Graphics.width * (1 - proportion * proportion)
@sprites[1].x = Graphics.width * (proportion * proportion - 1)
@sprites[0].x = Graphics.width * (1 - (proportion * proportion))
@sprites[1].x = Graphics.width * ((proportion * proportion) - 1)
# Expand third black bar
@sprites[2].zoom_y = 2.0 * proportion * proportion # Ends at 2x zoom
end
@@ -820,10 +820,10 @@ module Transitions
# Split overworld/ball apart, move blackness in following them
proportion = (@timer - @slide_start) / (@duration - @slide_start)
@overworld_sprites.each_with_index do |sprite, i|
sprite.x = (0.5 + (i * 2 - 1) * proportion * proportion) * Graphics.width
sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom
sprite.x = (0.5 + (((i * 2) - 1) * proportion * proportion)) * Graphics.width
sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
sprite.zoom_y = sprite.zoom_x
@black_sprites[i].x = sprite.x + (1 - i * 2) * Graphics.width / 2
@black_sprites[i].x = sprite.x + ((1 - (i * 2)) * Graphics.width / 2)
@ball_sprites[i].x = sprite.x
end
end
@@ -859,7 +859,7 @@ module Transitions
# Black squares
for j in 0...NUM_SPRITES_Y
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
idx_sprite = (j * NUM_SPRITES_X) + i
@sprites[idx_sprite] = new_sprite(i * @black_bitmap.width * @zoom_x_target,
j * @black_bitmap.height * @zoom_y_target, @black_bitmap)
@sprites[idx_sprite].visible = false
@@ -868,7 +868,7 @@ module Transitions
# Falling balls
@ball_sprites = []
for i in 0...3
@ball_sprites[i] = new_sprite(Graphics.width / 2 + (i - 1) * 160,
@ball_sprites[i] = new_sprite((Graphics.width / 2) + ((i - 1) * 160),
-@ball_bitmap.height - BALL_START_Y_OFFSETS[i],
@ball_bitmap, @ball_bitmap.width / 2, @ball_bitmap.height / 2)
@ball_sprites[i].z = 2
@@ -882,8 +882,8 @@ module Transitions
for j in 0...NUM_SPRITES_Y
row_offset = NUM_SPRITES_Y - j - 1
for i in 0...NUM_SPRITES_X
idx_sprite = j * NUM_SPRITES_X + i
@timings[idx_sprite] = period * (row_offset * NUM_SPRITES_X + appear_order[i]) / TOTAL_SPRITES
idx_sprite = (j * NUM_SPRITES_X) + i
@timings[idx_sprite] = period * ((row_offset * NUM_SPRITES_X) + appear_order[i]) / TOTAL_SPRITES
@timings[idx_sprite] += @black_appear_start
end
end
@@ -906,7 +906,7 @@ module Transitions
proportion = @timer / @black_appear_start
@ball_sprites.each_with_index do |sprite, i|
sprite.y = -@ball_bitmap.height - BALL_START_Y_OFFSETS[i]
sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + @ball_bitmap.height * 2) * proportion
sprite.y += (Graphics.height + BALL_START_Y_OFFSETS.max + (@ball_bitmap.height * 2)) * proportion
sprite.angle = 1.5 * 360 * proportion * ([1, -1][(i == 2) ? 0 : 1])
end
else
@@ -921,7 +921,7 @@ module Transitions
end
# Zoom in overworld sprite
proportion = (@timer - @black_appear_start) / (@duration - @black_appear_start)
@overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom
@overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
end
end
@@ -977,7 +977,7 @@ module Transitions
if @timer <= @ball_appear_end
# Make ball drop down and zoom in
proportion = @timer / @ball_appear_end
@ball_sprite.y = -@ball_bitmap.height / 2 + (Graphics.height + @ball_bitmap.height * 3) * proportion * proportion
@ball_sprite.y = (-@ball_bitmap.height / 2) + ((Graphics.height + (@ball_bitmap.height * 3)) * proportion * proportion)
@ball_sprite.angle = -1.5 * 360 * proportion
@ball_sprite.zoom_x = 3 * proportion * proportion
@ball_sprite.zoom_y = @ball_sprite.zoom_x
@@ -986,10 +986,10 @@ module Transitions
# Black curve and blackness descends
proportion = (@timer - @ball_appear_end) / (@duration - @ball_appear_end)
@sprites.each do |sprite|
sprite.y = -@curve_bitmap.height + (Graphics.height + @curve_bitmap.height) * proportion
sprite.y = -@curve_bitmap.height + ((Graphics.height + @curve_bitmap.height) * proportion)
end
# Zoom in overworld sprite
@overworld_sprite.zoom_x = 1.0 + proportion * proportion # Ends at 2x zoom
@overworld_sprite.zoom_x = 1.0 + (proportion * proportion) # Ends at 2x zoom
@overworld_sprite.zoom_y = @overworld_sprite.zoom_x
end
end
@@ -1024,7 +1024,7 @@ module Transitions
# Ball sprites
@ball_sprites = []
for i in 0...3
@ball_sprites[i] = new_sprite((2 * i + 1) * Graphics.width / 6,
@ball_sprites[i] = new_sprite(((2 * i) + 1) * Graphics.width / 6,
BALL_OFFSETS[i] * Graphics.height,
@ball_bitmap, @ball_bitmap.width / 2, @ball_bitmap.height / 2)
@ball_sprites[i].z = 4
@@ -1062,13 +1062,13 @@ module Transitions
# Make overworld wave strips oscillate
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
@sprites.each_with_index do |sprite, i|
sprite.x = (1 - (i % 2) * 2) * amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING)
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
end
# Move balls and trailing blackness up
if @timer >= @ball_rising_start
proportion = (@timer - @ball_rising_start) / (@duration - @ball_rising_start)
@ball_sprites.each_with_index do |sprite, i|
sprite.y = BALL_OFFSETS[i] * Graphics.height - Graphics.height * 3.5 * proportion
sprite.y = (BALL_OFFSETS[i] * Graphics.height) - (Graphics.height * 3.5 * proportion)
sprite.angle = [-1, -1, 1][i] * 360 * 2 * proportion
@black_trail_sprites[i].y = sprite.y
@black_trail_sprites[i].y = 0 if @black_trail_sprites[i].y < 0
@@ -1133,7 +1133,7 @@ module Transitions
# Make overworld wave strips oscillate
amplitude = MAX_WAVE_AMPLITUDE * [@timer / 0.1, 1].min # Build up to max in 0.1 seconds
@sprites.each_with_index do |sprite, i|
sprite.x = (1 - (i % 2) * 2) * amplitude * Math.sin(@timer * WAVE_SPEED + i * WAVE_SPACING)
sprite.x = (1 - ((i % 2) * 2)) * amplitude * Math.sin((@timer * WAVE_SPEED) + (i * WAVE_SPACING))
end
if @timer <= @ball_appear_end
# Fade in ball while spinning
@@ -1208,11 +1208,11 @@ module Transitions
if @timer <= @ball_appear_end
# Balls fly out from centre of screen
proportion = @timer / @ball_appear_end
ball_travel_x = (Graphics.width + @ball_bitmap.width * 2) / 2
ball_travel_y = (Graphics.height + @ball_bitmap.height * 2) / 2
ball_travel_x = (Graphics.width + (@ball_bitmap.width * 2)) / 2
ball_travel_y = (Graphics.height + (@ball_bitmap.height * 2)) / 2
@ball_sprites.each_with_index do |sprite, i|
sprite.x = Graphics.width / 2 + [0, 1, 0, -1][i] * ball_travel_x * proportion if i.odd?
sprite.y = Graphics.height / 2 + [1, 0, -1, 0][i] * ball_travel_y * proportion if i.even?
sprite.x = (Graphics.width / 2) + ([0, 1, 0, -1][i] * ball_travel_x * proportion) if i.odd?
sprite.y = (Graphics.height / 2) + ([1, 0, -1, 0][i] * ball_travel_y * proportion) if i.even?
end
else
# Black wedges expand to fill screen
+5 -4
View File
@@ -207,13 +207,14 @@ module GameData
# @return [Boolean] whether other represents the same thing as this thing
def ==(other)
return false if other.nil?
if other.is_a?(Symbol)
case other
when Symbol
return @id == other
elsif other.is_a?(self.class)
when self.class
return @id == other.id
elsif other.is_a?(String)
when String
return @id == other.to_sym
elsif other.is_a?(Integer)
when Integer
return @id_number == other
end
return false
@@ -133,7 +133,7 @@ GameData::GrowthRate.register({
765275, 804997, 834809, 877201, 908905, 954084, 987754, 1035837, 1071552, 1122660,
1160499, 1214753, 1254796, 1312322, 1354652, 1415577, 1460276, 1524731, 1571884, 1640000],
:exp_formula => proc { |level|
rate = [82 - (level - 100) / 2.0, 40].max
rate = [82 - ((level - 100) / 2.0), 40].max
next (level**4) * rate / 5000
}
})
@@ -152,7 +152,7 @@ GameData::GrowthRate.register({
360838, 377197, 394045, 411388, 429235, 447591, 466464, 485862, 505791, 526260,
547274, 568841, 590969, 613664, 636935, 660787, 685228, 710266, 735907, 762160,
789030, 816525, 844653, 873420, 902835, 932903, 963632, 995030, 1027103, 1059860],
:exp_formula => proc { |level| next ((level**3) * 6 / 5) - 15 * (level**2) + 100 * level - 140 }
:exp_formula => proc { |level| next ((level**3) * 6 / 5) - (15 * (level**2)) + (100 * level) - 140 }
})
GameData::GrowthRate.register({
@@ -311,8 +311,8 @@ module GameData
evos.each do |evo|
if check_method.is_a?(Array)
next if !check_method.include?(evo[2])
else
next if evo[2] != check_method
elsif evo[2] != check_method
next
end
return true if check_param.nil? || evo[3] == check_param
end
@@ -69,8 +69,7 @@ module GameData
if (index & 1) == 1 # Foe Pokémon
sprite.x += @shadow_x * 2
end
else
if (index & 1) == 0 # Player's Pokémon
elsif (index & 1) == 0 # Player's Pokémon
sprite.x += @back_sprite[0] * 2
sprite.y += @back_sprite[1] * 2
else # Foe Pokémon
@@ -79,7 +78,6 @@ module GameData
sprite.y -= @front_sprite_altitude * 2
end
end
end
def shows_shadow?
return true
@@ -202,7 +202,7 @@ class Battle
end
def maxBattlerIndex
return (pbSideSize(0) > pbSideSize(1)) ? (pbSideSize(0) - 1) * 2 : pbSideSize(1) * 2 - 1
return (pbSideSize(0) > pbSideSize(1)) ? (pbSideSize(0) - 1) * 2 : (pbSideSize(1) * 2) - 1
end
#=============================================================================
@@ -282,7 +282,7 @@ class Battle
def pbNumPositions(side, idxTrainer)
ret = 0
for i in 0...pbSideSize(side)
t = pbGetOwnerIndexFromBattlerIndex(i * 2 + side)
t = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
next if t != idxTrainer
ret += 1
end
@@ -49,7 +49,7 @@ class Battle
requireds = []
# Find out how many Pokémon each trainer on side needs to have
for i in 0...@sideSizes[side]
idxTrainer = pbGetOwnerIndexFromBattlerIndex(i * 2 + side)
idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
requireds[idxTrainer] = 0 if requireds[idxTrainer].nil?
requireds[idxTrainer] += 1
end
@@ -119,10 +119,10 @@ class Battle
# Set up wild Pokémon
if side == 1 && wildBattle?
pbParty(1).each_with_index do |pkmn, idxPkmn|
pbCreateBattler(2 * idxPkmn + side, pkmn, idxPkmn)
pbCreateBattler((2 * idxPkmn) + side, pkmn, idxPkmn)
# Changes the Pokémon's form upon entering battle (if it should)
@peer.pbOnEnteringBattle(self, @battlers[2 * idxPkmn + side], pkmn, true)
pbSetSeen(@battlers[2 * idxPkmn + side])
@peer.pbOnEnteringBattle(self, @battlers[(2 * idxPkmn) + side], pkmn, true)
pbSetSeen(@battlers[(2 * idxPkmn) + side])
@usedInBattle[side][idxPkmn] = true
end
next
@@ -132,7 +132,7 @@ class Battle
requireds = []
# Find out how many Pokémon each trainer on side needs to have
for i in 0...@sideSizes[side]
idxTrainer = pbGetOwnerIndexFromBattlerIndex(i * 2 + side)
idxTrainer = pbGetOwnerIndexFromBattlerIndex((i * 2) + side)
requireds[idxTrainer] = 0 if requireds[idxTrainer].nil?
requireds[idxTrainer] += 1
end
@@ -143,7 +143,7 @@ class Battle
ret[side][idxTrainer] = []
eachInTeam(side, idxTrainer) do |pkmn, idxPkmn|
next if !pkmn.able?
idxBattler = 2 * battlerNumber + side
idxBattler = (2 * battlerNumber) + side
pbCreateBattler(idxBattler, pkmn, idxPkmn)
ret[side][idxTrainer].push(idxBattler)
battlerNumber += 1
@@ -125,7 +125,7 @@ class Battle
# Scale the gained Exp based on the gainer's level (or not)
if Settings::SCALED_EXP_FORMULA
exp /= 5
levelAdjust = (2 * level + 10.0) / (pkmn.level + level + 10.0)
levelAdjust = ((2 * level) + 10.0) / (pkmn.level + level + 10.0)
levelAdjust = levelAdjust**5
levelAdjust = Math.sqrt(levelAdjust)
exp *= levelAdjust
@@ -116,8 +116,8 @@ class Battle
@scene.pbPartyScreen(idxBattler, canCancel) { |idxParty, partyScene|
if checkLaxOnly
next false if !pbCanSwitchLax?(idxBattler, idxParty, partyScene)
else
next false if !pbCanSwitch?(idxBattler, idxParty, partyScene)
elsif !pbCanSwitch?(idxBattler, idxParty, partyScene)
next false
end
if shouldRegister
next false if idxParty < 0 || !pbRegisterSwitch(idxBattler, idxParty)
@@ -119,13 +119,10 @@ class Battle::Battler
else
pbRaiseStatStageByCause(stat, increment, self, abilityName)
end
else
if Battle::Scene::USE_ABILITY_SPLASH
elsif Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true)))
else
@battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
pbThis, abilityName, move.name))
end
@battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", pbThis, abilityName, move.name))
end
@battle.pbHideAbilitySplash(self)
end
@@ -149,13 +146,10 @@ class Battle::Battler
else
@battle.pbDisplay(_INTL("{1}'s {2} restored its HP.", pbThis, abilityName))
end
else
if Battle::Scene::USE_ABILITY_SPLASH
elsif Battle::Scene::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("It doesn't affect {1}...", pbThis(true)))
else
@battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
pbThis, abilityName, move.name))
end
@battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!", pbThis, abilityName, move.name))
end
@battle.pbHideAbilitySplash(self)
end
@@ -298,14 +298,12 @@ class Battle::Move
else
@battle.pbDisplay(_INTL("{1} landed a critical hit, wishing to be praised!", user.pbThis))
end
else
if numTargets > 1
elsif numTargets > 1
@battle.pbDisplay(_INTL("A critical hit on {1}!", target.pbThis(true)))
else
@battle.pbDisplay(_INTL("A critical hit!"))
end
end
end
# Effectiveness message, for moves with 1 hit
if !multiHitMove? && user.effects[PBEffects::ParentalBond] == 0
pbEffectivenessMessage(user, target, numTargets)
@@ -283,7 +283,7 @@ class Battle::Move
baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max
atk = [(atk * multipliers[:attack_multiplier]).round, 1].max
defense = [(defense * multipliers[:defense_multiplier]).round, 1].max
damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
damage = ((((2.0 * user.level / 5) + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max
target.damageState.calcDamage = damage
end
@@ -130,7 +130,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move
showAnim = true
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
@@ -140,7 +140,7 @@ class Battle::Move::MultiStatUpMove < Battle::Move
showAnim = true
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
@@ -156,7 +156,7 @@ class Battle::Move::StatDownMove < Battle::Move
showAnim = true
for i in 0...@statDown.length / 2
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if user.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, showAnim)
if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
@@ -255,7 +255,7 @@ class Battle::Move::TargetMultiStatDownMove < Battle::Move
showMirrorArmorSplash = true
for i in 0...@statDown.length / 2
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user,
if target.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user,
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim = false
end
@@ -440,14 +440,14 @@ class Battle::Move::LowerUserDefSpDef1RaiseUserAtkSpAtkSpd2 < Battle::Move
showAnim = true
for i in 0...@statDown.length / 2
next if !user.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if user.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user, showAnim)
if user.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
showAnim = true
for i in 0...@statUp.length / 2
next if !user.pbCanRaiseStatStage?(@statUp[i * 2], user, self)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[i * 2 + 1], user, showAnim)
if user.pbRaiseStatStage(@statUp[i * 2], @statUp[(i * 2) + 1], user, showAnim)
showAnim = false
end
end
@@ -1385,7 +1385,7 @@ class Battle::Move::LowerPoisonedTargetAtkSpAtkSpd1 < Battle::Move
showMirrorArmorSplash = true
for i in 0...@statDown.length / 2
next if !target.pbCanLowerStatStage?(@statDown[i * 2], user, self)
if target.pbLowerStatStage(@statDown[i * 2], @statDown[i * 2 + 1], user,
if target.pbLowerStatStage(@statDown[i * 2], @statDown[(i * 2) + 1], user,
showAnim, false, (showMirrorArmorSplash) ? 1 : 3)
showAnim = false
end
@@ -710,12 +710,10 @@ class Battle::Move::StartWeakenElectricMoves < Battle::Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
else
if @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
elsif @battle.allBattlers.any? { |b| b.effects[PBEffects::MudSport] }
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
end
return false
end
@@ -739,12 +737,10 @@ class Battle::Move::StartWeakenFireMoves < Battle::Move
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
else
if @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
elsif @battle.allBattlers.any? { |b| b.effects[PBEffects::WaterSport] }
@battle.pbDisplay(_INTL("But it failed!"))
return true
end
end
return false
end
@@ -1359,7 +1355,7 @@ def pbHiddenPower(pkmn)
power |= (iv[:SPEED] & 2) << 2
power |= (iv[:SPECIAL_ATTACK] & 2) << 3
power |= (iv[:SPECIAL_DEFENSE] & 2) << 4
power = powerMin + (powerMax - powerMin) * power / 63
power = powerMin + ((powerMax - powerMin) * power / 63)
end
return [type, power]
end
@@ -64,11 +64,11 @@ class Battle::Scene
# Shift depending on index (no shifting needed for sideSize of 1)
case sideSize
when 2
ret[0] += [-48, 48, 32, -32][2 * index + side]
ret[1] += [ 0, 0, 0, -16][2 * index + side]
ret[0] += [-48, 48, 32, -32][(2 * index) + side]
ret[1] += [ 0, 0, 0, -16][(2 * index) + side]
when 3
ret[0] += [-80, 80, 0, 0, 80, -80][2 * index + side]
ret[1] += [ 0, 0, 0, -8, 0, -16][2 * index + side]
ret[0] += [-80, 80, 0, 0, 80, -80][(2 * index) + side]
ret[1] += [ 0, 0, 0, -8, 0, -16][(2 * index) + side]
end
return ret
end
@@ -83,7 +83,7 @@ class Battle::Scene
# Wild battle, so set up the Pokémon sprite(s) accordingly
if @battle.wildBattle?
@battle.pbParty(1).each_with_index do |pkmn, i|
index = i * 2 + 1
index = (i * 2) + 1
pbChangePokemon(index, pkmn)
pkmnSprite = @sprites["pokemon_#{index}"]
pkmnSprite.tone = Tone.new(-80, -80, -80)
@@ -28,7 +28,7 @@ class Battle::Scene
# shiny animation(s)
# Set up data box animation
for i in 0...@battle.sideSizes[1]
idxBattler = 2 * i + 1
idxBattler = (2 * i) + 1
next if !@battle.battlers[idxBattler]
dataBoxAnim = Animation::DataBoxAppear.new(@sprites, @viewport, idxBattler)
@animations.push(dataBoxAnim)
@@ -43,7 +43,7 @@ class Battle::Scene
# Show shiny animation for wild Pokémon
if @battle.showAnims
for i in 0...@battle.sideSizes[1]
idxBattler = 2 * i + 1
idxBattler = (2 * i) + 1
next if !@battle.battlers[idxBattler] || !@battle.battlers[idxBattler].shiny?
if Settings::SUPER_SHINY && @battle.battlers[idxBattler].super_shiny?
pbCommonAnimation("SuperShiny", @battle.battlers[idxBattler])
@@ -58,15 +58,16 @@ class Battle::Scene
# Animates a party lineup appearing for the given side
#=============================================================================
def pbShowPartyLineup(side, fullAnim = false)
@animations.push(Animation::LineupAppear.new(
@sprites, @viewport, side, @battle.pbParty(side), @battle.pbPartyStarts(side), fullAnim
))
if !fullAnim
@animations.push(
Animation::LineupAppear.new(@sprites, @viewport, side,
@battle.pbParty(side), @battle.pbPartyStarts(side),
fullAnim)
)
return if fullAnim
while inPartyAnimation?
pbUpdate
end
end
end
#=============================================================================
# Animates an opposing trainer sliding in from off-screen. Will animate a
@@ -541,7 +542,7 @@ class Battle::Scene
end
animPlayer.setLineTransform(
FOCUSUSER_X, FOCUSUSER_Y, FOCUSTARGET_X, FOCUSTARGET_Y,
oldUserX, oldUserY - userHeight / 2, oldTargetX, oldTargetY - targetHeight / 2
oldUserX, oldUserY - (userHeight / 2), oldTargetX, oldTargetY - (targetHeight / 2)
)
# Play the animation
animPlayer.start
@@ -137,7 +137,7 @@ class Battle::Scene::CommandMenu < Battle::Scene::MenuBase
button = SpriteWrapper.new(viewport)
button.bitmap = @buttonBitmap.bitmap
button.x = self.x + Graphics.width - 260
button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4)
button.x += (i.even? ? 0 : (@buttonBitmap.width / 2) - 4)
button.y = self.y + 6
button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4)
button.src_rect.width = @buttonBitmap.width / 2
@@ -247,7 +247,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
button = SpriteWrapper.new(viewport)
button.bitmap = @buttonBitmap.bitmap
button.x = self.x + 4
button.x += (i.even? ? 0 : @buttonBitmap.width / 2 - 4)
button.x += (i.even? ? 0 : (@buttonBitmap.width / 2) - 4)
button.y = self.y + 6
button.y += (((i / 2) == 0) ? 0 : BUTTON_HEIGHT - 4)
button.src_rect.width = @buttonBitmap.width / 2
@@ -278,7 +278,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
@megaButton = SpriteWrapper.new(viewport)
@megaButton.bitmap = @megaEvoBitmap.bitmap
@megaButton.x = self.x + 120
@megaButton.y = self.y - @megaEvoBitmap.height / 2
@megaButton.y = self.y - (@megaEvoBitmap.height / 2)
@megaButton.src_rect.height = @megaEvoBitmap.height / 2
addSprite("megaButton", @megaButton)
# Create Shift button
@@ -354,7 +354,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
textPos = []
@buttons.each_with_index do |button, i|
next if !@visibility["button_#{i}"]
x = button.x - self.x + button.src_rect.width / 2
x = button.x - self.x + (button.src_rect.width / 2)
y = button.y - self.y + 2
moveNameBase = TEXT_BASE_COLOR
if GET_MOVE_TEXT_COLOR_FROM_MOVE_BUTTON && moves[i].display_type(@battler)
@@ -414,7 +414,7 @@ class Battle::Scene::FightMenu < Battle::Scene::MenuBase
ppFraction = [(4.0 * move.pp / move.total_pp).ceil, 3].min
textPos = []
textPos.push([_INTL("PP: {1}/{2}", move.pp, move.total_pp),
448, 44, 2, PP_COLORS[ppFraction * 2], PP_COLORS[ppFraction * 2 + 1]])
448, 44, 2, PP_COLORS[ppFraction * 2], PP_COLORS[(ppFraction * 2) + 1]])
pbDrawTextPositions(@infoOverlay.bitmap, textPos)
end
end
@@ -467,7 +467,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
def initialize(viewport, z, sideSizes)
super(viewport)
@sideSizes = sideSizes
maxIndex = (@sideSizes[0] > @sideSizes[1]) ? (@sideSizes[0] - 1) * 2 : @sideSizes[1] * 2 - 1
maxIndex = (@sideSizes[0] > @sideSizes[1]) ? (@sideSizes[0] - 1) * 2 : (@sideSizes[1] * 2) - 1
@smallButtons = (@sideSizes.max > 2)
self.x = 0
self.y = Graphics.height - 96
@@ -483,7 +483,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
# NOTE: Battler indexes go from left to right from the perspective of
# that side's trainer, so inc is different for each side for the
# same value of i/2.
inc = (i.even?) ? i / 2 : numButtons - 1 - i / 2
inc = (i.even?) ? i / 2 : numButtons - 1 - (i / 2)
button = SpriteWrapper.new(viewport)
button.bitmap = @buttonBitmap.bitmap
button.src_rect.width = (@smallButtons) ? CMD_BUTTON_WIDTH_SMALL : @buttonBitmap.width / 2
@@ -536,7 +536,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
sel ||= (@mode == 1)
buttonType = (i.even?) ? 1 : 2
end
buttonType = 2 * buttonType + ((@smallButtons) ? 1 : 0)
buttonType = (2 * buttonType) + ((@smallButtons) ? 1 : 0)
button.src_rect.x = (sel) ? @buttonBitmap.width / 2 : 0
button.src_rect.y = buttonType * BUTTON_HEIGHT
button.z = self.z + ((sel) ? 3 : 2)
@@ -546,7 +546,7 @@ class Battle::Scene::TargetMenu < Battle::Scene::MenuBase
textpos = []
@buttons.each_with_index do |button, i|
next if !button || nil_or_empty?(@texts[i])
x = button.x - self.x + button.src_rect.width / 2
x = button.x - self.x + (button.src_rect.width / 2)
y = button.y - self.y + 2
textpos.push([@texts[i], x, y, 2, TEXT_BASE_COLOR, TEXT_SHADOW_COLOR])
end
@@ -96,7 +96,7 @@ class Battle::Scene::PokemonDataBox < SpriteWrapper
@contents = BitmapWrapper.new(@databoxBitmap.width, @databoxBitmap.height)
self.bitmap = @contents
self.visible = false
self.z = 150 + ((@battler.index) / 2) * 5
self.z = 150 + ((@battler.index / 2) * 5)
pbSetSystemFont(self.bitmap)
end
@@ -538,9 +538,9 @@ class Battle::Scene::BattlerSprite < RPG::Sprite
return if !@_iconBitmap
pbSetOrigin
if @index.even?
self.z = 50 + 5 * @index / 2
self.z = 50 + (5 * @index / 2)
else
self.z = 50 - 5 * (@index + 1) / 2
self.z = 50 - (5 * (@index + 1) / 2)
end
# Set original position
p = Battle::Scene.pbBattlerPosition(@index, @sideSize)
@@ -102,7 +102,7 @@ module Battle::Scene::Animation::BallAnimationMixin
ball.setVisible(7, true)
ballStartX = traSprite.x
ballStartX -= ball.totalDuration * (Graphics.width / (2 * 16)) if !safariThrow
ballStartY = traSprite.y - traSprite.bitmap.height / 2
ballStartY = traSprite.y - (traSprite.bitmap.height / 2)
return ballStartX, ballStartY
end
# Back sprite is animated, make the Poké Ball track the trainer's hand
@@ -166,13 +166,13 @@ module Battle::Scene::Animation::BallAnimationMixin
# throw). Instead, that throw animation and initialDelay are designed
# to make sure the Ball's trajectory starts at the same position.
ball.setVisible(delay, true)
a = 2 * startY - 4 * midY + 2 * endY
b = 4 * midY - 3 * startY - endY
a = (2 * startY) - (4 * midY) + (2 * endY)
b = (4 * midY) - (3 * startY) - endY
c = startY
for i in 1..duration
t = i.to_f / duration # t ranges from 0 to 1
x = startX + (endX - startX) * t # Linear in t
y = a * t**2 + b * t + c # Quadratic in t
x = startX + ((endX - startX) * t) # Linear in t
y = (a * (t**2)) + (b * t) + c # Quadratic in t
ball.moveXY(delay + i - 1, 1, x, y)
end
createBallTumbling(ball, delay, duration)
@@ -28,7 +28,7 @@ class Battle::Scene::Animation::Intro < Battle::Scene::Animation
end
else # Wild battle
@battle.pbParty(1).each_with_index do |_pkmn, i|
idxBattler = 2 * i + 1
idxBattler = (2 * i) + 1
makeSlideSprite("pokemon_#{idxBattler}", -1, appearTime, PictureOrigin::Bottom)
end
end
@@ -71,7 +71,7 @@ class Battle::Scene::Animation::Intro2 < Battle::Scene::Animation
def createProcesses
for i in 0...@sideSize
idxBattler = 2 * i + 1
idxBattler = (2 * i) + 1
next if !@sprites["pokemon_#{idxBattler}"]
battler = addSprite(@sprites["pokemon_#{idxBattler}"], PictureOrigin::Bottom)
battler.moveTone(0, 4, Tone.new(0, 0, 0, 0))
@@ -112,7 +112,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
ballY = barY - 30
barX -= bar.bitmap.width
end
ballXdiff = 32 * (1 - 2 * @side)
ballXdiff = 32 * (1 - (2 * @side))
bar.x = barX
bar.y = barY
bar.opacity = 255
@@ -155,7 +155,7 @@ class Battle::Scene::Animation::LineupAppear < Battle::Scene::Animation
bar.moveDelta(0, 8, -dir * Graphics.width / 2, 0)
delay = bar.totalDuration
for i in 0...Battle::Scene::NUM_BALLS
createBall(i, (@fullAnim) ? delay + i * 2 : 0, dir)
createBall(i, (@fullAnim) ? delay + (i * 2) : 0, dir)
end
end
@@ -287,7 +287,7 @@ class Battle::Scene::Animation::TrainerAppear < Battle::Scene::Animation
# Make new trainer sprite move on-screen
if @sprites["trainer_#{@idxTrainer + 1}"]
trainerX, trainerY = Battle::Scene.pbTrainerPosition(1)
trainerX += 64 + Graphics.width / 4
trainerX += 64 + (Graphics.width / 4)
newTrainer = addSprite(@sprites["trainer_#{@idxTrainer + 1}"], PictureOrigin::Bottom)
newTrainer.setVisible(delay, true)
newTrainer.setXY(delay, trainerX, trainerY)
@@ -342,7 +342,7 @@ class Battle::Scene::Animation::PlayerFade < Battle::Scene::Animation
for i in 0...Battle::Scene::NUM_BALLS
next if !@sprites["partyBall_0_#{i}"] || !@sprites["partyBall_0_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_0_#{i}"])
partyBall.moveDelta(delay + 2 * i, 16, -Graphics.width, 0) if @fullAnim
partyBall.moveDelta(delay + (2 * i), 16, -Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -387,7 +387,7 @@ class Battle::Scene::Animation::TrainerFade < Battle::Scene::Animation
for i in 0...Battle::Scene::NUM_BALLS
next if !@sprites["partyBall_1_#{i}"] || !@sprites["partyBall_1_#{i}"].visible
partyBall = addSprite(@sprites["partyBall_1_#{i}"])
partyBall.moveDelta(delay + 2 * i, 16, Graphics.width, 0) if @fullAnim
partyBall.moveDelta(delay + (2 * i), 16, Graphics.width, 0) if @fullAnim
partyBall.moveOpacity(delay, 12, 0)
partyBall.setVisible(delay + 12, false)
partyBall.setOpacity(delay + 12, 255)
@@ -782,12 +782,12 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
delay -= t if i == 0
if i > 0
ball.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish
ball.setZoomXY(delay, 100 + (5 * (5 - i)), 100 - (5 * (5 - i))) # Squish
ball.moveZoom(delay, 2, 100) # Unsquish
ball.moveXY(delay, t, ballEndX, ballGroundY - (ballGroundY - ballEndY) / d)
ball.moveXY(delay, t, ballEndX, ballGroundY - ((ballGroundY - ballEndY) / d))
end
ball.moveXY(delay + t, t, ballEndX, ballGroundY)
ball.setSE(delay + 2 * t, "Battle ball drop", 100 - i * 7)
ball.setSE(delay + (2 * t), "Battle ball drop", 100 - (i * 7))
delay = ball.totalDuration
end
battler.setXY(ball.totalDuration, ballEndX, ballGroundY)
@@ -795,9 +795,9 @@ class Battle::Scene::Animation::PokeballThrowCapture < Battle::Scene::Animation
delay = ball.totalDuration + 12
for i in 0...[@numShakes, 3].min
ball.setSE(delay, "Battle ball shake")
ball.moveXY(delay, 2, ballEndX - 2 * (4 - i), ballGroundY)
ball.moveXY(delay, 2, ballEndX - (2 * (4 - i)), ballGroundY)
ball.moveAngle(delay, 2, 5 * (4 - i)) # positive means counterclockwise
ball.moveXY(delay + 2, 4, ballEndX + 2 * (4 - i), ballGroundY)
ball.moveXY(delay + 2, 4, ballEndX + (2 * (4 - i)), ballGroundY)
ball.moveAngle(delay + 2, 4, -5 * (4 - i)) # negative means clockwise
ball.moveXY(delay + 6, 2, ballEndX, ballGroundY)
ball.moveAngle(delay + 6, 2, 0)
@@ -176,10 +176,8 @@ class Battle::AI
miss = false if user.hasActiveAbility?(:NOGUARD) || target.hasActiveAbility?(:NOGUARD)
if miss && pbRoughStat(user, :SPEED, skill) > pbRoughStat(target, :SPEED, skill)
# Knows what can get past semi-invulnerability
if target.effects[PBEffects::SkyDrop] >= 0
miss = false if move.hitsFlyingTargets?
else
if target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
if target.effects[PBEffects::SkyDrop] >= 0 ||
target.inTwoTurnAttack?("TwoTurnAttackInvulnerableInSky",
"TwoTurnAttackInvulnerableInSkyParalyzeTarget",
"TwoTurnAttackInvulnerableInSkyTargetCannotAct")
miss = false if move.hitsFlyingTargets?
@@ -189,7 +187,6 @@ class Battle::AI
miss = false if move.hitsDivingTargets?
end
end
end
score -= 80 if miss
end
# Pick a good move for the Choice items
@@ -28,11 +28,9 @@ class Battle::AI
score -= 50
end
end
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "SleepTargetNextTurn"
if target.effects[PBEffects::Yawn] > 0 || !target.pbCanSleep?(user, false)
@@ -63,11 +61,9 @@ class Battle::AI
score += 10 if pbRoughStat(target, :SPECIAL_DEFENSE, skill) > 100
score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :TOXICBOOST])
end
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "ParalyzeTarget", "ParalyzeTargetIfNotTypeImmune",
"ParalyzeTargetTrampleMinimize", "ParalyzeTargetAlwaysHitsInRainHitsTargetInSky",
@@ -89,11 +85,9 @@ class Battle::AI
if skill >= PBTrainerAI.highSkill
score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET])
end
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "BurnTarget", "BurnFlinchTarget", "TwoTurnAttackBurnTarget"
if target.pbCanBurn?(user, false)
@@ -101,11 +95,9 @@ class Battle::AI
if skill >= PBTrainerAI.highSkill
score -= 40 if target.hasActiveAbility?([:GUTS, :MARVELSCALE, :QUICKFEET, :FLAREBOOST])
end
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "FreezeTarget", "FreezeTargetAlwaysHitsInHail", "FreezeFlinchTarget"
if target.pbCanFreeze?(user, false)
@@ -113,11 +105,9 @@ class Battle::AI
if skill >= PBTrainerAI.highSkill
score -= 20 if target.hasActiveAbility?(:MARVELSCALE)
end
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "FlinchTarget"
score += 30
@@ -159,11 +149,9 @@ class Battle::AI
when "ConfuseTarget", "ConfuseTargetAlwaysHitsInRainHitsTargetInSky"
if target.pbCanConfuse?(user, false)
score += 30
else
if skill >= PBTrainerAI.mediumSkill
elsif skill >= PBTrainerAI.mediumSkill
score -= 90 if move.statusMove?
end
end
#---------------------------------------------------------------------------
when "AttractTarget"
canattract = true
@@ -274,8 +262,8 @@ class Battle::AI
else
score -= user.stages[:DEFENSE] * 20
end
else
score += 20 if user.stages[:DEFENSE] < 0
elsif user.stages[:DEFENSE] < 0
score += 20
end
#---------------------------------------------------------------------------
when "RaiseUserSpeed1"
@@ -290,8 +278,8 @@ class Battle::AI
score += 30 if aspeed < ospeed && aspeed * 2 > ospeed
end
end
else
score += 20 if user.stages[:SPEED] < 0
elsif user.stages[:SPEED] < 0
score += 20
end
#---------------------------------------------------------------------------
when "RaiseUserSpAtk1"
@@ -341,8 +329,8 @@ class Battle::AI
else
score -= user.stages[:SPECIAL_DEFENSE] * 20
end
else
score += 20 if user.stages[:SPECIAL_DEFENSE] < 0
elsif user.stages[:SPECIAL_DEFENSE] < 0
score += 20
end
#---------------------------------------------------------------------------
when "RaiseUserEvasion1"
@@ -352,8 +340,8 @@ class Battle::AI
else
score -= user.stages[:EVASION] * 10
end
else
score += 20 if user.stages[:EVASION] < 0
elsif user.stages[:EVASION] < 0
score += 20
end
#---------------------------------------------------------------------------
when "RaiseUserCriticalHitRate2"
@@ -363,8 +351,8 @@ class Battle::AI
else
score += 30
end
else
score += 30 if user.effects[PBEffects::FocusEnergy] < 2
elsif user.effects[PBEffects::FocusEnergy] < 2
score += 30
end
#---------------------------------------------------------------------------
when "RaiseUserAtkDef1"
@@ -858,15 +846,15 @@ class Battle::AI
when "RaiseTargetSpAtk1ConfuseTarget"
if !target.pbCanConfuse?(user, false)
score -= 90
else
score += 30 if target.stages[:SPECIAL_ATTACK] < 0
elsif target.stages[:SPECIAL_ATTACK] < 0
score += 30
end
#---------------------------------------------------------------------------
when "RaiseTargetAttack2ConfuseTarget"
if !target.pbCanConfuse?(user, false)
score -= 90
else
score += 30 if target.stages[:ATTACK] < 0
elsif target.stages[:ATTACK] < 0
score += 30
end
#---------------------------------------------------------------------------
when "LowerTargetAttack1"
@@ -909,8 +897,8 @@ class Battle::AI
else
score += target.stages[:DEFENSE] * 20
end
else
score += 20 if target.stages[:DEFENSE] > 0
elsif target.stages[:DEFENSE] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetSpeed1", "LowerTargetSpeed1WeakerInGrassyTerrain"
@@ -925,8 +913,8 @@ class Battle::AI
score += 30 if aspeed < ospeed && aspeed * 2 > ospeed
end
end
else
score += 20 if user.stages[:SPEED] > 0
elsif user.stages[:SPEED] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetSpAtk1"
@@ -969,8 +957,8 @@ class Battle::AI
else
score += target.stages[:SPECIAL_DEFENSE] * 20
end
else
score += 20 if target.stages[:SPECIAL_DEFENSE] > 0
elsif target.stages[:SPECIAL_DEFENSE] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetAccuracy1", "LowerTargetAccuracy2", "LowerTargetAccuracy3"
@@ -980,8 +968,8 @@ class Battle::AI
else
score += target.stages[:ACCURACY] * 10
end
else
score += 20 if target.stages[:ACCURACY] > 0
elsif target.stages[:ACCURACY] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetEvasion1", "LowerTargetEvasion2", "LowerTargetEvasion3"
@@ -991,8 +979,8 @@ class Battle::AI
else
score += target.stages[:EVASION] * 10
end
else
score += 20 if target.stages[:EVASION] > 0
elsif target.stages[:EVASION] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetEvasion1RemoveSideEffects"
@@ -1002,8 +990,8 @@ class Battle::AI
else
score += target.stages[:EVASION] * 10
end
else
score += 20 if target.stages[:EVASION] > 0
elsif target.stages[:EVASION] > 0
score += 20
end
score += 30 if target.pbOwnSide.effects[PBEffects::AuroraVeil] > 0 ||
target.pbOwnSide.effects[PBEffects::Reflect] > 0 ||
@@ -1918,15 +1906,15 @@ class Battle::AI
score -= 90
elsif skill >= PBTrainerAI.mediumSkill && target.pbHasType?(:GRASS)
score -= 90
else
score += 60 if user.turnCount == 0
elsif user.turnCount == 0
score += 60
end
#---------------------------------------------------------------------------
when "HealUserByHalfOfDamageDone"
if skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE)
score -= 70
else
score += 20 if user.hp <= user.totalhp / 2
elsif user.hp <= user.totalhp / 2
score += 20
end
#---------------------------------------------------------------------------
when "HealUserByHalfOfDamageDoneIfTargetAsleep"
@@ -1934,16 +1922,15 @@ class Battle::AI
score -= 100
elsif skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE)
score -= 70
else
score += 20 if user.hp <= user.totalhp / 2
elsif user.hp <= user.totalhp / 2
score += 20
end
#---------------------------------------------------------------------------
when "HealTargetHalfOfTotalHP"
if user.opposes?(target)
score -= 100
else
score += 20 if target.hp < target.totalhp / 2 &&
target.effects[PBEffects::Substitute] == 0
elsif target.hp < target.totalhp / 2 && target.effects[PBEffects::Substitute] == 0
score += 20
end
#---------------------------------------------------------------------------
when "UserFaintsExplosive"
@@ -1979,8 +1966,8 @@ class Battle::AI
when "StartPerishCountsForAllBattlers"
if @battle.pbAbleNonActiveCount(user.idxOwnSide) == 0
score -= 90
else
score -= 90 if target.effects[PBEffects::PerishSong] > 0
elsif target.effects[PBEffects::PerishSong] > 0
score -= 90
end
#---------------------------------------------------------------------------
when "ReduceAttackerMovePPTo0IfUserFaints"
@@ -2125,14 +2112,12 @@ class Battle::AI
when "TargetTakesUserItem"
if !user.item || target.item
score -= 90
else
if user.hasActiveItem?([:FLAMEORB, :TOXICORB, :STICKYBARB, :IRONBALL,
elsif user.hasActiveItem?([:FLAMEORB, :TOXICORB, :STICKYBARB, :IRONBALL,
:CHOICEBAND, :CHOICESCARF, :CHOICESPECS])
score += 50
else
score -= 80
end
end
#---------------------------------------------------------------------------
when "UserConsumeTargetBerry", "DestroyTargetBerryOrGem"
if target.effects[PBEffects::Substitute] == 0
@@ -2160,8 +2145,8 @@ class Battle::AI
when "StartNegateHeldItems"
if @battle.field.effects[PBEffects::MagicRoom] > 0
score -= 90
else
score += 30 if !user.item && target.item
elsif !user.item && target.item
score += 30
end
#---------------------------------------------------------------------------
when "RecoilQuarterOfDamageDealt"
@@ -2245,40 +2230,31 @@ class Battle::AI
when "AddSpikesToFoeSide"
if user.pbOpposingSide.effects[PBEffects::Spikes] >= 3
score -= 90
else
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
# Opponent can't switch in any Pokemon
score -= 90
elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
score -= 90 # Opponent can't switch in any Pokemon
else
score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide)
score += [40, 26, 13][user.pbOpposingSide.effects[PBEffects::Spikes]]
end
end
#---------------------------------------------------------------------------
when "AddToxicSpikesToFoeSide"
if user.pbOpposingSide.effects[PBEffects::ToxicSpikes] >= 2
score -= 90
else
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
# Opponent can't switch in any Pokemon
score -= 90
elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
score -= 90 # Opponent can't switch in any Pokemon
else
score += 8 * @battle.pbAbleNonActiveCount(user.idxOpposingSide)
score += [26, 13][user.pbOpposingSide.effects[PBEffects::ToxicSpikes]]
end
end
#---------------------------------------------------------------------------
when "AddStealthRocksToFoeSide"
if user.pbOpposingSide.effects[PBEffects::StealthRock]
score -= 90
else
if user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
# Opponent can't switch in any Pokemon
score -= 90
elsif user.allOpposing.none? { |b| @battle.pbCanChooseNonActive?(b.index) }
score -= 90 # Opponent can't switch in any Pokemon
else
score += 10 * @battle.pbAbleNonActiveCount(user.idxOpposingSide)
end
end
#---------------------------------------------------------------------------
when "GrassPledge"
#---------------------------------------------------------------------------
@@ -2360,10 +2336,9 @@ class Battle::AI
score += avg / 2
if user.effects[PBEffects::Stockpile] >= 3
score -= 80
else
# More preferable if user also has Spit Up/Swallow
score += 20 if user.pbHasMoveFunction?("PowerDependsOnUserStockpile",
elsif user.pbHasMoveFunction?("PowerDependsOnUserStockpile",
"HealUserDependingOnUserStockpile") # Spit Up, Swallow
score += 20 # More preferable if user also has Spit Up/Swallow
end
#---------------------------------------------------------------------------
when "PowerDependsOnUserStockpile"
@@ -2557,8 +2532,8 @@ class Battle::AI
when "HoopaRemoveProtectionsBypassSubstituteLowerUserDef1"
if !user.isSpecies?(:HOOPA) || user.form != 1
score -= 100
else
score += 20 if target.stages[:DEFENSE] > 0
elsif target.stages[:DEFENSE] > 0
score += 20
end
#---------------------------------------------------------------------------
when "LowerTargetSpAtk2", "LowerTargetSpAtk3"
@@ -2657,8 +2632,8 @@ class Battle::AI
ospeed = pbRoughStat(target, :SPEED, skill)
if aspeed > ospeed
score -= 90
else
score += 30 if target.pbHasMoveType?(:FIRE)
elsif target.pbHasMoveType?(:FIRE)
score += 30
end
#---------------------------------------------------------------------------
when "ProtectUserSideFromDamagingMovesIfUserFirstTurn"
@@ -2715,8 +2690,8 @@ class Battle::AI
when "HealUserByThreeQuartersOfDamageDone"
if skill >= PBTrainerAI.highSkill && target.hasActiveAbility?(:LIQUIDOOZE)
score -= 80
else
score += 40 if user.hp <= user.totalhp / 2
elsif user.hp <= user.totalhp / 2
score += 40
end
#---------------------------------------------------------------------------
when "RaiseTargetAttack1"
@@ -2776,8 +2751,8 @@ class Battle::AI
when "CureTargetBurn"
if target.opposes?(user)
score -= 40 if target.status == :BURN
else
score += 40 if target.status == :BURN
elsif target.status == :BURN
score += 40
end
#---------------------------------------------------------------------------
when "CureTargetStatusHealUserHalfOfTotalHP"
@@ -562,7 +562,7 @@ class Battle::AI
baseDmg = [(baseDmg * multipliers[:base_damage_multiplier]).round, 1].max
atk = [(atk * multipliers[:attack_multiplier]).round, 1].max
defense = [(defense * multipliers[:defense_multiplier]).round, 1].max
damage = (((2.0 * user.level / 5 + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
damage = ((((2.0 * user.level / 5) + 2).floor * baseDmg * atk / defense).floor / 50).floor + 2
damage = [(damage * multipliers[:final_damage_multiplier]).round, 1].max
# "AI-specific calculations below"
# Increased critical hit rates
@@ -154,7 +154,7 @@ module Battle::CatchAndStoreMixin
# First half of the shakes calculation
a = battler.totalhp
b = battler.hp
x = ((3 * a - 2 * b) * catch_rate.to_f) / (3 * a)
x = (((3 * a) - (2 * b)) * catch_rate.to_f) / (3 * a)
# Calculation modifiers
if battler.status == :SLEEP || battler.status == :FROZEN
x *= 2.5
@@ -45,8 +45,8 @@ end
def repositionY(x1, y1, x2, y2, tx, ty)
dx = x2 - x1
dy = y2 - y1
x = x1 + tx * dx.to_f
y = y1 + ty * dy.to_f
x = x1 + (tx * dx.to_f)
y = y1 + (ty * dy.to_f)
return [x, y]
end
@@ -219,11 +219,9 @@ class RPG::Animation
timing = RPG::Animation::Timing.new
othertiming = otherAnim.timings[i]
timing.frame = frame + othertiming.frame
timing.se = RPG::AudioFile.new(
othertiming.se.name.clone,
timing.se = RPG::AudioFile.new(othertiming.se.name.clone,
othertiming.se.volume,
othertiming.se.pitch
)
othertiming.se.pitch)
timing.flash_scope = othertiming.flash_scope
timing.flash_color = othertiming.flash_color.clone
timing.flash_duration = othertiming.flash_duration
@@ -571,20 +569,20 @@ class PBAnimation < Array
next if frame < i.frame || frame > i.frame + i.duration
fraction = (frame - i.frame).to_f / i.duration
if bgGraphic.bitmap != nil
bgGraphic.ox = oldbg[0] - (i.bgX - oldbg[0]) * fraction if i.bgX != nil
bgGraphic.oy = oldbg[1] - (i.bgY - oldbg[1]) * fraction if i.bgY != nil
bgGraphic.opacity = oldbg[2] + (i.opacity - oldbg[2]) * fraction if i.opacity != nil
cr = (i.colorRed != nil) ? oldbg[3].red + (i.colorRed - oldbg[3].red) * fraction : oldbg[3].red
cg = (i.colorGreen != nil) ? oldbg[3].green + (i.colorGreen - oldbg[3].green) * fraction : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + (i.colorBlue - oldbg[3].blue) * fraction : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + (i.colorAlpha - oldbg[3].alpha) * fraction : oldbg[3].alpha
bgGraphic.ox = oldbg[0] - ((i.bgX - oldbg[0]) * fraction) if i.bgX != nil
bgGraphic.oy = oldbg[1] - ((i.bgY - oldbg[1]) * fraction) if i.bgY != nil
bgGraphic.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
bgGraphic.color = Color.new(cr, cg, cb, ca)
else
bgColor.opacity = oldbg[2] + (i.opacity - oldbg[2]) * fraction if i.opacity != nil
cr = (i.colorRed != nil) ? oldbg[3].red + (i.colorRed - oldbg[3].red) * fraction : oldbg[3].red
cg = (i.colorGreen != nil) ? oldbg[3].green + (i.colorGreen - oldbg[3].green) * fraction : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + (i.colorBlue - oldbg[3].blue) * fraction : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + (i.colorAlpha - oldbg[3].alpha) * fraction : oldbg[3].alpha
bgColor.opacity = oldbg[2] + ((i.opacity - oldbg[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldbg[3].red + ((i.colorRed - oldbg[3].red) * fraction) : oldbg[3].red
cg = (i.colorGreen != nil) ? oldbg[3].green + ((i.colorGreen - oldbg[3].green) * fraction) : oldbg[3].green
cb = (i.colorBlue != nil) ? oldbg[3].blue + ((i.colorBlue - oldbg[3].blue) * fraction) : oldbg[3].blue
ca = (i.colorAlpha != nil) ? oldbg[3].alpha + ((i.colorAlpha - oldbg[3].alpha) * fraction) : oldbg[3].alpha
bgColor.color = Color.new(cr, cg, cb, ca)
end
when 4
@@ -592,20 +590,20 @@ class PBAnimation < Array
next if frame < i.frame || frame > i.frame + i.duration
fraction = (frame - i.frame).to_f / i.duration
if foGraphic.bitmap != nil
foGraphic.ox = oldfo[0] - (i.bgX - oldfo[0]) * fraction if i.bgX != nil
foGraphic.oy = oldfo[1] - (i.bgY - oldfo[1]) * fraction if i.bgY != nil
foGraphic.opacity = oldfo[2] + (i.opacity - oldfo[2]) * fraction if i.opacity != nil
cr = (i.colorRed != nil) ? oldfo[3].red + (i.colorRed - oldfo[3].red) * fraction : oldfo[3].red
cg = (i.colorGreen != nil) ? oldfo[3].green + (i.colorGreen - oldfo[3].green) * fraction : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + (i.colorBlue - oldfo[3].blue) * fraction : oldfo[3].blue
ca = (i.colorAlpha != nil) ? oldfo[3].alpha + (i.colorAlpha - oldfo[3].alpha) * fraction : oldfo[3].alpha
foGraphic.ox = oldfo[0] - ((i.bgX - oldfo[0]) * fraction) if i.bgX != nil
foGraphic.oy = oldfo[1] - ((i.bgY - oldfo[1]) * fraction) if i.bgY != nil
foGraphic.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
ca = (i.colorAlpha != nil) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
foGraphic.color = Color.new(cr, cg, cb, ca)
else
foColor.opacity = oldfo[2] + (i.opacity - oldfo[2]) * fraction if i.opacity != nil
cr = (i.colorRed != nil) ? oldfo[3].red + (i.colorRed - oldfo[3].red) * fraction : oldfo[3].red
cg = (i.colorGreen != nil) ? oldfo[3].green + (i.colorGreen - oldfo[3].green) * fraction : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + (i.colorBlue - oldfo[3].blue) * fraction : oldfo[3].blue
ca = (i.colorAlpha != nil) ? oldfo[3].alpha + (i.colorAlpha - oldfo[3].alpha) * fraction : oldfo[3].alpha
foColor.opacity = oldfo[2] + ((i.opacity - oldfo[2]) * fraction) if i.opacity != nil
cr = (i.colorRed != nil) ? oldfo[3].red + ((i.colorRed - oldfo[3].red) * fraction) : oldfo[3].red
cg = (i.colorGreen != nil) ? oldfo[3].green + ((i.colorGreen - oldfo[3].green) * fraction) : oldfo[3].green
cb = (i.colorBlue != nil) ? oldfo[3].blue + ((i.colorBlue - oldfo[3].blue) * fraction) : oldfo[3].blue
ca = (i.colorAlpha != nil) ? oldfo[3].alpha + ((i.colorAlpha - oldfo[3].alpha) * fraction) : oldfo[3].alpha
foColor.color = Color.new(cr, cg, cb, ca)
end
end
@@ -925,14 +925,12 @@ Battle::AbilityEffects::MoveImmunity.add(:FLASHFIRE,
battle.pbDisplay(_INTL("The power of {1}'s Fire-type moves rose because of its {2}!",
target.pbThis(true), target.abilityName))
end
else
if Battle::Scene::USE_ABILITY_SPLASH
elsif Battle::Scene::USE_ABILITY_SPLASH
battle.pbDisplay(_INTL("It doesn't affect {1}...", target.pbThis(true)))
else
battle.pbDisplay(_INTL("{1}'s {2} made {3} ineffective!",
target.pbThis, target.abilityName, move.name))
end
end
battle.pbHideAbilitySplash(target)
end
next true
@@ -2604,8 +2602,8 @@ Battle::AbilityEffects::OnSwitchIn.add(:ANTICIPATION,
next if Effectiveness.ineffective?(eff)
next if !Effectiveness.super_effective?(eff) &&
!["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
else
next if !["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
elsif !["OHKO", "OHKOIce", "OHKOHitsUndergroundTarget"].include?(m.function)
next
end
found = true
break
@@ -2857,8 +2855,8 @@ Battle::AbilityEffects::OnSwitchIn.add(:INTIMIDATE,
check_item = true
if b.hasActiveAbility?(:CONTRARY)
check_item = false if b.statStageAtMax?(:ATTACK)
else
check_item = false if b.statStageAtMin?(:ATTACK)
elsif b.statStageAtMin?(:ATTACK)
check_item = false
end
check_ability = b.pbLowerAttackStatStageIntimidate(battler)
b.pbAbilitiesOnIntimidated if check_ability
@@ -922,7 +922,7 @@ Battle::ItemEffects::DamageCalcFromUser.copy(:METALCOAT, :IRONPLATE)
Battle::ItemEffects::DamageCalcFromUser.add(:METRONOME,
proc { |item, user, target, move, mults, baseDmg, type|
met = 1 + 0.2 * [user.effects[PBEffects::Metronome], 5].min
met = 1 + (0.2 * [user.effects[PBEffects::Metronome], 5].min)
mults[:final_damage_multiplier] *= met
}
)
@@ -1030,11 +1030,9 @@ Battle::ItemEffects::DamageCalcFromUser.add(:SOULDEW,
next if !user.isSpecies?(:LATIAS) && !user.isSpecies?(:LATIOS)
if Settings::SOUL_DEW_POWERS_UP_TYPES
mults[:final_damage_multiplier] *= 1.2 if [:DRAGON, :PSYCHIC].include?(type)
else
if move.specialMove? && !user.battle.rules["souldewclause"]
elsif move.specialMove? && !user.battle.rules["souldewclause"]
mults[:attack_multiplier] *= 1.5
end
end
}
)
@@ -113,7 +113,7 @@ class Battle::Scene::Animation::ThrowBait < Battle::Scene::Animation
traSprite = @sprites["player_1"]
ballPos = Battle::Scene.pbBattlerPosition(@battler.index, batSprite.sideSize)
ballStartX = traSprite.x
ballStartY = traSprite.y - traSprite.bitmap.height / 2
ballStartY = traSprite.y - (traSprite.bitmap.height / 2)
ballMidX = 0 # Unused in arc calculation
ballMidY = 122
ballEndX = ballPos[0] - 40
@@ -178,11 +178,11 @@ class Battle::Scene::Animation::ThrowRock < Battle::Scene::Animation
batSprite = @sprites["pokemon_#{@battler.index}"]
traSprite = @sprites["player_1"]
ballStartX = traSprite.x
ballStartY = traSprite.y - traSprite.bitmap.height / 2
ballStartY = traSprite.y - (traSprite.bitmap.height / 2)
ballMidX = 0 # Unused in arc calculation
ballMidY = 122
ballEndX = batSprite.x
ballEndY = batSprite.y - batSprite.bitmap.height / 2
ballEndY = batSprite.y - (batSprite.bitmap.height / 2)
# Set up trainer sprite
trainer = addSprite(traSprite, PictureOrigin::Bottom)
# Set up bait sprite
@@ -242,13 +242,12 @@ class Battle::Scene
end
def pbSafariCommandMenu(index)
pbCommandMenuEx(index, [
_INTL("What will\n{1} throw?", @battle.pbPlayer.name),
pbCommandMenuEx(index,
[_INTL("What will\n{1} throw?", @battle.pbPlayer.name),
_INTL("Ball"),
_INTL("Bait"),
_INTL("Rock"),
_INTL("Run")
], 3)
_INTL("Run")], 3)
end
def pbThrowBait
@@ -324,10 +323,8 @@ class SafariBattle
@player = [player]
@party2 = party2
@sideSizes = [1, 1]
@battlers = [
Battle::FakeBattler.new(self, 0),
Battle::FakeBattler.new(self, 1)
]
@battlers = [Battle::FakeBattler.new(self, 0),
Battle::FakeBattler.new(self, 1)]
@rules = {}
@ballCount = 0
end
@@ -45,13 +45,12 @@ class BugContestBattle < Battle
end
def pbCommandMenu(idxBattler, _firstAction)
return @scene.pbCommandMenuEx(idxBattler, [
_INTL("Sport Balls: {1}", @ballCount),
return @scene.pbCommandMenuEx(idxBattler,
[_INTL("Sport Balls: {1}", @ballCount),
_INTL("Fight"),
_INTL("Ball"),
_INTL("Pokémon"),
_INTL("Run")
], 4)
_INTL("Run")], 4)
end
def pbConsumeItemInBag(_item, _idxBattler)
@@ -245,8 +245,8 @@ module RPG
return
end
if @weatherTypes[weather_type][0].category == :Rain && index.odd? # Splash
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width * 2)
sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + sprite.bitmap.height * 2)
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + (sprite.bitmap.width * 2))
sprite.y = @oy - sprite.bitmap.height + rand(Graphics.height + (sprite.bitmap.height * 2))
lifetimes[index] = (rand(30...50)) * 0.01 # 0.3-0.5 seconds
else
x_speed = @weatherTypes[weather_type][0].particle_delta_x
@@ -255,14 +255,14 @@ module RPG
if gradient.abs >= 1
# Position sprite to the right of the screen
sprite.x = @ox + Graphics.width + rand(Graphics.width)
sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - Graphics.width / gradient)
distance_to_cover = sprite.x - @ox - Graphics.width / 2 + sprite.bitmap.width + rand(Graphics.width * 8 / 5)
sprite.y = @oy + Graphics.height - rand(Graphics.height + sprite.bitmap.height - (Graphics.width / gradient))
distance_to_cover = sprite.x - @ox - (Graphics.width / 2) + sprite.bitmap.width + rand(Graphics.width * 8 / 5)
lifetimes[index] = (distance_to_cover.to_f / x_speed).abs
else
# Position sprite to the top of the screen
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - gradient * Graphics.height)
sprite.x = @ox - sprite.bitmap.width + rand(Graphics.width + sprite.bitmap.width - (gradient * Graphics.height))
sprite.y = @oy - sprite.bitmap.height - rand(Graphics.height)
distance_to_cover = @oy - sprite.y + Graphics.height / 2 + rand(Graphics.height * 8 / 5)
distance_to_cover = @oy - sprite.y + (Graphics.height / 2) + rand(Graphics.height * 8 / 5)
lifetimes[index] = (distance_to_cover.to_f / y_speed).abs
end
end
@@ -333,8 +333,8 @@ module RPG
def update_tile_position(sprite, index)
return if !sprite || !sprite.bitmap || !sprite.visible
sprite.x = @tile_x.round + (index % @tiles_wide) * sprite.bitmap.width
sprite.y = @tile_y.round + (index / @tiles_wide) * sprite.bitmap.height
sprite.x = @tile_x.round + ((index % @tiles_wide) * sprite.bitmap.width)
sprite.y = @tile_y.round + ((index / @tiles_wide) * sprite.bitmap.height)
sprite.x += @tiles_wide * sprite.bitmap.width if sprite.x - @ox < -sprite.bitmap.width
sprite.y -= @tiles_tall * sprite.bitmap.height if sprite.y - @oy > Graphics.height
sprite.visible = true
@@ -372,10 +372,10 @@ module RPG
@fade_time < [FADE_NEW_TONE_END - @time_shift, 0].max
weather_max = @target_max
fract = (@fade_time - [FADE_NEW_TONE_START - @time_shift, 0].max) / (FADE_NEW_TONE_END - FADE_NEW_TONE_START)
tone_red = @target_tone.red + (1 - fract) * (@old_tone.red - @target_tone.red)
tone_green = @target_tone.green + (1 - fract) * (@old_tone.green - @target_tone.green)
tone_blue = @target_tone.blue + (1 - fract) * (@old_tone.blue - @target_tone.blue)
tone_gray = @target_tone.gray + (1 - fract) * (@old_tone.gray - @target_tone.gray)
tone_red = @target_tone.red + ((1 - fract) * (@old_tone.red - @target_tone.red))
tone_green = @target_tone.green + ((1 - fract) * (@old_tone.green - @target_tone.green))
tone_blue = @target_tone.blue + ((1 - fract) * (@old_tone.blue - @target_tone.blue))
tone_gray = @target_tone.gray + ((1 - fract) * (@old_tone.gray - @target_tone.gray))
else
tone_red = @viewport.tone.red
tone_green = @viewport.tone.green
@@ -153,12 +153,12 @@ class LightEffect_Basic < LightEffect
super
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2
@light.y = ScreenPosHelper.pbScreenY(@event) - (Game_Map::TILE_HEIGHT / 2)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
@light.zoom_y = @light.zoom_x
else
@light.x = @event.screen_x
@light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2
@light.y = @event.screen_y - (Game_Map::TILE_HEIGHT / 2)
end
@light.tone = $game_screen.tone
end
@@ -188,12 +188,12 @@ class LightEffect_DayNight < LightEffect
if @light.opacity > 0
if (Object.const_defined?(:ScreenPosHelper) rescue false)
@light.x = ScreenPosHelper.pbScreenX(@event)
@light.y = ScreenPosHelper.pbScreenY(@event) - Game_Map::TILE_HEIGHT / 2
@light.y = ScreenPosHelper.pbScreenY(@event) - (Game_Map::TILE_HEIGHT / 2)
@light.zoom_x = ScreenPosHelper.pbScreenZoomX(@event)
@light.zoom_y = ScreenPosHelper.pbScreenZoomY(@event)
else
@light.x = @event.screen_x
@light.y = @event.screen_y - Game_Map::TILE_HEIGHT / 2
@light.y = @event.screen_y - (Game_Map::TILE_HEIGHT / 2)
end
@light.tone.set($game_screen.tone.red,
$game_screen.tone.green,
+3 -3
View File
@@ -286,8 +286,8 @@ Events.onMapSceneChange += proc { |_sender, e|
if $PokemonGlobal.mapTrail[1]
for i in 0...Settings::NO_SIGNPOSTS.length / 2
nosignpost = true if Settings::NO_SIGNPOSTS[2 * i] == $PokemonGlobal.mapTrail[1] &&
Settings::NO_SIGNPOSTS[2 * i + 1] == $game_map.map_id
nosignpost = true if Settings::NO_SIGNPOSTS[2 * i + 1] == $PokemonGlobal.mapTrail[1] &&
Settings::NO_SIGNPOSTS[(2 * i) + 1] == $game_map.map_id
nosignpost = true if Settings::NO_SIGNPOSTS[(2 * i) + 1] == $PokemonGlobal.mapTrail[1] &&
Settings::NO_SIGNPOSTS[2 * i] == $game_map.map_id
break if nosignpost
end
@@ -378,7 +378,7 @@ def pbEventCanReachPlayer?(event, player, distance)
end
if real_distance > 0
real_distance.times do |i|
return false if !event.can_move_from_coordinate?(event.x + i * delta_x, event.y + i * delta_y, event.direction)
return false if !event.can_move_from_coordinate?(event.x + (i * delta_x), event.y + (i * delta_y), event.direction)
end
end
return true
@@ -182,8 +182,8 @@ def pbGetEnvironment
tile_environment = terrainTag.battle_environment
if ret == :Forest && [:Grass, :TallGrass].include?(tile_environment)
ret = :ForestGrass
else
ret = tile_environment if tile_environment
elsif tile_environment
ret = tile_environment
end
return ret
end
@@ -383,13 +383,14 @@ def pbTrainerBattleCore(*args)
foeParty = []
foePartyStarts = []
for arg in args
if arg.is_a?(NPCTrainer)
case arg
when NPCTrainer
foeTrainers.push(arg)
foePartyStarts.push(foeParty.length)
arg.party.each { |pkmn| foeParty.push(pkmn) }
foeEndSpeeches.push(arg.lose_text)
foeItems.push(arg.items)
elsif arg.is_a?(Array) # [trainer type, trainer name, ID, speech (optional)]
when Array # [trainer type, trainer name, ID, speech (optional)]
trainer = pbLoadTrainer(arg[0], arg[1], arg[2])
pbMissingTrainer(arg[0], arg[1], arg[2]) if !trainer
return 0 if !trainer
@@ -709,7 +710,7 @@ end
def pbHoneyGather(pkmn)
return if !GameData::Item.exists?(:HONEY)
return if pkmn.egg? || !pkmn.hasAbility?(:HONEYGATHER) || pkmn.hasItem?
chance = 5 + ((pkmn.level - 1) / 10) * 5
chance = 5 + (((pkmn.level - 1) / 10) * 5)
return unless rand(100) < chance
pkmn.item = :HONEY
end
@@ -155,7 +155,7 @@ def pbBattleAnimation(bgm = nil, battletype = 0, foe = nil)
Input.update
pbUpdateSceneMap
timer += Graphics.delta_s
viewport.color.alpha = 255 * (1 - timer / 0.4)
viewport.color.alpha = 255 * (1 - (timer / 0.4))
break if viewport.color.alpha <= 0
end
viewport.dispose
@@ -267,9 +267,9 @@ SpecialBattleIntroAnimations.register("vs_animation", 50, # Priority 50
flash.opacity -= 52 * 20 / Graphics.frame_rate if flash.opacity > 0
bar1.ox -= 32 * 20 / Graphics.frame_rate
bar2.ox += 32 * 20 / Graphics.frame_rate
if i >= animTime / 2 && i < slideInTime + animTime / 2
player.x = xoffset * (i + 1 - slideInTime - animTime / 2) / slideInTime
trainer.x = xoffset * (slideInTime - i - 1 + animTime / 2) / slideInTime
if i >= animTime / 2 && i < slideInTime + (animTime / 2)
player.x = xoffset * (i + 1 - slideInTime - (animTime / 2)) / slideInTime
trainer.x = xoffset * (slideInTime - i - 1 + (animTime / 2)) / slideInTime
end
pbWait(1)
end
@@ -114,7 +114,7 @@ class PokemonEncounters
return true if pbPokeRadarOnShakingGrass
# Get base encounter chance and minimum steps grace period
encounter_chance = @step_chances[enc_type].to_f
min_steps_needed = (8 - encounter_chance / 10).clamp(0, 8).to_f
min_steps_needed = (8 - (encounter_chance / 10)).clamp(0, 8).to_f
# Apply modifiers to the encounter chance and the minimum steps amount
if triggered_by_step
encounter_chance += @chance_accumulator / 200
@@ -168,7 +168,7 @@ class PokemonEncounters
# after a previous wild encounter
if triggered_by_step && @step_count < min_steps_needed
@step_count += 1
return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + @chance_accumulator / 200)
return false if rand(100) >= encounter_chance * 5 / (@step_chances[enc_type] + (@chance_accumulator / 200))
end
# Decide whether the wild encounter should actually happen
return true if rand(100) < encounter_chance
@@ -429,7 +429,7 @@ def pbGenerateWildPokemon(species, level, isRoamer = false)
shiny_retries.times do
break if genwildpoke.shiny?
genwildpoke.shiny = nil # Make it recalculate shininess
genwildpoke.personalID = rand(2**16) | rand(2**16) << 16
genwildpoke.personalID = rand(2**16) | (rand(2**16) << 16)
end
end
# Give Pokérus
@@ -148,9 +148,9 @@ def moonphase(time = nil) # in UTC
27.6849270496875
]
yy = time.year - ((12 - time.mon) / 10.0).floor
j = (365.25 * (4712 + yy)).floor + (((time.mon + 9) % 12) * 30.6 + 0.5).floor + time.day + 59
j = (365.25 * (4712 + yy)).floor + ((((time.mon + 9) % 12) * 30.6) + 0.5).floor + time.day + 59
j -= (((yy / 100.0) + 49).floor * 0.75).floor - 38 if j > 2299160
j += (((time.hour * 60) + time.min * 60) + time.sec) / 86400.0
j += (((time.hour * 60) + (time.min * 60)) + time.sec) / 86400.0
v = (j - 2451550.1) / 29.530588853
v = ((v - v.floor) + (v < 0 ? 1 : 0))
ag = v * 29.53
@@ -178,8 +178,8 @@ def zodiac(month, day)
2, 19, 3, 20 # Pisces
]
for i in 0...12
return i if month == time[i * 4] && day >= time[i * 4 + 1]
return i if month == time[i * 4 + 2] && day <= time[i * 4 + 3]
return i if month == time[i * 4] && day >= time[(i * 4) + 1]
return i if month == time[(i * 4) + 2] && day <= time[(i * 4) + 3]
end
return 0
end
@@ -258,8 +258,7 @@ def pbGetMonthName(month)
end
def pbGetAbbrevMonthName(month)
return ["",
_INTL("Jan."),
return [_INTL("Jan."),
_INTL("Feb."),
_INTL("Mar."),
_INTL("Apr."),
@@ -270,7 +269,7 @@ def pbGetAbbrevMonthName(month)
_INTL("Sep."),
_INTL("Oct."),
_INTL("Nov."),
_INTL("Dec.")][month]
_INTL("Dec.")][month - 1]
end
#===============================================================================
@@ -287,12 +286,10 @@ def pbIsSeason(seasonVariable, *arg)
ret = true if wd == thisseason
end
if seasonVariable > 0
$game_variables[seasonVariable] = [
_INTL("Spring"),
$game_variables[seasonVariable] = [_INTL("Spring"),
_INTL("Summer"),
_INTL("Autumn"),
_INTL("Winter")
][thisseason]
_INTL("Winter")][thisseason]
$game_map.need_refresh = true if $game_map
end
return ret
@@ -159,15 +159,15 @@ def pbHiddenMoveAnimation(pokemon)
strobe.ox = strobe.viewport.rect.x
strobe.oy = strobe.viewport.rect.y
if !strobe.visible # Initial placement of strobes
randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2))
strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2
randomY = 16 * (1 + rand((bg.bitmap.height / 16) - 2))
strobe.y = randomY + ((Graphics.height - bg.bitmap.height) / 2)
strobe.x = rand(Graphics.width)
strobe.visible = true
elsif strobe.x < Graphics.width # Move strobe right
strobe.x += strobeSpeed
else # Strobe is off the screen, reposition it to the left of the screen
randomY = 16 * (1 + rand(bg.bitmap.height / 16 - 2))
strobe.y = randomY + (Graphics.height - bg.bitmap.height) / 2
randomY = 16 * (1 + rand((bg.bitmap.height / 16) - 2))
strobe.y = randomY + ((Graphics.height - bg.bitmap.height) / 2)
strobe.x = -strobe.bitmap.width - rand(Graphics.width / 4)
end
end
@@ -236,15 +236,13 @@ def pbSmashEvent(event)
elsif event.name[/smashrock/i]
pbSEPlay("Rock Smash", 80)
end
pbMoveRoute(event, [
PBMoveRoute::Wait, 2,
pbMoveRoute(event, [PBMoveRoute::Wait, 2,
PBMoveRoute::TurnLeft,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnRight,
PBMoveRoute::Wait, 2,
PBMoveRoute::TurnUp,
PBMoveRoute::Wait, 2
])
PBMoveRoute::Wait, 2])
pbWait(Graphics.frame_rate * 4 / 10)
event.erase
$PokemonMap.addErasedEvent(event.id) if $PokemonMap
@@ -397,8 +395,8 @@ Events.onAction += proc { |_sender, _e|
$map_factory.getTerrainTag(surface_map_id, $game_player.x, $game_player.y).can_dive
pbSurfacing
end
else
pbDive if $game_player.terrain_tag.can_dive
elsif $game_player.terrain_tag.can_dive
pbDive
end
}
@@ -84,16 +84,13 @@ class BerryPlantData
data = GameData::BerryPlant.get(@berry_id)
if @new_mechanics
return [data.maximum_yield * (5 - @yield_penalty) / 5, data.minimum_yield].max
else
if @watering_count > 0
elsif @watering_count > 0
ret = (data.maximum_yield - data.minimum_yield) * (@watering_count - 1)
ret += rand(1 + data.maximum_yield - data.minimum_yield)
return (ret / 4) + data.minimum_yield
else
end
return data.minimum_yield
end
end
end
# Old mechanics only update a plant when its map is loaded. New mechanics
# update it every frame while its map is loaded.
@@ -138,7 +135,7 @@ class BerryPlantData
# Update how long plant has been alive for
old_growth_stage = @growth_stage
@time_alive = new_time_alive
@growth_stage = 1 + @time_alive / time_per_stage
@growth_stage = 1 + (@time_alive / time_per_stage)
@growth_stage += 1 if replanted? # Replants start at stage 2
@time_last_updated = time_now.to_i
# Record watering (old mechanics), and apply drying out per hour (new mechanics)
@@ -244,7 +244,7 @@ class DayCare
shiny_retries.times do
break if egg.shiny?
egg.shiny = nil # Make it recalculate shininess
egg.personalID = rand(2**16) | rand(2**16) << 16
egg.personalID = rand(2**16) | (rand(2**16) << 16)
end
end
@@ -118,7 +118,7 @@ module RandomDungeonGenerator
def paint_corridor(tile, x, y, width, height)
for j in 0...height
for i in 0...width
tile[(y + j) * CELL_WIDTH + (x + i)] = DungeonTile::CORRIDOR
tile[((y + j) * CELL_WIDTH) + (x + i)] = DungeonTile::CORRIDOR
end
end
end
@@ -129,25 +129,25 @@ module RandomDungeonGenerator
when TURN_NONE
for y in 0...CELL_HEIGHT
for x in 0...CELL_WIDTH
dungeon[x + dstX, y + dstY] = tile_layout[y * CELL_WIDTH + x]
dungeon[x + dstX, y + dstY] = tile_layout[(y * CELL_WIDTH) + x]
end
end
when TURN_LEFT
for y in 0...CELL_HEIGHT
for x in 0...CELL_WIDTH
dungeon[y + dstX, CELL_WIDTH - 1 - x + dstY] = tile_layout[y * CELL_WIDTH + x]
dungeon[y + dstX, CELL_WIDTH - 1 - x + dstY] = tile_layout[(y * CELL_WIDTH) + x]
end
end
when TURN_RIGHT
for y in 0...CELL_HEIGHT
for x in 0...CELL_WIDTH
dungeon[CELL_HEIGHT - 1 - y + dstX, x + dstY] = tile_layout[y * CELL_WIDTH + x]
dungeon[CELL_HEIGHT - 1 - y + dstX, x + dstY] = tile_layout[(y * CELL_WIDTH) + x]
end
end
when TURN_BACK
for y in 0...CELL_HEIGHT
for x in 0...CELL_WIDTH
dungeon[CELL_WIDTH - 1 - x + dstX, CELL_HEIGHT - 1 - y + dstY] = tile_layout[y * CELL_WIDTH + x]
dungeon[CELL_WIDTH - 1 - x + dstX, CELL_HEIGHT - 1 - y + dstY] = tile_layout[(y * CELL_WIDTH) + x]
end
end
end
@@ -164,8 +164,8 @@ module RandomDungeonGenerator
width = rand(ROOM_MIN_WIDTH..ROOM_MAX_WIDTH)
height = rand(ROOM_MIN_HEIGHT..ROOM_MAX_HEIGHT)
return false if width <= 0 || height <= 0
centerX = CELL_WIDTH / 2 + rand(5) - 2
centerY = CELL_HEIGHT / 2 + rand(5) - 2
centerX = (CELL_WIDTH / 2) + rand(5) - 2
centerY = (CELL_HEIGHT / 2) + rand(5) - 2
x = centerX - (width / 2)
y = centerY - (height / 2)
rect = [x, y, width, height]
@@ -244,17 +244,17 @@ module RandomDungeonGenerator
def getVisited(x, y)
return false if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight
return (@cells[y * cellWidth + x] & EdgeMasks::VISITED) != 0
return (@cells[(y * cellWidth) + x] & EdgeMasks::VISITED) != 0
end
def setVisited(x, y)
return if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight
@cells[y * cellWidth + x] |= EdgeMasks::VISITED
@cells[(y * cellWidth) + x] |= EdgeMasks::VISITED
end
def clearVisited(x, y)
return if x < 0 || y < 0 || x >= cellWidth || x >= cellHeight
@cells[y * cellWidth + x] &= ~EdgeMasks::VISITED
@cells[(y * cellWidth) + x] &= ~EdgeMasks::VISITED
end
def clearAllCells
@@ -265,12 +265,12 @@ module RandomDungeonGenerator
def getEdgeNode(x, y, edge)
return false if x < 0 || y < 0 || x >= nodeWidth || y >= nodeHeight
return @nodes[y * nodeWidth + x].getEdge(edge)
return @nodes[(y * nodeWidth) + x].getEdge(edge)
end
def setEdgeNode(x, y, edge)
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
@nodes[y * nodeWidth + x].setEdge(edge)
@nodes[(y * nodeWidth) + x].setEdge(edge)
e = 0
nx = x
ny = y
@@ -291,7 +291,7 @@ module RandomDungeonGenerator
return
end
return if nx < 0 || ny < 0 || nx >= nodeWidth || ny >= nodeHeight
@nodes[ny * nodeWidth + nx].setEdge(e)
@nodes[(ny * nodeWidth) + nx].setEdge(e)
end
def setAllEdges
@@ -302,7 +302,7 @@ module RandomDungeonGenerator
def clearEdgeNode(x, y, edge)
return if x < 0 || x >= nodeWidth || y < 0 || y >= nodeHeight
@nodes[y * nodeWidth + x].clearEdge(edge)
@nodes[(y * nodeWidth) + x].clearEdge(edge)
e = 0
nx = x
ny = y
@@ -323,7 +323,7 @@ module RandomDungeonGenerator
raise ArgumentError.new
end
return if nx < 0 || ny < 0 || nx >= nodeWidth || ny >= nodeHeight
@nodes[ny * nodeWidth + nx].clearEdge(e)
@nodes[(ny * nodeWidth) + nx].clearEdge(e)
end
def clearAllEdges
@@ -334,7 +334,7 @@ module RandomDungeonGenerator
def isBlockedNode?(x, y)
return false if x < 0 || y < 0 || x >= nodeWidth || y >= nodeHeight
return @nodes[y * nodeWidth + x].isBlocked?
return @nodes[(y * nodeWidth) + x].isBlocked?
end
def getEdgePattern(x, y)
@@ -483,22 +483,22 @@ module RandomDungeonGenerator
end
def [](x, y)
return @array[y * @width + x]
return @array[(y * @width) + x]
end
def []=(x, y, value)
@array[y * @width + x] = value
@array[(y * @width) + x] = value
end
def value(x, y)
return DungeonTile::VOID if x < 0 || y < 0 || x >= @width || y >= @height
return @array[y * @width + x]
return @array[(y * @width) + x]
end
# Unused
def get(x, y)
return false if x < 0 || y < 0 || x >= @width || y >= @height
return @array[y * @width + x] != DungeonTile::VOID
return @array[(y * @width) + x] != DungeonTile::VOID
end
# Unused
@@ -553,8 +553,8 @@ module RandomDungeonGenerator
def generate
self.clear
maxWidth = @width - BUFFER_X * 2
maxHeight = @height - BUFFER_Y * 2
maxWidth = @width - (BUFFER_X * 2)
maxHeight = @height - (BUFFER_Y * 2)
cellWidth = DungeonMaze::CELL_WIDTH
cellHeight = DungeonMaze::CELL_HEIGHT
return if maxWidth < 0 || maxHeight < 0
@@ -576,7 +576,7 @@ module RandomDungeonGenerator
for x in 0...maxWidth / cellWidth
pattern = maze.getEdgePattern(x, y)
next if !DungeonMaze.paint_cell_contents(
self, BUFFER_X + x * cellWidth, BUFFER_Y + y * cellHeight,
self, BUFFER_X + (x * cellWidth), BUFFER_Y + (y * cellHeight),
corridor_patterns[pattern], DungeonMaze::TURN_NONE
)
roomcount += 1
@@ -605,7 +605,7 @@ module RandomDungeonGenerator
for j in 0...map.height
nb = TileDrawingHelper.tableNeighbors(tbl, i, j)
tile = TileDrawingHelper::NEIGHBORS_TO_AUTOTILE_INDEX[nb]
map.data[i, j, 0] = tile + 48 * (tbl[i, j])
map.data[i, j, 0] = tile + (48 * (tbl[i, j]))
map.data[i, j, 1] = 0
map.data[i, j, 2] = 0
end
@@ -638,8 +638,8 @@ module RandomDungeonGenerator
# @param x_cells [Integer] the number of cells wide the dungeon will be
# @param y_cells [Intenger] the number of cells tall the dungeon will be
def self.generate_test_dungeon(x_cells = 4, y_cells = 4)
dungeon = Dungeon.new(Dungeon::BUFFER_X * 2 + DungeonMaze::CELL_WIDTH * x_cells,
Dungeon::BUFFER_Y * 2 + DungeonMaze::CELL_HEIGHT * y_cells)
dungeon = Dungeon.new((Dungeon::BUFFER_X * 2) + (DungeonMaze::CELL_WIDTH * x_cells),
(Dungeon::BUFFER_Y * 2) + (DungeonMaze::CELL_HEIGHT * y_cells))
dungeon.generate
echoln dungeon.write
end
+6 -16
View File
@@ -319,7 +319,7 @@ def pbGainExpFromExpCandy(pkmn, base_amt, qty, scene)
if qty > 1
(qty - 1).times { pkmn.changeHappiness("vitamin") }
end
pbChangeExp(pkmn, pkmn.exp + base_amt * qty, scene)
pbChangeExp(pkmn, pkmn.exp + (base_amt * qty), scene)
scene.pbHardRefresh
return true
end
@@ -351,11 +351,9 @@ def pbBattleHPItem(pkmn, battler, restoreHP, scene)
if battler.pbRecoverHP(restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", battler.pbThis))
end
else
if pbItemRestoreHP(pkmn, restoreHP) > 0
elsif pbItemRestoreHP(pkmn, restoreHP) > 0
scene.pbDisplay(_INTL("{1}'s HP was restored.", pkmn.name))
end
end
return true
end
@@ -814,36 +812,28 @@ def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
if scene.pbConfirm(_INTL("Would you like to switch the two items?"))
$bag.remove(item)
if !$bag.add(pkmn.item)
if !$bag.add(item)
raise _INTL("Could't re-store deleted item in Bag somehow")
end
raise _INTL("Couldn't re-store deleted item in Bag somehow") if !$bag.add(item)
scene.pbDisplay(_INTL("The Bag is full. The Pokémon's item could not be removed."))
else
if GameData::Item.get(item).is_mail?
elsif GameData::Item.get(item).is_mail?
if pbWriteMail(item, pkmn, pkmnid, scene)
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
return true
else
if !$bag.add(item)
elsif !$bag.add(item)
raise _INTL("Couldn't re-store deleted item in Bag somehow")
end
end
else
pkmn.item = item
scene.pbDisplay(_INTL("Took the {1} from {2} and gave it the {3}.", olditemname, pkmn.name, newitemname))
return true
end
end
end
else
if !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene)
elsif !GameData::Item.get(item).is_mail? || pbWriteMail(item, pkmn, pkmnid, scene)
$bag.remove(item)
pkmn.item = item
scene.pbDisplay(_INTL("{1} is now holding the {2}.", pkmn.name, newitemname))
return true
end
end
return false
end
+24 -12
View File
@@ -943,11 +943,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:POMEGBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:POMEGBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :HP, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :HP, qty, [
_INTL("{1} adores you! Its base HP fell!", pkmn.name),
_INTL("{1} became more friendly. Its base HP can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base HP fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn|
@@ -955,11 +957,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:KELPSYBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:KELPSYBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :ATTACK, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :ATTACK, qty, [
_INTL("{1} adores you! Its base Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Attack fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn|
@@ -967,11 +971,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:QUALOTBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:QUALOTBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :DEFENSE, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :DEFENSE, qty, [
_INTL("{1} adores you! Its base Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Defense fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn|
@@ -979,11 +985,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:HONDEWBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:HONDEWBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_ATTACK, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPECIAL_ATTACK, qty, [
_INTL("{1} adores you! Its base Special Attack fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Attack can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Attack fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn|
@@ -991,11 +999,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:GREPABERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:GREPABERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPECIAL_DEFENSE, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPECIAL_DEFENSE, qty, [
_INTL("{1} adores you! Its base Special Defense fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Special Defense can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Special Defense fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn|
@@ -1003,11 +1013,13 @@ ItemHandlers::UseOnPokemonMaximum.add(:TAMATOBERRY, proc { |item, pkmn|
})
ItemHandlers::UseOnPokemon.add(:TAMATOBERRY, proc { |item, qty, pkmn, scene|
next pbRaiseHappinessAndLowerEV(pkmn, scene, :SPEED, qty, [
next pbRaiseHappinessAndLowerEV(
pkmn, scene, :SPEED, qty, [
_INTL("{1} adores you! Its base Speed fell!", pkmn.name),
_INTL("{1} became more friendly. Its base Speed can't go lower.", pkmn.name),
_INTL("{1} became more friendly. However, its base Speed fell!", pkmn.name)
])
]
)
})
ItemHandlers::UseOnPokemon.add(:ABILITYCAPSULE, proc { |item, qty, pkmn, scene|
@@ -49,8 +49,8 @@ ItemHandlers::CanUseInBattle.addIf(proc { |item| GameData::Item.get(item).is_pok
if battle.pbOpposingBattlerCount > 1 && !(GameData::Item.get(item).is_snag_ball? && battle.trainerBattle?)
if battle.pbOpposingBattlerCount == 2
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are two Pokémon!")) if showMessages
else
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!")) if showMessages
elsif showMessages
scene.pbDisplay(_INTL("It's no good! It's impossible to aim when there are more than one Pokémon!"))
end
next false
end
+1 -1
View File
@@ -150,7 +150,7 @@ Events.onMapUpdate += proc { |_sender, _e|
next if !num[0] || num.length != 8 # if not visible or not a trainer
# Reset time to next can-battle if necessary
if num[4] == 0
num[3] = 20 * 60 + rand(20 * 60) # 20-40 minutes
num[3] = rand(20...40) * 60 # 20-40 minutes
num[4] = 1
end
# Count down time to next can-battle
+7 -7
View File
@@ -66,11 +66,11 @@ def pbPokeRadarHighlightGrass(showmessage = true)
if r <= (i + 1) * 2
x = $game_player.x - i - 1 + r
y = $game_player.y - i - 1
elsif r <= (i + 1) * 6 - 2
elsif r <= ((i + 1) * 6) - 2
x = [$game_player.x + i + 1, $game_player.x - i - 1][r % 2]
y = $game_player.y - i + ((r - 1 - (i + 1) * 2) / 2).floor
y = $game_player.y - i + ((r - 1 - ((i + 1) * 2)) / 2).floor
else
x = $game_player.x - i + r - (i + 1) * 6
x = $game_player.x - i + r - ((i + 1) * 6)
y = $game_player.y + i + 1
end
# Add tile to grasses array if it's a valid grass tile
@@ -81,7 +81,7 @@ def pbPokeRadarHighlightGrass(showmessage = true)
# Choose a rarity for the grass (0=normal, 1=rare, 2=shiny)
s = (rand(100) < 25) ? 1 : 0
if $game_temp.poke_radar_data && $game_temp.poke_radar_data[2] > 0
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - [$game_temp.poke_radar_data[2], 40].min * 200, 200].max
v = [(65536 / Settings::SHINY_POKEMON_CHANCE) - ([$game_temp.poke_radar_data[2], 40].min * 200), 200].max
v = (65536 / v.to_f).ceil
s = 2 if rand(65536) < v
end
@@ -164,7 +164,7 @@ EncounterModifier.register(proc { |encounter|
$game_temp.poke_radar_data[3].each { |g| rarity = g[3] if g[2] == ring }
if $game_temp.poke_radar_data[2] > 0 # Chain count, i.e. is chaining
if rarity == 2 ||
rand(100) < 58 + ring * 10 + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
rand(100) < 58 + (ring * 10) + ([$game_temp.poke_radar_data[2], 40].min / 4) + ($game_temp.poke_radar_data[4] ? 10 : 0)
# Continue the chain
encounter = [$game_temp.poke_radar_data[0], $game_temp.poke_radar_data[1]]
$game_temp.force_single_battle = true
@@ -186,8 +186,8 @@ EncounterModifier.register(proc { |encounter|
encounter = pbPokeRadarGetEncounter(rarity)
$game_temp.force_single_battle = true
end
else # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel if encounter
elsif encounter # Encounter triggered by stepping in non-rustling grass
pbPokeRadarCancel
end
next encounter
})
@@ -394,7 +394,7 @@ MultipleForms.copy(:SCATTERBUG, :SPEWPA, :VIVILLON)
MultipleForms.register(:FURFROU, {
"getForm" => proc { |pkmn|
if !pkmn.time_form_set ||
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 5 # 5 days
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + (60 * 60 * 24 * 5) # 5 days
next 0
end
},
@@ -447,7 +447,7 @@ MultipleForms.register(:ZYGARDE, {
MultipleForms.register(:HOOPA, {
"getForm" => proc { |pkmn|
if !pkmn.time_form_set ||
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + 60 * 60 * 24 * 3 # 3 days
pbGetTimeNow.to_i > pkmn.time_form_set.to_i + (60 * 60 * 24 * 3) # 3 days
next 0
end
},
@@ -596,7 +596,7 @@ MultipleForms.register(:MILCERY, {
sweets = [:STRAWBERRYSWEET, :BERRYSWEET, :LOVESWEET, :STARSWEET,
:CLOVERSWEET, :FLOWERSWEET, :RIBBONSWEET]
if sweets.include?(pkmn.item_id)
next sweets.index(pkmn.item_id) + (pkmn.personalID % num_flavors) * sweets.length
next sweets.index(pkmn.item_id) + ((pkmn.personalID % num_flavors) * sweets.length)
end
next 0
}
+6 -5
View File
@@ -1071,12 +1071,12 @@ class Pokemon
# @return [Integer] the maximum HP of this Pokémon
def calcHP(base, level, iv, ev)
return 1 if base == 1 # For Shedinja
return ((base * 2 + iv + (ev / 4)) * level / 100).floor + level + 10
return (((base * 2) + iv + (ev / 4)) * level / 100).floor + level + 10
end
# @return [Integer] the specified stat of this Pokémon (not used for total HP)
def calcStat(base, level, iv, ev, nat)
return ((((base * 2 + iv + (ev / 4)) * level / 100).floor + 5) * nat / 100).floor
return (((((base * 2) + iv + (ev / 4)) * level / 100).floor + 5) * nat / 100).floor
end
# Recalculates this Pokémon's stats.
@@ -1179,9 +1179,10 @@ class Pokemon
@iv[s.id] = rand(IV_STAT_LIMIT + 1)
@ev[s.id] = 0
end
if owner.is_a?(Owner)
case owner
when Owner
@owner = owner
elsif owner.is_a?(Player) || owner.is_a?(NPCTrainer)
when Player, NPCTrainer
@owner = Owner.new_from_trainer(owner)
else
@owner = Owner.new(0, '', 2, 2)
@@ -1195,7 +1196,7 @@ class Pokemon
@timeReceived = pbGetTimeNow.to_i
@timeEggHatched = nil
@fused = nil
@personalID = rand(2**16) | rand(2**16) << 16
@personalID = rand(2**16) | (rand(2**16) << 16)
@hp = 1
@totalhp = 1
calc_stats
+1 -1
View File
@@ -43,7 +43,7 @@ class Pokemon
# @return [Integer] total PP
def total_pp
max_pp = GameData::Move.get(@id).total_pp
return max_pp + max_pp * @ppup / 5
return max_pp + (max_pp * @ppup / 5)
end
alias totalpp total_pp
@@ -34,7 +34,7 @@ class Trainer
# Random ID other than this Trainer's ID
def make_foreign_ID
loop do
ret = rand(2**16) | rand(2**16) << 16
ret = rand(2**16) | (rand(2**16) << 16)
return ret if ret != @id
end
return 0
@@ -168,7 +168,7 @@ class Trainer
def initialize(name, trainer_type)
@trainer_type = GameData::TrainerType.get(trainer_type).id
@name = name
@id = rand(2**16) | rand(2**16) << 16
@id = rand(2**16) | (rand(2**16) << 16)
@language = pbGetLanguage
@party = []
end
@@ -14,8 +14,8 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
for i in 0...Settings::MAX_PARTY_SIZE
if i == 0
pbMessage(_INTL("Please enter the first Pokémon.", i))
else
break if !pbConfirmMessage(_INTL("Add another Pokémon?"))
elsif !pbConfirmMessage(_INTL("Add another Pokémon?"))
break
end
loop do
species = pbChooseSpeciesList
@@ -42,10 +42,12 @@ def pbNewTrainer(tr_type, tr_name, tr_version, save_changes = true)
:pokemon => []
}
party.each do |pkmn|
trainer_hash[:pokemon].push({
trainer_hash[:pokemon].push(
{
:species => pkmn[0],
:level => pkmn[1]
})
}
)
end
# Add trainer's data to records
trainer_hash[:id] = [trainer_hash[:trainer_type], trainer_hash[:name], trainer_hash[:version]]
@@ -89,8 +89,8 @@ class PokemonEggHatch_Scene
@pokemon.species_data.apply_metrics_to_sprite(@sprites["pokemon"], 1)
@sprites["hatch"].visible = false
for i in 1..fadeTime
@sprites["pokemon"].tone = Tone.new(255 - i * toneDiff, 255 - i * toneDiff, 255 - i * toneDiff)
@sprites["overlay"].opacity = 255 - i * toneDiff
@sprites["pokemon"].tone = Tone.new(255 - (i * toneDiff), 255 - (i * toneDiff), 255 - (i * toneDiff))
@sprites["overlay"].opacity = 255 - (i * toneDiff)
updateScene
end
@sprites["pokemon"].tone = Tone.new(0, 0, 0)
@@ -124,12 +124,12 @@ class PokemonTrade_Scene
d = [1, 2, 4, 8][i] # Fraction of the starting height each bounce rises to
delay -= t if i == 0
if i > 0
pictureBall.setZoomXY(delay, 100 + 5 * (5 - i), 100 - 5 * (5 - i)) # Squish
pictureBall.setZoomXY(delay, 100 + (5 * (5 - i)), 100 - (5 * (5 - i))) # Squish
pictureBall.moveZoom(delay, 2, 100) # Unsquish
pictureBall.moveXY(delay, t, Graphics.width / 2, y - 100 / d)
pictureBall.moveXY(delay, t, Graphics.width / 2, y - (100 / d))
end
pictureBall.moveXY(delay + t, t, Graphics.width / 2, y)
pictureBall.setSE(delay + 2 * t, "Battle ball drop")
pictureBall.setSE(delay + (2 * t), "Battle ball drop")
delay = pictureBall.totalDuration
end
picturePoke.setXY(delay, Graphics.width / 2, y)
@@ -139,10 +139,10 @@ class HallOfFame_Scene
def xpointformula(battlernumber)
ret = 0
if !SINGLEROW
ret = 32 + 160 * xpositionformula(battlernumber)
ret = 32 + (160 * xpositionformula(battlernumber))
else
ret = (60 * (battlernumber / 2) + 48) * (xpositionformula(battlernumber) - 1)
ret += Graphics.width / 2 - 56
ret = ((60 * (battlernumber / 2)) + 48) * (xpositionformula(battlernumber) - 1)
ret += (Graphics.width / 2) - 56
end
return ret
end
@@ -150,9 +150,9 @@ class HallOfFame_Scene
def ypointformula(battlernumber)
ret = 0
if !SINGLEROW
ret = 32 + 128 * ypositionformula(battlernumber) / 2
ret = 32 + (128 * ypositionformula(battlernumber) / 2)
else
ret = 96 - 8 * (battlernumber / 2)
ret = 96 - (8 * (battlernumber / 2))
end
return ret
end
@@ -319,8 +319,8 @@ class HallOfFame_Scene
Graphics.width - 192, Graphics.height - 54, 2, BASECOLOR, SHADOWCOLOR]
]
if (hallNumber > -1)
textPositions.push([_INTL("Hall of Fame No."), Graphics.width / 2 - 104, -6, 0, BASECOLOR, SHADOWCOLOR])
textPositions.push([hallNumber.to_s, Graphics.width / 2 + 104, -6, 1, BASECOLOR, SHADOWCOLOR])
textPositions.push([_INTL("Hall of Fame No."), (Graphics.width / 2) - 104, -6, 0, BASECOLOR, SHADOWCOLOR])
textPositions.push([hallNumber.to_s, (Graphics.width / 2) + 104, -6, 1, BASECOLOR, SHADOWCOLOR])
end
pbDrawTextPositions(overlay, textPositions)
end
@@ -118,14 +118,14 @@ _END_
pcred = PluginManager.credits(plugin)
plugin_credits << "\"#{plugin}\" v.#{PluginManager.version(plugin)} by:\n"
if pcred.size >= 5
plugin_credits << pcred[0] + "\n"
plugin_credits << (pcred[0] + "\n")
i = 1
until i >= pcred.size
plugin_credits << pcred[i] + "<s>" + (pcred[i + 1] || "") + "\n"
plugin_credits << (pcred[i] + "<s>" + (pcred[i + 1] || "") + "\n")
i += 2
end
else
pcred.each { |name| plugin_credits << name + "\n" }
pcred.each { |name| plugin_credits << (name + "\n") }
end
plugin_credits << "\n"
end
@@ -148,7 +148,7 @@ _END_
credit_bitmap = Bitmap.new(Graphics.width, @bitmap_height + 16)
pbSetSystemFont(credit_bitmap)
for j in 0...lines_per_bitmap
line = credit_lines[i * lines_per_bitmap + j]
line = credit_lines[(i * lines_per_bitmap) + j]
next if !line
line = line.split("<s>")
xpos = 0
@@ -156,29 +156,29 @@ _END_
linewidth = Graphics.width
for k in 0...line.length
if line.length > 1
xpos = (k == 0) ? 0 : 20 + Graphics.width / 2
xpos = (k == 0) ? 0 : 20 + (Graphics.width / 2)
align = (k == 0) ? 2 : 0 # Right align : left align
linewidth = Graphics.width / 2 - 20
linewidth = (Graphics.width / 2) - 20
end
credit_bitmap.font.color = TEXT_SHADOW_COLOR
credit_bitmap.draw_text(xpos, j * 32 + 12, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 12, linewidth, 32, line[k], align)
credit_bitmap.font.color = TEXT_OUTLINE_COLOR
credit_bitmap.draw_text(xpos + 2, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32 + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, j * 32 + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32 + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, j * 32 + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, j * 32 + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, j * 32 + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 2, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos + 2, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos - 2, (j * 32) + 6, linewidth, 32, line[k], align)
credit_bitmap.font.color = TEXT_BASE_COLOR
credit_bitmap.draw_text(xpos, j * 32 + 4, linewidth, 32, line[k], align)
credit_bitmap.draw_text(xpos, (j * 32) + 4, linewidth, 32, line[k], align)
end
end
credit_sprite = Sprite.new(text_viewport)
credit_sprite.bitmap = credit_bitmap
credit_sprite.z = 9998
credit_sprite.oy = @realOY - @bitmap_height * i
credit_sprite.oy = @realOY - (@bitmap_height * i)
@credit_sprites[i] = credit_sprite
end
#-------------------------------
@@ -245,6 +245,6 @@ _END_
return if cancel?
return if last?
@realOY += SCROLL_SPEED * delta
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - @bitmap_height * i }
@credit_sprites.each_with_index { |s, i| s.oy = @realOY - (@bitmap_height * i) }
end
end
+4 -8
View File
@@ -143,8 +143,8 @@ class PokemonPauseMenu
@scene.pbShowInfo(_INTL("Caught: None\nBalls: {1}", pbBugContestState.ballcount))
end
commands[cmdQuit = commands.length] = _INTL("Quit Contest")
else
commands[cmdSave = commands.length] = _INTL("Save") if $game_system && !$game_system.save_disabled
elsif $game_system && !$game_system.save_disabled
commands[cmdSave = commands.length] = _INTL("Save")
end
commands[cmdOption = commands.length] = _INTL("Options")
commands[cmdDebug = commands.length] = _INTL("Debug") if $DEBUG
@@ -160,8 +160,7 @@ class PokemonPauseMenu
screen.pbStartScreen
@scene.pbRefresh
}
else
if $player.pokedex.accessible_dexes.length == 1
elsif $player.pokedex.accessible_dexes.length == 1
$PokemonGlobal.pokedexDex = $player.pokedex.accessible_dexes[0]
pbFadeOutIn {
scene = PokemonPokedex_Scene.new
@@ -177,7 +176,6 @@ class PokemonPauseMenu
@scene.pbRefresh
}
end
end
elsif cmdPokemon >= 0 && command == cmdPokemon
pbPlayDecisionSE
hiddenmove = nil
@@ -243,15 +241,13 @@ class PokemonPauseMenu
else
pbShowMenu
end
else
if pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
elsif pbConfirmMessage(_INTL("Would you like to end the Contest now?"))
@scene.pbEndScene
pbBugContestState.pbStartJudging
return
else
pbShowMenu
end
end
elsif cmdSave >= 0 && command == cmdSave
@scene.pbHideMenu
scene = PokemonSave_Scene.new
+5 -4
View File
@@ -23,10 +23,11 @@ class Window_DexesList < Window_CommandPokemon
sprintf("%d", @commands2[index][1]), self.baseColor, self.shadowColor, 1)
allseen = (@commands2[index][0] >= @commands2[index][2])
allown = (@commands2[index][1] >= @commands2[index][2])
pbDrawImagePositions(self.contents, [
["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 236, rect.y + 2, (allseen) ? 24 : 0, 0, 24, 24],
["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 332, rect.y + 2, (allown) ? 24 : 0, 24, 24, 24]
])
pbDrawImagePositions(
self.contents,
[["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 236, rect.y + 2, (allseen) ? 24 : 0, 0, 24, 24],
["Graphics/Pictures/Pokedex/icon_menuseenown", rect.x + 332, rect.y + 2, (allown) ? 24 : 0, 24, 24, 24]]
)
end
end
end
+32 -32
View File
@@ -169,7 +169,7 @@ class PokedexSearchSelectionSprite < SpriteWrapper
self.y = 52
when 1, 2, 3, 4 # Name, type, height, weight
self.x = 114
self.y = 110 + (@index - 1) * 52
self.y = 110 + ((@index - 1) * 52)
when 5 # Color
self.x = 382
self.y = 110
@@ -177,7 +177,7 @@ class PokedexSearchSelectionSprite < SpriteWrapper
self.x = 420
self.y = 214
when 7, 8, 9 # Reset, start, cancel
self.x = 4 + (@index - 7) * 176
self.x = 4 + ((@index - 7) * 176)
self.y = 334
end
else # Parameter screen
@@ -207,11 +207,11 @@ class PokedexSearchSelectionSprite < SpriteWrapper
case @index
when -1 # Blank option
if @mode == 3 || @mode == 4 # Height/weight range
self.x = @xstart + (@cmds + 1) * @xgap * (@minmax % 2)
self.y = @ystart + @ygap * ((@minmax + 1) % 2)
self.x = @xstart + ((@cmds + 1) * @xgap * (@minmax % 2))
self.y = @ystart + (@ygap * ((@minmax + 1) % 2))
else
self.x = @xstart + (@cols - 1) * @xgap
self.y = @ystart + (@cmds / @cols).floor * @ygap
self.x = @xstart + ((@cols - 1) * @xgap)
self.y = @ystart + ((@cmds / @cols).floor * @ygap)
end
when -2 # OK
self.x = 4
@@ -223,19 +223,19 @@ class PokedexSearchSelectionSprite < SpriteWrapper
case @mode
when 0, 1, 2, 5, 6 # Order, name, type, color, shape
if @index >= @cmds
self.x = @xstart + (@cols - 1) * @xgap
self.y = @ystart + (@cmds / @cols).floor * @ygap
self.x = @xstart + ((@cols - 1) * @xgap)
self.y = @ystart + ((@cmds / @cols).floor * @ygap)
else
self.x = @xstart + (@index % @cols) * @xgap
self.y = @ystart + (@index / @cols).floor * @ygap
self.x = @xstart + ((@index % @cols) * @xgap)
self.y = @ystart + ((@index / @cols).floor * @ygap)
end
when 3, 4 # Height, weight
if @index >= @cmds
self.x = @xstart + (@cmds + 1) * @xgap * ((@minmax + 1) % 2)
self.x = @xstart + ((@cmds + 1) * @xgap * ((@minmax + 1) % 2))
else
self.x = @xstart + (@index + 1) * @xgap
self.x = @xstart + ((@index + 1) * @xgap)
end
self.y = @ystart + @ygap * ((@minmax + 1) % 2)
self.y = @ystart + (@ygap * ((@minmax + 1) % 2))
end
end
end
@@ -462,8 +462,8 @@ class PokemonPokedex_Scene
overlay.blt(468, y, @sliderbitmap.bitmap, Rect.new(40, 0, 40, 8))
i = 0
while i * 16 < boxheight - 8 - 16
height = [boxheight - 8 - 16 - i * 16, 16].min
overlay.blt(468, y + 8 + i * 16, @sliderbitmap.bitmap, Rect.new(40, 8, 40, height))
height = [boxheight - 8 - 16 - (i * 16), 16].min
overlay.blt(468, y + 8 + (i * 16), @sliderbitmap.bitmap, Rect.new(40, 8, 40, height))
i += 1
end
overlay.blt(468, y + boxheight - 16, @sliderbitmap.bitmap, Rect.new(40, 24, 40, 16))
@@ -615,11 +615,11 @@ class PokemonPokedex_Scene
when 2 # Type icons
for i in 0...2
if !sel[i] || sel[i] < 0
textpos.push(["----", 298 + 128 * i, 58, 2, base, shadow, 1])
textpos.push(["----", 298 + (128 * i), 58, 2, base, shadow, 1])
else
type_number = @typeCommands[sel[i]].icon_position
typerect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(250 + 128 * i, 58, @typebitmap.bitmap, typerect)
overlay.blt(250 + (128 * i), 58, @typebitmap.bitmap, typerect)
end
end
when 3 # Height range
@@ -677,10 +677,10 @@ class PokemonPokedex_Scene
end
# Draw selected option(s) button graphic
if [3, 4].include?(mode) # Height, weight
xpos1 = xstart + (sel[0] + 1) * xgap
xpos1 = xstart + ((sel[0] + 1) * xgap)
xpos1 = xstart if sel[0] < -1
xpos2 = xstart + (sel[1] + 1) * xgap
xpos2 = xstart + cols * xgap if sel[1] < 0
xpos2 = xstart + ((sel[1] + 1) * xgap)
xpos2 = xstart + (cols * xgap) if sel[1] < 0
xpos2 = xstart if sel[1] >= cols - 1
ypos1 = ystart + 172
ypos2 = ystart + 28
@@ -698,9 +698,9 @@ class PokemonPokedex_Scene
for i in 0...sel.length
selrect = Rect.new(0, selbuttony, @selbitmap.bitmap.width, selbuttonheight)
if sel[i] >= 0
overlay.blt(xstart + (sel[i] % cols) * xgap, ystart + (sel[i] / cols).floor * ygap, @selbitmap.bitmap, selrect)
overlay.blt(xstart + ((sel[i] % cols) * xgap), ystart + ((sel[i] / cols).floor * ygap), @selbitmap.bitmap, selrect)
else
overlay.blt(xstart + (cols - 1) * xgap, ystart + (cmds.length / cols).floor * ygap, @selbitmap.bitmap, selrect)
overlay.blt(xstart + ((cols - 1) * xgap), ystart + ((cmds.length / cols).floor * ygap), @selbitmap.bitmap, selrect)
end
end
end
@@ -708,35 +708,35 @@ class PokemonPokedex_Scene
case mode
when 0, 1 # Order, name
for i in 0...cmds.length
x = xstart + halfwidth + (i % cols) * xgap
y = ystart + 6 + (i / cols).floor * ygap
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 6 + ((i / cols).floor * ygap)
textpos.push([cmds[i], x, y, 2, base, shadow, 1])
end
if mode != 0
textpos.push([(mode == 1) ? "-" : "----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1])
end
when 2 # Type
typerect = Rect.new(0, 0, 96, 32)
for i in 0...cmds.length
typerect.y = @typeCommands[i].icon_position * 32
overlay.blt(xstart + 14 + (i % cols) * xgap, ystart + 6 + (i / cols).floor * ygap, @typebitmap.bitmap, typerect)
overlay.blt(xstart + 14 + ((i % cols) * xgap), ystart + 6 + ((i / cols).floor * ygap), @typebitmap.bitmap, typerect)
end
textpos.push(["----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1])
when 5 # Color
for i in 0...cmds.length
x = xstart + halfwidth + (i % cols) * xgap
y = ystart + 6 + (i / cols).floor * ygap
x = xstart + halfwidth + ((i % cols) * xgap)
y = ystart + 6 + ((i / cols).floor * ygap)
textpos.push([cmds[i].name, x, y, 2, base, shadow, 1])
end
textpos.push(["----",
xstart + halfwidth + (cols - 1) * xgap, ystart + 6 + (cmds.length / cols).floor * ygap, 2, base, shadow, 1])
xstart + halfwidth + ((cols - 1) * xgap), ystart + 6 + ((cmds.length / cols).floor * ygap), 2, base, shadow, 1])
when 6 # Shape
shaperect = Rect.new(0, 0, 60, 60)
for i in 0...cmds.length
shaperect.y = @shapeCommands[i].icon_position * 60
overlay.blt(xstart + 4 + (i % cols) * xgap, ystart + 4 + (i / cols).floor * ygap, @shapebitmap.bitmap, shaperect)
overlay.blt(xstart + 4 + ((i % cols) * xgap), ystart + 4 + ((i / cols).floor * ygap), @shapebitmap.bitmap, shaperect)
end
end
# Draw all text
@@ -986,7 +986,7 @@ class PokemonPokedex_Scene
else
if Input.trigger?(Input::UP)
if index == -1 # From blank
index = cmds.length - 1 - (cmds.length - 1) % cols - 1
index = cmds.length - 1 - ((cmds.length - 1) % cols) - 1
elsif index == -2 # From OK
index = ((cmds.length - 1) / cols).floor * cols
elsif index == -3 && mode == 0 # From Cancel
+15 -13
View File
@@ -28,11 +28,12 @@ class PokemonPokedexInfo_Scene
@sprites["areamap"].y += (Graphics.height + 32 - @sprites["areamap"].bitmap.height) / 2
for hidden in Settings::REGION_MAP_EXTRAS
if hidden[0] == @region && hidden[1] > 0 && $game_switches[hidden[1]]
pbDrawImagePositions(@sprites["areamap"].bitmap, [
["Graphics/Pictures/#{hidden[4]}",
pbDrawImagePositions(
@sprites["areamap"].bitmap,
[["Graphics/Pictures/#{hidden[4]}",
hidden[2] * PokemonRegionMap_Scene::SQUARE_WIDTH,
hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT]
])
hidden[3] * PokemonRegionMap_Scene::SQUARE_HEIGHT]]
)
end
end
@sprites["areahighlight"] = BitmapSprite.new(Graphics.width, Graphics.height, @viewport)
@@ -261,7 +262,7 @@ class PokemonPokedexInfo_Scene
species_data.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 32, 96, 32)
overlay.blt(296 + 100 * i, 120, @typebitmap.bitmap, type_rect)
overlay.blt(296 + (100 * i), 120, @typebitmap.bitmap, type_rect)
end
else
# Write the category
@@ -316,16 +317,16 @@ class PokemonPokedexInfo_Scene
mapsize = map_metadata.town_map_size
if mapsize && mapsize[0] && mapsize[0] > 0
sqwidth = mapsize[0]
sqheight = (mapsize[1].length * 1.0 / mapsize[0]).ceil
sqheight = (mapsize[1].length.to_f / mapsize[0]).ceil
for i in 0...sqwidth
for j in 0...sqheight
if mapsize[1][i + j * sqwidth, 1].to_i > 0
points[mappos[1] + i + (mappos[2] + j) * mapwidth] = true
if mapsize[1][i + (j * sqwidth), 1].to_i > 0
points[mappos[1] + i + ((mappos[2] + j) * mapwidth)] = true
end
end
end
else
points[mappos[1] + mappos[2] * mapwidth] = true
points[mappos[1] + (mappos[2] * mapwidth)] = true
end
end
# Draw coloured squares on each square of the region map with a nest
@@ -357,10 +358,11 @@ class PokemonPokedexInfo_Scene
# Set the text
textpos = []
if points.length == 0
pbDrawImagePositions(overlay, [
[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188]
])
textpos.push([_INTL("Area unknown"), Graphics.width / 2, Graphics.height / 2 - 6, 2, base, shadow])
pbDrawImagePositions(
overlay,
[[sprintf("Graphics/Pictures/Pokedex/overlay_areanone"), 108, 188]]
)
textpos.push([_INTL("Area unknown"), Graphics.width / 2, (Graphics.height / 2) - 6, 2, base, shadow])
end
textpos.push([pbGetMessage(MessageTypes::RegionNames, @region), 414, 38, 2, base, shadow])
textpos.push([_INTL("{1}'s area", GameData::Species.get(@species).name),
+8 -12
View File
@@ -140,7 +140,7 @@ class PokemonPartyBlankPanel < SpriteWrapper
def initialize(_pokemon, index, viewport = nil)
super(viewport)
self.x = (index % 2) * Graphics.width / 2
self.y = 16 * (index % 2) + 96 * (index / 2)
self.y = (16 * (index % 2)) + (96 * (index / 2))
@panelbgsprite = AnimatedBitmap.new("Graphics/Pictures/Party/panel_blank")
self.bitmap = @panelbgsprite.bitmap
@text = nil
@@ -177,7 +177,7 @@ class PokemonPartyPanel < SpriteWrapper
@active = (index == 0) # true = rounded panel, false = rectangular panel
@refreshing = true
self.x = (index % 2) * Graphics.width / 2
self.y = 16 * (index % 2) + 96 * (index / 2)
self.y = (16 * (index % 2)) + (96 * (index / 2))
@panelbgsprite = ChangelingSprite.new(0, 0, viewport)
@panelbgsprite.z = self.z
if @active # Rounded panel
@@ -374,7 +374,7 @@ class PokemonPartyPanel < SpriteWrapper
textpos.push([sprintf("% 3d /% 3d", @pokemon.hp, @pokemon.totalhp), 224, 54, 1, basecolor, shadowcolor])
# Draw HP bar
if @pokemon.hp > 0
w = @pokemon.hp * 96 * 1.0 / @pokemon.totalhp
w = @pokemon.hp * 96 / @pokemon.totalhp.to_f
w = 1 if w < 1
w = ((w / 2).round) * 2
hpzone = 0
@@ -415,16 +415,14 @@ class PokemonPartyPanel < SpriteWrapper
pbDrawImagePositions(@overlaysprite.bitmap,
[["Graphics/Pictures/Party/overlay_lv", 20, 70, 0, 0, 22, 14]])
pbSetSmallFont(@overlaysprite.bitmap)
pbDrawTextPositions(@overlaysprite.bitmap, [
[@pokemon.level.to_s, 42, 57, 0, basecolor, shadowcolor]
])
pbDrawTextPositions(@overlaysprite.bitmap,
[[@pokemon.level.to_s, 42, 57, 0, basecolor, shadowcolor]])
end
# Draw annotation text
if @text && @text.length > 0
pbSetSystemFont(@overlaysprite.bitmap)
pbDrawTextPositions(@overlaysprite.bitmap, [
[@text, 96, 52, 0, basecolor, shadowcolor]
])
pbDrawTextPositions(@overlaysprite.bitmap,
[[@text, 96, 52, 0, basecolor, shadowcolor]])
end
end
@refreshing = false
@@ -514,12 +512,10 @@ class PokemonParty_Scene
pbPlayDecisionSE if @sprites["messagebox"].pausing?
@sprites["messagebox"].resume
end
else
if Input.trigger?(Input::BACK) || Input.trigger?(Input::USE)
elsif Input.trigger?(Input::BACK) || Input.trigger?(Input::USE)
break
end
end
end
@sprites["messagebox"].visible = false
@sprites["helpwindow"].visible = true
end
+16 -19
View File
@@ -78,7 +78,7 @@ class RibbonSelectionSprite < MoveSelectionSprite
def refresh
w = @movesel.width
h = @movesel.height / 2
self.x = 228 + (self.index % 4) * 68
self.x = 228 + ((self.index % 4) * 68)
self.y = 76 + ((self.index / 4).floor * 68)
self.bitmap = @movesel.bitmap
if self.preselected
@@ -291,7 +291,7 @@ class PokemonSummary_Scene
(@markingbitmap.bitmap.width / MARK_WIDTH).times do |i|
markrect.x = i * MARK_WIDTH
markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT
bitmap.blt(x + i * MARK_WIDTH, y, @markingbitmap.bitmap, markrect)
bitmap.blt(x + (i * MARK_WIDTH), y, @markingbitmap.bitmap, markrect)
end
end
@@ -459,16 +459,15 @@ class PokemonSummary_Scene
@pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (@pokemon.types.length == 1) ? 402 : 370 + 66 * i
type_x = (@pokemon.types.length == 1) ? 402 : 370 + (66 * i)
overlay.blt(type_x, 146, @typebitmap.bitmap, type_rect)
end
# Draw Exp bar
if @pokemon.level < GameData::GrowthRate.max_level
w = @pokemon.exp_fraction * 128
w = ((w / 2).round) * 2
pbDrawImagePositions(overlay, [
["Graphics/Pictures/Summary/overlay_exp", 362, 372, 0, 0, w, 6]
])
pbDrawImagePositions(overlay,
[["Graphics/Pictures/Summary/overlay_exp", 362, 372, 0, 0, w, 6]])
end
end
@@ -663,7 +662,7 @@ class PokemonSummary_Scene
pbDrawTextPositions(overlay, textpos)
# Draw HP bar
if @pokemon.hp > 0
w = @pokemon.hp * 96 * 1.0 / @pokemon.totalhp
w = @pokemon.hp * 96 / @pokemon.totalhp.to_f
w = 1 if w < 1
w = ((w / 2).round) * 2
hpzone = 0
@@ -792,7 +791,7 @@ class PokemonSummary_Scene
@pokemon.types.each_with_index do |type, i|
type_number = GameData::Type.get(type).icon_position
type_rect = Rect.new(0, type_number * 28, 64, 28)
type_x = (@pokemon.types.length == 1) ? 130 : 96 + 70 * i
type_x = (@pokemon.types.length == 1) ? 130 : 96 + (70 * i)
overlay.blt(type_x, 78, @typebitmap.bitmap, type_rect)
end
end
@@ -843,12 +842,12 @@ class PokemonSummary_Scene
# Show all ribbons
imagepos = []
coord = 0
for i in @ribbonOffset * 4...@ribbonOffset * 4 + 12
for i in @ribbonOffset * 4...(@ribbonOffset * 4) + 12
break if !@pokemon.ribbons[i]
ribbon_data = GameData::Ribbon.get(@pokemon.ribbons[i])
ribn = ribbon_data.icon_position
imagepos.push(["Graphics/Pictures/ribbons",
230 + 68 * (coord % 4), 78 + 68 * (coord / 4).floor,
230 + (68 * (coord % 4)), 78 + (68 * (coord / 4).floor),
64 * (ribn % 8), 64 * (ribn / 8).floor, 64, 64])
coord += 1
end
@@ -939,8 +938,7 @@ class PokemonSummary_Scene
break if !switching
@sprites["movepresel"].visible = false
switching = false
else
if !@pokemon.shadowPokemon?
elsif !@pokemon.shadowPokemon?
if !switching
@sprites["movepresel"].index = selmove
@sprites["movepresel"].visible = true
@@ -955,7 +953,6 @@ class PokemonSummary_Scene
drawSelectedMove(nil, @pokemon.moves[selmove])
end
end
end
elsif Input.trigger?(Input::UP)
selmove -= 1
if selmove < Pokemon::MAX_MOVES && selmove >= @pokemon.numMoves
@@ -1009,7 +1006,7 @@ class PokemonSummary_Scene
if !switching
if @pokemon.ribbons[selribbon]
pbPlayDecisionSE
@sprites["ribbonpresel"].index = selribbon - @ribbonOffset * 4
@sprites["ribbonpresel"].index = selribbon - (@ribbonOffset * 4)
oldselribbon = selribbon
@sprites["ribbonpresel"].visible = true
switching = true
@@ -1056,8 +1053,8 @@ class PokemonSummary_Scene
@ribbonOffset = (selribbon / 4).floor - 2 if selribbon >= (@ribbonOffset + 3) * 4
@ribbonOffset = 0 if @ribbonOffset < 0
@ribbonOffset = numRows - 3 if @ribbonOffset > numRows - 3
@sprites["ribbonsel"].index = selribbon - @ribbonOffset * 4
@sprites["ribbonpresel"].index = oldselribbon - @ribbonOffset * 4
@sprites["ribbonsel"].index = selribbon - (@ribbonOffset * 4)
@sprites["ribbonpresel"].index = oldselribbon - (@ribbonOffset * 4)
drawSelectedRibbon(@pokemon.ribbons[selribbon])
end
end
@@ -1083,7 +1080,7 @@ class PokemonSummary_Scene
(@markingbitmap.bitmap.width / MARK_WIDTH).times do |i|
markrect.x = i * MARK_WIDTH
markrect.y = [(markings[i] || 0), mark_variants - 1].min * MARK_HEIGHT
@sprites["markingoverlay"].bitmap.blt(300 + 58 * (i % 3), 154 + 50 * (i / 3),
@sprites["markingoverlay"].bitmap.blt(300 + (58 * (i % 3)), 154 + (50 * (i / 3)),
@markingbitmap.bitmap, markrect)
end
textpos = [
@@ -1095,8 +1092,8 @@ class PokemonSummary_Scene
redraw = false
end
# Reposition the cursor
@sprites["markingsel"].x = 284 + 58 * (index % 3)
@sprites["markingsel"].y = 144 + 50 * (index / 3)
@sprites["markingsel"].x = 284 + (58 * (index % 3))
@sprites["markingsel"].y = 144 + (50 * (index / 3))
case index
when 6 # OK
@sprites["markingsel"].x = 284
+24 -26
View File
@@ -47,9 +47,9 @@ class Window_PokemonBag < Window_DrawableCommand
item > self.top_item + self.page_item_max
return Rect.new(0, 0, 0, 0)
else
cursor_width = (self.width - self.borderX - (@column_max - 1) * @column_spacing) / @column_max
cursor_width = (self.width - self.borderX - ((@column_max - 1) * @column_spacing)) / @column_max
x = item % @column_max * (cursor_width + @column_spacing)
y = item / @column_max * @row_height - @virtualOy
y = (item / @column_max * @row_height) - @virtualOy
return Rect.new(x, y, cursor_width, @row_height)
end
end
@@ -80,13 +80,13 @@ class Window_PokemonBag < Window_DrawableCommand
)
if GameData::Item.get(item).is_important?
if @bag.registered?(item)
pbDrawImagePositions(self.contents, [
["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]
])
pbDrawImagePositions(
self.contents,
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 0, -1, 24]])
elsif pbCanRegisterItem?(item)
pbDrawImagePositions(self.contents, [
["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]
])
pbDrawImagePositions(
self.contents,
[["Graphics/Pictures/Bag/icon_register", rect.x + rect.width - 72, rect.y + 8, 0, 24, -1, 24]])
end
else
qty = (@filterlist) ? thispocket[@filterlist[@pocket][index]][1] : thispocket[index][1]
@@ -190,7 +190,7 @@ class PokemonBag_Scene
@sprites["rightarrow"].y = 76
@sprites["rightarrow"].visible = (!@choosing || numfilledpockets > 1)
@sprites["rightarrow"].play
@sprites["itemlist"] = Window_PokemonBag.new(@bag, @filterlist, lastpocket, 168, -8, 314, 40 + 32 + ITEMSVISIBLE * 32)
@sprites["itemlist"] = Window_PokemonBag.new(@bag, @filterlist, lastpocket, 168, -8, 314, 40 + 32 + (ITEMSVISIBLE * 32))
@sprites["itemlist"].viewport = @viewport
@sprites["itemlist"].pocket = lastpocket
@sprites["itemlist"].index = @bag.last_viewed_index(lastpocket)
@@ -270,13 +270,13 @@ class PokemonBag_Scene
for i in 1...@bag.pockets.length
if @filterlist[i].length == 0
@sprites["pocketicon"].bitmap.blt(
6 + (i - 1) * 22, 6, @pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20)
6 + ((i - 1) * 22), 6, @pocketbitmap.bitmap, Rect.new((i - 1) * 20, 28, 20, 20)
)
end
end
end
@sprites["pocketicon"].bitmap.blt(
2 + (@sprites["itemlist"].pocket - 1) * 22, 2, @pocketbitmap.bitmap,
2 + ((@sprites["itemlist"].pocket - 1) * 22), 2, @pocketbitmap.bitmap,
Rect.new((@sprites["itemlist"].pocket - 1) * 28, 0, 28, 28)
)
# Refresh the item window
@@ -290,9 +290,9 @@ class PokemonBag_Scene
overlay = @sprites["overlay"].bitmap
overlay.clear
# Draw the pocket name
pbDrawTextPositions(overlay, [
[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]
])
pbDrawTextPositions(
overlay,
[[PokemonBag.pocket_names[@bag.last_viewed_pocket - 1], 94, 176, 2, POCKETNAMEBASECOLOR, POCKETNAMESHADOWCOLOR]])
# Draw slider arrows
showslider = false
if itemlist.top_row > 0
@@ -314,8 +314,8 @@ class PokemonBag_Scene
overlay.blt(470, y, @sliderbitmap.bitmap, Rect.new(36, 0, 36, 4))
i = 0
while i * 16 < boxheight - 4 - 18
height = [boxheight - 4 - 18 - i * 16, 16].min
overlay.blt(470, y + 4 + i * 16, @sliderbitmap.bitmap, Rect.new(36, 4, 36, height))
height = [boxheight - 4 - 18 - (i * 16), 16].min
overlay.blt(470, y + 4 + (i * 16), @sliderbitmap.bitmap, Rect.new(36, 4, 36, height))
i += 1
end
overlay.blt(470, y + boxheight - 18, @sliderbitmap.bitmap, Rect.new(36, 20, 36, 18))
@@ -377,8 +377,7 @@ class PokemonBag_Scene
pbPlayCancelSE
pbRefresh
end
else
# Change pockets
else # Change pockets
if Input.trigger?(Input::LEFT)
newpocket = itemwindow.pocket
loop do
@@ -386,8 +385,8 @@ class PokemonBag_Scene
break if !@choosing || newpocket == itemwindow.pocket
if @filterlist
break if @filterlist[newpocket].length > 0
else
break if @bag.pockets[newpocket].length > 0
elsif @bag.pockets[newpocket].length > 0
break
end
end
if itemwindow.pocket != newpocket
@@ -404,8 +403,8 @@ class PokemonBag_Scene
break if !@choosing || newpocket == itemwindow.pocket
if @filterlist
break if @filterlist[newpocket].length > 0
else
break if @bag.pockets[newpocket].length > 0
elsif @bag.pockets[newpocket].length > 0
break
end
end
if itemwindow.pocket != newpocket
@@ -539,11 +538,10 @@ class PokemonBagScreen
elsif cmdDebug >= 0 && command == cmdDebug # Debug
command = 0
loop do
command = @scene.pbShowCommands(_INTL("Do what with {1}?", itemname), [
_INTL("Change quantity"),
command = @scene.pbShowCommands(_INTL("Do what with {1}?", itemname),
[_INTL("Change quantity"),
_INTL("Make Mystery Gift"),
_INTL("Cancel")
], command)
_INTL("Cancel")], command)
case command
### Cancel ###
when -1, 2

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