Project1
标题:
调整彩虹神剑数字
[打印本页]
作者:
悠哈悠哈
时间:
2008-12-3 04:07
标题:
调整彩虹神剑数字
悬赏1VIP(版务交易):
本人有一份让人改过的彩虹神剑,阴差阳错的使它数字图片显示混乱了(原因大约图片大小变了,但脚本却没改过来),现将脚本和图片上传,请好心人帮我把这个彩虹神剑改改好,让他能完全正常显示,不胜感激!(如发现有BUG的话也请改一样!)
http://rpg.blue/upload_program/d/悠哈悠哈_AAA_108676933.rar
作者:
cinderelmini
时间:
2008-12-3 04:12
那个,如果可以,就试试这个吧,基本没改的。。。。
=begin
==============================================================================
彩虹神剑(伤害分段显示)显示总伤害版 v1.0b
==============================================================================
彩虹神剑 by 柳柳
显示总伤害修改 by 叶子
==============================================================================
6-20-2006 v1.0
在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的
v1.0a
修正了显示伤害和实际伤害有差别的问题
修正了miss的情况下显示miss混乱的问题
修正了对己方技能重复显示伤害的问题
未修正播放目标动画第一帧时目标有时无端跳动的BUG
v1.0b
修改了总伤害数字的位置和z坐标
未修正播放目标动画第一帧时目标有时无端跳动的BUG
==============================================================================
=end
# 核心的说明:
# damage_pop 不再附带damage()的功能,这个放到animation里面去了
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = true
class Sprite < ::Sprite
#==========================================
# 修改说明:
# @flash_shake用来制作挨打时候跳跃
# @_damage 用来记录每次打击之后弹出数字
# @_total_damage 记录总伤害
# @_total_damage_duration 总伤害持续帧
#==========================================
#alias 66RPG_rainbow_initialize : initialize
def initialize(viewport = nil)
#66RPG_rainbow_initialize(viewport)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
# 挨打时候跳跃
@flash_shake = 0
# 伤害记录数组
@_damage = []
# 总伤害数字
@_total_damage = 0
# 总伤害持续帧
@_total_damage_duration = 0
end
def damage(value, critical)
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, 55, 55)
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(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
#=======================================
# 修改:推入新的伤害
#=======================================
@_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
# 总伤害处理
make_total_damage(value)
end
#--------------------------------------------------------------------------
# ● 总伤害处理
#--------------------------------------------------------------------------
def make_total_damage(value)
if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
@_total_damage += value
else
return
end
bitmap = Bitmap.new(300, 150)
bitmap.font.name = "Arial Black"
bitmap.font.size = 48
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
if @_total_damage < 0
bitmap.font.color.set(80, 255, 00)
else
bitmap.font.color.set(255, 140, 0)
end
bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
if @_total_damage_sprite.nil?
@_total_damage_sprite = ::Sprite.new(self.viewport)
@_total_damage_sprite.ox = 80
@_total_damage_sprite.oy = 20
@_total_damage_sprite.z = 3000
end
@_total_damage_sprite.bitmap = bitmap
@_total_damage_sprite.zoom_x = 1.5
@_total_damage_sprite.zoom_y = 1.5
@_total_damage_sprite.x = self.x
@_total_damage_sprite.y = self.y - self.oy / 2 - 64
@_total_damage_sprite.z = 3001
@_total_damage_duration = 80
end
def animation(animation, hit, battler_damage="", battler_critical=false)
dispose_animation
#=======================================
# 修改:记录伤害和critical
#=======================================
@battler_damage = battler_damage
@battler_critical = battler_critical
@_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)
#=======================================
# 修改:计算总闪光权限值
#=======================================
for timing in @_animation.timings
quanzhong = animation_process_timing(timing, @_animation_hit,true)
@all_quanzhong += quanzhong
# 记录最后一次闪光
@_last_frame = timing.frame if quanzhong != 0
end
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
#=======================================
# 修改:行动方动画不显示伤害
#=======================================
if $scene.is_a?(Scene_Battle)
if $scene.animation1_id == @battler.animation_id
@battler_damage = ""
end
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
#=======================================
# 修改:更换清除伤害的算法,以防万一
# 本内容在脚本中没有使用过
#=======================================
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
@_total_damage = 0
@_last_frame = -1
if @_total_damage_sprite != nil
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
def dispose_animation
#=======================================
# 修改:清除记录的伤害,清除权重记录
#=======================================
@battler_damage = nil
@battler_critical = nil
@all_quanzhong = 1
@_total_damage = 0
@_last_frame = -1
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#=======================================
# 修改:更新算法,更新弹出
#=======================================
if @_damage_duration > 0
@_damage_duration -= 1
for damage in @_damage
damage[0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2 +
(40 - damage[1]) * damage[3] / 10
damage[0].y -= damage[4]+damage[1]/10
damage[0].opacity = damage[1]*20
damage[1] -= 1
if damage[1]==0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
next
end
end
end
#=======================================
# 添加:弹出总伤害
#=======================================
if @_total_damage_duration > 0
@_total_damage_duration -= 1
@_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
if @_total_damage_sprite.zoom_x > 1.0
@_total_damage_sprite.zoom_x -= 0.05
end
if @_total_damage_sprite.zoom_y > 1.0
@_total_damage_sprite.zoom_y -= 0.05
end
@_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
if @_total_damage_duration <= 0
@_total_damage = 0
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
t *= @battler_damage
t /= @all_quanzhong
#p t,"当前伤害",@battler_damage,"总伤害"
t = t.to_i
# 最后一次闪光的话,伤害修正
if frame_index == @_last_frame
@_total_damage = @battler_damage - t
end
#p t,@battler_damage,@all_quanzhong
damage(t,@battler_critical)
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
#=======================================
# 修改:敌人跳跃的功能 + 添加返回数值
#=======================================
def animation_process_timing(timing, hit,dontflash=false)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
unless dontflash
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
case timing.flash_scope
when 1
unless dontflash
self.flash(timing.flash_color, timing.flash_duration * 2)
if @_total_damage >0
@flash_shake_switch = true
@flash_shake = 10
end
end
return timing.flash_color.alpha * timing.flash_duration
when 2
unless dontflash
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
return timing.flash_color.alpha * timing.flash_duration
end
end
when 3
unless dontflash
self.flash(nil, timing.flash_duration * 2)
end
return timing.flash_color.alpha * timing.flash_duration
end
end
return 0
end
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
# 添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
@flash_shake_switch = true
end
#--------------------------------------------------------------------------
# ● 刷新画面
# 增添跳跃功能
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.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
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
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
@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.damage, @battler.critical)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu
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
# 设置活动块的坐标
if @flash_shake_switch == true
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
@flash_shake_switch = false
end
if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
case @flash_shake
when 9..10
self.x = @battler.screen_x
self.y -=4
self.z = @battler.screen_z
when 6..8
self.x = @battler.screen_x
self.y -=2
self.z = @battler.screen_z
when 3..5
self.x = @battler.screen_x
self.y +=2
self.z = @battler.screen_z
when 2
self.x = @battler.screen_x
self.y += 4
self.z = @battler.screen_z
when 1
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
@flash_shake -= 1
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :animation1_id # 行动方动画ID
end
复制代码
作者:
redant
时间:
2008-12-3 04:19
#调用SP伤害图片
bitmap.blt(damage_x, 32, RPG::Cache.picture("spDamage"),
Rect.new(number * 14, rect_y, 14, 32))
#调用HP伤害图片
else
bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
Rect.new(number * 14, rect_y,14, 32))
是不是因为图片数字小的缘故 觉得 字漂地有些怪异= =|
作者:
悠哈悠哈
时间:
2008-12-3 04:59
这个彩虹神剑是为我的工程特意改的,如果没有更好的我不想用别的了.至于乱翻........我就是要你们改好这些东西吧!我看不懂也不会改,所以就麻烦你们了,
应该是图片大小已不是原来的大小造成的!所以请高人重新调整吧!
作者:
悠哈悠哈
时间:
2008-12-3 05:19
redant
好象没你说的好么容易吧...........我去试试看..........{/pz}
试了,不行,还有问题的说,不信你自己试试!比如MISS显示.总之光改这个好象不行.你应该明白我的的脚本文盲程度!
作者:
redant
时间:
2008-12-3 06:21
这是你的damage图片140 按14改的
这是我的图片300 按30 改的
sp总伤害 是200 找到 bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("sp总伤害"),
Rect.new(number * 25, rect_y, 25, 32))
把25改成20
hp一样
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = false
class Sprite < ::Sprite
# 用文件名字代替实例加快搜索速度
@@_reference_count_ary = []
#==========================================
# 修改说明:
# @flash_shake用来制作挨打时候跳跃
# @_damage 用来记录每次打击之后弹出数字
# @_total_damage 记录总伤害
# @_total_damage_duration 总伤害持续帧
#==========================================
alias rainbow_initialize :initialize
def initialize(viewport = nil)
# 元方法引用
rainbow_initialize(viewport)
# 挨打时候跳跃
@flash_shake = 0
# 伤害记录数组
@_damage = []
# 总伤害数字
@_total_damage = 0
# 总伤害持续帧
@_total_damage_duration = 0
end
#--------------------------------------------------------------------------
# 图片化显示伤害
#--------------------------------------------------------------------------
def damage(value, critical)
bitmap = Bitmap.new(200, 64)
bitmap.font.name = "Arial Black"
bitmap.font.size = 18
# 伤害值是数值的情况下
if value.is_a?(Numeric)
# 伤害值为负的情况下
if value < 0
rect_y = 32# 调用回复数字表
damage_string = (-value).to_s
else
rect_y = 0 # 调用伤害数字表
damage_string = (value).to_s
end
# 分割伤害值字符串
damage_array = damage_string.scan(/./)
damage_x = (9 - damage_string.size)* 9
# 循环伤害值字符串
damage_array.each do |char|
number = char.to_i
if $SP判定 == 2 #当伤害值为SP伤害时
#调用SP伤害图片
bitmap.blt(damage_x, 32, RPG::Cache.picture("spDamage"),
Rect.new(number * 14, rect_y, 14, 50))
#调用HP伤害图片
else
bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
Rect.new(number * 14, rect_y,14, 50))
end
# 后移一位
damage_x += 20
end
# 伤害值不是数值的情况
else
damage_string = value.to_s
# 如果伤害值不是 Miss
unless value == "Miss"
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 11, 160, 36, damage_string, 1)
#bitmap.draw_text(+1, 11, 160, 36, damage_string, 1)
#bitmap.draw_text(-1, 13, 160, 36, damage_string, 1)
#bitmap.draw_text(+1, 13, 160, 36, damage_string, 1)
# Miss 的情况下
else
# 显示未击中图画
bitmap.blt(36, 28, RPG::Cache.picture("Damage"),Rect.new(90, 64, 90, 50))
end
end
# 会心一击标志打开的情况
if critical
# 显示会心一击图画
bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
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
#=======================================
# 修改:推入新的伤害
#=======================================
@_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
# 总伤害处理
make_total_damage(value)
end
#############################################################################
#--------------------------------------------------------------------------
# ● 总伤害处理
#--------------------------------------------------------------------------
############################################################################
#总伤害图片化
def make_total_damage(value)
if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE #如果总伤害数值为数字并且总伤害显示开关为真。
@_total_damage += value
value1 = @_total_damage #代入伤害数值
total_string = value1.abs.to_s #转化字符串
#分割伤害数值
@_total_damage_array = total_string.scan(/./)
@_total_damage_x = (9 - total_string.size) * 9
else
return
end
########图片尺寸以及字体
bitmap = Bitmap.new(320,82)
bitmap.font.name = "黑体"
bitmap.font.size = 32
#################
if @_total_damage < 0 #如果总伤害小于0
rect_y = 32 #定位伤害值行数
############处理伤害分割数字
for char in @_total_damage_array
number = char.to_i
if $SP判定 == 2 #当SP判定为2时,即显示SP恢复和伤害量
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("sp总伤害"),
Rect.new(number * 25, rect_y, 25, 32))
else #伤害为HP的情况下
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("hp总伤害"),
Rect.new(number * 25, rect_y, 25, 32))
end
# 后移一位
@_total_damage_x += 25
end
else #伤害值大于0的情况
rect_y = 0 #定位伤害值行数
#总伤害数值循环处理
for char in @_total_damage_array
number = char.to_i
if $SP判定 == 2 #当伤害为SP伤害时
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("sp总伤害"),
Rect.new(number * 20, rect_y, 20, 32))
else #除此以外的情况。
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("hp总伤害"),
Rect.new(number * 20, rect_y, 0, 32))
end
# 后移一位
@_total_damage_x += 25
end
end
if @_total_damage_sprite.nil?
@_total_damage_sprite = ::Sprite.new(self.viewport)
@_total_damage_sprite.ox = 80
@_total_damage_sprite.oy = 20
@_total_damage_sprite.z = 3000
end
@_total_damage_sprite.bitmap = bitmap
@_total_damage_sprite.zoom_x = 1.5
@_total_damage_sprite.zoom_y = 1.5
@_total_damage_sprite.x = self.x
@_total_damage_sprite.y = self.y - self.oy / 2 - 64
@_total_damage_sprite.z = 3001
@_total_damage_duration = 80
end
##################################################################
def animation(animation, hit, battler_damage="", battler_critical=false,battler=nil)
dispose_animation
@battler = battler
#=======================================
# 修改:记录伤害和critical
#=======================================
@battler_damage = battler_damage
@battler_critical = battler_critical
@_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)
#=======================================
# 修改:计算总闪光权限值
#=======================================
for timing in @_animation.timings
quanzhong = animation_process_timing(timing, @_animation_hit,true)
quanzhong = 0
@all_quanzhong += quanzhong
# 记录最后一次闪光
@_last_frame = timing.frame if quanzhong != 0
end
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
#=======================================
# 修改:行动方动画不显示伤害
#=======================================
if $scene.is_a?(Scene_Battle)
if $scene.animation1_id == @battler.animation_id
@battler_damage = ""
end
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
15.times do
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
#=======================================
# 修改:更换清除伤害的算法,以防万一
# 本内容在脚本中没有使用过
#=======================================
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
@_total_damage = 0
@_last_frame = -1
if @_total_damage_sprite != nil
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
def dispose_animation
#=======================================
# 修改:清除记录的伤害,清除权重记录
#=======================================
@battler_damage = nil
@battler_critical = nil
@all_quanzhong = 1
@_total_damage = 0
@_last_frame = -1
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = @_whiten_duration * 10 - 32
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = @_escape_duration * 10 - 64
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#=======================================
# 修改:更新算法,更新弹出
#=======================================
if @_damage_duration > 0
@_damage_duration -= 1
for damage in @_damage
damage[0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2 +
(4 - damage[1]/ 10) * damage[3]
damage[0].y -= damage[4]+damage[1]/10
damage[0].opacity = damage[1]*20
damage[1] -= 1
if damage[1]==0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
next
end
end
end
#=======================================
# 添加:弹出总伤害
#=======================================
if @_total_damage_duration > 0
@_total_damage_duration -= 1
@_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
if @_total_damage_sprite.zoom_x > 1.0
@_total_damage_sprite.zoom_x -= 0.05
end
if @_total_damage_sprite.zoom_y > 1.0
@_total_damage_sprite.zoom_y -= 0.05
end
@_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
if @_total_damage_duration <= 0
@_total_damage = 0
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
#p @battler_damage, t
t *= @battler_damage
t /= @all_quanzhong
t *= (rand(10)/10.0)
t = t.to_i
@_total_damage += t
#p t,@battler_damage, @_total_damage
damage(t,@battler_critical)
@battler.hp -= t
$scene.statusupdate
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
#=======================================
# 修改:敌人跳跃的功能 + 添加返回数值
#=======================================
def animation_process_timing(timing, hit,dontflash=false)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
unless dontflash
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
case timing.flash_scope
when 1
unless dontflash
self.flash(timing.flash_color, timing.flash_duration * 2)
if @_total_damage >0
@flash_shake_switch = true
@flash_shake = 10
end
end
return timing.flash_color.alpha * timing.flash_duration
when 2
unless dontflash
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
return timing.flash_color.alpha * timing.flash_duration
end
end
when 3
unless dontflash
self.flash(nil, timing.flash_duration * 2)
end
return timing.flash_color.alpha * timing.flash_duration
end
end
return 0
end
end
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 初始化对像
# 添加跳跃记录
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
@battler = battler
@battler_visible = false
@flash_shake_switch = true
end
#--------------------------------------------------------------------------
# ● 刷新画面
# 增添跳跃功能
#--------------------------------------------------------------------------
def update
super
# 战斗者为 nil 的情况下
if @battler == nil
self.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
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = self.bitmap.width
@height = self.bitmap.height
self.ox = @width / 2
self.oy = @height
# 如果是战斗不能或者是隐藏状态就把透明度设置成 0
if @battler.dead? or @battler.hidden
self.opacity = 0
end
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
@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.damage, @battler.critical,@battler)
@battler.animation_id = 0
end
# 伤害
if @battler.damage_pop
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
# korapusu
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
# 设置活动块的坐标
if @flash_shake_switch == true
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
@flash_shake_switch = false
end
if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
case @flash_shake
when 9..10
self.x = @battler.screen_x
self.y -=4
self.z = @battler.screen_z
when 6..8
self.x = @battler.screen_x
self.y -=2
self.z = @battler.screen_z
when 3..5
self.x = @battler.screen_x
self.y +=2
self.z = @battler.screen_z
when 2
self.x = @battler.screen_x
self.y += 4
self.z = @battler.screen_z
when 1
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
@flash_shake -= 1
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :animation1_id # 行动方动画ID
def statusupdate
@status_window.refresh
Graphics.frame_reset
end
end
复制代码
这是那个修改过的 你试试= =|
作者:
悠哈悠哈
时间:
2008-12-3 18:40
说有问题你还不信.那我给你说一下发现的几个问题吧!(同试了几下就发现的问题):
1.一眼就能看出来的:你不觉得这些数字与数字间的距离太大了吗?(这数字间的距离只要不完全碰在一起就行了)
2.你觉得这个数字显示正确吗?看一下技能的威力,怎么可能打出这种伤害值?我试了下,一个回复药能出现N十万的回复量,小刀也能打出数万伤害.........
3.总伤害(或回复)的数字呢?不是满天乱飞,就是找不到影子.........
新问题正在找,先就说出这几个问题吧!
会心一击没试过,MISS显示好象对了,不过也觉得怪怪的!
{/gg}
作者:
redant
时间:
2008-12-3 20:49
module RPG
#--------------------------------------------------------------------------
# ● 常量设定
#--------------------------------------------------------------------------
# 是否显示总伤害
SHOW_TOTAL_DAMAGE = true
# 角色受攻击时是否跳一下
BATTLER_JUMP = false
class Sprite < ::Sprite
# 用文件名字代替实例加快搜索速度
@@_reference_count_ary = []
#==========================================
# 修改说明:
# @flash_shake用来制作挨打时候跳跃
# @_damage 用来记录每次打击之后弹出数字
# @_total_damage 记录总伤害
# @_total_damage_duration 总伤害持续帧
#==========================================
alias rainbow_initialize :initialize
def initialize(viewport = nil)
# 元方法引用
rainbow_initialize(viewport)
# 挨打时候跳跃
@flash_shake = 0
# 伤害记录数组
@_damage = []
# 总伤害数字
@_total_damage = 0
# 总伤害持续帧
@_total_damage_duration = 0
end
#--------------------------------------------------------------------------
# 图片化显示伤害
#--------------------------------------------------------------------------
def damage(value, critical)
bitmap = Bitmap.new(200, 64)
bitmap.font.name = "Arial Black"
bitmap.font.size = 18
# 伤害值是数值的情况下
if value.is_a?(Numeric)
# 伤害值为负的情况下
if value < 0
rect_y = 32# 调用回复数字表
damage_string = (-value).to_s
else
rect_y = 0 # 调用伤害数字表
damage_string = (value).to_s
end
# 分割伤害值字符串
damage_array = damage_string.scan(/./)
damage_x = (9 - damage_string.size)* 9
# 循环伤害值字符串
damage_array.each do |char|
number = char.to_i
if $SP判定 == 2 #当伤害值为SP伤害时
#调用SP伤害图片
bitmap.blt(damage_x, 32, RPG::Cache.picture("spDamage"),
Rect.new(number * 14, rect_y, 14, 50))
#调用HP伤害图片
else
bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
Rect.new(number * 14, rect_y,14, 50))
end
# 后移一位
damage_x += 20
end
# 伤害值不是数值的情况
else
damage_string = value.to_s
# 如果伤害值不是 Miss
unless value == "Miss"
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 11, 160, 36, damage_string, 1)
#bitmap.draw_text(+1, 11, 160, 36, damage_string, 1)
#bitmap.draw_text(-1, 13, 160, 36, damage_string, 1)
#bitmap.draw_text(+1, 13, 160, 36, damage_string, 1)
# Miss 的情况下
else
# 显示未击中图画
bitmap.blt(36, 28, RPG::Cache.picture("Damage"),Rect.new(90, 64, 90, 50))
end
end
# 会心一击标志打开的情况
if critical
# 显示会心一击图画
bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
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
#=======================================
# 修改:推入新的伤害
#=======================================
@_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
# 总伤害处理
make_total_damage(value)
end
#############################################################################
#--------------------------------------------------------------------------
# ● 总伤害处理
#--------------------------------------------------------------------------
############################################################################
#总伤害图片化
def make_total_damage(value)
if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE #如果总伤害数值为数字并且总伤害显示开关为真。
@_total_damage += value
value1 = @_total_damage #代入伤害数值
# damage_string = @_total_damage.abs.to_s
total_string = value1.abs.to_s #转化字符串
#分割伤害数值
@_total_damage_array = total_string.scan(/./)
@_total_damage_x = (9 - total_string.size) * 9
else
return
end
########图片尺寸以及字体
bitmap = Bitmap.new(320,82)
bitmap.font.name = "黑体"
bitmap.font.size = 32
#################
if @_total_damage < 0 #如果总伤害小于0
rect_y = 32 #定位伤害值行数
############处理伤害分割数字
for char in @_total_damage_array
number = char.to_i
if $SP判定 == 2 #当SP判定为2时,即显示SP恢复和伤害量
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("sp总伤害"),
Rect.new(number * 25, rect_y, 25, 32))
else #伤害为HP的情况下
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("hp总伤害"),
Rect.new(number * 25, rect_y, 25, 32))
end
# 后移一位
@_total_damage_x += 25
end
else #伤害值大于0的情况
rect_y = 0 #定位伤害值行数
#总伤害数值循环处理
for char in @_total_damage_array
number = char.to_i
if $SP判定 == 2 #当伤害为SP伤害时
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("sp总伤害"),
Rect.new(number * 20, rect_y, 20, 32))
else #除此以外的情况。
bitmap.blt(@_total_damage_x, 32, RPG::Cache.picture("hp总伤害"),
Rect.new(number * 20, rect_y, 0, 32))
end
# 后移一位
@_total_damage_x += 25
end
end
if @_total_damage_sprite.nil?
@_total_damage_sprite = ::Sprite.new(self.viewport)
@_total_damage_sprite.ox = 80
@_total_damage_sprite.oy = 20
@_total_damage_sprite.z = 3000
end
@_total_damage_sprite.bitmap = bitmap
@_total_damage_sprite.zoom_x = 1.5
@_total_damage_sprite.zoom_y = 1.5
@_total_damage_sprite.x = self.x
@_total_damage_sprite.y = self.y - self.oy / 2 - 64
@_total_damage_sprite.z = 3001
@_total_damage_duration = 80
end
##################################################################
def animation(animation, hit, battler_damage="", battler_critical=false)
dispose_animation
#=======================================
# 修改:记录伤害和critical
#=======================================
@battler_damage = battler_damage
@battler_critical = battler_critical
@_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)
#=======================================
# 修改:计算总闪光权限值
#=======================================
for timing in @_animation.timings
quanzhong = animation_process_timing(timing, @_animation_hit,true)
@all_quanzhong += quanzhong
# 记录最后一次闪光
@_last_frame = timing.frame if quanzhong != 0
end
#.........................................................................
@last_frame = @_last_frame
#.........................................................................
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
#=======================================
# 修改:行动方动画不显示伤害
#=======================================
if $scene.is_a?(Scene_Battle)
if $scene.animation1_id == @battler.animation_id
@battler_damage = ""
end
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
#=======================================
# 修改:更换清除伤害的算法,以防万一
# 本内容在脚本中没有使用过
#=======================================
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
@_total_damage = 0
@_last_frame = -1
if @_total_damage_sprite != nil
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
# 清除hit数
#=======================================
#...........................................................................
def dispose_hit
if @_hits_sprite != nil
@_hits_sprite.bitmap.dispose
@_hits_sprite.dispose
@_hits_sprite = nil
end
end
#...........................................................................
def dispose_animation
#=======================================
# 修改:清除记录的伤害,清除权重记录
#=======================================
@battler_damage = nil
@battler_critical = nil
@all_quanzhong = 1
@_total_damage = 0
@_last_frame = -1
#.........................................................................
@hits = 0
#.........................................................................
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#=======================================
# 修改:更新算法,更新弹出
#=======================================
if @_damage_duration > 0
@_damage_duration -= 1
for damage in @_damage
damage[0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2 +
(40 - damage[1]) * damage[3] / 10
damage[0].y -= damage[4]+damage[1]/10
damage[0].opacity = damage[1]*20
damage[1] -= 1
if damage[1]==0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
next
end
end
end
#=======================================
# 添加:弹出总伤害
#=======================================
if @_total_damage_duration > 0
@_total_damage_duration -= 1
@_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
if @_total_damage_sprite.zoom_x > 1.0
@_total_damage_sprite.zoom_x -= 0.05
end
if @_total_damage_sprite.zoom_y > 1.0
@_total_damage_sprite.zoom_y -= 0.05
end
@_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
#......................................................................
if @_total_damage_duration <= 7 and @_total_damage_duration > 0
# @_hits_sprite.opacity -= 32
#@_hits_sprite.x += 1
end
#......................................................................
if @_total_damage_duration <= 0
#.....................................................................
dispose_hit
##########################
@_total_damage = 0
##########################
#.....................................................................
@_total_damage = 0
@_total_damage_duration = 0
#####################################################小改动
if SHOW_TOTAL_DAMAGE
@_total_damage_sprite.bitmap.dispose
end
#####################################################
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
#......................................................................
@loop_animation_once = 0
@loop_animation_once = 1 if @once == 1 and @_loop_animation_index == @_loop_animation.frame_max
#......................................................................
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
#..........................................................................
def loop_animation_once
return @_loop_animation_once
end
#..........................................................................
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
@frame_index = frame_index
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
t *= @battler_damage
t /= @all_quanzhong
t = t.to_i
#在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index != @_last_frame
@p_dam+= t
end
#p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
#闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
t=@battler_damage-@p_dam
end
#p t,"当前伤害",@battler_damage,"总伤害"
# 最后一次闪光的话,伤害修正
if frame_index == @_last_frame
@_total_damage = @battler_damage - t
@p_dam=0 #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
end
#p t,@battler_damage,@all_quanzhong
damage(t,@battler_critical)
#连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
if frame_index == @_last_frame
############ #小改动
@last_hits=1
@temp_hits=0
############
@hits=0
end
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
#=======================================
# 修改:敌人跳跃的功能 + 添加返回数值
#=======================================
def update_loop_animation
frame_index = @_loop_animation_index
cell_data = @_loop_animation.frames[frame_index].cell_data
position = @_loop_animation.position
#·改·
if @wait_count.to_i <= 0
@wait_count = 0
animation_set_sprites(@_loop_animation_sprites, cell_data, position)
else
@wait_count -= 1
for sprite in @_loop_animation_sprites
sprite.visible = false
end
end
if @wait_flash.to_i <= 0
@wait_flash = 0
else
@wait_flash -= 1
for sprite in @_loop_animation_sprites
sprite.blend_type = 1
end
end
#·改·
for timing in @_loop_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, true)
end
end
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_process_timing(timing, hit,dontflash=false)
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
unless dontflash
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
case timing.flash_scope
when 1
unless dontflash
self.flash(timing.flash_color, timing.flash_duration * 2)
#....................................................................
@wait_flash = timing.flash_duration
#....................................................................
if @_total_damage >0
@flash_shake_switch = true
@flash_shake = 10
end
end
return timing.flash_color.alpha * timing.flash_duration
when 2
unless dontflash
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
return timing.flash_color.alpha * timing.flash_duration
end
end
when 3
unless dontflash
self.flash(nil, timing.flash_duration * 2)
#@_loop_animation_count = 1
#·改·
@wait_count = timing.flash_duration
#·改·
end
return timing.flash_color.alpha * timing.flash_duration
end
end
return 0
end
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :animation1_id # 行动方动画ID
def statusupdate
@status_window.refresh
Graphics.frame_reset
end
end
复制代码
好了 这个问题 你去问帮你改脚本的人= =| 是他出了错
也就是说 数据库 动画 (也就是说 默认阿尔 剑 如果没有闪烁对象的话 就不会显示伤害)
是在闪光 弹出伤害出了问题
和图片没有关系 =。= 图片显示多少 就确实是打出了多少伤害
所以说 这个改过的是不完整版= =|
现在伤害显示正常
距离的话 起码你截个图来看 距离多远 我不能凭空猜吧=。=
把以上脚本 替换原来的 再试试
你PS 做个效果图 我看着还明白点= =|
[LINE]1,#dddddd[/LINE]
http://rpg.blue/upload_program/d/redant_Project5_108751940.rar
作者:
禾西
时间:
2008-12-4 08:47
其实楼上,原版198 行删掉
quanzhong = 0
就可以解决天文数字问题
作者:
redant
时间:
2008-12-4 14:52
多谢禾老大 指导 我去看看先{/wx}
作者:
悠哈悠哈
时间:
2008-12-4 19:28
脚本已收到,就此结贴!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1