Essa é uma modificação do damage text que eu e meus colegas fizemos só na zueira mesmo e ficou lindo segue o cód
Lembrando que é do master e para fazer funcionar basta substituir o RPG Sprite Damage/Text
por esse novo.
Créd ao:
Valentine
Kaitro
Kizuki
RD12
- Código:
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 = "Segoe UI"
bitmap.font.size = 24
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(0, 96, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(96, 0, 0)
else
bitmap.font.color.set(0, 0, 96)
end
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(0, 255, 0)
elsif value.is_a?(Numeric) and value > 0
bitmap.font.color.set(255, 0, 0)
else
bitmap.font.color.set(0, 0, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.color.set(96, 96, 0)
bitmap.draw_text(-1, 5-1, 160, 20, "Critical", 1)
bitmap.draw_text(+1, 5-1, 160, 20, "Critical", 1)
bitmap.draw_text(-1, 5+1, 160, 20, "Critical", 1)
bitmap.draw_text(+1, 5+1, 160, 20, "Critical", 1)
bitmap.font.color.set(255, 255, 0)
bitmap.draw_text(0, 5, 160, 20, "Critical", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2 - 60
@_damage_sprite.z += 99999
@_damage_duration = 40
end
def show_text(string, size=16, color=0)
dispose_damage
damage_string = string
if string.is_a?(Array)
array = true
else
array = false
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Segoe UI"
bitmap.font.size = size
if array
for i in 0..string.size
next if damage_string[i] == nil
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 0
bitmap.draw_text(-1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)-1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(-1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.draw_text(+1, (12+(16*i)+1)-16, 160, 36, damage_string[i], 1)
bitmap.font.color.set(255, 200, 0) if color == 0
bitmap.font.color.set(0, 255, 200) if color == 1
bitmap.font.color.set(200, 0, 255)if color == 2
bitmap.font.color.set(50, 255, 50)if color == 3
bitmap.draw_text(0, (12+(16*i))-16, 160, 36, damage_string[i], 1)
end
else
bitmap.font.color.set(96, 96-20, 0) if color == 0
bitmap.font.color.set(0, 0, 0) if color != 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)
bitmap.font.color.set(255, 200, 0) if color == 0
bitmap.font.color.set(0, 255, 200) if color == 1
bitmap.font.color.set(200, 0, 255)if color == 2
bitmap.font.color.set(50, 255, 50)if color == 3
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
#--------------------------------------------------------------------------
# * Balão do Chat
#--------------------------------------------------------------------------
def show_chat(text)
dispose_damage
damage_string = text.to_s
line = 1
for i in 0..text.size-1
line += 1
end
bitmap = Bitmap.new(160, 16*line + 32)
bitmap.font.name = Font.default_name
bitmap.font.size = 15
bitmap.font.bold = false
bitmap.font.italic = false
msg1 = text[0].to_s
msg2 = ""
b = Bitmap.new(1,1)
w1 = b.text_size(msg1).width
bitmap = Bitmap.new([w1].max+8, (msg2 == "" ? (22*line) : 48))
bitmap.fill_rect(1, 1, bitmap.width-2, (23*line)-(9*(line+1)), Color.new(255,255,255,200))
bitmap.fill_rect(1, 0, bitmap.width-2, 1, Color.new(255,255,255,200))
bitmap.fill_rect(0, 1, 1, (24*line)-(10*(line+1)), Color.new(255,255,255,200))
bitmap.fill_rect(bitmap.width-1, 1, 1, (24*line)-(10*(line+1)), Color.new(255,255,255,200))
# Não tire o parêntese
center = (bitmap.width-8)/2
bitmap.fill_rect(center, (22*line)-(8*(line+1)), 1, 8, Color.new(255,255,255,200))
bitmap.fill_rect(center+1, (22*line)-(8*(line+1)), 1, 7, Color.new(255,255,255,200))
bitmap.fill_rect(center+2, (22*line)-(8*(line+1)), 1, 6, Color.new(255,255,255,200))
bitmap.fill_rect(center+3, (22*line)-(8*(line+1)), 1, 5, Color.new(255,255,255,200))
bitmap.fill_rect(center+4, (22*line)-(8*(line+1)), 1, 4, Color.new(255,255,255,200))
bitmap.fill_rect(center+5, (22*line)-(8*(line+1)), 1, 3, Color.new(255,255,255,200))
bitmap.fill_rect(center+6, (22*line)-(8*(line+1)), 1, 2, Color.new(255,255,255,200))
bitmap.fill_rect(center+7, (22*line)-(8*(line+1)), 1, 1, Color.new(255,255,255,200))
for i in 0..text.size-1
bitmap.draw_text(2, 16*i + 1, bitmap.width-4, 16, text[i], 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = bitmap.width/2
@_damage_sprite.oy = 16*line + 52
@_damage_sprite.opacity = 255
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y
@_damage_sprite.z += 99999
@_damage_duration = 200
end
alias oldupdate_spriteme update
def update
if @_damage_duration > 0
@_damage_sprite.x = self.x
ymin = 0 if ymin == nil
case @_damage_duration
when 38..39
ymin -= 4
when 36..37
ymin -= 2
when 34..35
ymin -= 1
when 28..33
ymin -= 0
end
@_damage_sprite.y = self.y - self.oy / 2 + ymin
end
oldupdate_spriteme
end
end
end
Lembrando que é do master e para fazer funcionar basta substituir o RPG Sprite Damage/Text
por esse novo.
Créd ao:
Valentine
Kaitro
Kizuki
RD12