mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-07 21:24:59 +00:00
Minor refactoring to kill various Rubocop warnings
This commit is contained in:
@@ -277,7 +277,7 @@ end
|
||||
# Used to determine whether a data file exists (rather than a graphics or
|
||||
# audio file). Doesn't check RTP, but does check encrypted archives.
|
||||
|
||||
# Note: pbGetFileChar checks anything added in MKXP's RTP setting,
|
||||
# NOTE: pbGetFileChar checks anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
def pbRgssExists?(filename)
|
||||
if safeExists?("./Game.rgssad")
|
||||
@@ -291,7 +291,7 @@ end
|
||||
# Opens an IO, even if the file is in an encrypted archive.
|
||||
# Doesn't check RTP for the file.
|
||||
|
||||
# Note: load_data checks anything added in MKXP's RTP setting,
|
||||
# NOTE: load_data checks anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
def pbRgssOpen(file,mode=nil)
|
||||
#File.open("debug.txt","ab") { |fw| fw.write([file,mode,Time.now.to_f].inspect+"\r\n") }
|
||||
@@ -344,7 +344,7 @@ end
|
||||
# Gets the contents of a file. Doesn't check RTP, but does check
|
||||
# encrypted archives.
|
||||
|
||||
# Note: load_data will check anything added in MKXP's RTP setting,
|
||||
# NOTE: load_data will check anything added in MKXP's RTP setting,
|
||||
# and matching mount points added through System.mount
|
||||
def pbGetFileString(file)
|
||||
file = canonicalize(file)
|
||||
|
||||
@@ -31,7 +31,7 @@ def pbPostData(url, postdata, filename=nil, depth=0)
|
||||
return ret if !ret.is_a?(Hash)
|
||||
return "" if ret[:status] != 200
|
||||
return ret[:body] if !filename
|
||||
File.open(filename, "wb"){|f|f.write(ret[:body])}
|
||||
File.open(filename, "wb") { |f| f.write(ret[:body]) }
|
||||
return ""
|
||||
end
|
||||
return ""
|
||||
|
||||
@@ -259,7 +259,8 @@ def pbGetText(infile)
|
||||
end
|
||||
end
|
||||
i=0
|
||||
loop do break unless i<section.length
|
||||
loop do
|
||||
break unless i < section.length
|
||||
if itemlength==3
|
||||
if !section[i][/^\d+$/]
|
||||
raise _INTL("Expected a number in section {1}, got {2} instead",name,section[i])
|
||||
|
||||
@@ -212,13 +212,13 @@ class Interpreter
|
||||
# * Freezes all events on the map (for use at the beginning of common events)
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbGlobalLock
|
||||
$game_map.events.values.each { |event| event.minilock }
|
||||
$game_map.events.each_value { |event| event.minilock }
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Unfreezes all events on the map (for use at the end of common events)
|
||||
#-----------------------------------------------------------------------------
|
||||
def pbGlobalUnlock
|
||||
$game_map.events.values.each { |event| event.unlock }
|
||||
$game_map.events.each_value { |event| event.unlock }
|
||||
end
|
||||
#-----------------------------------------------------------------------------
|
||||
# * Gets the next index in the interpreter, ignoring certain commands between messages
|
||||
|
||||
@@ -13,21 +13,15 @@ class Event
|
||||
end
|
||||
|
||||
# Removes an event handler procedure from the event.
|
||||
def -(method)
|
||||
for i in 0...@callbacks.length
|
||||
next if @callbacks[i]!=method
|
||||
@callbacks.delete_at(i)
|
||||
break
|
||||
end
|
||||
def -(other)
|
||||
@callbacks.delete(other)
|
||||
return self
|
||||
end
|
||||
|
||||
# Adds an event handler procedure from the event.
|
||||
def +(method)
|
||||
for i in 0...@callbacks.length
|
||||
return self if @callbacks[i]==method
|
||||
end
|
||||
@callbacks.push(method)
|
||||
def +(other)
|
||||
return self if @callbacks.include?(other)
|
||||
@callbacks.push(other)
|
||||
return self
|
||||
end
|
||||
|
||||
|
||||
@@ -248,17 +248,13 @@ class Game_System
|
||||
return (@battle_bgm) ? @battle_bgm : $data_system.battle_bgm
|
||||
end
|
||||
|
||||
def battle_bgm=(battle_bgm)
|
||||
@battle_bgm = battle_bgm
|
||||
end
|
||||
attr_writer :battle_bgm
|
||||
|
||||
def battle_end_me
|
||||
return (@battle_end_me) ? @battle_end_me : $data_system.battle_end_me
|
||||
end
|
||||
|
||||
def battle_end_me=(battle_end_me)
|
||||
@battle_end_me = battle_end_me
|
||||
end
|
||||
attr_writer :battle_end_me
|
||||
|
||||
################################################################################
|
||||
|
||||
@@ -270,9 +266,7 @@ class Game_System
|
||||
end
|
||||
end
|
||||
|
||||
def windowskin_name=(windowskin_name)
|
||||
@windowskin_name = windowskin_name
|
||||
end
|
||||
attr_writer :windowskin_name
|
||||
|
||||
def update
|
||||
@timer -= 1 if @timer_working && @timer>0
|
||||
|
||||
@@ -40,7 +40,7 @@ class Spriteset_Map
|
||||
@@viewport3 = Viewport.new(0, 0, Settings::SCREEN_WIDTH, Settings::SCREEN_HEIGHT) # Flashing
|
||||
@@viewport3.z = 500
|
||||
|
||||
def Spriteset_Map.viewport # For access by Spriteset_Global
|
||||
def self.viewport # For access by Spriteset_Global
|
||||
return @@viewport1
|
||||
end
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ class TilemapRenderer
|
||||
super
|
||||
@timer += Graphics.delta_s
|
||||
# Update the current frame for each autotile
|
||||
@bitmaps.keys.each do |filename|
|
||||
@bitmaps.each_key do |filename|
|
||||
next if !@bitmaps[filename] || @bitmaps[filename].disposed?
|
||||
old_frame = @current_frames[filename]
|
||||
set_current_frame(filename)
|
||||
|
||||
@@ -67,7 +67,7 @@ class TilemapRenderer
|
||||
merge = (srcrect.y % MAX_TEX_SIZE) > ((srcrect.y + srcrect.height) % MAX_TEX_SIZE)
|
||||
srcrect_mod = getWrappedRect(srcrect)
|
||||
if merge
|
||||
# FIXME won't work on heights longer than two columns, but nobody should need
|
||||
# FIXME: won't work on heights longer than two columns, but nobody should need
|
||||
# more than 32k pixels high at once anyway
|
||||
side = {
|
||||
:a => MAX_TEX_SIZE - srcrect_mod.y,
|
||||
|
||||
@@ -6,7 +6,6 @@ class WindowCursorRect < Rect
|
||||
|
||||
def empty
|
||||
return unless needs_update?(0, 0, 0, 0)
|
||||
|
||||
set(0, 0, 0, 0)
|
||||
end
|
||||
|
||||
@@ -16,9 +15,7 @@ class WindowCursorRect < Rect
|
||||
|
||||
def set(x, y, width, height)
|
||||
return unless needs_update?(x, y, width, height)
|
||||
|
||||
super(x, y, width, height)
|
||||
|
||||
@window.width = @window.width
|
||||
end
|
||||
|
||||
@@ -336,9 +333,11 @@ class Window
|
||||
left=dstrect.x
|
||||
top=dstrect.y
|
||||
y = 0
|
||||
loop do break unless y < dstrect.height
|
||||
loop do
|
||||
break unless y < dstrect.height
|
||||
x = 0
|
||||
loop do break unless x < dstrect.width
|
||||
loop do
|
||||
break unless x < dstrect.width
|
||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||
x+=srcrect.width
|
||||
end
|
||||
@@ -527,10 +526,10 @@ class Window
|
||||
rect = Rect.new(margin,margin,
|
||||
width - fullmargin, height - fullmargin)
|
||||
@cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[8])
|
||||
@cursorbitmap.blt(0, 0, @_windowskin, cursorrects[4])# top left
|
||||
@cursorbitmap.blt(width-margin, 0, @_windowskin, cursorrects[5]) # top right
|
||||
@cursorbitmap.blt(0, height-margin, @_windowskin, cursorrects[6]) # bottom right
|
||||
@cursorbitmap.blt(width-margin, height-margin, @_windowskin, cursorrects[7]) # bottom left
|
||||
@cursorbitmap.blt(0, 0, @_windowskin, cursorrects[4]) # top left
|
||||
@cursorbitmap.blt(width-margin, 0, @_windowskin, cursorrects[5]) # top right
|
||||
@cursorbitmap.blt(0, height-margin, @_windowskin, cursorrects[6]) # bottom right
|
||||
@cursorbitmap.blt(width-margin, height-margin, @_windowskin, cursorrects[7]) # bottom left
|
||||
rect = Rect.new(margin, 0,
|
||||
width - fullmargin, margin)
|
||||
@cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[0])
|
||||
|
||||
@@ -456,9 +456,11 @@ class SpriteWindow < Window
|
||||
left=dstrect.x
|
||||
top=dstrect.y
|
||||
y = 0
|
||||
loop do break unless y < dstrect.height
|
||||
loop do
|
||||
break unless y < dstrect.height
|
||||
x = 0
|
||||
loop do break unless x < dstrect.width
|
||||
loop do
|
||||
break unless x < dstrect.width
|
||||
dstbitmap.blt(x+left,y+top,srcbitmap,srcrect)
|
||||
x+=srcrect.width
|
||||
end
|
||||
@@ -714,10 +716,10 @@ class SpriteWindow < Window
|
||||
@sprites["cursor"].src_rect.set(0,0,width,height)
|
||||
rect = Rect.new(margin,margin,width - fullmargin, height - fullmargin)
|
||||
@cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[8])
|
||||
@cursorbitmap.blt(0, 0, @_windowskin, cursorrects[4])# top left
|
||||
@cursorbitmap.blt(width-margin, 0, @_windowskin, cursorrects[5]) # top right
|
||||
@cursorbitmap.blt(0, height-margin, @_windowskin, cursorrects[6]) # bottom right
|
||||
@cursorbitmap.blt(width-margin, height-margin, @_windowskin, cursorrects[7]) # bottom left
|
||||
@cursorbitmap.blt(0, 0, @_windowskin, cursorrects[4]) # top left
|
||||
@cursorbitmap.blt(width-margin, 0, @_windowskin, cursorrects[5]) # top right
|
||||
@cursorbitmap.blt(0, height-margin, @_windowskin, cursorrects[6]) # bottom right
|
||||
@cursorbitmap.blt(width-margin, height-margin, @_windowskin, cursorrects[7]) # bottom left
|
||||
rect = Rect.new(margin, 0,width - fullmargin, margin)
|
||||
@cursorbitmap.stretch_blt(rect, @_windowskin, cursorrects[0])
|
||||
rect = Rect.new(0, margin,margin, height - fullmargin)
|
||||
|
||||
@@ -731,6 +731,7 @@ end
|
||||
#===============================================================================
|
||||
class SpriteWindow_Selectable < SpriteWindow_Base
|
||||
attr_reader :index
|
||||
attr_writer :ignore_input
|
||||
|
||||
def initialize(x, y, width, height)
|
||||
super(x, y, width, height)
|
||||
@@ -789,10 +790,6 @@ class SpriteWindow_Selectable < SpriteWindow_Base
|
||||
end
|
||||
end
|
||||
|
||||
def ignore_input=(value)
|
||||
@ignore_input=value
|
||||
end
|
||||
|
||||
def count
|
||||
return @item_max
|
||||
end
|
||||
|
||||
@@ -106,11 +106,9 @@ class PictureWindow < SpriteWindow_Base
|
||||
self.height=@_iconbitmap.bitmap.height+self.borderY
|
||||
else
|
||||
@_iconbitmap=AnimatedBitmap.new(pathOrBitmap,hue)
|
||||
self.contents=@_iconbitmap ? @_iconbitmap.bitmap : nil
|
||||
self.width=@_iconbitmap ? @_iconbitmap.bitmap.width+self.borderX :
|
||||
32+self.borderX
|
||||
self.height=@_iconbitmap ? @_iconbitmap.bitmap.height+self.borderY :
|
||||
32+self.borderY
|
||||
self.contents = @_iconbitmap&.bitmap
|
||||
self.width = self.borderX + (@_iconbitmap&.bitmap&.width || 32)
|
||||
self.height = self.borderY + (@_iconbitmap&.bitmap&.height || 32)
|
||||
end
|
||||
else
|
||||
@_iconbitmap=nil
|
||||
|
||||
@@ -346,14 +346,14 @@ class ChangelingSprite < SpriteWrapper
|
||||
|
||||
def dispose
|
||||
return if disposed?
|
||||
@bitmaps.values.each { |bm| bm.dispose }
|
||||
@bitmaps.each_value { |bm| bm.dispose }
|
||||
@bitmaps.clear
|
||||
super
|
||||
end
|
||||
|
||||
def update
|
||||
return if disposed?
|
||||
@bitmaps.values.each { |bm| bm.update }
|
||||
@bitmaps.each_value { |bm| bm.update }
|
||||
self.bitmap = (@currentBitmap) ? @currentBitmap.bitmap : nil
|
||||
end
|
||||
end
|
||||
|
||||
@@ -402,9 +402,9 @@ def getFormattedText(bitmap,xDst,yDst,widthDst,heightDst,text,lineheight=32,
|
||||
while text[FORMATREGEXP]
|
||||
textchunks.push($~.pre_match)
|
||||
if $~[3]
|
||||
controls.push([$~[2].downcase,$~[4],-1,$~[1]=="/" ? true : false])
|
||||
controls.push([$~[2].downcase, $~[4], -1, $~[1] == "/"])
|
||||
else
|
||||
controls.push([$~[2].downcase,"",-1,$~[1]=="/" ? true : false])
|
||||
controls.push([$~[2].downcase, "", -1, $~[1] == "/"])
|
||||
end
|
||||
text=$~.post_match
|
||||
end
|
||||
|
||||
@@ -56,6 +56,9 @@ end
|
||||
#
|
||||
#===============================================================================
|
||||
class ChooseNumberParams
|
||||
attr_reader :messageSkin # Set the full path for the message's window skin
|
||||
attr_reader :skin
|
||||
|
||||
def initialize
|
||||
@maxDigits=0
|
||||
@minNumber=0
|
||||
@@ -71,18 +74,10 @@ class ChooseNumberParams
|
||||
@messageSkin=value
|
||||
end
|
||||
|
||||
def messageSkin # Set the full path for the message's window skin
|
||||
@messageSkin
|
||||
end
|
||||
|
||||
def setSkin(value)
|
||||
@skin=value
|
||||
end
|
||||
|
||||
def skin
|
||||
@skin
|
||||
end
|
||||
|
||||
def setNegativesAllowed(value)
|
||||
@negativeAllowed=value
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
#===============================================================================
|
||||
class CharacterEntryHelper
|
||||
attr_reader :text
|
||||
attr_accessor :text
|
||||
attr_accessor :maxlength
|
||||
attr_reader :passwordChar
|
||||
attr_accessor :cursor
|
||||
@@ -14,10 +14,6 @@ class CharacterEntryHelper
|
||||
@cursor=text.scan(/./m).length
|
||||
end
|
||||
|
||||
def text=(value)
|
||||
@text=value
|
||||
end
|
||||
|
||||
def textChars
|
||||
chars=text.scan(/./m)
|
||||
if @passwordChar!=""
|
||||
@@ -502,7 +498,7 @@ class Window_MultilineTextEntry < SpriteWindow_Base
|
||||
self.delete
|
||||
return
|
||||
end
|
||||
Input.gets.each_char{|c|insert(c)}
|
||||
Input.gets.each_char { |c| insert(c) }
|
||||
end
|
||||
|
||||
def refresh
|
||||
|
||||
@@ -79,7 +79,7 @@ def oggfiletime(file)
|
||||
end
|
||||
ret = 0.0
|
||||
for i in 0...pcmlengths.length
|
||||
ret += pcmlengths[i].to_f / rates[i].to_f
|
||||
ret += pcmlengths[i].to_f / rates[i]
|
||||
end
|
||||
return ret * 256.0
|
||||
end
|
||||
@@ -136,7 +136,7 @@ def getPlayTime2(filename)
|
||||
end
|
||||
file.pos = 0
|
||||
# Find the length of an MP3 file
|
||||
while true
|
||||
loop do
|
||||
rstr = ""
|
||||
ateof = false
|
||||
while !file.eof?
|
||||
|
||||
@@ -29,8 +29,8 @@ def pbResolveAudioFile(str,volume=nil,pitch=nil)
|
||||
end
|
||||
if str.is_a?(RPG::AudioFile)
|
||||
if volume || pitch
|
||||
return RPG::AudioFile.new(str.name,volume || str.volume || 100 ,
|
||||
pitch || str.pitch || 100)
|
||||
return RPG::AudioFile.new(str.name, volume || str.volume || 100,
|
||||
pitch || str.pitch || 100)
|
||||
else
|
||||
return str
|
||||
end
|
||||
|
||||
@@ -548,7 +548,7 @@ module Transitions
|
||||
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
|
||||
case @parameters[0] || 0 # Origin
|
||||
case @parameters[0] # Origin
|
||||
when 1 # Top right -> bottom left
|
||||
idx_from_start = j * NUM_SPRITES_X + NUM_SPRITES_X - i - 1
|
||||
when 2 # Bottom left -> top right
|
||||
|
||||
@@ -116,7 +116,7 @@ module GameData
|
||||
"BaseEXP" => [0, "v"],
|
||||
"EffortPoints" => [0, "uuuuuu"],
|
||||
"HiddenAbility" => [0, "*e", :Ability],
|
||||
"StepsToHatch" => [0, "v"],
|
||||
"StepsToHatch" => [0, "v"]
|
||||
}
|
||||
if compiling_forms
|
||||
ret["PokedexForm"] = [0, "u"]
|
||||
|
||||
@@ -30,7 +30,7 @@ module GameData
|
||||
"Shiny" => [:shininess, "b"],
|
||||
"SuperShiny" => [:super_shininess, "b"],
|
||||
"Shadow" => [:shadowness, "b"],
|
||||
"Ball" => [:poke_ball, "e", :Item],
|
||||
"Ball" => [:poke_ball, "e", :Item]
|
||||
}
|
||||
|
||||
extend ClassMethodsSymbols
|
||||
|
||||
@@ -173,9 +173,8 @@ class Battle
|
||||
newLevel = growth_rate.level_from_exp(expFinal)
|
||||
if newLevel<curLevel
|
||||
debugInfo = "Levels: #{curLevel}->#{newLevel} | Exp: #{pkmn.exp}->#{expFinal} | gain: #{expGained}"
|
||||
raise RuntimeError.new(
|
||||
_INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
|
||||
pkmn.name,debugInfo))
|
||||
raise _INTL("{1}'s new level is less than its\r\ncurrent level, which shouldn't happen.\r\n[Debug: {2}]",
|
||||
pkmn.name,debugInfo)
|
||||
end
|
||||
# Give Exp
|
||||
if pkmn.shadowPokemon?
|
||||
|
||||
@@ -138,8 +138,8 @@ class Battle::Battler
|
||||
return false
|
||||
end
|
||||
if abilityActive?
|
||||
return false if Battle::AbilityEffects.triggerStatLossImmunity(
|
||||
self.ability,self,stat,@battle,showFailMsg) if !@battle.moldBreaker
|
||||
return false if !@battle.moldBreaker && Battle::AbilityEffects.triggerStatLossImmunity(
|
||||
self.ability,self,stat,@battle,showFailMsg)
|
||||
return false if Battle::AbilityEffects.triggerStatLossImmunityNonIgnorable(
|
||||
self.ability,self,stat,@battle,showFailMsg)
|
||||
end
|
||||
|
||||
@@ -488,7 +488,8 @@ class Battle::Move::ThrowUserItemAtTarget < Battle::Move
|
||||
# Exp Candies
|
||||
:EXPCANDYXS, :EXPCANDYS, :EXPCANDYM, :EXPCANDYL, :EXPCANDYXL
|
||||
],
|
||||
20 => [# Feathers
|
||||
20 => [
|
||||
# Feathers
|
||||
:CLEVERFEATHER,:GENIUSFEATHER,:HEALTHFEATHER,:MUSCLEFEATHER,
|
||||
:PRETTYFEATHER,:RESISTFEATHER,:SWIFTFEATHER,
|
||||
:CLEVERWING,:GENIUSWING,:HEALTHWING,:MUSCLEWING,:PRETTYWING,
|
||||
|
||||
@@ -199,10 +199,11 @@ class Battle::Scene
|
||||
$bag.last_pocket_selections = @bagChoices if @bagChoices != nil
|
||||
# Start Bag screen
|
||||
itemScene = PokemonBag_Scene.new
|
||||
itemScene.pbStartScene($bag, true, Proc.new { |item|
|
||||
useType = GameData::Item.get(item).battle_use
|
||||
next useType && useType>0
|
||||
},false)
|
||||
itemScene.pbStartScene($bag, true,
|
||||
Proc.new { |item|
|
||||
useType = GameData::Item.get(item).battle_use
|
||||
next useType && useType > 0
|
||||
}, false)
|
||||
# Loop while in Bag screen
|
||||
wasTargeting = false
|
||||
loop do
|
||||
|
||||
@@ -139,9 +139,9 @@ class Battle::Scene
|
||||
end
|
||||
fadeAnim.dispose
|
||||
sendOutAnims.each do |a|
|
||||
a[0].dispose
|
||||
a[1].dispose
|
||||
end
|
||||
a[0].dispose
|
||||
a[1].dispose
|
||||
end
|
||||
# Play shininess animations for shiny Pokémon
|
||||
sendOuts.each do |b|
|
||||
next if !@battle.showAnims || !@battle.battlers[b[0]].shiny?
|
||||
|
||||
@@ -47,8 +47,8 @@ class Battle::DebugSceneNoLogging
|
||||
def pbHPChanged(battler,oldHP,showAnim=false); end
|
||||
def pbFaintBattler(battler); end
|
||||
def pbEXPBar(battler,startExp,endExp,tempExp1,tempExp2); end
|
||||
def pbLevelUp(pkmn,battler,oldTotalHP,oldAttack,oldDefense,
|
||||
oldSpAtk,oldSpDef,oldSpeed); end
|
||||
def pbLevelUp(pkmn, battler, oldTotalHP, oldAttack, oldDefense,
|
||||
oldSpAtk, oldSpDef, oldSpeed); end
|
||||
def pbForgetMove(pkmn,moveToLearn); return 0; end # Always forget first move
|
||||
|
||||
def pbCommandMenu(idxBattler,firstAction)
|
||||
|
||||
@@ -32,7 +32,7 @@ class Battle::AI
|
||||
n += 1
|
||||
end
|
||||
return 0 if n<2
|
||||
mean = sum.to_f/n.to_f
|
||||
mean = sum.to_f / n
|
||||
varianceTimesN = 0
|
||||
choices.each do |c|
|
||||
next if c[1]<=0
|
||||
|
||||
@@ -277,7 +277,9 @@ class Battle::Scene
|
||||
dimmingvp = Viewport.new(0,0,Graphics.width,Graphics.height-msgwindow.height)
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: That's it! We will now go to judging to determine the winner!\\wtnp[20]")) {
|
||||
pbBattleArenaUpdate; dimmingvp.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
}
|
||||
dimmingvp.z = 99999
|
||||
infowindow = SpriteWindow_Base.new(80,0,320,224)
|
||||
infowindow.contents = Bitmap.new(infowindow.width-infowindow.borderX,
|
||||
@@ -303,15 +305,24 @@ class Battle::Scene
|
||||
updateJudgment(infowindow,1,battler1,battler2,ratings1,ratings2)
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judging category 1, Mind!\nThe Pokémon showing the most guts!\\wtnp[40]")) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
updateJudgment(infowindow,2,battler1,battler2,ratings1,ratings2)
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judging category 2, Skill!\nThe Pokémon using moves the best!\\wtnp[40]")) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
updateJudgment(infowindow,3,battler1,battler2,ratings1,ratings2)
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judging category 3, Body!\nThe Pokémon with the most vitality!\\wtnp[40]")) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
total1 = 0
|
||||
total2 = 0
|
||||
for i in 0...3
|
||||
@@ -321,17 +332,26 @@ class Battle::Scene
|
||||
if total1==total2
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judgment: {1} to {2}!\nWe have a draw!\\wtnp[40]",total1,total2)) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
elsif total1>total2
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}'s {4}!\\wtnp[40]",
|
||||
total1,total2,@battle.pbGetOwnerName(battler1.index),battler1.name)) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
else
|
||||
pbMessageDisplay(msgwindow,
|
||||
_INTL("REFEREE: Judgment: {1} to {2}!\nThe winner is {3}!\\wtnp[40]",
|
||||
total1,total2,battler2.name)) {
|
||||
pbBattleArenaUpdate; dimmingvp.update; infowindow.update }
|
||||
pbBattleArenaUpdate
|
||||
dimmingvp.update
|
||||
infowindow.update
|
||||
}
|
||||
end
|
||||
infowindow.visible = false
|
||||
msgwindow.visible = false
|
||||
|
||||
@@ -202,7 +202,7 @@ class BerryPlantMoistureSprite
|
||||
return if !@sprite || !@event
|
||||
new_moisture = -1
|
||||
berry_plant = @event.variable
|
||||
if berry_plant&.is_a?(BerryPlantData) && berry_plant.planted?
|
||||
if berry_plant.is_a?(BerryPlantData) && berry_plant.planted?
|
||||
new_moisture = berry_plant.moisture_stage
|
||||
end
|
||||
if new_moisture != @moisture_stage
|
||||
|
||||
@@ -135,7 +135,7 @@ module RandomDungeonGenerator
|
||||
when TurnLeft
|
||||
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 TurnRight
|
||||
|
||||
@@ -469,7 +469,7 @@ MultipleForms.register(:LYCANROC,{
|
||||
next 2 if PBDayNight.isEvening? # Dusk
|
||||
next 1 if PBDayNight.isNight? # Midnight
|
||||
next 0 # Midday
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
MultipleForms.register(:WISHIWASHI,{
|
||||
|
||||
@@ -93,7 +93,7 @@ class HallOfFame_Scene
|
||||
def slowFadeOut(sprites,exponent) # 2 exponent
|
||||
# To handle values above 8
|
||||
extraWaitExponent=exponent-9
|
||||
exponent=8 if 8<exponent
|
||||
exponent=8 if exponent > 8
|
||||
max=2**exponent
|
||||
speed=(2**8)/max
|
||||
for j in 0..max
|
||||
@@ -181,18 +181,18 @@ class HallOfFame_Scene
|
||||
def moveSprite(i)
|
||||
spritename=(i>-1) ? "pokemon#{i}" : "trainer"
|
||||
speed = (i>-1) ? ANIMATIONSPEED : 2
|
||||
if(!ANIMATION) # Skips animation
|
||||
if !ANIMATION # Skips animation
|
||||
@sprites[spritename].x-=speed*@xmovement[i]
|
||||
@xmovement[i]=0
|
||||
@sprites[spritename].y-=speed*@ymovement[i]
|
||||
@ymovement[i]=0
|
||||
end
|
||||
if(@xmovement[i]!=0)
|
||||
if @xmovement[i] != 0
|
||||
direction = (@xmovement[i]>0) ? -1 : 1
|
||||
@sprites[spritename].x+=speed*direction
|
||||
@xmovement[i]+=direction
|
||||
end
|
||||
if(@ymovement[i]!=0)
|
||||
if @ymovement[i] != 0
|
||||
direction = (@ymovement[i]>0) ? -1 : 1
|
||||
@sprites[spritename].y+=speed*direction
|
||||
@ymovement[i]+=direction
|
||||
@@ -260,7 +260,7 @@ class HallOfFame_Scene
|
||||
end
|
||||
@xmovement[@battlerIndex]=0
|
||||
@ymovement[@battlerIndex]=0
|
||||
if(ANIMATION && !SINGLEROW) # Trainer Animation
|
||||
if ANIMATION && !SINGLEROW # Trainer Animation
|
||||
startpoint=Graphics.width/2
|
||||
# 2 is the trainer speed
|
||||
@xmovement[@battlerIndex]=(startpoint-@sprites["trainer"].x)/2
|
||||
|
||||
@@ -377,8 +377,8 @@ class PokemonPokedex_Scene
|
||||
dexlist[0] = nil if dexlist[0][5] && !$player.seen?(dexlist[0][0])
|
||||
# Remove unseen species from the end of the list
|
||||
i = dexlist.length-1
|
||||
loop do break unless i>=0
|
||||
break if !dexlist[i] || $player.seen?(dexlist[i][0])
|
||||
loop do
|
||||
break if i < 0 || !dexlist[i] || $player.seen?(dexlist[i][0])
|
||||
dexlist[i] = nil
|
||||
i -= 1
|
||||
end
|
||||
|
||||
@@ -711,8 +711,7 @@ class DirectFlowDiagram
|
||||
@points[j]=BitmapSprite.new(8,8,@viewport)
|
||||
@points[j].bitmap.fill_rect(0,0,8,8,Color.new(0,0,0))
|
||||
end
|
||||
@points[j].tone=(@strength==2) ? Tone.new(232,232,248) :
|
||||
Tone.new(16,16,232)
|
||||
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
|
||||
@points[j].visible=(@strength!=0)
|
||||
end
|
||||
|
||||
@@ -786,8 +785,7 @@ class FlowDiagram
|
||||
@points[j]=BitmapSprite.new(8,8,@viewport)
|
||||
@points[j].bitmap.fill_rect(0,0,8,8,Color.new(0,0,0))
|
||||
end
|
||||
@points[j].tone=(@strength==2) ? Tone.new(232,232,248) :
|
||||
Tone.new(16,16,232)
|
||||
@points[j].tone = (@strength == 2) ? Tone.new(232, 232, 248) : Tone.new(16, 16, 232)
|
||||
@points[j].visible=(@strength!=0)
|
||||
end
|
||||
|
||||
|
||||
@@ -586,7 +586,7 @@ class VoltorbFlip
|
||||
break
|
||||
end
|
||||
end
|
||||
pbFadeOutAndHide(@sprites) {update}
|
||||
pbFadeOutAndHide(@sprites) { update }
|
||||
pbDisposeSpriteHash(@sprites)
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
@@ -379,7 +379,7 @@ class BattleFactoryData
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
|
||||
trainerdata[0])
|
||||
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, @rentals)
|
||||
@opponent.party = opponentPkmn.shuffle[0, 3]
|
||||
@opponent.party = opponentPkmn.sample(3)
|
||||
end
|
||||
|
||||
def pbChooseRentals
|
||||
@@ -402,7 +402,7 @@ class BattleFactoryData
|
||||
trainerdata[0])
|
||||
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps,
|
||||
[].concat(@rentals).concat(@oldopponent))
|
||||
@opponent.party = opponentPkmn.shuffle[0, 3]
|
||||
@opponent.party = opponentPkmn.sample(3)
|
||||
end
|
||||
|
||||
def pbChooseSwaps
|
||||
|
||||
@@ -9,7 +9,7 @@ class BattleSwapScene
|
||||
@sprites["title"] = Window_UnformattedTextPokemon.newWithSize(
|
||||
_INTL("RENTAL POKéMON"), 0, 0, Graphics.width, 64, @viewport)
|
||||
@sprites["list"] = Window_AdvancedCommandPokemonEx.newWithSize(
|
||||
[], 0, 64, Graphics.width, Graphics.height - 128 , @viewport)
|
||||
[], 0, 64, Graphics.width, Graphics.height - 128, @viewport)
|
||||
@sprites["help"] = Window_UnformattedTextPokemon.newWithSize("",
|
||||
0, Graphics.height - 64, Graphics.width, 64, @viewport)
|
||||
@sprites["msgwindow"] = Window_AdvancedTextPokemon.newWithSize("",
|
||||
|
||||
@@ -60,7 +60,6 @@ def pbGetLegalMoves2(species, maxlevel)
|
||||
species_data.tutor_moves.each { |m| addMove(moves, m, 0) if $tmMoves.include?(m) }
|
||||
babyspecies = babySpecies(species)
|
||||
GameData::Species.get(babyspecies).egg_moves.each { |m| addMove(moves, m, 2) }
|
||||
#
|
||||
movedatas = []
|
||||
for move in moves
|
||||
movedatas.push([move, GameData::Move.get(move)])
|
||||
|
||||
@@ -155,7 +155,7 @@ def pbBalancedLevel(party)
|
||||
party.each { |p| sum += p.level }
|
||||
return 1 if sum == 0
|
||||
mLevel = GameData::GrowthRate.max_level
|
||||
average = sum.to_f / party.length.to_f
|
||||
average = sum.to_f / party.length
|
||||
# Calculate the standard deviation
|
||||
varianceTimesN = 0
|
||||
party.each do |pkmn|
|
||||
@@ -169,7 +169,7 @@ def pbBalancedLevel(party)
|
||||
weights = []
|
||||
# Skew weights according to standard deviation
|
||||
party.each do |pkmn|
|
||||
weight = pkmn.level.to_f / sum.to_f
|
||||
weight = pkmn.level.to_f / sum
|
||||
if weight < 0.5
|
||||
weight -= (stdev / mLevel.to_f)
|
||||
weight = 0.001 if weight <= 0.001
|
||||
@@ -209,21 +209,21 @@ def pbSize(pkmn)
|
||||
n = (pkmn.personalID >> 8) & 0xFF
|
||||
s = (((ativ ^ dfiv) * hpiv) ^ m) * 256 + (((saiv ^ sdiv) * spiv) ^ n)
|
||||
xyz = []
|
||||
if s < 10; xyz = [ 290, 1, 0]
|
||||
elsif s < 110; xyz = [ 300, 1, 10]
|
||||
elsif s < 310; xyz = [ 400, 2, 110]
|
||||
elsif s < 710; xyz = [ 500, 4, 310]
|
||||
elsif s < 2710; xyz = [ 600, 20, 710]
|
||||
elsif s < 7710; xyz = [ 700, 50, 2710]
|
||||
elsif s < 17710; xyz = [ 800, 100, 7710]
|
||||
elsif s < 32710; xyz = [ 900, 150, 17710]
|
||||
elsif s < 47710; xyz = [1000, 150, 32710]
|
||||
elsif s < 57710; xyz = [1100, 100, 47710]
|
||||
elsif s < 62710; xyz = [1200, 50, 57710]
|
||||
elsif s < 64710; xyz = [1300, 20, 62710]
|
||||
elsif s < 65210; xyz = [1400, 5, 64710]
|
||||
elsif s < 65410; xyz = [1500, 2, 65210]
|
||||
else; xyz = [1700, 1, 65510]
|
||||
if s < 10 then xyz = [ 290, 1, 0]
|
||||
elsif s < 110 then xyz = [ 300, 1, 10]
|
||||
elsif s < 310 then xyz = [ 400, 2, 110]
|
||||
elsif s < 710 then xyz = [ 500, 4, 310]
|
||||
elsif s < 2710 then xyz = [ 600, 20, 710]
|
||||
elsif s < 7710 then xyz = [ 700, 50, 2710]
|
||||
elsif s < 17710 then xyz = [ 800, 100, 7710]
|
||||
elsif s < 32710 then xyz = [ 900, 150, 17710]
|
||||
elsif s < 47710 then xyz = [1000, 150, 32710]
|
||||
elsif s < 57710 then xyz = [1100, 100, 47710]
|
||||
elsif s < 62710 then xyz = [1200, 50, 57710]
|
||||
elsif s < 64710 then xyz = [1300, 20, 62710]
|
||||
elsif s < 65210 then xyz = [1400, 5, 64710]
|
||||
elsif s < 65410 then xyz = [1500, 2, 65210]
|
||||
else xyz = [1700, 1, 65510]
|
||||
end
|
||||
return (((s - xyz[2]) / xyz[1] + xyz[0]).floor * baseheight / 10).floor
|
||||
end
|
||||
|
||||
@@ -687,7 +687,7 @@ module TrainerPokemonProperty
|
||||
:iv => oldsetting[12 + Pokemon::MAX_MOVES],
|
||||
:ev => oldsetting[13 + Pokemon::MAX_MOVES],
|
||||
:happiness => oldsetting[14 + Pokemon::MAX_MOVES],
|
||||
:poke_ball => oldsetting[15 + Pokemon::MAX_MOVES],
|
||||
:poke_ball => oldsetting[15 + Pokemon::MAX_MOVES]
|
||||
}
|
||||
moves = []
|
||||
Pokemon::MAX_MOVES.times do |i|
|
||||
@@ -788,7 +788,7 @@ def pbEditPlayerMetadata(player_id = 1)
|
||||
:surf_charset => data[4],
|
||||
:dive_charset => data[5],
|
||||
:fish_charset => data[6],
|
||||
:surf_fish_charset => data[7],
|
||||
:surf_fish_charset => data[7]
|
||||
}
|
||||
# Add player metadata's data to records
|
||||
GameData::PlayerMetadata.register(metadata_hash)
|
||||
@@ -1198,7 +1198,7 @@ def pbRegionalDexEditor(dex)
|
||||
dex[cmd[1] + 1], dex[cmd[1]] = dex[cmd[1]], dex[cmd[1] + 1]
|
||||
refresh_list = true
|
||||
end
|
||||
when 2 # Swap entry down
|
||||
when 2 # Swap entry down
|
||||
if cmd[1] > 0
|
||||
dex[cmd[1] - 1], dex[cmd[1]] = dex[cmd[1]], dex[cmd[1] - 1]
|
||||
refresh_list = true
|
||||
|
||||
@@ -286,7 +286,7 @@ class TextField < UIControl
|
||||
return
|
||||
end
|
||||
# Letter & Number keys
|
||||
Input.gets.each_char{|c|insert(c)}
|
||||
Input.gets.each_char { |c| insert(c) }
|
||||
end
|
||||
|
||||
def refresh
|
||||
|
||||
@@ -1707,7 +1707,7 @@ module Compiler
|
||||
GameData::MapMetadata::DATA.clear
|
||||
map_infos = pbLoadMapInfos
|
||||
map_names = []
|
||||
map_infos.keys.each { |id| map_names[id] = map_infos[id].name }
|
||||
map_infos.each_key { |id| map_names[id] = map_infos[id].name }
|
||||
# Read from PBS file
|
||||
File.open(path, "rb") { |f|
|
||||
FileLineData.file = path # For error reporting
|
||||
|
||||
@@ -152,9 +152,9 @@ module Compiler
|
||||
f.write("IsSpecialType = true\r\n") if type.special?
|
||||
f.write("IsPseudoType = true\r\n") if type.pseudo_type
|
||||
f.write(sprintf("Flags = %s\r\n", type.flags.join(","))) if type.flags.length > 0
|
||||
f.write("Weaknesses = #{type.weaknesses.join(",")}\r\n") if type.weaknesses.length > 0
|
||||
f.write("Resistances = #{type.resistances.join(",")}\r\n") if type.resistances.length > 0
|
||||
f.write("Immunities = #{type.immunities.join(",")}\r\n") if type.immunities.length > 0
|
||||
f.write("Weaknesses = #{type.weaknesses.join(',')}\r\n") if type.weaknesses.length > 0
|
||||
f.write("Resistances = #{type.resistances.join(',')}\r\n") if type.resistances.length > 0
|
||||
f.write("Immunities = #{type.immunities.join(',')}\r\n") if type.immunities.length > 0
|
||||
end
|
||||
}
|
||||
process_pbs_file_message_end
|
||||
@@ -204,7 +204,7 @@ module Compiler
|
||||
f.write("Target = #{move.target}\r\n")
|
||||
f.write("Priority = #{move.priority}\r\n") if move.priority != 0
|
||||
f.write("FunctionCode = #{move.function_code}\r\n")
|
||||
f.write("Flags = #{move.flags.join(",")}\r\n") if move.flags.length > 0
|
||||
f.write("Flags = #{move.flags.join(',')}\r\n") if move.flags.length > 0
|
||||
f.write("EffectChance = #{move.effect_chance}\r\n") if move.effect_chance > 0
|
||||
f.write("Description = #{move.real_description}\r\n")
|
||||
end
|
||||
|
||||
@@ -1180,10 +1180,10 @@ module Compiler
|
||||
)
|
||||
changed = true
|
||||
end
|
||||
if false # deletedRoute
|
||||
insertMoveRouteAt.call(list,list.length-1,deletedRoute)
|
||||
changed = true
|
||||
end
|
||||
# if deletedRoute
|
||||
# insertMoveRouteAt.call(list,list.length-1,deletedRoute)
|
||||
# changed = true
|
||||
# end
|
||||
end
|
||||
when 101 # Show Text
|
||||
# Capitalise/decapitalise various text formatting codes
|
||||
|
||||
Reference in New Issue
Block a user