mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Rubocop-inspired style tweaks
This commit is contained in:
@@ -87,8 +87,8 @@ NO_SIGNPOSTS = []
|
||||
# * The maximum length, in characters, that the player's name can be.
|
||||
#===============================================================================
|
||||
INITIAL_MONEY = 3000
|
||||
MAX_MONEY = 999999
|
||||
MAX_COINS = 99999
|
||||
MAX_MONEY = 999_999
|
||||
MAX_COINS = 99_999
|
||||
MAX_PLAYER_NAME_SIZE = 10
|
||||
|
||||
#===============================================================================
|
||||
@@ -97,9 +97,9 @@ MAX_PLAYER_NAME_SIZE = 10
|
||||
# associated trainer type will be named as whatever is in that variable.
|
||||
#===============================================================================
|
||||
RIVAL_NAMES = [
|
||||
[:RIVAL1,12],
|
||||
[:RIVAL2,12],
|
||||
[:CHAMPION,12]
|
||||
[:RIVAL1, 12],
|
||||
[:RIVAL2, 12],
|
||||
[:CHAMPION, 12]
|
||||
]
|
||||
|
||||
#===============================================================================
|
||||
@@ -155,7 +155,7 @@ SCALED_EXP_FORMULA = true
|
||||
SPLIT_EXP_BETWEEN_GAINERS = false
|
||||
ENABLE_CRITICAL_CAPTURES = false
|
||||
GAIN_EXP_FOR_CAPTURE = true
|
||||
MEGA_RINGS = [:MEGARING,:MEGABRACELET,:MEGACUFF,:MEGACHARM]
|
||||
MEGA_RINGS = [:MEGARING, :MEGABRACELET, :MEGACUFF, :MEGACHARM]
|
||||
|
||||
#===============================================================================
|
||||
# * The names of each pocket of the Bag. Leave the first entry blank.
|
||||
@@ -175,9 +175,9 @@ def pbPocketNames; return ["",
|
||||
_INTL("Battle Items"),
|
||||
_INTL("Key Items")
|
||||
]; end
|
||||
BAG_MAX_POCKET_SIZE = [0,-1,-1,-1,-1,-1,-1,-1,-1]
|
||||
BAG_MAX_POCKET_SIZE = [0, -1, -1, -1, -1, -1, -1, -1, -1]
|
||||
BAG_MAX_PER_SLOT = 999
|
||||
BAG_POCKET_AUTO_SORT = [0,false,false,false,true,true,false,false,false]
|
||||
BAG_POCKET_AUTO_SORT = [0, false, false, false, true, true, false, false, false]
|
||||
|
||||
#===============================================================================
|
||||
# * A set of arrays each containing details of a graphic to be shown on the
|
||||
@@ -190,8 +190,8 @@ BAG_POCKET_AUTO_SORT = [0,false,false,false,true,true,false,false,false]
|
||||
# - The graphic will always (true) or never (false) be shown on a wall map.
|
||||
#===============================================================================
|
||||
REGION_MAP_EXTRAS = [
|
||||
[0,51,16,15,"mapHiddenBerth",false],
|
||||
[0,52,20,14,"mapHiddenFaraday",false]
|
||||
[0, 51, 16, 15, "mapHiddenBerth", false],
|
||||
[0, 52, 20, 14, "mapHiddenFaraday", false]
|
||||
]
|
||||
|
||||
#===============================================================================
|
||||
@@ -229,8 +229,8 @@ NUM_STORAGE_BOXES = 30
|
||||
#===============================================================================
|
||||
USE_CURRENT_REGION_DEX = false
|
||||
def pbDexNames; return [
|
||||
[_INTL("Kanto Pokédex"),0],
|
||||
[_INTL("Johto Pokédex"),1],
|
||||
[_INTL("Kanto Pokédex"), 0],
|
||||
[_INTL("Johto Pokédex"), 1],
|
||||
_INTL("National Pokédex")
|
||||
]; end
|
||||
DEX_SHOWS_ALL_FORMS = false
|
||||
@@ -250,25 +250,25 @@ DEXES_WITH_OFFSETS = []
|
||||
# - Roaming areas specifically for this Pokémon (optional).
|
||||
#===============================================================================
|
||||
RoamingAreas = {
|
||||
5 => [21,28,31,39,41,44,47,66,69],
|
||||
21 => [5,28,31,39,41,44,47,66,69],
|
||||
28 => [5,21,31,39,41,44,47,66,69],
|
||||
31 => [5,21,28,39,41,44,47,66,69],
|
||||
39 => [5,21,28,31,41,44,47,66,69],
|
||||
41 => [5,21,28,31,39,44,47,66,69],
|
||||
44 => [5,21,28,31,39,41,47,66,69],
|
||||
47 => [5,21,28,31,39,41,44,66,69],
|
||||
66 => [5,21,28,31,39,41,44,47,69],
|
||||
69 => [5,21,28,31,39,41,44,47,66]
|
||||
5 => [ 21, 28, 31, 39, 41, 44, 47, 66, 69],
|
||||
21 => [5, 28, 31, 39, 41, 44, 47, 66, 69],
|
||||
28 => [5, 21, 31, 39, 41, 44, 47, 66, 69],
|
||||
31 => [5, 21, 28, 39, 41, 44, 47, 66, 69],
|
||||
39 => [5, 21, 28, 31, 41, 44, 47, 66, 69],
|
||||
41 => [5, 21, 28, 31, 39, 44, 47, 66, 69],
|
||||
44 => [5, 21, 28, 31, 39, 41, 47, 66, 69],
|
||||
47 => [5, 21, 28, 31, 39, 41, 44, 66, 69],
|
||||
66 => [5, 21, 28, 31, 39, 41, 44, 47, 69],
|
||||
69 => [5, 21, 28, 31, 39, 41, 44, 47, 66 ]
|
||||
}
|
||||
RoamingSpecies = [
|
||||
[:LATIAS, 30, 53, 0, "Battle roaming"],
|
||||
[:LATIOS, 30, 53, 0, "Battle roaming"],
|
||||
[:KYOGRE, 40, 54, 2, nil, {
|
||||
2 => [21,31],
|
||||
21 => [2,31,69],
|
||||
31 => [2,21,69],
|
||||
69 => [21,31]
|
||||
2 => [ 21, 31 ],
|
||||
21 => [2, 31, 69],
|
||||
31 => [2, 21, 69],
|
||||
69 => [ 21, 31 ]
|
||||
}],
|
||||
[:ENTEI, 40, 55, 1, nil]
|
||||
]
|
||||
@@ -348,6 +348,6 @@ PLANT_SPARKLE_ANIMATION_ID = 7
|
||||
# languages to choose from.
|
||||
#===============================================================================
|
||||
LANGUAGES = [
|
||||
# ["English","english.dat"],
|
||||
# ["Deutsch","deutsch.dat"]
|
||||
# ["English", "english.dat"],
|
||||
# ["Deutsch", "deutsch.dat"]
|
||||
]
|
||||
|
||||
@@ -7,24 +7,20 @@ class Class
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# module Comparable
|
||||
#===============================================================================
|
||||
unless Comparable.method_defined? :clamp
|
||||
module Comparable
|
||||
def clamp(min, max)
|
||||
if max-min<0
|
||||
if max - min < 0
|
||||
raise ArgumentError("min argument must be smaller than max argument")
|
||||
end
|
||||
return (self>max) ? max : (self<min) ? min : self
|
||||
return (self > max) ? max : (self < min) ? min : self
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# class Boolean
|
||||
#===============================================================================
|
||||
@@ -34,32 +30,30 @@ class Boolean
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# class String
|
||||
#===============================================================================
|
||||
class String
|
||||
def starts_with?(str)
|
||||
proc = (self[0...str.length] == str) if self.length >= str.length
|
||||
return proc ? proc : false
|
||||
return proc || false
|
||||
end
|
||||
|
||||
def ends_with?(str)
|
||||
e = self.length - 1
|
||||
proc = (self[(e-str.length)...e] == str) if self.length >= str.length
|
||||
return proc ? proc : false
|
||||
return proc || false
|
||||
end
|
||||
|
||||
def starts_with_vowel?
|
||||
return ['a','e','i','o','u'].include?(self[0,1].downcase)
|
||||
return ['a', 'e', 'i', 'o', 'u'].include?(self[0, 1].downcase)
|
||||
end
|
||||
|
||||
def first(n=1)
|
||||
def first(n = 1)
|
||||
return self[0...n]
|
||||
end
|
||||
|
||||
def last(n=1)
|
||||
def last(n = 1)
|
||||
return self[-n..-1] || self
|
||||
end
|
||||
|
||||
@@ -90,14 +84,14 @@ class String
|
||||
return blank
|
||||
end
|
||||
|
||||
def cut(bitmap,width)
|
||||
def cut(bitmap, width)
|
||||
string = self
|
||||
width -= bitmap.text_size("...").width
|
||||
string_width = 0
|
||||
text = []
|
||||
for char in string.scan(/./)
|
||||
wdh = bitmap.text_size(char).width
|
||||
next if (wdh+string_width) > width
|
||||
next if (wdh + string_width) > width
|
||||
string_width += wdh
|
||||
text.push(char)
|
||||
end
|
||||
@@ -110,8 +104,6 @@ class String
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# class Numeric
|
||||
#===============================================================================
|
||||
@@ -122,21 +114,17 @@ class Numeric
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# class Integer
|
||||
#===============================================================================
|
||||
class Integer
|
||||
# Returns an array containing each digit of the number in turn.
|
||||
def digits(base=10)
|
||||
def digits(base = 10)
|
||||
quotient, remainder = divmod(base)
|
||||
(quotient==0) ? [remainder] : quotient.digits(base).push(remainder)
|
||||
return (quotient == 0) ? [remainder] : quotient.digits(base).push(remainder)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# class Array
|
||||
#===============================================================================
|
||||
@@ -150,7 +138,7 @@ class Array
|
||||
end
|
||||
|
||||
def ^(other) # xor of two arrays
|
||||
return (self|other)-(self&other)
|
||||
return (self|other) - (self&other)
|
||||
end
|
||||
|
||||
def shuffle
|
||||
@@ -158,15 +146,14 @@ class Array
|
||||
end unless method_defined? :shuffle
|
||||
|
||||
def shuffle!
|
||||
(size-1).times do |i|
|
||||
r = i+rand(size-i)
|
||||
(size - 1).times do |i|
|
||||
r = i + rand(size - i)
|
||||
self[i], self[r] = self[r], self[i]
|
||||
end
|
||||
self
|
||||
end unless method_defined? :shuffle!
|
||||
end
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# module Enumerable
|
||||
#===============================================================================
|
||||
@@ -178,8 +165,6 @@ module Enumerable
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
# Kernel methods
|
||||
#===============================================================================
|
||||
|
||||
@@ -1,308 +1,302 @@
|
||||
################################################################################
|
||||
#===============================================================================
|
||||
# "Duel" mini-game
|
||||
# Based on the Duel minigame by Alael
|
||||
################################################################################
|
||||
begin
|
||||
|
||||
#===============================================================================
|
||||
class DuelWindow < Window_AdvancedTextPokemon
|
||||
attr_accessor :hp
|
||||
attr_accessor :name
|
||||
attr_accessor :isEnemy
|
||||
attr_reader :hp
|
||||
attr_reader :name
|
||||
attr_reader :is_enemy
|
||||
|
||||
def initialize(name,isEnemy)
|
||||
def initialize(name, is_enemy)
|
||||
@hp = 10
|
||||
@name = name
|
||||
@isEnemy = isEnemy
|
||||
super("")
|
||||
@is_enemy = is_enemy
|
||||
super()
|
||||
self.width = 160
|
||||
self.height = 96
|
||||
duelRefresh
|
||||
duel_refresh
|
||||
end
|
||||
|
||||
def hp=(value)
|
||||
@hp = value
|
||||
duelRefresh
|
||||
duel_refresh
|
||||
end
|
||||
|
||||
def name=(value)
|
||||
@name = value
|
||||
duelRefresh
|
||||
duel_refresh
|
||||
end
|
||||
|
||||
def isEnemy=(value)
|
||||
@isEnemy = value
|
||||
duelRefresh
|
||||
def is_enemy=(value)
|
||||
@is_enemy = value
|
||||
duel_refresh
|
||||
end
|
||||
|
||||
def duelRefresh
|
||||
nameColor = @isEnemy ? "<ar><c3=E00808,F8B870>" : "<c3=3050C8,A0C0F0>"
|
||||
hpColor = "<c3=209808,90F090>"
|
||||
self.text = _INTL("{1}{2}\r\n{3}HP: {4}",nameColor,fmtescape(@name),hpColor,@hp)
|
||||
def duel_refresh
|
||||
name_color = @is_enemy ? "<ar><c3=E00808,F8B870>" : "<c3=3050C8,A0C0F0>"
|
||||
hp_color = "<c3=209808,90F090>"
|
||||
self.text = _INTL("{1}{2}\r\n{3}HP: {4}", name_color, fmtescape(@name), hp_color, @hp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#===============================================================================
|
||||
#
|
||||
#===============================================================================
|
||||
class PokemonDuel
|
||||
def pbStartDuel(opponent,event)
|
||||
@viewport = Viewport.new(0,0,Graphics.width,Graphics.height)
|
||||
def pbStartDuel(opponent, event)
|
||||
@event = event
|
||||
@viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@viewport.z = 99999
|
||||
@sprites = {}
|
||||
@event = event
|
||||
@sprites["player"] = IconSprite.new(-128-32,96,@viewport)
|
||||
@sprites["player"] = IconSprite.new(-128 - 32, 96, @viewport)
|
||||
@sprites["player"].setBitmap(pbTrainerSpriteFile($Trainer.trainertype))
|
||||
@sprites["opponent"] = IconSprite.new(Graphics.width+32,96,@viewport)
|
||||
@sprites["opponent"] = IconSprite.new(Graphics.width + 32, 96, @viewport)
|
||||
@sprites["opponent"].setBitmap(pbTrainerSpriteFile(opponent.trainertype))
|
||||
@sprites["playerwindow"] = DuelWindow.new($Trainer.name,false)
|
||||
@sprites["playerwindow"] = DuelWindow.new($Trainer.name, false)
|
||||
@sprites["playerwindow"].x = -@sprites["playerwindow"].width
|
||||
@sprites["playerwindow"].viewport = @viewport
|
||||
@sprites["opponentwindow"] = DuelWindow.new(opponent.name,true)
|
||||
@sprites["opponentwindow"] = DuelWindow.new(opponent.name, true)
|
||||
@sprites["opponentwindow"].x = Graphics.width
|
||||
@sprites["opponentwindow"].viewport = @viewport
|
||||
pbWait(Graphics.frame_rate/2)
|
||||
distancePerFrame = 8*20/Graphics.frame_rate
|
||||
while @sprites["player"].x<0
|
||||
@sprites["player"].x += distancePerFrame
|
||||
@sprites["playerwindow"].x += distancePerFrame
|
||||
@sprites["opponent"].x -= distancePerFrame
|
||||
@sprites["opponentwindow"].x -= distancePerFrame
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
distance_per_frame = 8 * 20 / Graphics.frame_rate
|
||||
while @sprites["player"].x < 0
|
||||
@sprites["player"].x += distance_per_frame
|
||||
@sprites["playerwindow"].x += distance_per_frame
|
||||
@sprites["opponent"].x -= distance_per_frame
|
||||
@sprites["opponentwindow"].x -= distandistance_per_framecePerFrame
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
@oldmovespeed = $game_player.move_speed
|
||||
@oldeventspeed = event.move_speed
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::DirectionFixOn])
|
||||
pbWait(Graphics.frame_rate*3/4)
|
||||
pbWait(Graphics.frame_rate * 3 / 4)
|
||||
end
|
||||
|
||||
def pbDuel(opponent,event,speeches)
|
||||
pbStartDuel(opponent,event)
|
||||
@hp = [10,10]
|
||||
@special = [false,false]
|
||||
def pbDuel(opponent, event, speeches)
|
||||
pbStartDuel(opponent, event)
|
||||
@hp = [10, 10]
|
||||
@special = [false, false]
|
||||
decision = nil
|
||||
loop do
|
||||
@hp[0] = 0 if @hp[0]<0
|
||||
@hp[1] = 0 if @hp[1]<0
|
||||
@hp[0] = 0 if @hp[0] < 0
|
||||
@hp[1] = 0 if @hp[1] < 0
|
||||
pbRefresh
|
||||
if @hp[0]<=0
|
||||
if @hp[0] <= 0
|
||||
decision = false
|
||||
break
|
||||
elsif @hp[1]<=0
|
||||
elsif @hp[1] <= 0
|
||||
decision = true
|
||||
break
|
||||
end
|
||||
action = 0
|
||||
scores = [3,4,4,2]
|
||||
scores = [3, 4, 4, 2]
|
||||
choices = (@special[1]) ? 3 : 4
|
||||
scores[3] = 0 if @special[1]
|
||||
total = scores[0]+scores[1]+scores[2]+scores[3]
|
||||
if total<=0
|
||||
total = scores[0] + scores[1] + scores[2] + scores[3]
|
||||
if total <= 0
|
||||
action = rand(choices)
|
||||
else
|
||||
num = rand(total)
|
||||
cumtotal = 0
|
||||
for i in 0...4
|
||||
cumtotal += scores[i]
|
||||
if num<cumtotal
|
||||
if num < cumtotal
|
||||
action = i
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@special[1] = true if action==3
|
||||
pbMessage(_INTL("{1}: {2}",opponent.name,speeches[action*3+rand(3)]))
|
||||
command = rand(4)
|
||||
@special[1] = true if action == 3
|
||||
pbMessage(_INTL("{1}: {2}", opponent.name, speeches[action * 3 + rand(3)]))
|
||||
list = [
|
||||
_INTL("DEFEND"),
|
||||
_INTL("PRECISE ATTACK"),
|
||||
_INTL("FIERCE ATTACK")
|
||||
]
|
||||
if !@special[0]
|
||||
list.push(_INTL("SPECIAL ATTACK"))
|
||||
end
|
||||
command = pbMessage(_INTL("Choose a command."),list,0)
|
||||
if command==3
|
||||
@special[0] = true
|
||||
end
|
||||
if action==0 && command==0
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ScriptAsync,"moveRight90",
|
||||
PBMoveRoute::ScriptAsync,"moveLeft90",
|
||||
PBMoveRoute::ScriptAsync,"moveLeft90",
|
||||
PBMoveRoute::ScriptAsync,"moveRight90"])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ScriptAsync,"moveLeft90",
|
||||
PBMoveRoute::ScriptAsync,"moveRight90",
|
||||
PBMoveRoute::ScriptAsync,"moveRight90",
|
||||
PBMoveRoute::ScriptAsync,"moveLeft90"])
|
||||
pbWait(Graphics.frame_rate/2)
|
||||
list.push(_INTL("SPECIAL ATTACK")) if !@special[0]
|
||||
command = pbMessage(_INTL("Choose a command."), list, 0)
|
||||
@special[0] = true if command == 3
|
||||
if action == 0 && command == 0
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90"])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveRight90",
|
||||
PBMoveRoute::ScriptAsync, "moveLeft90"])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbMessage(_INTL("You study each other's movements..."))
|
||||
elsif action==0 && command==1
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
elsif action == 0 && command == 1
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*4/10)
|
||||
pbShake(9,9,8)
|
||||
pbFlashScreens(false,true)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(false, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[1] -= 1
|
||||
pbMessage(_INTL("Your attack was not blocked!"))
|
||||
elsif action==0 && command==2
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
elsif action == 0 && command == 2
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Backward])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMessage(_INTL("Your attack was evaded!"))
|
||||
elsif (action==0 || action==1 || action==2) && command==3
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
pbWait(Graphics.frame_rate*4/10)
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,5,
|
||||
elsif (action == 0 || action == 1 || action == 2) && command == 3
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
pbWait(Graphics.frame_rate/2)
|
||||
pbShake(9,9,8)
|
||||
pbFlashScreens(false,true)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(false, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
@hp[1] -= 3
|
||||
pbMessage(_INTL("You pierce through the opponent's defenses!"))
|
||||
elsif action==1 && command==0
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
elsif action == 1 && command == 0
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*4/10)
|
||||
pbShake(9,9,8)
|
||||
pbFlashScreens(true,false)
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, false)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[0] -= 1
|
||||
pbMessage(_INTL("You fail to block the opponent's attack!"))
|
||||
elsif action==1 && command==1
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
elsif action == 1 && command == 1
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*6/10)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbWait(Graphics.frame_rate * 6 / 10)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*6/10)
|
||||
pbMoveRoute(event,[PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*6/10)
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Backward])
|
||||
pbWait(Graphics.frame_rate * 6 / 10)
|
||||
pbMoveRoute(event, [PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate * 6 / 10)
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Backward])
|
||||
pbMessage(_INTL("You cross blades with the opponent!"))
|
||||
elsif (action==1 && command==2) ||
|
||||
(action==2 && command==1) ||
|
||||
(action==2 && command==2)
|
||||
pbMoveRoute($game_player,[
|
||||
elsif (action == 1 && command == 2) ||
|
||||
(action == 2 && command == 1) ||
|
||||
(action == 2 && command == 2)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
pbWait(Graphics.frame_rate*8/10)
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 8 / 10)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbWait(Graphics.frame_rate*9/10)
|
||||
pbShake(9,9,8)
|
||||
pbFlashScreens(true,true)
|
||||
pbMoveRoute($game_player,[
|
||||
pbWait(Graphics.frame_rate * 9 / 10)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, true)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute(event,[PBMoveRoute::Forward])
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Forward])
|
||||
pbMoveRoute(event, [PBMoveRoute::Forward])
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Forward])
|
||||
@hp[0] -= action # Enemy action
|
||||
@hp[1] -= command # Player command
|
||||
pbMessage(_INTL("You hit each other!"))
|
||||
elsif action==2 && command==0
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
elsif action == 2 && command == 0
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpBackward"])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpBackward"])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
pbMessage(_INTL("You evade the opponent's attack!"))
|
||||
elsif action==3 && (command==0 || command==1 || command==2)
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
pbWait(Graphics.frame_rate*4/10)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,5,
|
||||
elsif action == 3 && (command == 0 || command == 1 || command == 2)
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate * 4 / 10)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
pbWait(Graphics.frame_rate/2)
|
||||
pbShake(9,9,8)
|
||||
pbFlashScreens(true,false)
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbWait(Graphics.frame_rate / 2)
|
||||
pbShake(9, 9, 8)
|
||||
pbFlashScreens(true, false)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Forward])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,2,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 2,
|
||||
PBMoveRoute::Backward])
|
||||
@hp[0] -= 3
|
||||
pbMessage(_INTL("The opponent pierces through your defenses!"))
|
||||
elsif action==3 && command==3
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::Wait,15,
|
||||
PBMoveRoute::ChangeSpeed,4,
|
||||
PBMoveRoute::ScriptAsync,"jumpForward"])
|
||||
elsif action == 3 && command == 3
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Backward])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::Wait, 15,
|
||||
PBMoveRoute::ChangeSpeed, 4,
|
||||
PBMoveRoute::ScriptAsync, "jumpForward"])
|
||||
pbWait(Graphics.frame_rate)
|
||||
pbMoveRoute(event,[
|
||||
PBMoveRoute::ChangeSpeed,5,
|
||||
pbMoveRoute(event, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
pbMoveRoute($game_player,[
|
||||
PBMoveRoute::ChangeSpeed,5,
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::ChangeSpeed, 5,
|
||||
PBMoveRoute::Backward,
|
||||
PBMoveRoute::ChangeSpeed,2])
|
||||
pbShake(9,9,8)
|
||||
pbFlash(Color.new(255,255,255,255),20)
|
||||
pbFlashScreens(true,true)
|
||||
pbMoveRoute($game_player,[PBMoveRoute::Forward])
|
||||
PBMoveRoute::ChangeSpeed, 2])
|
||||
pbShake(9, 9, 8)
|
||||
pbFlash(Color.new(255, 255, 255, 255), 20)
|
||||
pbFlashScreens(true, true)
|
||||
pbMoveRoute($game_player, [PBMoveRoute::Forward])
|
||||
@hp[0] -= 4
|
||||
@hp[1] -= 4
|
||||
pbMessage(_INTL("Your special attacks collide!"))
|
||||
@@ -313,22 +307,22 @@ class PokemonDuel
|
||||
end
|
||||
|
||||
def pbEndDuel
|
||||
pbWait(Graphics.frame_rate*3/4)
|
||||
pbMoveRoute($game_player,[
|
||||
pbWait(Graphics.frame_rate * 3 / 4)
|
||||
pbMoveRoute($game_player, [
|
||||
PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed,@oldmovespeed])
|
||||
pbMoveRoute(@event,[
|
||||
PBMoveRoute::ChangeSpeed, @oldmovespeed])
|
||||
pbMoveRoute(@event, [
|
||||
PBMoveRoute::DirectionFixOff,
|
||||
PBMoveRoute::ChangeSpeed,@oldeventspeed])
|
||||
fadeTime = Graphics.frame_rate*4/10
|
||||
alphaDiff = (255.0/fadeTime).ceil
|
||||
fadeTime.times do
|
||||
@sprites["player"].opacity -= alphaDiff
|
||||
@sprites["opponent"].opacity -= alphaDiff
|
||||
@sprites["playerwindow"].contents_opacity -= alphaDiff
|
||||
@sprites["opponentwindow"].contents_opacity -= alphaDiff
|
||||
@sprites["playerwindow"].opacity -= alphaDiff
|
||||
@sprites["opponentwindow"].opacity -= alphaDiff
|
||||
PBMoveRoute::ChangeSpeed, @oldeventspeed])
|
||||
fade_time = Graphics.frame_rate * 4 / 10
|
||||
alpha_diff = (255.0 / fade_time).ceil
|
||||
fade_time.times do
|
||||
@sprites["player"].opacity -= alpha_diff
|
||||
@sprites["opponent"].opacity -= alpha_diff
|
||||
@sprites["playerwindow"].contents_opacity -= alpha_diff
|
||||
@sprites["opponentwindow"].contents_opacity -= alpha_diff
|
||||
@sprites["playerwindow"].opacity -= alpha_diff
|
||||
@sprites["opponentwindow"].opacity -= alpha_diff
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
@@ -337,71 +331,61 @@ class PokemonDuel
|
||||
@viewport.dispose
|
||||
end
|
||||
|
||||
def pbFlashScreens(player,opponent)
|
||||
def pbFlashScreens(player, opponent)
|
||||
i = 0
|
||||
flashTime = Graphics.frame_rate*2/10
|
||||
alphaDiff = (2*255.0/flashTime).ceil
|
||||
flashTime.times do
|
||||
flash_time = Graphics.frame_rate * 2 / 10
|
||||
alpha_diff = (2 * 255.0 / flash_time).ceil
|
||||
flash_time.times do
|
||||
i += 1
|
||||
if player
|
||||
@sprites["player"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["playerwindow"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["player"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
@sprites["playerwindow"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
end
|
||||
if opponent
|
||||
@sprites["opponent"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["opponentwindow"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["opponent"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
@sprites["opponentwindow"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
flashTime.times do
|
||||
flash_time.times do
|
||||
i -= 1
|
||||
if player
|
||||
@sprites["player"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["playerwindow"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["player"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
@sprites["playerwindow"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
end
|
||||
if opponent
|
||||
@sprites["opponent"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["opponentwindow"].color = Color.new(255,255,255,i*alphaDiff)
|
||||
@sprites["opponent"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
@sprites["opponentwindow"].color = Color.new(255, 255, 255, i * alpha_diff)
|
||||
end
|
||||
Graphics.update
|
||||
Input.update
|
||||
pbUpdateSceneMap
|
||||
end
|
||||
pbWait(Graphics.frame_rate*4/10) if !player || !opponent
|
||||
pbWait(Graphics.frame_rate * 4 / 10) if !player || !opponent
|
||||
end
|
||||
|
||||
def pbRefresh
|
||||
@sprites["playerwindow"].hp = @hp[0]
|
||||
@sprites["opponentwindow"].hp = @hp[1]
|
||||
pbWait(Graphics.frame_rate/4)
|
||||
pbWait(Graphics.frame_rate / 4)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# Starts a duel.
|
||||
# trainerid - ID or symbol of the opponent's trainer type.
|
||||
# trainername - Name of the opponent
|
||||
# trainer_id - ID or symbol of the opponent's trainer type.
|
||||
# trainer_name - Name of the opponent
|
||||
# event - Game_Event object for the character's event
|
||||
# speeches - Array of 12 speeches
|
||||
def pbDuel(trainerID,trainerName,event,speeches)
|
||||
trainerID = getID(PBTrainers,trainerID)
|
||||
def pbDuel(trainer_id, trainer_name, event, speeches)
|
||||
trainer_id = getID(PBTrainers, trainer_id)
|
||||
duel = PokemonDuel.new
|
||||
opponent = PokeBattle_Trainer.new(
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainerName),trainerID)
|
||||
speechTexts = []
|
||||
pbGetMessageFromHash(MessageTypes::TrainerNames,trainer_name), trainer_id)
|
||||
speech_texts = []
|
||||
for i in 0...12
|
||||
speechTexts.push(_I(speeches[i]))
|
||||
end
|
||||
duel.pbDuel(opponent,event,speechTexts)
|
||||
end
|
||||
|
||||
|
||||
|
||||
rescue Exception
|
||||
if $!.is_a?(SystemExit) || "#{$!.class}"=="Reset"
|
||||
raise $!
|
||||
speech_texts.push(_I(speeches[i]))
|
||||
end
|
||||
duel.pbDuel(opponent, event, speech_texts)
|
||||
end
|
||||
|
||||
@@ -261,7 +261,6 @@ class TriadScene
|
||||
preview.y = 60
|
||||
preview.z = 4
|
||||
index = -1
|
||||
chosenSprites = []
|
||||
for i in 0...@battle.maxCards
|
||||
@sprites["player#{i}"] = Sprite.new(@viewport)
|
||||
@sprites["player#{i}"].x = Graphics.width-92
|
||||
@@ -443,9 +442,8 @@ class TriadScene
|
||||
return choice
|
||||
end
|
||||
|
||||
def pbPlayerPlaceCard(card,cardIndex)
|
||||
def pbPlayerPlaceCard(cardIndex)
|
||||
@sprites["helpwindow"].text = _INTL("Place the card.")
|
||||
choice = 0
|
||||
boardX = 0
|
||||
boardY = 0
|
||||
doRefresh = true
|
||||
@@ -733,9 +731,10 @@ class TriadScreen
|
||||
for i in 0...@width*@height
|
||||
square = TriadSquare.new
|
||||
if @elements
|
||||
begin
|
||||
loop do
|
||||
square.type = rand(PBTypes.maxValue+1)
|
||||
end until !PBTypes.isPseudoType?(square.type)
|
||||
break if !PBTypes.isPseudoType?(square.type)
|
||||
end
|
||||
end
|
||||
@board.push(square)
|
||||
end
|
||||
@@ -793,7 +792,7 @@ class TriadScreen
|
||||
minIndex = minLevel*20
|
||||
maxIndex = maxLevel*20+20
|
||||
opponentCards = []
|
||||
for i in 0...self.maxCards
|
||||
self.maxCards.times do
|
||||
# generate random card based on level
|
||||
index = minIndex+rand(maxIndex-minIndex)
|
||||
opponentCards.push(candidates[index][0])
|
||||
@@ -821,7 +820,7 @@ class TriadScreen
|
||||
while !position
|
||||
cardIndex = @scene.pbPlayerChooseCard(cards.length)
|
||||
triadCard = TriadCard.new(cards[cardIndex])
|
||||
position = @scene.pbPlayerPlaceCard(triadCard,cardIndex)
|
||||
position = @scene.pbPlayerPlaceCard(cardIndex)
|
||||
end
|
||||
else
|
||||
# Opponent's turn
|
||||
@@ -990,7 +989,7 @@ end
|
||||
# Card storage
|
||||
#===============================================================================
|
||||
class PokemonGlobalMetadata
|
||||
attr_accessor :triads
|
||||
attr_writer :triads
|
||||
|
||||
def triads
|
||||
@triads = TriadStorage.new if !@triads
|
||||
|
||||
@@ -431,7 +431,7 @@ class VoltorbFlip
|
||||
# Create and split a string for the number, with padded 0s
|
||||
zeroes=2-num.to_s.length
|
||||
numText=""
|
||||
for j in 0...zeroes
|
||||
zeroes.times do
|
||||
numText+="0"
|
||||
end
|
||||
numText+=num.to_s
|
||||
@@ -449,7 +449,7 @@ class VoltorbFlip
|
||||
# Create and split a string for the number, with padded 0s
|
||||
zeroes=2-num.to_s.length
|
||||
numText=""
|
||||
for j in 0...zeroes
|
||||
zeroes.times do
|
||||
numText+="0"
|
||||
end
|
||||
numText+=num.to_s
|
||||
@@ -466,7 +466,7 @@ class VoltorbFlip
|
||||
def pbCreateCoins(source,y)
|
||||
zeroes=5-source.to_s.length
|
||||
coinText=""
|
||||
for i in 0...zeroes
|
||||
zeroes.times do
|
||||
coinText+="0"
|
||||
end
|
||||
coinText+=source.to_s
|
||||
|
||||
@@ -32,7 +32,7 @@ def pbLottery(winnum,nameVar=2,positionVar=3,matchedVar=4)
|
||||
winmatched=thismatched
|
||||
end
|
||||
end
|
||||
pbEachPokemon { |poke,box|
|
||||
pbEachPokemon { |poke,_box|
|
||||
thismatched=0
|
||||
id=poke.publicID
|
||||
for j in 0...5
|
||||
|
||||
@@ -339,8 +339,6 @@ class MiningGameScene
|
||||
prepattern=ITEMS[i[0]][6]
|
||||
next if provx+provwidth<=prex || provx>=prex+prewidth ||
|
||||
provy+provheight<=prey || provy>=prey+preheight
|
||||
dx=prex-provx
|
||||
dy=prey-provy
|
||||
for j in 0...prepattern.length
|
||||
next if prepattern[j]==0
|
||||
xco=prex+(j%prewidth)
|
||||
@@ -359,8 +357,6 @@ class MiningGameScene
|
||||
prepattern=IRON[i[0]][4]
|
||||
next if provx+provwidth<=prex || provx>=prex+prewidth ||
|
||||
provy+provheight<=prey || provy>=prey+preheight
|
||||
dx=prex-provx
|
||||
dy=prey-provy
|
||||
for j in 0...prepattern.length
|
||||
next if prepattern[j]==0
|
||||
xco=prex+(j%prewidth)
|
||||
|
||||
Reference in New Issue
Block a user