# ğÁė֜ΦʼѢ©ӊЭѭӬذª ver0.90
class Scene_Battle
alias :main_original :main
def atb_setup
for path in ["num_n", "num_c", "num_rh"]
for i in 0..9
RPG::Cache.numeric(path + i.to_s)
end
end
for path in ["critical", "miss"]
RPG::Cache.numeric(path)
end
main
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
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
if value.is_a?(Numeric)
if value >= 0
if critical
bitmap.draw_numlic(0, 12, 160, 36, value, 1, 1)
else
bitmap.draw_numlic(0, 12, 160, 36, value, 0, 1)
end
else
bitmap.draw_numlic(0, 12, 160, 36, value, 2, 1)
end
else
bitmap.draw_numlic(0, 12, 160, 36, value, 3, 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
end
end
class Bitmap
def draw_numlic(x, y, width, height, value, element, align = 0)
if value.is_a?(Numeric)
value = value.abs
if value > 0
log = Math.log10(value).to_i
else
log = 0
end
filename = "num_"
case element
when 0
filename += "n"
when 1
file = RPG::Cache.numeric("critical")
blt(x + width / 2 - file.rect.width / 2, y - 12, file, file.rect)
filename += "c"
when 2
filename += "rh"
end
if align == 1
x += width / 2 - 13 - 9 * (log)
end
while log >= 0
case value / (10 ** log)
when 0
file = RPG::Cache.numeric(filename + "0")
when 1
file = RPG::Cache.numeric(filename + "1")
when 2
file = RPG::Cache.numeric(filename + "2")
when 3
file = RPG::Cache.numeric(filename + "3")
when 4
file = RPG::Cache.numeric(filename + "4")
when 5
file = RPG::Cache.numeric(filename + "5")
when 6
file = RPG::Cache.numeric(filename + "6")
when 7
file = RPG::Cache.numeric(filename + "7")
when 8
file = RPG::Cache.numeric(filename + "8")
when 9
file = RPG::Cache.numeric(filename + "9")
end
blt(x, y, file, file.rect)
x += 18
value %= 10 ** log
log -= 1
end
else
case value
when ""
return
when "Miss"
file = RPG::Cache.numeric("miss")
else
file = RPG::Cache.numeric(value)
end
if align == 1
x += width / 2 - file.rect.width / 2
end
blt(x, y, file, file.rect)
end
end
end
module RPG
module Cache
def self.numeric(filename)
self.load_bitmap("Graphics/String/", filename)
end
end