I use rpg maker XP and I am just started
but i can't put those script in one game.
script1:
script2:
script3:
I hope you guys can help me :P XD
but i can't put those script in one game.
script1:
class Bitmap
if not method_defined?('original_draw_text')
alias original_draw_text draw_text
def draw_text(*arg)
original_color = self.font.color.dup
self.font.color = Color.new(0, 0, 0, 128)
if arg[0].is_a?(Rect)
arg[0].x += 2
arg[0].y += 2
self.original_draw_text(*arg)
arg[0].x -= 2
arg[0].y -= 2
else
arg[0] += 2
arg[1] += 2
self.original_draw_text(*arg)
arg[0] -= 2
arg[1] -= 2
end
self.font.color = original_color
self.original_draw_text(*arg)
end
end
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80 + self.viewport.ox
@_damage_sprite.oy = 20 + self.viewport.oy
@_damage_sprite.x = self.x + self.viewport.rect.x
@_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
class Game_Actor < Game_Battler
def screen_x
if self.index != nil
n_split = [($game_party.actors.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_party.actors.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_party.actors.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_party.actors.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_party.actors.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_party.actors.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) / 5) + 480 + ((n_index / 4).floor * 60)
else
return 0
end
end
#--------------------------------------------------------------------------
# ? ????? Y ?????
#--------------------------------------------------------------------------
def screen_y
n_split = [($game_party.actors.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_party.actors.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_party.actors.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_party.actors.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_party.actors.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_party.actors.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
end
#--------------------------------------------------------------------------
# ? ????? Z ?????
#--------------------------------------------------------------------------
def screen_z
# ??????????? Z ?????????
if self.index != nil
return self.index
else
return 0
end
end
end
class Game_Enemy < Game_Battler
def screen_x
n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_troop.enemies.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_troop.enemies.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_troop.enemies.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_troop.enemies.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 2
end
end
when 4
n_index = self.index
if $game_troop.enemies.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((-160 / (4)) / 5) + 160 - ((n_index / 4).floor * 60)
end
#--------------------------------------------------------------------------
# ? ????? Y ?????
#--------------------------------------------------------------------------
def screen_y
n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_troop.enemies.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_troop.enemies.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_troop.enemies.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_troop.enemies.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_troop.enemies.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
end
#--------------------------------------------------------------------------
# ? ????? Z ?????
#--------------------------------------------------------------------------
def screen_z
return @member_index + 1
end
end
#==============================================================================
# ¦ Sprite_Battler
#------------------------------------------------------------------------------
# ????????????????Game_Battler ???????????????
# ????????????????????
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :battler # ????
attr_accessor :moving # Is the sprite moving?
attr_reader :index
attr_accessor :target_index
attr_accessor :direction
attr_accessor :pattern
#--------------------------------------------------------------------------
# ? ?????????
# viewport : ??????
# battler : ???? (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
change
@old = Graphics.frame_count # For the delay method
@goingup = true # Increasing animation? (if @rm2k_mode is true)
@once = false # Is the animation only played once?
@animated = true # Used to stop animation when @once is true
self.opacity = 0
@index = 0
@pattern_b = 0
@counter_b = 0
@trans_sprite = Sprite.new
@trans_sprite.opacity = 0
@bar_hp_sprite = Sprite.new
@bar_hp_sprite.bitmap = Bitmap.new(64, 10)
@bar_sp_sprite = Sprite.new
@bar_sp_sprite.bitmap = Bitmap.new(64, 10)
@color1 = Color.new(0, 0, 0, 192)
@color2 = Color.new(255, 255, 192, 192)
@color3 = Color.new(0, 0, 0, 192)
@color4 = Color.new(64, 0, 0, 192)
@old_hp = -1
@old_sp = -1
@battler = battler
@battler_visible = false
@first = true
@pattern = 0
if $target_index == nil
$target_index = 0
end
@battler.is_a?(Game_Enemy) ? enemy_pose(0, 1) : pose(0, 1)
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
if @trans_sprite.bitmap != nil
@trans_sprite.bitmap.dispose
end
@trans_sprite.dispose
@bar_hp_sprite.bitmap.dispose
@bar_hp_sprite.dispose
@bar_sp_sprite.bitmap.dispose
@bar_sp_sprite.dispose
super
end
def change(frames = 0, delay = 0, offx = 0, offy = 0, startf = 0, once = false)
@frames = frames
@delay = delay
@offset_x, @offset_y = offx, offy
@current_frame = startf
@once = once
@goingup = true
@animated = true
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
bar_check = true if @_damage_duration == 1
super
@trans_sprite.blend_type = self.blend_type
@trans_sprite.color = self.color
if @_collapse_duration > 0
@trans_sprite.opacity = self.opacity
else
@trans_sprite.opacity = [self.opacity, 160].min
end
if (@_damage_duration == 0 and bar_check == true) or @first == true
@first = false if @first == true
bar_check = false
@bar_must_change = true
end
@bar_hp_sprite.opacity = self.opacity
@bar_sp_sprite.opacity = self.opacity
# ????? nil ???
if @battler == nil
self.bitmap = nil
@trans_sprite.bitmap = nil
loop_animation(nil)
return
end
# ????????????????????
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# ????????????
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
if @battler.is_a?(Game_Actor)
@battler_name = @battler.character_name
@battler_hue = @battler.character_hue
@direction = 4
else
@direction = 6
end
self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
@width = bitmap.width / 4
@height = bitmap.height / 4
@frame_width = @width
@frame_height = @height
self.ox = @width / 2
self.oy = @height
@pattern = @current_frame
@direction = @offset_y
sx = @pattern * @width
sy = (@direction - 2) / 2 * @height
self.src_rect.set(sx, sy, @width, @height)
@current_frame = (@current_frame + 1) unless @frames == 0
@animated = false if @current_frame == @frames and @once
@current_frame %= @frames
@trans_sprite.bitmap = self.bitmap
@trans_sprite.ox = self.ox
@trans_sprite.oy = self.oy
@trans_sprite.src_rect.set(sx, sy, @width, @height)
# ?????????????????? 0 ???
if @battler.dead? or @battler.hidden
self.opacity = 0
@trans_sprite.opacity = 0
@bar_hp_sprite.opacity = 0
@bar_sp_sprite.opacity = 0
end
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
change_sp_bar if @old_sp != @battler.sp
if delay(@delay) and @animated
@pattern = @current_frame
@direction = @offset_y
sx = @pattern * @width
sy = (@direction - 2) / 2 * @height
self.src_rect.set(sx, sy, @width, @height)
@current_frame = (@current_frame + 1) unless @frames == 0
@animated = false if @current_frame == @frames and @once
@current_frame %= @frames
@trans_sprite.ox = self.ox
@trans_sprite.oy = self.oy
@trans_sprite.src_rect.set(sx, sy, @width, @height)
end
# ??????? ID ????????????
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# ??????????????
#if @battler.is_a?(Game_Actor) and @battler_visible
# ???????????????????????
#if $game_temp.battle_main_phase
#self.opacity += 3 if self.opacity < 255
#else
#self.opacity -= 3 if self.opacity > 207
#end
#end
# ??
if @battler.blink
blink_on
else
blink_off
end
# ??????
unless @battler_visible
# ??
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
# ?????
if @battler_visible
# ??
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@trans_sprite.opacity = 0
@battler_visible = false
end
# ??????
if @battler.white_flash
whiten
@battler.white_flash = false
end
# ???????
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# ????
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
if @bar_must_change == true
@bar_must_change = false
if @old_hp != @battler.hp
change_hp_bar
end
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
end
# ???????????
@trans_sprite.x = self.x
@trans_sprite.y = self.y
@trans_sprite.z = self.z
@bar_hp_sprite.x = @battler.screen_x - 32
@bar_hp_sprite.y = @battler.screen_y - (@height +18) if @height != nil
@bar_hp_sprite.z = 100
@bar_sp_sprite.x = @battler.screen_x - 32
@bar_sp_sprite.y = @battler.screen_y - (@height + 8) if @height != nil
@bar_sp_sprite.z = 100
end
#--------------------------------------------------------------------------
# - Move the sprite
# x : X coordinate of the destination point
# y : Y coordinate of the destination point
# speed : Speed of movement (0 = delayed, 1+ = faster)
# delay : Movement delay if speed is at 0
#--------------------------------------------------------------------------
def move(x, y, speed = 1, delay = 0)
@destx = x
@desty = y
@move_speed = speed
@move_delay = delay
@move_old = Graphics.frame_count
@moving = true
end
#--------------------------------------------------------------------------
# - Move sprite to destx and desty
#--------------------------------------------------------------------------
def update_move
return unless @moving
movinc = @move_speed == 0 ? 1 : @move_speed
if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
self.x += movinc if self.x < @destx
self.x -= movinc if self.x > @destx
self.y += movinc if self.y < @desty
self.y -= movinc if self.y > @desty
@move_old = Graphics.frame_count
end
if @move_speed > 1 # Check if sprite can't reach that point
self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
(@destx - self.x).abs <= @move_speed
self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
(@desty - self.y).abs <= @move_speed
end
if self.x == @destx and self.y == @desty
@moving = false
end
end
#--------------------------------------------------------------------------
# - Pause animation, but still updates movement
# frames : Number of frames
#--------------------------------------------------------------------------
def delay(frames)
update_move
if (Graphics.frame_count - @old >= frames)
@old = Graphics.frame_count
return true
end
return false
end
def change_hp_bar
j = false
@old_hp = @battler.hp if @old_hp == -1
i = @old_hp
loop do
i -= 10
if i < @battler.hp
i = @battler.hp
j = true
end
rate = i.to_f / @battler.maxhp
@color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
@color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
@bar_hp_sprite.bitmap.clear
@bar_hp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
@bar_hp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
@bar_hp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
@bar_hp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color5, @color6, 2)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
@bar_hp_sprite.opacity = self.opacity
Graphics.update
if j == true
j = false
break
end
end
@old_hp = @battler.hp
end
def change_sp_bar
j = false
@old_sp = @battler.sp if @old_sp == -1
i = @old_sp
loop do
i -= 10
if i < @battler.sp
i = @battler.sp
j = true
end
rate = i.to_f / @battler.maxsp
@color7 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
@color8 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
@bar_sp_sprite.bitmap.clear
@bar_sp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
@bar_sp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
@bar_sp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
@bar_sp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color7, @color8, 0)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
@bar_sp_sprite.opacity = self.opacity
Graphics.update
if j == true
j = false
break
end
end
@old_sp = @battler.sp
end
def enemy #
$target_index += $game_troop.enemies.size
$target_index %= $game_troop.enemies.size
return $game_troop.enemies[$target_index] #
end #
def actor #
$target_index += $game_party.actors.size
$target_index %= $game_party.actors.size
return $game_party.actors[$target_index] #
end
def index=(index)
@index = index
update
end
def pose(number, frames = 4)
case number
when 0
change(frames, 4, 0, 4, 0)
when 1
change(frames, 4, 0, 4)
when 2
change(frames, 4, 0, 6)
else
change(frames, 4, 0, 0, 0)
end
end
def enemy_pose(number ,enemy_frames = 4)
case number
when 0
change(enemy_frames, 4, 0, 6, 0)
when 1
change(enemy_frames, 4, 0, 4)
when 2
change(enemy_frames, 4, 0, 6)
else
change(enemy_frames, 4, 0, 0, 0)
end
end
def default_pose
pose(0, 1)
end
end
#==============================================================================
# ¦ Spriteset_Battle
#------------------------------------------------------------------------------
# ???????????????????????????? Scene_Battle ??
# ????????????
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :viewport1 # ????????????
attr_reader :viewport2 # ????????????
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ?????????
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
if $game_temp.battleback_name == ""
@battleback_sprite = nil
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names
@tilemap.autotiles = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
else
# ??????????????
@tilemap = nil
@battleback_sprite = Sprite.new(@viewport1)
end
# ????????????
@enemy_sprites = []
for enemy in $game_troop.enemies#.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# ????????????
@actor_sprites = []
for j in 0..7
# ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ð’ljÁ
@actor_sprites.push(Sprite_Battler.new(@viewport1, $game_party.actors[j]))
end
# ?????
@weather = RPG::Weather.new(@viewport1)
# ????????????
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# ????????????
@timer_sprite = Sprite_Timer.new
# ??????
update
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
if @tilemap != nil
# ?????????
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles.dispose
end
@tilemap.dispose
end
# ??????????????
if @battleback_sprite != nil
# ??????????????????????
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.dispose
end
# ??????????????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# ?????
@weather.dispose
# ????????????
for sprite in @picture_sprites
sprite.dispose
end
# ????????????
@timer_sprite.dispose
# ?????????
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def effect?
# ??????????????? true ???
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ???????????????????????
if @battleback_sprite != nil
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
bg_bitmap = RPG::Cache.battleback(@battleback_name)
bg_bitmap_stretch = Bitmap.new(640, 480)
bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 640, 480), bg_bitmap, bg_bitmap.rect)
@battleback_sprite.bitmap = bg_bitmap_stretch
end
end
if @tilemap != nil
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
end
# ????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# ???????????
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# ????????????
for sprite in @picture_sprites
sprite.update
end
# ????????????
@timer_sprite.update
# ???????????????
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# ????????????
@viewport4.color = $game_screen.flash_color
# ?????????
@viewport1.update
@viewport2.update
@viewport4.update
end
end
#==============================================================================
# ¦ Window_Command
#------------------------------------------------------------------------------
# ?????????????????????
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
# width : ???????
# commands : ??????????
#--------------------------------------------------------------------------
def initialize(width, commands, column_max = 1, style = 0, inf_scroll = 1)
# ????????????????????
super(0, 0, width, (commands.size * 1.0 / column_max).ceil * 32 + 32)
@inf_scroll = inf_scroll
@item_max = commands.size
@commands = commands
@column_max = column_max
@style = style
self.contents = Bitmap.new(width - 32, (@item_max * 1.0 / @column_max).ceil * 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
# color : ???
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(index%@column_max * (self.width / @column_max) + 4, 32 * (index/@column_max), self.width / @column_max - 40, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], @style)
end
#--------------------------------------------------------------------------
# ? ??????
# index : ????
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
def update_help
@help_window.set_actor($game_party.actors[$scene.actor_index])
end
end
#==============================================================================
# ¦ Arrow_Enemy
#------------------------------------------------------------------------------
# ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================
class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
def enemy
return $game_troop.enemies[@index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
# ???????????????????
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
# ?????
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# ?????
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += ((($game_troop.enemies.length) * 0.5).ceil)
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - ((($game_troop.enemies.length) * 0.5).ceil)
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# ???????????
if self.enemy != nil
self.x = self.enemy.screen_x + 4
self.y = self.enemy.screen_y + 36
self.z = self.enemy.screen_z + 1
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
# ????????????????????????
@help_window.set_enemy(self.enemy)
end
end
#==============================================================================
# ¦ Arrow_Actor
#------------------------------------------------------------------------------
# ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================
class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
def actor
return $game_party.actors[@index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
# ?????
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# ?????
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += ($game_party.actors.length * 0.5).ceil
@index %= $game_party.actors.size
end
# ?????
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - (($game_party.actors.length * 0.5).ceil)
@index %= $game_party.actors.size
end
# ???????????
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y + 36
self.z = self.actor.screen_z + 1
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
# ??????????????????????
@help_window.set_actor(self.actor)
end
end
class Scene_Battle
attr_accessor :actor_index
def main
# ???????????????
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# ??????????????????
$game_system.battle_interpreter.setup(nil, 0)
# ???????
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# ????????????????
s1 = $data_system.words.attack
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(640, [s1, s2, s3, s4], 4)
@actor_command_window.y = 64
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# ????????????
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
#@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# ???????????
@spriteset = Spriteset_Battle.new
# ????????????
@wait_count = 0
# ?????????
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# ???????????
start_phase1
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ??????????
$game_map.refresh
# ?????????
Graphics.freeze
# ????????
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
#@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# ???????????
@spriteset.dispose
# ???????????????
if $scene.is_a?(Scene_Title)
# ??????????
Graphics.transition
Graphics.freeze
end
# ???????????????????????????
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
def update
# ?????????????
if $game_system.battle_interpreter.running?
# ?????????
$game_system.battle_interpreter.update
# ?????????????????????????
if $game_temp.forcing_battler == nil
# ?????????????????
unless $game_system.battle_interpreter.running?
# ??????????????????????????
unless judge
setup_battle_event
end
end
# ????????????????
if @phase != 5
# ?????????????????
#@status_window.refresh
end
end
end
# ???? (????)??????
$game_system.update
$game_screen.update
# ????? 0 ??????
if $game_system.timer_working and $game_system.timer == 0
# ?????
$game_temp.battle_abort = true
end
# ????????
@help_window.update
@party_command_window.update
@actor_command_window.update
#@status_window.update
@message_window.update
# ???????????
@spriteset.update
# ?????????????
if $game_temp.transition_processing
# ?????????????????
$game_temp.transition_processing = false
# ?????????
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# ????????????????
if $game_temp.message_window_showing
return
end
# ???????????
if @spriteset.effect?
return
end
# ??????????
if $game_temp.gameover
# ??????????????
$scene = Scene_Gameover.new
return
end
# ???????????
if $game_temp.to_title
# ???????????
$scene = Scene_Title.new
return
end
# ????????
if $game_temp.battle_abort
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# ?????
battle_end(1)
return
end
# ????????
if @wait_count > 0
# ????????????
@wait_count -= 1
return
end
# this one holds the battle while the player moves
for actor in @spriteset.actor_sprites
if actor.moving
return
end
end
# and this one is for the enemy...
for enemy in @spriteset.enemy_sprites
if enemy.moving# and $game_system.animated_enemy
return
end
end
# ???????????????????????
# ????????????????
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# ??????????
case @phase
when 1 # ?????????
update_phase1
when 2 # ????????????
update_phase2
when 3 # ????????????
update_phase3
when 4 # ???????
update_phase4
when 5 # ???????????
update_phase5
end
end
def start_phase2
# ???? 2 ???
@phase = 2
# ?????????????
@actor_index = -1
@active_battler = nil
# ?????????????????
@party_command_window.active = true
@party_command_window.visible = true
# ?????????????????
@actor_command_window.active = false
@actor_command_window.visible = false
@help_window.visible = false
# ??????????????
$game_temp.battle_main_phase = false
# ????????????????
$game_party.clear_actions
# ????????????
unless $game_party.inputable?
# ?????????
start_phase4
end
end
def update_phase2_escape
# ??????????????
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# ??????????????
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# ??????
success = rand(100) < 50 * actors_agi / enemies_agi
# ???????
if success
# ?? SE ???
$game_system.se_play($data_system.escape_se)
for actor in $game_party.actors
@spriteset.actor_sprites[actor.index].pose(2)
@spriteset.actor_sprites[actor.index].move(660, actor.screen_y, 10)
end
check = escape_move
until check == false
@spriteset.update
Graphics.update
check = escape_move
end
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# ?????
battle_end(1)
# ???????
else
# ????????????????
$game_party.clear_actions
# ?????????
start_phase4
end
end
def escape_move
for actor in @spriteset.actor_sprites
if actor.moving
return true
end
end
return false
end
def start_phase5
# ???? 5 ???
@phase = 5
# ????? ME ???
$game_system.me_play($game_system.battle_end_me)
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# EXP???????????????
exp = 0
gold = 0
treasures = []
# ???
for enemy in $game_troop.enemies
# ??????????????
unless enemy.hidden
# ?? EXP????????
exp += enemy.exp
gold += enemy.gold
# ?????????
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# ???????? 6 ??????
treasures = treasures[0..5]
# EXP ??
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
#@status_window.level_up(i)
end
end
end
# ??????
$game_party.gain_gold(gold)
# ???????
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# ???????????????
@result_window = Window_BattleResult.new(exp, gold, treasures)
# ???????????
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ? ?????? (???????????)
#--------------------------------------------------------------------------
def update_phase5
# ????????? 0 ???????
if @phase5_wait_count > 0
# ????????????
@phase5_wait_count -= 1
# ????????? 0 ??????
if @phase5_wait_count == 0
# ????????????
@result_window.visible = true
# ??????????????
$game_temp.battle_main_phase = false
# ?????????????????
#@status_window.refresh
end
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?????
battle_end(0)
end
end
def phase3_setup_command_window
# ?????????????????
@party_command_window.active = false
@party_command_window.visible = false
# ?????????????????
@actor_command_window.active = true
@actor_command_window.visible = true
@help_window.visible = true
# ???????????????????
if @actor_command_window.help_window == nil
@actor_command_window.help_window = @help_window
end
@actor_command_window.update_help
#@actor_command_window.x = @actor_index * 160
# ??????? 0 ???
@actor_command_window.index = 0
end
def start_enemy_select
# ??????????
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
# ?????????????
@enemy_arrow.help_window = @help_window
# ?????????????????
@actor_command_window.active = false
@actor_command_window.visible = false
end
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
when 7
update_phase4_step7
end
end
def update_phase4_step1
# Change actor poses to default
#if @active_battler.is_a?(Game_Actor)
# @spriteset.actor_sprites[@active_battler.index].default_pose
#end
for i in 0...$game_party.actors.size
actor = $game_party.actors
@spriteset.actor_sprites.default_pose
end
@help_window.visible = false
if judge
return
end
if $game_temp.forcing_battler == nil
setup_battle_event
if $game_system.battle_interpreter.running?
return
end
end
if $game_temp.forcing_battler != nil
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
if @action_battlers.size == 0
start_phase2
return
end
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
@active_battler = @action_battlers.shift
if @active_battler.index == nil
return
end
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
@active_battler.remove_states_auto
#@status_window.refresh
@phase4_step = 2
end
def make_basic_action_result
if @active_battler.is_a?(Game_Actor)
$actor_on_top = true
elsif @active_battler.is_a?(Game_Enemy)
$actor_on_top = false
end
if @active_battler.current_action.basic == 0
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
#======== here is the setting for the movement & animation...
x = target.screen_x - 32
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(2)
@spriteset.enemy_sprites[@active_battler.index].move(x, target.screen_y, 10)
#========= here if you look at the RPG's movement settings you'll see
#========= that he takes the number 40 for the speed of the animation...
#========= i thing thats too fast so i settet it down to 10 so looks smoother...
end
if @active_battler.is_a?(Game_Actor)
weapon = $data_weapons[@active_battler.weapon_id]
range = false
if weapon != nil
for id in weapon.element_set
if $data_system.elements[23] == "Range"
range = true
break
end
end
end
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
#======= the same thing for the player... ^-^
x = target.screen_x + 32
@spriteset.actor_sprites[@active_battler.index].pose(1)
@spriteset.actor_sprites[@active_battler.index].move(x * (range ? 2 : 1), target.screen_y, 10)
range = false
end
@target_battlers = [target]
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
if @active_battler.current_action.basic == 1
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1) #defence
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1) #defence
end
@help_window.set_text($data_system.words.guard, 1)
return
end
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
@help_window.set_text("Escape", 1)
@active_battler.escape
return
end
if @active_battler.current_action.basic == 3
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
if @active_battler.current_action.basic == 4
if $game_temp.battle_can_escape == false
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
update_phase2_escape
return
end
end
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@active_battler.sp -= @skill.sp_cost
#@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
if @active_battler.is_a?(Game_Enemy)
#@spriteset.enemy_sprites[@active_battler.index].change_sp_bar
x = @active_battler.screen_x + 48
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(2)
@spriteset.enemy_sprites[@active_battler.index].move(x, @active_battler.screen_y, 5)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
if @active_battler.is_a?(Game_Actor)
#@spriteset.actor_sprites[@active_battler.index].change_sp_bar
x = @active_battler.screen_x - 48
@spriteset.actor_sprites[@active_battler.index].pose(1)
@spriteset.actor_sprites[@active_battler.index].move(x, @active_battler.screen_y, 5)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
end
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
def make_item_action_result
# sorry i didnt work on this...
# couse i dont have a sprite that uses items....
# so i just added the standby sprite here...
# when i get more time for this i'll try what i can do for this one... ^-^
# its the same as the ones above...
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
@item = $data_items[@active_battler.current_action.item_id]
unless $game_party.item_can_use?(@item.id)
@phase4_step = 1
return
end
if @item.consumable
$game_party.lose_item(@item.id, 1)
end
@help_window.set_text(@item.name, 1)
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
@common_event_id = @item.common_event_id
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
set_target_battlers(@item.scope)
for target in @target_battlers
target.item_effect(@item)
end
end
def update_phase4_step3
if @active_battler.current_action.kind == 0 and
@active_battler.current_action.basic == 0
# in this one... we have our weapon animations... for player and monster
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0,1)
elsif @active_battler.is_a?(Game_Enemy)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0,1)
end
end
if @animation1_id == 1
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
@phase4_step = 4
end
def update_phase4_step4
# this here is for the hit animation...
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
@wait_count = 8
@phase4_step = 5
end
def update_phase4_step5
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# ???????????
@help_window.visible = false
# ?????????????????
#@status_window.refresh
# ??????
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
end
end
# ???? 6 ???
@phase4_step = 6
end
def update_phase4_step6
# here we are asking if the player is dead and is a player or an enemy...
# these lines are for the running back and standby animation....
if @active_battler.is_a?(Game_Actor)
if @active_battler.current_action.basic == 1
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.actor_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
@spriteset.actor_sprites[@active_battler.index].pose(2)
end
else
if @active_battler.current_action.basic == 1
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
end
end
for target in @target_battlers
if target.is_a?(Game_Actor)
@spriteset.actor_sprites[target.index].pose(0, 1)
else
@spriteset.enemy_sprites[target.index].enemy_pose(0, 1)
end
end
$game_temp.forcing_battler = nil
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
@phase4_step = 7
end
def update_phase4_step7
# here we are asking if the player is dead and is a player or an enemy...
# these lines are for the running back and standby animation....
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
$game_temp.forcing_battler = nil
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
@phase4_step = 1
end
end
if not method_defined?('original_draw_text')
alias original_draw_text draw_text
def draw_text(*arg)
original_color = self.font.color.dup
self.font.color = Color.new(0, 0, 0, 128)
if arg[0].is_a?(Rect)
arg[0].x += 2
arg[0].y += 2
self.original_draw_text(*arg)
arg[0].x -= 2
arg[0].y -= 2
else
arg[0] += 2
arg[1] += 2
self.original_draw_text(*arg)
arg[0] -= 2
arg[1] -= 2
end
self.font.color = original_color
self.original_draw_text(*arg)
end
end
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80 + self.viewport.ox
@_damage_sprite.oy = 20 + self.viewport.oy
@_damage_sprite.x = self.x + self.viewport.rect.x
@_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
class Game_Actor < Game_Battler
def screen_x
if self.index != nil
n_split = [($game_party.actors.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_party.actors.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_party.actors.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_party.actors.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_party.actors.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_party.actors.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) / 5) + 480 + ((n_index / 4).floor * 60)
else
return 0
end
end
#--------------------------------------------------------------------------
# ? ????? Y ?????
#--------------------------------------------------------------------------
def screen_y
n_split = [($game_party.actors.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_party.actors.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_party.actors.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_party.actors.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_party.actors.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_party.actors.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
end
#--------------------------------------------------------------------------
# ? ????? Z ?????
#--------------------------------------------------------------------------
def screen_z
# ??????????? Z ?????????
if self.index != nil
return self.index
else
return 0
end
end
end
class Game_Enemy < Game_Battler
def screen_x
n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_troop.enemies.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_troop.enemies.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_troop.enemies.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_troop.enemies.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 2
end
end
when 4
n_index = self.index
if $game_troop.enemies.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((-160 / (4)) / 5) + 160 - ((n_index / 4).floor * 60)
end
#--------------------------------------------------------------------------
# ? ????? Y ?????
#--------------------------------------------------------------------------
def screen_y
n_split = [($game_troop.enemies.length * 0.5).ceil, 4].min
case n_split
when 1
n_index = self.index * 2
when 2
if self.index < ($game_troop.enemies.length - 2)
n_index = 0.5 + (2 * self.index)
else
if $game_troop.enemies.length == 3 then
n_index = (self.index * 2) + 2
elsif $game_troop.enemies.length == 4 then
n_index = self.index * 2
end
end
when 3
n_index = self.index + (0.25 * (self.index + 1))
if $game_troop.enemies.length == 5
if self.index < 2
n_index = self.index + (0.25 * (self.index + 1))
else
n_index = self.index + (0.25 * (self.index + 2)) + 1
end
end
when 4
n_index = self.index
if $game_troop.enemies.length == 7
if self.index < 3
n_index = self.index
else
n_index = self.index + 1
end
end
end
return (n_index - ((n_index / 4).floor) * 4) * ((160 / (4)) * 1.6) + 270 - ((n_index / 4).floor * (110 - (4 * 20)))
end
#--------------------------------------------------------------------------
# ? ????? Z ?????
#--------------------------------------------------------------------------
def screen_z
return @member_index + 1
end
end
#==============================================================================
# ¦ Sprite_Battler
#------------------------------------------------------------------------------
# ????????????????Game_Battler ???????????????
# ????????????????????
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_accessor :battler # ????
attr_accessor :moving # Is the sprite moving?
attr_reader :index
attr_accessor :target_index
attr_accessor :direction
attr_accessor :pattern
#--------------------------------------------------------------------------
# ? ?????????
# viewport : ??????
# battler : ???? (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
change
@old = Graphics.frame_count # For the delay method
@goingup = true # Increasing animation? (if @rm2k_mode is true)
@once = false # Is the animation only played once?
@animated = true # Used to stop animation when @once is true
self.opacity = 0
@index = 0
@pattern_b = 0
@counter_b = 0
@trans_sprite = Sprite.new
@trans_sprite.opacity = 0
@bar_hp_sprite = Sprite.new
@bar_hp_sprite.bitmap = Bitmap.new(64, 10)
@bar_sp_sprite = Sprite.new
@bar_sp_sprite.bitmap = Bitmap.new(64, 10)
@color1 = Color.new(0, 0, 0, 192)
@color2 = Color.new(255, 255, 192, 192)
@color3 = Color.new(0, 0, 0, 192)
@color4 = Color.new(64, 0, 0, 192)
@old_hp = -1
@old_sp = -1
@battler = battler
@battler_visible = false
@first = true
@pattern = 0
if $target_index == nil
$target_index = 0
end
@battler.is_a?(Game_Enemy) ? enemy_pose(0, 1) : pose(0, 1)
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
end
if @trans_sprite.bitmap != nil
@trans_sprite.bitmap.dispose
end
@trans_sprite.dispose
@bar_hp_sprite.bitmap.dispose
@bar_hp_sprite.dispose
@bar_sp_sprite.bitmap.dispose
@bar_sp_sprite.dispose
super
end
def change(frames = 0, delay = 0, offx = 0, offy = 0, startf = 0, once = false)
@frames = frames
@delay = delay
@offset_x, @offset_y = offx, offy
@current_frame = startf
@once = once
@goingup = true
@animated = true
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
bar_check = true if @_damage_duration == 1
super
@trans_sprite.blend_type = self.blend_type
@trans_sprite.color = self.color
if @_collapse_duration > 0
@trans_sprite.opacity = self.opacity
else
@trans_sprite.opacity = [self.opacity, 160].min
end
if (@_damage_duration == 0 and bar_check == true) or @first == true
@first = false if @first == true
bar_check = false
@bar_must_change = true
end
@bar_hp_sprite.opacity = self.opacity
@bar_sp_sprite.opacity = self.opacity
# ????? nil ???
if @battler == nil
self.bitmap = nil
@trans_sprite.bitmap = nil
loop_animation(nil)
return
end
# ????????????????????
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# ????????????
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
if @battler.is_a?(Game_Actor)
@battler_name = @battler.character_name
@battler_hue = @battler.character_hue
@direction = 4
else
@direction = 6
end
self.bitmap = RPG::Cache.character(@battler_name, @battler_hue)
@width = bitmap.width / 4
@height = bitmap.height / 4
@frame_width = @width
@frame_height = @height
self.ox = @width / 2
self.oy = @height
@pattern = @current_frame
@direction = @offset_y
sx = @pattern * @width
sy = (@direction - 2) / 2 * @height
self.src_rect.set(sx, sy, @width, @height)
@current_frame = (@current_frame + 1) unless @frames == 0
@animated = false if @current_frame == @frames and @once
@current_frame %= @frames
@trans_sprite.bitmap = self.bitmap
@trans_sprite.ox = self.ox
@trans_sprite.oy = self.oy
@trans_sprite.src_rect.set(sx, sy, @width, @height)
# ?????????????????? 0 ???
if @battler.dead? or @battler.hidden
self.opacity = 0
@trans_sprite.opacity = 0
@bar_hp_sprite.opacity = 0
@bar_sp_sprite.opacity = 0
end
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
change_sp_bar if @old_sp != @battler.sp
if delay(@delay) and @animated
@pattern = @current_frame
@direction = @offset_y
sx = @pattern * @width
sy = (@direction - 2) / 2 * @height
self.src_rect.set(sx, sy, @width, @height)
@current_frame = (@current_frame + 1) unless @frames == 0
@animated = false if @current_frame == @frames and @once
@current_frame %= @frames
@trans_sprite.ox = self.ox
@trans_sprite.oy = self.oy
@trans_sprite.src_rect.set(sx, sy, @width, @height)
end
# ??????? ID ????????????
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
# ??????????????
#if @battler.is_a?(Game_Actor) and @battler_visible
# ???????????????????????
#if $game_temp.battle_main_phase
#self.opacity += 3 if self.opacity < 255
#else
#self.opacity -= 3 if self.opacity > 207
#end
#end
# ??
if @battler.blink
blink_on
else
blink_off
end
# ??????
unless @battler_visible
# ??
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
# ?????
if @battler_visible
# ??
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@trans_sprite.opacity = 0
@battler_visible = false
end
# ??????
if @battler.white_flash
whiten
@battler.white_flash = false
end
# ???????
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
# ????
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
if @bar_must_change == true
@bar_must_change = false
if @old_hp != @battler.hp
change_hp_bar
end
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
end
# ???????????
@trans_sprite.x = self.x
@trans_sprite.y = self.y
@trans_sprite.z = self.z
@bar_hp_sprite.x = @battler.screen_x - 32
@bar_hp_sprite.y = @battler.screen_y - (@height +18) if @height != nil
@bar_hp_sprite.z = 100
@bar_sp_sprite.x = @battler.screen_x - 32
@bar_sp_sprite.y = @battler.screen_y - (@height + 8) if @height != nil
@bar_sp_sprite.z = 100
end
#--------------------------------------------------------------------------
# - Move the sprite
# x : X coordinate of the destination point
# y : Y coordinate of the destination point
# speed : Speed of movement (0 = delayed, 1+ = faster)
# delay : Movement delay if speed is at 0
#--------------------------------------------------------------------------
def move(x, y, speed = 1, delay = 0)
@destx = x
@desty = y
@move_speed = speed
@move_delay = delay
@move_old = Graphics.frame_count
@moving = true
end
#--------------------------------------------------------------------------
# - Move sprite to destx and desty
#--------------------------------------------------------------------------
def update_move
return unless @moving
movinc = @move_speed == 0 ? 1 : @move_speed
if Graphics.frame_count - @move_old > @move_delay or @move_speed != 0
self.x += movinc if self.x < @destx
self.x -= movinc if self.x > @destx
self.y += movinc if self.y < @desty
self.y -= movinc if self.y > @desty
@move_old = Graphics.frame_count
end
if @move_speed > 1 # Check if sprite can't reach that point
self.x = @destx if (@destx - self.x).abs % @move_speed != 0 and
(@destx - self.x).abs <= @move_speed
self.y = @desty if (@desty - self.y).abs % @move_speed != 0 and
(@desty - self.y).abs <= @move_speed
end
if self.x == @destx and self.y == @desty
@moving = false
end
end
#--------------------------------------------------------------------------
# - Pause animation, but still updates movement
# frames : Number of frames
#--------------------------------------------------------------------------
def delay(frames)
update_move
if (Graphics.frame_count - @old >= frames)
@old = Graphics.frame_count
return true
end
return false
end
def change_hp_bar
j = false
@old_hp = @battler.hp if @old_hp == -1
i = @old_hp
loop do
i -= 10
if i < @battler.hp
i = @battler.hp
j = true
end
rate = i.to_f / @battler.maxhp
@color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
@color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
@bar_hp_sprite.bitmap.clear
@bar_hp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
@bar_hp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
@bar_hp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
@bar_hp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color5, @color6, 2)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
@bar_hp_sprite.opacity = self.opacity
Graphics.update
if j == true
j = false
break
end
end
@old_hp = @battler.hp
end
def change_sp_bar
j = false
@old_sp = @battler.sp if @old_sp == -1
i = @old_sp
loop do
i -= 10
if i < @battler.sp
i = @battler.sp
j = true
end
rate = i.to_f / @battler.maxsp
@color7 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
@color8 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
@bar_sp_sprite.bitmap.clear
@bar_sp_sprite.bitmap.fill_rect(0, 0, 64, 10, @color1)
@bar_sp_sprite.bitmap.fill_rect(1, 1, 62, 8, @color2)
@bar_sp_sprite.bitmap.gradation_rect(2, 2, 60, 6, @color3, @color4, 1)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 60, 6, @color3)
@bar_sp_sprite.bitmap.gradation_rect(2, 2, 64 * rate - 4, 6, @color7, @color8, 0)
#@bar_hp_sprite.bitmap.fill_rect(2, 2, 64 * rate - 4, 6, @color5)
@bar_sp_sprite.opacity = self.opacity
Graphics.update
if j == true
j = false
break
end
end
@old_sp = @battler.sp
end
def enemy #
$target_index += $game_troop.enemies.size
$target_index %= $game_troop.enemies.size
return $game_troop.enemies[$target_index] #
end #
def actor #
$target_index += $game_party.actors.size
$target_index %= $game_party.actors.size
return $game_party.actors[$target_index] #
end
def index=(index)
@index = index
update
end
def pose(number, frames = 4)
case number
when 0
change(frames, 4, 0, 4, 0)
when 1
change(frames, 4, 0, 4)
when 2
change(frames, 4, 0, 6)
else
change(frames, 4, 0, 0, 0)
end
end
def enemy_pose(number ,enemy_frames = 4)
case number
when 0
change(enemy_frames, 4, 0, 6, 0)
when 1
change(enemy_frames, 4, 0, 4)
when 2
change(enemy_frames, 4, 0, 6)
else
change(enemy_frames, 4, 0, 0, 0)
end
end
def default_pose
pose(0, 1)
end
end
#==============================================================================
# ¦ Spriteset_Battle
#------------------------------------------------------------------------------
# ???????????????????????????? Scene_Battle ??
# ????????????
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
attr_reader :viewport1 # ????????????
attr_reader :viewport2 # ????????????
attr_accessor :actor_sprites
attr_accessor :enemy_sprites
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
# ?????????
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
if $game_temp.battleback_name == ""
@battleback_sprite = nil
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names
@tilemap.autotiles = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
else
# ??????????????
@tilemap = nil
@battleback_sprite = Sprite.new(@viewport1)
end
# ????????????
@enemy_sprites = []
for enemy in $game_troop.enemies#.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# ????????????
@actor_sprites = []
for j in 0..7
# ƒAƒNƒ^[ƒXƒvƒ‰ƒCƒg‚ð’ljÁ
@actor_sprites.push(Sprite_Battler.new(@viewport1, $game_party.actors[j]))
end
# ?????
@weather = RPG::Weather.new(@viewport1)
# ????????????
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# ????????????
@timer_sprite = Sprite_Timer.new
# ??????
update
end
#--------------------------------------------------------------------------
# ? ??
#--------------------------------------------------------------------------
def dispose
if @tilemap != nil
# ?????????
@tilemap.tileset.dispose
for i in 0..6
@tilemap.autotiles.dispose
end
@tilemap.dispose
end
# ??????????????
if @battleback_sprite != nil
# ??????????????????????
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
@battleback_sprite.dispose
end
# ??????????????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.dispose
end
# ?????
@weather.dispose
# ????????????
for sprite in @picture_sprites
sprite.dispose
end
# ????????????
@timer_sprite.dispose
# ?????????
@viewport1.dispose
@viewport2.dispose
@viewport3.dispose
@viewport4.dispose
end
#--------------------------------------------------------------------------
# ? ??????????
#--------------------------------------------------------------------------
def effect?
# ??????????????? true ???
for sprite in @enemy_sprites + @actor_sprites
return true if sprite.effect?
end
return false
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ???????????????????????
if @battleback_sprite != nil
if @battleback_name != $game_temp.battleback_name
@battleback_name = $game_temp.battleback_name
if @battleback_sprite.bitmap != nil
@battleback_sprite.bitmap.dispose
end
bg_bitmap = RPG::Cache.battleback(@battleback_name)
bg_bitmap_stretch = Bitmap.new(640, 480)
bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 640, 480), bg_bitmap, bg_bitmap.rect)
@battleback_sprite.bitmap = bg_bitmap_stretch
end
end
if @tilemap != nil
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
end
# ????????????
for sprite in @enemy_sprites + @actor_sprites
sprite.update
end
# ???????????
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.update
# ????????????
for sprite in @picture_sprites
sprite.update
end
# ????????????
@timer_sprite.update
# ???????????????
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# ????????????
@viewport4.color = $game_screen.flash_color
# ?????????
@viewport1.update
@viewport2.update
@viewport4.update
end
end
#==============================================================================
# ¦ Window_Command
#------------------------------------------------------------------------------
# ?????????????????????
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
# width : ???????
# commands : ??????????
#--------------------------------------------------------------------------
def initialize(width, commands, column_max = 1, style = 0, inf_scroll = 1)
# ????????????????????
super(0, 0, width, (commands.size * 1.0 / column_max).ceil * 32 + 32)
@inf_scroll = inf_scroll
@item_max = commands.size
@commands = commands
@column_max = column_max
@style = style
self.contents = Bitmap.new(width - 32, (@item_max * 1.0 / @column_max).ceil * 32)
self.contents.font.name = "Tahoma"
self.contents.font.size = 22
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
# color : ???
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(index%@column_max * (self.width / @column_max) + 4, 32 * (index/@column_max), self.width / @column_max - 40, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], @style)
end
#--------------------------------------------------------------------------
# ? ??????
# index : ????
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
def update_help
@help_window.set_actor($game_party.actors[$scene.actor_index])
end
end
#==============================================================================
# ¦ Arrow_Enemy
#------------------------------------------------------------------------------
# ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================
class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
def enemy
return $game_troop.enemies[@index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
# ???????????????????
$game_troop.enemies.size.times do
break if self.enemy.exist?
@index += 1
@index %= $game_troop.enemies.size
end
# ?????
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# ?????
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += ((($game_troop.enemies.length) * 0.5).ceil)
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - ((($game_troop.enemies.length) * 0.5).ceil)
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# ???????????
if self.enemy != nil
self.x = self.enemy.screen_x + 4
self.y = self.enemy.screen_y + 36
self.z = self.enemy.screen_z + 1
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
# ????????????????????????
@help_window.set_enemy(self.enemy)
end
end
#==============================================================================
# ¦ Arrow_Actor
#------------------------------------------------------------------------------
# ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================
class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ? ?????????????????
#--------------------------------------------------------------------------
def actor
return $game_party.actors[@index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
# ?????
if Input.repeat?(Input::DOWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# ?????
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
if Input.repeat?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index += ($game_party.actors.length * 0.5).ceil
@index %= $game_party.actors.size
end
# ?????
if Input.repeat?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - (($game_party.actors.length * 0.5).ceil)
@index %= $game_party.actors.size
end
# ???????????
if self.actor != nil
self.x = self.actor.screen_x
self.y = self.actor.screen_y + 36
self.z = self.actor.screen_z + 1
end
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
# ??????????????????????
@help_window.set_actor(self.actor)
end
end
class Scene_Battle
attr_accessor :actor_index
def main
# ???????????????
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# ??????????????????
$game_system.battle_interpreter.setup(nil, 0)
# ???????
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# ????????????????
s1 = $data_system.words.attack
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@actor_command_window = Window_Command.new(640, [s1, s2, s3, s4], 4)
@actor_command_window.y = 64
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# ????????????
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
#@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# ???????????
@spriteset = Spriteset_Battle.new
# ????????????
@wait_count = 0
# ?????????
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# ???????????
start_phase1
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ??????????
$game_map.refresh
# ?????????
Graphics.freeze
# ????????
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
#@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# ???????????
@spriteset.dispose
# ???????????????
if $scene.is_a?(Scene_Title)
# ??????????
Graphics.transition
Graphics.freeze
end
# ???????????????????????????
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
def update
# ?????????????
if $game_system.battle_interpreter.running?
# ?????????
$game_system.battle_interpreter.update
# ?????????????????????????
if $game_temp.forcing_battler == nil
# ?????????????????
unless $game_system.battle_interpreter.running?
# ??????????????????????????
unless judge
setup_battle_event
end
end
# ????????????????
if @phase != 5
# ?????????????????
#@status_window.refresh
end
end
end
# ???? (????)??????
$game_system.update
$game_screen.update
# ????? 0 ??????
if $game_system.timer_working and $game_system.timer == 0
# ?????
$game_temp.battle_abort = true
end
# ????????
@help_window.update
@party_command_window.update
@actor_command_window.update
#@status_window.update
@message_window.update
# ???????????
@spriteset.update
# ?????????????
if $game_temp.transition_processing
# ?????????????????
$game_temp.transition_processing = false
# ?????????
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# ????????????????
if $game_temp.message_window_showing
return
end
# ???????????
if @spriteset.effect?
return
end
# ??????????
if $game_temp.gameover
# ??????????????
$scene = Scene_Gameover.new
return
end
# ???????????
if $game_temp.to_title
# ???????????
$scene = Scene_Title.new
return
end
# ????????
if $game_temp.battle_abort
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# ?????
battle_end(1)
return
end
# ????????
if @wait_count > 0
# ????????????
@wait_count -= 1
return
end
# this one holds the battle while the player moves
for actor in @spriteset.actor_sprites
if actor.moving
return
end
end
# and this one is for the enemy...
for enemy in @spriteset.enemy_sprites
if enemy.moving# and $game_system.animated_enemy
return
end
end
# ???????????????????????
# ????????????????
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
# ??????????
case @phase
when 1 # ?????????
update_phase1
when 2 # ????????????
update_phase2
when 3 # ????????????
update_phase3
when 4 # ???????
update_phase4
when 5 # ???????????
update_phase5
end
end
def start_phase2
# ???? 2 ???
@phase = 2
# ?????????????
@actor_index = -1
@active_battler = nil
# ?????????????????
@party_command_window.active = true
@party_command_window.visible = true
# ?????????????????
@actor_command_window.active = false
@actor_command_window.visible = false
@help_window.visible = false
# ??????????????
$game_temp.battle_main_phase = false
# ????????????????
$game_party.clear_actions
# ????????????
unless $game_party.inputable?
# ?????????
start_phase4
end
end
def update_phase2_escape
# ??????????????
enemies_agi = 0
enemies_number = 0
for enemy in $game_troop.enemies
if enemy.exist?
enemies_agi += enemy.agi
enemies_number += 1
end
end
if enemies_number > 0
enemies_agi /= enemies_number
end
# ??????????????
actors_agi = 0
actors_number = 0
for actor in $game_party.actors
if actor.exist?
actors_agi += actor.agi
actors_number += 1
end
end
if actors_number > 0
actors_agi /= actors_number
end
# ??????
success = rand(100) < 50 * actors_agi / enemies_agi
# ???????
if success
# ?? SE ???
$game_system.se_play($data_system.escape_se)
for actor in $game_party.actors
@spriteset.actor_sprites[actor.index].pose(2)
@spriteset.actor_sprites[actor.index].move(660, actor.screen_y, 10)
end
check = escape_move
until check == false
@spriteset.update
Graphics.update
check = escape_move
end
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# ?????
battle_end(1)
# ???????
else
# ????????????????
$game_party.clear_actions
# ?????????
start_phase4
end
end
def escape_move
for actor in @spriteset.actor_sprites
if actor.moving
return true
end
end
return false
end
def start_phase5
# ???? 5 ???
@phase = 5
# ????? ME ???
$game_system.me_play($game_system.battle_end_me)
# ??????? BGM ???
$game_system.bgm_play($game_temp.map_bgm)
# EXP???????????????
exp = 0
gold = 0
treasures = []
# ???
for enemy in $game_troop.enemies
# ??????????????
unless enemy.hidden
# ?? EXP????????
exp += enemy.exp
gold += enemy.gold
# ?????????
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# ???????? 6 ??????
treasures = treasures[0..5]
# EXP ??
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.cant_get_exp? == false
last_level = actor.level
actor.exp += exp
if actor.level > last_level
#@status_window.level_up(i)
end
end
end
# ??????
$game_party.gain_gold(gold)
# ???????
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# ???????????????
@result_window = Window_BattleResult.new(exp, gold, treasures)
# ???????????
@phase5_wait_count = 100
end
#--------------------------------------------------------------------------
# ? ?????? (???????????)
#--------------------------------------------------------------------------
def update_phase5
# ????????? 0 ???????
if @phase5_wait_count > 0
# ????????????
@phase5_wait_count -= 1
# ????????? 0 ??????
if @phase5_wait_count == 0
# ????????????
@result_window.visible = true
# ??????????????
$game_temp.battle_main_phase = false
# ?????????????????
#@status_window.refresh
end
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?????
battle_end(0)
end
end
def phase3_setup_command_window
# ?????????????????
@party_command_window.active = false
@party_command_window.visible = false
# ?????????????????
@actor_command_window.active = true
@actor_command_window.visible = true
@help_window.visible = true
# ???????????????????
if @actor_command_window.help_window == nil
@actor_command_window.help_window = @help_window
end
@actor_command_window.update_help
#@actor_command_window.x = @actor_index * 160
# ??????? 0 ???
@actor_command_window.index = 0
end
def start_enemy_select
# ??????????
@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport2)
# ?????????????
@enemy_arrow.help_window = @help_window
# ?????????????????
@actor_command_window.active = false
@actor_command_window.visible = false
end
def update_phase4
case @phase4_step
when 1
update_phase4_step1
when 2
update_phase4_step2
when 3
update_phase4_step3
when 4
update_phase4_step4
when 5
update_phase4_step5
when 6
update_phase4_step6
when 7
update_phase4_step7
end
end
def update_phase4_step1
# Change actor poses to default
#if @active_battler.is_a?(Game_Actor)
# @spriteset.actor_sprites[@active_battler.index].default_pose
#end
for i in 0...$game_party.actors.size
actor = $game_party.actors
@spriteset.actor_sprites.default_pose
end
@help_window.visible = false
if judge
return
end
if $game_temp.forcing_battler == nil
setup_battle_event
if $game_system.battle_interpreter.running?
return
end
end
if $game_temp.forcing_battler != nil
@action_battlers.delete($game_temp.forcing_battler)
@action_battlers.unshift($game_temp.forcing_battler)
end
if @action_battlers.size == 0
start_phase2
return
end
@animation1_id = 0
@animation2_id = 0
@common_event_id = 0
@active_battler = @action_battlers.shift
if @active_battler.index == nil
return
end
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
@active_battler.remove_states_auto
#@status_window.refresh
@phase4_step = 2
end
def make_basic_action_result
if @active_battler.is_a?(Game_Actor)
$actor_on_top = true
elsif @active_battler.is_a?(Game_Enemy)
$actor_on_top = false
end
if @active_battler.current_action.basic == 0
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
#======== here is the setting for the movement & animation...
x = target.screen_x - 32
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(2)
@spriteset.enemy_sprites[@active_battler.index].move(x, target.screen_y, 10)
#========= here if you look at the RPG's movement settings you'll see
#========= that he takes the number 40 for the speed of the animation...
#========= i thing thats too fast so i settet it down to 10 so looks smoother...
end
if @active_battler.is_a?(Game_Actor)
weapon = $data_weapons[@active_battler.weapon_id]
range = false
if weapon != nil
for id in weapon.element_set
if $data_system.elements[23] == "Range"
range = true
break
end
end
end
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
#======= the same thing for the player... ^-^
x = target.screen_x + 32
@spriteset.actor_sprites[@active_battler.index].pose(1)
@spriteset.actor_sprites[@active_battler.index].move(x * (range ? 2 : 1), target.screen_y, 10)
range = false
end
@target_battlers = [target]
for target in @target_battlers
target.attack_effect(@active_battler)
end
return
end
if @active_battler.current_action.basic == 1
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1) #defence
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1) #defence
end
@help_window.set_text($data_system.words.guard, 1)
return
end
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
@help_window.set_text("Escape", 1)
@active_battler.escape
return
end
if @active_battler.current_action.basic == 3
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
if @active_battler.current_action.basic == 4
if $game_temp.battle_can_escape == false
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
update_phase2_escape
return
end
end
def make_skill_action_result
@skill = $data_skills[@active_battler.current_action.skill_id]
unless @active_battler.current_action.forcing
unless @active_battler.skill_can_use?(@skill.id)
$game_temp.forcing_battler = nil
@phase4_step = 1
return
end
end
@active_battler.sp -= @skill.sp_cost
#@status_window.refresh
@help_window.set_text(@skill.name, 1)
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
if @active_battler.is_a?(Game_Enemy)
#@spriteset.enemy_sprites[@active_battler.index].change_sp_bar
x = @active_battler.screen_x + 48
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(2)
@spriteset.enemy_sprites[@active_battler.index].move(x, @active_battler.screen_y, 5)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
if @active_battler.is_a?(Game_Actor)
#@spriteset.actor_sprites[@active_battler.index].change_sp_bar
x = @active_battler.screen_x - 48
@spriteset.actor_sprites[@active_battler.index].pose(1)
@spriteset.actor_sprites[@active_battler.index].move(x, @active_battler.screen_y, 5)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
end
@common_event_id = @skill.common_event_id
set_target_battlers(@skill.scope)
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
def make_item_action_result
# sorry i didnt work on this...
# couse i dont have a sprite that uses items....
# so i just added the standby sprite here...
# when i get more time for this i'll try what i can do for this one... ^-^
# its the same as the ones above...
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
@item = $data_items[@active_battler.current_action.item_id]
unless $game_party.item_can_use?(@item.id)
@phase4_step = 1
return
end
if @item.consumable
$game_party.lose_item(@item.id, 1)
end
@help_window.set_text(@item.name, 1)
@animation1_id = @item.animation1_id
@animation2_id = @item.animation2_id
@common_event_id = @item.common_event_id
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
set_target_battlers(@item.scope)
for target in @target_battlers
target.item_effect(@item)
end
end
def update_phase4_step3
if @active_battler.current_action.kind == 0 and
@active_battler.current_action.basic == 0
# in this one... we have our weapon animations... for player and monster
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0,1)
elsif @active_battler.is_a?(Game_Enemy)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0,1)
end
end
if @animation1_id == 1
@active_battler.white_flash = true
else
@active_battler.animation_id = @animation1_id
@active_battler.animation_hit = true
end
@phase4_step = 4
end
def update_phase4_step4
# this here is for the hit animation...
for target in @target_battlers
target.animation_id = @animation2_id
target.animation_hit = (target.damage != "Miss")
end
@wait_count = 8
@phase4_step = 5
end
def update_phase4_step5
if @active_battler.hp > 0 and @active_battler.slip_damage?
@active_battler.slip_damage_effect
@active_battler.damage_pop = true
end
# ???????????
@help_window.visible = false
# ?????????????????
#@status_window.refresh
# ??????
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
for target in @target_battlers
if target.damage != nil
target.damage_pop = true
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
end
end
# ???? 6 ???
@phase4_step = 6
end
def update_phase4_step6
# here we are asking if the player is dead and is a player or an enemy...
# these lines are for the running back and standby animation....
if @active_battler.is_a?(Game_Actor)
if @active_battler.current_action.basic == 1
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.actor_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
@spriteset.actor_sprites[@active_battler.index].pose(2)
end
else
if @active_battler.current_action.basic == 1
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].move(@active_battler.screen_x, @active_battler.screen_y, 20)
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(1)
end
end
for target in @target_battlers
if target.is_a?(Game_Actor)
@spriteset.actor_sprites[target.index].pose(0, 1)
else
@spriteset.enemy_sprites[target.index].enemy_pose(0, 1)
end
end
$game_temp.forcing_battler = nil
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
@phase4_step = 7
end
def update_phase4_step7
# here we are asking if the player is dead and is a player or an enemy...
# these lines are for the running back and standby animation....
if @active_battler.is_a?(Game_Actor)
@spriteset.actor_sprites[@active_battler.index].pose(0, 1)
else
@spriteset.enemy_sprites[@active_battler.index].enemy_pose(0, 1)
end
$game_temp.forcing_battler = nil
if @common_event_id > 0
common_event = $data_common_events[@common_event_id]
$game_system.battle_interpreter.setup(common_event.list, 0)
end
@phase4_step = 1
end
end
script2:
#=================================================================
# ? Battle Result by A3D Ver. 1.02
# Useful : show battle result in a different way
# Effect to default script : this code will replace methode "start_phase5" & "update_phase5" in Scene_Battle
# How to install : in script editor, insert all the code above main
# Note : this script is for non-commercial use only, give credit if use
# Contact : A3D (hyper_s@hotmail.com)
#=================================================================
module A3D
WAIT_WINDOW_APPEAR = 60
WAIT_RUNNING_NUMBER = 20
STEP_EXP = 1
STEP_GOLD = 1
SE_LEVELUP = ["007-System07", 100, 100]
SE_NEWSKILL = ["007-System07", 100, 100]
FONT_NAME = "Tahoma"
FONT_SIZE = 22
end
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ? After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure acquisition
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Create Variable & Window
@phase5_step = 1
@wait_window_appear = A3D::WAIT_WINDOW_APPEAR
@wait_running_number = A3D::WAIT_RUNNING_NUMBER
@resultreceive_window = Window_ResultReceive.new(exp, gold, treasures)
@resultgold_window = Window_ResultGold.new
@resultparty_window = Window_ResultParty.new
@actor_level_before = []
@resultlevel_window = []
@resultskill_window = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
@actor_level_before = actor.level
@resultlevel_window = Window_ResultLevel.new(i)
@resultskill_window = Window_ResultSkill.new(i)
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5
#--------------------------------------------------------------------------
def update_phase5
case @phase5_step
when 1 # EXP & Gold Phase
update_phase5_step1
when 2 # Skill Phase
update_phase5_step2
when 3 # Delete Window Phase
update_phase5_step3
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 1
#--------------------------------------------------------------------------
def update_phase5_step1
# Wait Count Before Window Appear
if @wait_window_appear > 0
@wait_window_appear -= 1
if @wait_window_appear == 0
@resultreceive_window.visible = true
@resultgold_window.visible = true
@resultparty_window.visible = true
$game_temp.battle_main_phase = false
end
return
end
# Wait Count Before Running Number
if @wait_running_number > 0
@wait_running_number -= 1
return
end
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# EXP & Gold Rolling
if (@resultreceive_window.exp != 0 || @resultreceive_window.gold != 0)
# Input C to Shortcut Calculation
if Input.trigger?(Input::C)
for i in 0...$game_party.actors.size
actor = $game_party.actors
level_before = actor.level
actor.exp += @resultreceive_window.exp
if actor.level > level_before
@resultlevel_window.visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
end
$game_party.gain_gold(@resultreceive_window.gold)
@resultreceive_window.exp = 0
@resultreceive_window.gold = 0
@resultreceive_window.refresh
@resultgold_window.refresh
@resultparty_window.refresh
end
# EXP
if @resultreceive_window.exp != 0
step_exp = @resultreceive_window.exp >= A3D::STEP_EXP.abs ? A3D::STEP_EXP.abs : @resultreceive_window.exp
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.next_rest_exp <= step_exp && actor.next_rest_exp != 0
@resultlevel_window.visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
actor.exp += step_exp
end
@resultreceive_window.exp -= step_exp
@resultreceive_window.refresh
@resultparty_window.refresh
end
# Gold
if @resultreceive_window.gold != 0
step_gold = @resultreceive_window.gold >= A3D::STEP_GOLD.abs ? A3D::STEP_GOLD.abs : @resultreceive_window.gold
$game_party.gain_gold(step_gold)
@resultreceive_window.gold -= step_gold
@resultreceive_window.refresh
@resultgold_window.refresh
end
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 2
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 2
#--------------------------------------------------------------------------
def update_phase5_step2
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# Initialize Skill Phase
if @initialized_skill_phase == nil
for i in 0...$game_party.actors.size
actor = $game_party.actors
for skill in $data_classes[actor.class_id].learnings
if skill.level > @actor_level_before && skill.level <= actor.level
Audio.se_play("Audio/SE/" + A3D::SE_NEWSKILL[0], A3D::SE_NEWSKILL[1], A3D::SE_NEWSKILL[2])
@resultskill_window.skill_id = skill.skill_id
@resultskill_window.visible = true
@resultskill_window.refresh
@skill_phase_active = true
end
end
end
@initialized_skill_phase = true
end
# If Skill Phase Active, Show Window
if @skill_phase_active != nil
if @resultskill_window[0].x != 456
for i in 0...$game_party.actors.size
@resultskill_window.x -= 23
end
return
end
else
@phase5_step = 3
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 3
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 3
#--------------------------------------------------------------------------
def update_phase5_step3
# Delete All Result-Window
@resultreceive_window.dispose
@resultgold_window.dispose
@resultparty_window.dispose
for i in 0...$game_party.actors.size
@resultlevel_window.dispose
@resultskill_window.dispose
end
battle_end(0)
end
end
#==============================================================================
# ? Game_Actor
#==============================================================================
class Game_Actor
def next_rest_exp
return @exp_list[@level+1] > 0 ? (@exp_list[@level+1] - @exp) : 0
end
end
#==============================================================================
# ? Window_ResultReceive
#==============================================================================
class Window_ResultReceive < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :exp
attr_accessor :gold
attr_accessor :page
attr_reader :max_page
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
super(40, 28, 224, 212)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
@exp = exp
@gold = gold
@treasures = treasures
@page = 1
@max_page = treasures.size > 4 ? 2 : 1
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Exp")
self.contents.draw_text(0, 16, self.width - 32, 32, $data_system.words.gold)
self.contents.draw_text(0, 40, self.width - 32, 32, $data_system.words.item + " [" + @page.to_s + "/" + @max_page.to_s + "]" )
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, @exp.to_s, 2)
self.contents.draw_text(0, 16, self.width - 32, 32, @gold.to_s, 2)
if @treasures.size == 0
self.contents.draw_text(0, 68, self.width - 32, 32, "< Nothing. >")
elsif @treasures.size > 4
bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
self.contents.blt(184, 116, bitmap, Rect.new(168, 24, 16, 16), 255)
end
y = 68
item_start_index = @page == 1 ? 0 : 4
for i in item_start_index...@treasures.size
item = @treasures
draw_item_name(item, 0, y)
y += 28
end
end
end
#==============================================================================
# ? Window_ResultGold
#==============================================================================
class Window_ResultGold < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(40, 240, 224, 52)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Total " + $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, $game_party.gold.to_s, 2)
end
end
#==============================================================================
# ? Window_ResultParty
#==============================================================================
class Window_ResultParty < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(264, 28, 336, 264)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
actor = $game_party.actors
y = 60 * i + 22
draw_actor_graphic(actor, 24, y + 28 )
draw_actor_name(actor, 64, y - 28)
self.contents.font.color = system_color
self.contents.draw_text(116, y, (self.width - 32), 32, "Lv.")
self.contents.draw_text(188, y, (self.width - 32), 32, "Next")
self.contents.font.color = normal_color
self.contents.draw_text(-140, y, (self.width - 32), 32, actor.level.to_s ,2)
self.contents.draw_text(0 , y, (self.width - 32), 32, actor.next_rest_exp_s ,2)
end
end
end
#==============================================================================
# ? Window_ResultLevel
#==============================================================================
class Window_ResultLevel < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(332, 60 * id + 40, 124, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, -2, self.width - 32, 32, "Level-Up !!", 1)
end
end
#==============================================================================
# ? Window_ResultSkill
#==============================================================================
class Window_ResultSkill < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :skill_id
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(640, 60 * id + 40, 200, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
@skill_id = nil
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @skill_id == nil
return
end
skill = $data_skills[@skill_id]
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(0, 2, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.font.color = normal_color
self.contents.draw_text(32, -2, self.width - 64, 32, skill.name)
end
end
# ? Battle Result by A3D Ver. 1.02
# Useful : show battle result in a different way
# Effect to default script : this code will replace methode "start_phase5" & "update_phase5" in Scene_Battle
# How to install : in script editor, insert all the code above main
# Note : this script is for non-commercial use only, give credit if use
# Contact : A3D (hyper_s@hotmail.com)
#=================================================================
module A3D
WAIT_WINDOW_APPEAR = 60
WAIT_RUNNING_NUMBER = 20
STEP_EXP = 1
STEP_GOLD = 1
SE_LEVELUP = ["007-System07", 100, 100]
SE_NEWSKILL = ["007-System07", 100, 100]
FONT_NAME = "Tahoma"
FONT_SIZE = 22
end
#==============================================================================
# ? Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ? After battle phase start
#--------------------------------------------------------------------------
def start_phase5
# It moves to phase 5
@phase = 5
# Performing battle end ME
$game_system.me_play($game_system.battle_end_me)
# You reset to BGM before the battle starting
$game_system.bgm_play($game_temp.map_bgm)
# Initializing EXP, the gold and the treasure
exp = 0
gold = 0
treasures = []
# Loop
for enemy in $game_troop.enemies
# When the enemy hides and it is not state
unless enemy.hidden
# Adding acquisition EXP and the gold
exp += enemy.exp
gold += enemy.gold
# Treasure appearance decision
if rand(100) < enemy.treasure_prob
if enemy.item_id > 0
treasures.push($data_items[enemy.item_id])
end
if enemy.weapon_id > 0
treasures.push($data_weapons[enemy.weapon_id])
end
if enemy.armor_id > 0
treasures.push($data_armors[enemy.armor_id])
end
end
end
end
# Treasure acquisition
for item in treasures
case item
when RPG::Item
$game_party.gain_item(item.id, 1)
when RPG::Weapon
$game_party.gain_weapon(item.id, 1)
when RPG::Armor
$game_party.gain_armor(item.id, 1)
end
end
# Create Variable & Window
@phase5_step = 1
@wait_window_appear = A3D::WAIT_WINDOW_APPEAR
@wait_running_number = A3D::WAIT_RUNNING_NUMBER
@resultreceive_window = Window_ResultReceive.new(exp, gold, treasures)
@resultgold_window = Window_ResultGold.new
@resultparty_window = Window_ResultParty.new
@actor_level_before = []
@resultlevel_window = []
@resultskill_window = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
@actor_level_before = actor.level
@resultlevel_window = Window_ResultLevel.new(i)
@resultskill_window = Window_ResultSkill.new(i)
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5
#--------------------------------------------------------------------------
def update_phase5
case @phase5_step
when 1 # EXP & Gold Phase
update_phase5_step1
when 2 # Skill Phase
update_phase5_step2
when 3 # Delete Window Phase
update_phase5_step3
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 1
#--------------------------------------------------------------------------
def update_phase5_step1
# Wait Count Before Window Appear
if @wait_window_appear > 0
@wait_window_appear -= 1
if @wait_window_appear == 0
@resultreceive_window.visible = true
@resultgold_window.visible = true
@resultparty_window.visible = true
$game_temp.battle_main_phase = false
end
return
end
# Wait Count Before Running Number
if @wait_running_number > 0
@wait_running_number -= 1
return
end
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# EXP & Gold Rolling
if (@resultreceive_window.exp != 0 || @resultreceive_window.gold != 0)
# Input C to Shortcut Calculation
if Input.trigger?(Input::C)
for i in 0...$game_party.actors.size
actor = $game_party.actors
level_before = actor.level
actor.exp += @resultreceive_window.exp
if actor.level > level_before
@resultlevel_window.visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
end
$game_party.gain_gold(@resultreceive_window.gold)
@resultreceive_window.exp = 0
@resultreceive_window.gold = 0
@resultreceive_window.refresh
@resultgold_window.refresh
@resultparty_window.refresh
end
# EXP
if @resultreceive_window.exp != 0
step_exp = @resultreceive_window.exp >= A3D::STEP_EXP.abs ? A3D::STEP_EXP.abs : @resultreceive_window.exp
for i in 0...$game_party.actors.size
actor = $game_party.actors
if actor.next_rest_exp <= step_exp && actor.next_rest_exp != 0
@resultlevel_window.visible = true
Audio.se_play("Audio/SE/" + A3D::SE_LEVELUP[0], A3D::SE_LEVELUP[1], A3D::SE_LEVELUP[2])
end
actor.exp += step_exp
end
@resultreceive_window.exp -= step_exp
@resultreceive_window.refresh
@resultparty_window.refresh
end
# Gold
if @resultreceive_window.gold != 0
step_gold = @resultreceive_window.gold >= A3D::STEP_GOLD.abs ? A3D::STEP_GOLD.abs : @resultreceive_window.gold
$game_party.gain_gold(step_gold)
@resultreceive_window.gold -= step_gold
@resultreceive_window.refresh
@resultgold_window.refresh
end
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 2
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 2
#--------------------------------------------------------------------------
def update_phase5_step2
# Change Item Page
if Input.trigger?(Input::RIGHT)
if @resultreceive_window.max_page != 1
$game_system.se_play($data_system.cursor_se)
@resultreceive_window.page = @resultreceive_window.page == 1 ? 2 : 1
@resultreceive_window.refresh
end
end
# Initialize Skill Phase
if @initialized_skill_phase == nil
for i in 0...$game_party.actors.size
actor = $game_party.actors
for skill in $data_classes[actor.class_id].learnings
if skill.level > @actor_level_before && skill.level <= actor.level
Audio.se_play("Audio/SE/" + A3D::SE_NEWSKILL[0], A3D::SE_NEWSKILL[1], A3D::SE_NEWSKILL[2])
@resultskill_window.skill_id = skill.skill_id
@resultskill_window.visible = true
@resultskill_window.refresh
@skill_phase_active = true
end
end
end
@initialized_skill_phase = true
end
# If Skill Phase Active, Show Window
if @skill_phase_active != nil
if @resultskill_window[0].x != 456
for i in 0...$game_party.actors.size
@resultskill_window.x -= 23
end
return
end
else
@phase5_step = 3
return
end
# Input C to Bypass Step
if Input.trigger?(Input::C)
@phase5_step = 3
return
end
end
#--------------------------------------------------------------------------
# ? Update Phase 5 Step 3
#--------------------------------------------------------------------------
def update_phase5_step3
# Delete All Result-Window
@resultreceive_window.dispose
@resultgold_window.dispose
@resultparty_window.dispose
for i in 0...$game_party.actors.size
@resultlevel_window.dispose
@resultskill_window.dispose
end
battle_end(0)
end
end
#==============================================================================
# ? Game_Actor
#==============================================================================
class Game_Actor
def next_rest_exp
return @exp_list[@level+1] > 0 ? (@exp_list[@level+1] - @exp) : 0
end
end
#==============================================================================
# ? Window_ResultReceive
#==============================================================================
class Window_ResultReceive < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :exp
attr_accessor :gold
attr_accessor :page
attr_reader :max_page
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
super(40, 28, 224, 212)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
@exp = exp
@gold = gold
@treasures = treasures
@page = 1
@max_page = treasures.size > 4 ? 2 : 1
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Exp")
self.contents.draw_text(0, 16, self.width - 32, 32, $data_system.words.gold)
self.contents.draw_text(0, 40, self.width - 32, 32, $data_system.words.item + " [" + @page.to_s + "/" + @max_page.to_s + "]" )
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, @exp.to_s, 2)
self.contents.draw_text(0, 16, self.width - 32, 32, @gold.to_s, 2)
if @treasures.size == 0
self.contents.draw_text(0, 68, self.width - 32, 32, "< Nothing. >")
elsif @treasures.size > 4
bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
self.contents.blt(184, 116, bitmap, Rect.new(168, 24, 16, 16), 255)
end
y = 68
item_start_index = @page == 1 ? 0 : 4
for i in item_start_index...@treasures.size
item = @treasures
draw_item_name(item, 0, y)
y += 28
end
end
end
#==============================================================================
# ? Window_ResultGold
#==============================================================================
class Window_ResultGold < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(40, 240, 224, 52)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, -8, self.width - 32, 32, "Total " + $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(0, -8, self.width - 32, 32, $game_party.gold.to_s, 2)
end
end
#==============================================================================
# ? Window_ResultParty
#==============================================================================
class Window_ResultParty < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize
super(264, 28, 336, 264)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
actor = $game_party.actors
y = 60 * i + 22
draw_actor_graphic(actor, 24, y + 28 )
draw_actor_name(actor, 64, y - 28)
self.contents.font.color = system_color
self.contents.draw_text(116, y, (self.width - 32), 32, "Lv.")
self.contents.draw_text(188, y, (self.width - 32), 32, "Next")
self.contents.font.color = normal_color
self.contents.draw_text(-140, y, (self.width - 32), 32, actor.level.to_s ,2)
self.contents.draw_text(0 , y, (self.width - 32), 32, actor.next_rest_exp_s ,2)
end
end
end
#==============================================================================
# ? Window_ResultLevel
#==============================================================================
class Window_ResultLevel < Window_Base
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(332, 60 * id + 40, 124, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
refresh
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, -2, self.width - 32, 32, "Level-Up !!", 1)
end
end
#==============================================================================
# ? Window_ResultSkill
#==============================================================================
class Window_ResultSkill < Window_Base
#--------------------------------------------------------------------------
# ? Attr
#--------------------------------------------------------------------------
attr_accessor :skill_id
#--------------------------------------------------------------------------
# ? Initialize
#--------------------------------------------------------------------------
def initialize(id)
super(640, 60 * id + 40, 200, 60)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = A3D::FONT_NAME
self.contents.font.size = A3D::FONT_SIZE
self.back_opacity = 160
self.visible = false
self.z = 200
@skill_id = nil
end
#--------------------------------------------------------------------------
# ? Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @skill_id == nil
return
end
skill = $data_skills[@skill_id]
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt(0, 2, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.font.color = normal_color
self.contents.draw_text(32, -2, self.width - 64, 32, skill.name)
end
end
script3:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Easy LvlUp Notifier by Blizzard
# Version: 2.0
# Type: Battle Report Display
# Date: 27.8.2006
# Date v1.2b: 3.11.2006
# Date v1.3b: 11.3.2007
# Date v1.4b: 22.8.2007
# Date v2.0: 25.9.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 98% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt old
# savegames. May cause slight problems with following systems and would need
# therefore slight recalibration:
# - exotic CBS-es
# - exotic skill systems
# - exotic stat systems (additional stats like Wisdom, Luck etc.)
#
#
# Features:
#
# - shows increased stats and learned skills at level up
# - animated
# - shows EXP gain for each actor (!) only after gaining EXP after a battle
# - more simple and less laggy than other Level Up Notifiers
# - you can set up any sound to be played when a higher level is reached or a
# new skill is learned (LVLUP_SE and LEARN_SE further below)
#
# new in v1.2b:
# - better window movement
# - higher compatibility
# - fixed a few "eventual" bugs
#
# new in v1.3b:
# - fully compatible with Tons of Add-ons
#
# new in v1.4b:
# - improved coding
# - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#
# new in v2.0:
# - completely overworked and improved
# - now MUCH more simple than other Level Up Notifiers
# - halved the number of lines of code
# - much more compatible: can show increase of any stats after the battle in
# combination with any script, just put this script below those attribute
# modifying scripts
#
#
# Instructions:
#
# - Explanation:
#
# This script will notify you when any character is leveled up after a
# battle. It will show any stats that were increased and any skills that were
# learned. The windows are animated, the code is less complex than any other
# so far and it is most efficient as well as highly optimized and detailed
# worked out.
#
# - Configuration:
#
# There are a few options you can set up below.
#
# LVLUP_SE - sound effect played when a new level was reached
# LEARN_SE - sound effect played when a new skill was learned,
# keep in mind that the script takes into account that
# skills can only be learned after a level up
# WINDOW_BACK_OPACITY - set this value to the window's back opacity (0-255)
# NO_EXP_DISPLAY - set this value to true if you want to disable the EXP
# gaining display in the level up windows
# OLD_EXP_DISPLAY - set this value to true if you want to display the EXP
# in the normal result window again
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# RPG::AudioFile.new('FILENAME', VOLUME, PITCH)
LVLUP_SE = RPG::AudioFile.new('087-Action02', 80, 100)
LEARN_SE = RPG::AudioFile.new('106-Heal02', 80, 100)
WINDOW_BACK_OPACITY = 160
NO_EXP_DISPLAY = false
OLD_EXP_DISPLAY = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$easy_lvlup_notifier = true
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
def all_exp
return @exp
end
def all_exp=(exp)
@exp = exp
end
end
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
alias easy_lvlup_notfier_refresh refresh
def refresh
if $tons_version != nil && $tons_version >= 4.02 &&
$game_system.WINDOW_BATTLERESULT || OLD_EXP_DISPLAY
easy_lvlup_notfier_refresh
else
self.contents.clear
x = 4
self.contents.font.color = system_color
cx = contents.text_size('Gained').width
self.contents.draw_text(x, 0, cx+4, 32, 'Gained')
x += cx + 4
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx+4, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
(0...@treasures.size).each {|i| draw_item_name(@treasures, 4, (i+1)*32)}
end
end
end
#==============================================================================
# Window_LevelUp
#==============================================================================
class Window_LevelUp < Window_Base
attr_reader :limit
def initialize(a, d)
if $tons_version != nil && $tons_version >= 4.98 &&
$game_system.CENTER_BATTLER
x = case $game_party.actors.size
when 1 then 240
when 2 then a.index * 320 + 80
when 3 then a.index * 160 + 80
when 4 then a.index * 160
end
else
x = a.index * 160
end
text = []
text.push(['Level:', d[0], a.level]) if d[0] != a.level
text.push([$data_system.words.hp[0, 3], d[1], a.maxhp]) if d[1] != a.maxhp
text.push([$data_system.words.sp[0, 3], d[2], a.maxsp]) if d[2] != a.maxsp
text.push([$data_system.words.str[0, 3], d[3], a.str]) if d[3] != a.str
text.push([$data_system.words.dex[0, 3], d[4], a.dex]) if d[4] != a.dex
text.push([$data_system.words.agi[0, 3], d[5], a.agi]) if d[5] != a.agi
text.push([$data_system.words.int[0, 3], d[6], a.int]) if d[6] != a.int
h = text.size * 24 + (NO_EXP_DISPLAY ? 32 : 56)
@limit, y = 320 - h, 480 - h + (h/64+1)*64
super(x, y, 160, h)
self.z, self.back_opacity = 100, WINDOW_BACK_OPACITY
self.contents = Bitmap.new(self.width - 32, self.height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size, self.contents.font.bold = 20, true
unless NO_EXP_DISPLAY
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 128, 24, "#{a.exp - d[7]} EXP", 1)
end
text.each_index {|i|
index = NO_EXP_DISPLAY ? i : i + 1
self.contents.font.color = system_color
self.contents.draw_text(0, index*24, 128, 24, text[0])
self.contents.draw_text(80, index*24, 32, 24, '»')
self.contents.font.color = normal_color
self.contents.draw_text(0, index*24, 76, 24, text[1].to_s, 2)
if text[1] > text[2]
self.contents.font.color = Color.new(255, 64, 0)
else
self.contents.font.color = Color.new(0, 255, 64)
end
self.contents.draw_text(0, index*24, 128, 24, text[2].to_s, 2)}
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_lvlup_later main
def main
@lvlup_data = {}
@moving_windows, @pending_windows = [], []
(1...$data_actors.size).each {|i|
actor = $game_actors
@lvlup_data[actor] = [actor.level, actor.maxhp, actor.maxsp, actor.str,
actor.dex, actor.agi, actor.int, actor.exp, actor.skills.clone]}
main_lvlup_later
(@moving_windows + @pending_windows).each {|win| win.dispose if win != nil}
end
alias start_phase5_lvlup_later start_phase5
def start_phase5
start_phase5_lvlup_later
@skill_texts = []
$game_party.actors.each {|actor|
actor.remove_states_battle
if @lvlup_data[actor][0, 7] != [actor.level, actor.maxhp, actor.maxsp,
actor.str, actor.dex, actor.agi, actor.int]
@pending_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
@skill_texts.push('')
new_skills = actor.skills - @lvlup_data[actor][8]
if new_skills.size > 0
new_skills.each {|id|
@skill_texts.push("#{actor.name} learned #{$data_skills[id].name}!")}
end
elsif @lvlup_data[actor][7] != actor.exp && !NO_EXP_DISPLAY
@moving_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
end}
end
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
@result_window.visible, $game_temp.battle_main_phase = true, false
@status_window.refresh
end
return
end
@moving_windows.each {|win|
win.y -= [((win.y - win.limit) / 2.0).ceil, 64].min if win.y > win.limit}
if Input.trigger?(Input::C)
@result_window.visible = false
if @skill_texts.size > 0
text = @skill_texts.shift
if text == ''
$game_system.se_play(LVLUP_SE)
@moving_windows.push(@pending_windows.shift)
@help_window.visible = false
else
$game_system.se_play(LEARN_SE)
@help_window.set_text(text, 1)
end
else
battle_end(0)
end
end
end
end
# Easy LvlUp Notifier by Blizzard
# Version: 2.0
# Type: Battle Report Display
# Date: 27.8.2006
# Date v1.2b: 3.11.2006
# Date v1.3b: 11.3.2007
# Date v1.4b: 22.8.2007
# Date v2.0: 25.9.2007
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
# 98% compatible with SDK v1.x. 80% compatible with SDK 2.x. WILL corrupt old
# savegames. May cause slight problems with following systems and would need
# therefore slight recalibration:
# - exotic CBS-es
# - exotic skill systems
# - exotic stat systems (additional stats like Wisdom, Luck etc.)
#
#
# Features:
#
# - shows increased stats and learned skills at level up
# - animated
# - shows EXP gain for each actor (!) only after gaining EXP after a battle
# - more simple and less laggy than other Level Up Notifiers
# - you can set up any sound to be played when a higher level is reached or a
# new skill is learned (LVLUP_SE and LEARN_SE further below)
#
# new in v1.2b:
# - better window movement
# - higher compatibility
# - fixed a few "eventual" bugs
#
# new in v1.3b:
# - fully compatible with Tons of Add-ons
#
# new in v1.4b:
# - improved coding
# - rewritten conditions using classic syntax to avoid RGSS conditioning bug
#
# new in v2.0:
# - completely overworked and improved
# - now MUCH more simple than other Level Up Notifiers
# - halved the number of lines of code
# - much more compatible: can show increase of any stats after the battle in
# combination with any script, just put this script below those attribute
# modifying scripts
#
#
# Instructions:
#
# - Explanation:
#
# This script will notify you when any character is leveled up after a
# battle. It will show any stats that were increased and any skills that were
# learned. The windows are animated, the code is less complex than any other
# so far and it is most efficient as well as highly optimized and detailed
# worked out.
#
# - Configuration:
#
# There are a few options you can set up below.
#
# LVLUP_SE - sound effect played when a new level was reached
# LEARN_SE - sound effect played when a new skill was learned,
# keep in mind that the script takes into account that
# skills can only be learned after a level up
# WINDOW_BACK_OPACITY - set this value to the window's back opacity (0-255)
# NO_EXP_DISPLAY - set this value to true if you want to disable the EXP
# gaining display in the level up windows
# OLD_EXP_DISPLAY - set this value to true if you want to display the EXP
# in the normal result window again
#
#
# If you find any bugs, please report them here:
# http://forum.chaos-project.com
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# RPG::AudioFile.new('FILENAME', VOLUME, PITCH)
LVLUP_SE = RPG::AudioFile.new('087-Action02', 80, 100)
LEARN_SE = RPG::AudioFile.new('106-Heal02', 80, 100)
WINDOW_BACK_OPACITY = 160
NO_EXP_DISPLAY = false
OLD_EXP_DISPLAY = false
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
$easy_lvlup_notifier = true
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
def all_exp
return @exp
end
def all_exp=(exp)
@exp = exp
end
end
#==============================================================================
# Window_BattleResult
#==============================================================================
class Window_BattleResult < Window_Base
alias easy_lvlup_notfier_refresh refresh
def refresh
if $tons_version != nil && $tons_version >= 4.02 &&
$game_system.WINDOW_BATTLERESULT || OLD_EXP_DISPLAY
easy_lvlup_notfier_refresh
else
self.contents.clear
x = 4
self.contents.font.color = system_color
cx = contents.text_size('Gained').width
self.contents.draw_text(x, 0, cx+4, 32, 'Gained')
x += cx + 4
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx+4, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
(0...@treasures.size).each {|i| draw_item_name(@treasures, 4, (i+1)*32)}
end
end
end
#==============================================================================
# Window_LevelUp
#==============================================================================
class Window_LevelUp < Window_Base
attr_reader :limit
def initialize(a, d)
if $tons_version != nil && $tons_version >= 4.98 &&
$game_system.CENTER_BATTLER
x = case $game_party.actors.size
when 1 then 240
when 2 then a.index * 320 + 80
when 3 then a.index * 160 + 80
when 4 then a.index * 160
end
else
x = a.index * 160
end
text = []
text.push(['Level:', d[0], a.level]) if d[0] != a.level
text.push([$data_system.words.hp[0, 3], d[1], a.maxhp]) if d[1] != a.maxhp
text.push([$data_system.words.sp[0, 3], d[2], a.maxsp]) if d[2] != a.maxsp
text.push([$data_system.words.str[0, 3], d[3], a.str]) if d[3] != a.str
text.push([$data_system.words.dex[0, 3], d[4], a.dex]) if d[4] != a.dex
text.push([$data_system.words.agi[0, 3], d[5], a.agi]) if d[5] != a.agi
text.push([$data_system.words.int[0, 3], d[6], a.int]) if d[6] != a.int
h = text.size * 24 + (NO_EXP_DISPLAY ? 32 : 56)
@limit, y = 320 - h, 480 - h + (h/64+1)*64
super(x, y, 160, h)
self.z, self.back_opacity = 100, WINDOW_BACK_OPACITY
self.contents = Bitmap.new(self.width - 32, self.height - 32)
if $fontface != nil
self.contents.font.name = $fontface
elsif $defaultfonttype != nil
self.contents.font.name = $defaultfonttype
end
self.contents.font.size, self.contents.font.bold = 20, true
unless NO_EXP_DISPLAY
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 128, 24, "#{a.exp - d[7]} EXP", 1)
end
text.each_index {|i|
index = NO_EXP_DISPLAY ? i : i + 1
self.contents.font.color = system_color
self.contents.draw_text(0, index*24, 128, 24, text[0])
self.contents.draw_text(80, index*24, 32, 24, '»')
self.contents.font.color = normal_color
self.contents.draw_text(0, index*24, 76, 24, text[1].to_s, 2)
if text[1] > text[2]
self.contents.font.color = Color.new(255, 64, 0)
else
self.contents.font.color = Color.new(0, 255, 64)
end
self.contents.draw_text(0, index*24, 128, 24, text[2].to_s, 2)}
end
end
#==============================================================================
# Scene_Battle
#==============================================================================
class Scene_Battle
alias main_lvlup_later main
def main
@lvlup_data = {}
@moving_windows, @pending_windows = [], []
(1...$data_actors.size).each {|i|
actor = $game_actors
@lvlup_data[actor] = [actor.level, actor.maxhp, actor.maxsp, actor.str,
actor.dex, actor.agi, actor.int, actor.exp, actor.skills.clone]}
main_lvlup_later
(@moving_windows + @pending_windows).each {|win| win.dispose if win != nil}
end
alias start_phase5_lvlup_later start_phase5
def start_phase5
start_phase5_lvlup_later
@skill_texts = []
$game_party.actors.each {|actor|
actor.remove_states_battle
if @lvlup_data[actor][0, 7] != [actor.level, actor.maxhp, actor.maxsp,
actor.str, actor.dex, actor.agi, actor.int]
@pending_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
@skill_texts.push('')
new_skills = actor.skills - @lvlup_data[actor][8]
if new_skills.size > 0
new_skills.each {|id|
@skill_texts.push("#{actor.name} learned #{$data_skills[id].name}!")}
end
elsif @lvlup_data[actor][7] != actor.exp && !NO_EXP_DISPLAY
@moving_windows.push(Window_LevelUp.new(actor, @lvlup_data[actor]))
end}
end
def update_phase5
if @phase5_wait_count > 0
@phase5_wait_count -= 1
if @phase5_wait_count == 0
@result_window.visible, $game_temp.battle_main_phase = true, false
@status_window.refresh
end
return
end
@moving_windows.each {|win|
win.y -= [((win.y - win.limit) / 2.0).ceil, 64].min if win.y > win.limit}
if Input.trigger?(Input::C)
@result_window.visible = false
if @skill_texts.size > 0
text = @skill_texts.shift
if text == ''
$game_system.se_play(LVLUP_SE)
@moving_windows.push(@pending_windows.shift)
@help_window.visible = false
else
$game_system.se_play(LEARN_SE)
@help_window.set_text(text, 1)
end
else
battle_end(0)
end
end
end
end
I hope you guys can help me :P XD