#==============================================================================
# <<\/>> Vixotic_Damage_Pop up
#------------------------------------------------------------------------------
# Version 1.1
# Exclusive Script for [url]http://rpgmakervx.net/[/url]
#
# Place this script above Main
#==============================================================================
module VIX
#--------------------------
# Damage Text Position
#------------------------
Damage_X_Plus = 0
# Move Damage Position in vertical direction ((-)up <= 0 => down(+))
Damage_Y_Plus = -20
# Move Damage Position in horizontal direction ((-)left <= 0 => right(+))
#--------------------------
# Damage Text Font/Size
#------------------------
Damage_Text_Font = "Arial Black"
Damage_Text_Size = 32
end
class Sprite_Base < Sprite
alias vix_sprbase_ini initialize
alias vix_sprbase_upd update
def initialize(viewport = nil)
vix_sprbase_ini(viewport)
@_damage_duration = 0
end
def update
vix_sprbase_upd
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
dispose_damage
end
end
end
def damage(value)
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 = VIX::Damage_Text_Font
bitmap.font.size = VIX::Damage_Text_Size
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)
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x + VIX::Damage_X_Plus
@_damage_sprite.y = (self.y - self.oy / 2) + VIX::Damage_Y_Plus
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def dispose_damage
if @_damage_sprite != nil
@_damage_sprite.bitmap.dispose
@_damage_sprite.dispose
@_damage_sprite = nil
@_damage_duration = 0
end
end
end
class Game_Battler
attr_accessor :damage
alias vix_gamebat_clr clear_sprite_effects
def clear_sprite_effects
@damage = 0
vix_gamebat_clr
end
end
class Sprite_Battler < Sprite_Base
DAMAGE = 7
alias vix_sprbat_set setup_new_effect
def setup_new_effect
vix_sprbat_set
if @battler.damage != 0
damage(@battler.damage)
@effect_type = DAMAGE
@battler.damage = 0
end
end
end
class Scene_Battle < Scene_Base
def display_action_effects(target, obj = nil)
unless target.skipped
line_number = @message_window.line_number
wait(5)
target.damage = target.hp_damage if target.is_a?(Game_Enemy)
display_critical(target, obj)
display_damage(target, obj)
display_state_changes(target, obj)
if line_number == @message_window.line_number
display_failure(target, obj) unless target.states_active?
end
if line_number != @message_window.line_number
wait(30)
end
@message_window.back_to(line_number)
end
end
end