#==============================================================================
# ** RPG::Cache
#==============================================================================
module RPG
module Cache
def self.death_image(battler)
name = battler.battler_name + '_dead'
if @cache[name] == nil
b = Bitmap.new('Graphics/Battlers/' + battler.battler_name)
b.invert!
@cache[name] = b
end
return @cache[name]
end
end
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
def invert
w, h = self.width, self.height
inv = Bitmap.new(w, h)
(1..w).each{|x| (1..h).each{|y|
color = self.get_pixel(x, y)
next if color.alpha == 0
r, g = 255 - color.red, 255 - color.green
b, a = 255 - color.blue, color.alpha
inv.set_pixel(x, y, Color.new(r, g, b, a))}}
return inv
end
def invert!
w, h = self.width, self.height
(1..w).each{|x| (1..h).each{|y|
color = self.get_pixel(x, y)
next if color.alpha == 0
r, g = 255 - color.red, 255 - color.green
b, a = 255 - color.blue, color.alpha
self.set_pixel(x, y, Color.new(r, g, b, a))
}}
return self
end
end
# TONS Death Image
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DEATH_IMAGE = nil # the battler file name of your death image
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Sprite_DummyBattler
#==============================================================================
class Sprite_DummyBattler < RPG::Sprite
attr_accessor :battler
def update
return if @battler == nil
super
if self.bitmap == nil
#==================== MOD Begin =====================
if DEATH_IMAGE
self.bitmap = RPG::Cache.battler(DEATH_IMAGE, 0)
else
self.bitmap = RPG::Cache.death_image(@battler)
self.tone.set(0, 128, 128) # <<< Set tone to cyan
end
#==================== MOD End =====================
@width, @height = bitmap.width, bitmap.height
self.ox, self.oy = @width / 2, @height
self.opacity = 0 if @battler.dead? || @battler.hidden
end
if @battler_visible
if !@battler.hidden && !@battler.dead? &&
(@battler.damage == nil || @battler.damage_pop)
escape
@battler_visible = false
elsif $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
elsif self.opacity > 207
self.opacity -= 3
end
elsif @battler.damage == nil && @battler.dead?
appear
@battler_visible = true
end
if @battler != nil
if $game_system.CENTER_BATTLER && @battler.is_a?(Game_Actor)
self.x = case $game_party.actors.size
when 1 then @battler.screen_x + 240
when 2 then @battler.screen_x + 80 + @battler.index * 160
when 3 then @battler.screen_x + 80
when 4 then @battler.screen_x
end
else
self.x = @battler.screen_x
end
self.y, self.z = @battler.screen_y, @battler.screen_z
end
end
end