赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1875 |
最后登录 | 2013-8-23 |
在线时间 | 45 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 45 小时
- 注册时间
- 2011-11-26
- 帖子
- 90
|
本帖最后由 wxj541374210 于 2012-1-20 20:06 编辑
我弄了个血条和彩虹神剑的脚本,血条如下- # ————————————————————————————————————
- # 本脚本来自www.66rpg.com,转载请保留此信息
- # ————————————————————————————————————
- # HP/SP/EXPゲージ表示スクリプト Ver 1.00
- # 配布元・サポートURL
- # http://members.jcom.home.ne.jp/cogwheel/
- #==============================================================================
- # ■ Game_Actor
- #------------------------------------------------------------------------------
- # アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
- # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
- #==============================================================================
- class Game_Actor < Game_Battler
- def now_exp
- return @exp - @exp_list[@level]
- end
- def next_exp
- return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
- end
- end
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # ゲーム中のすべてのウィンドウのスーパークラスです。
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● HP ゲージの描画
- #--------------------------------------------------------------------------
- # オリジナルのHP描画を draw_actor_hp_original と名前変更
- alias :draw_actor_hp_original :draw_actor_hp
- def draw_actor_hp(actor, x, y, width = 144)
- # 変数rateに 現在のHP/MHPを代入
- if actor.maxhp != 0
- rate = actor.hp.to_f / actor.maxhp
- else
- rate = 0
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
- color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.maxhp != 0
- hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
- else
- hp = 0
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, hp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのHP描画処理を呼び出し
- draw_actor_hp_original(actor, x, y, width)
- end
- #--------------------------------------------------------------------------
- # ● SP ゲージの描画
- #--------------------------------------------------------------------------
- # オリジナルのSP描画を draw_actor_sp_original と名前変更
- alias :draw_actor_sp_original :draw_actor_sp
- def draw_actor_sp(actor, x, y, width = 144)
- # 変数rateに 現在のSP/MSPを代入
- if actor.maxsp != 0
- rate = actor.sp.to_f / actor.maxsp
- else
- rate = 1
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 64, 0, 192)
- color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
- color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.maxsp != 0
- sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
- else
- sp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, sp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのSP描画処理を呼び出し
- draw_actor_sp_original(actor, x, y, width)
- end
- #--------------------------------------------------------------------------
- # ● EXP ゲージの描画
- #--------------------------------------------------------------------------
- # オリジナルのEXP描画を draw_actor_sp_original と名前変更
- alias :draw_actor_exp_original :draw_actor_exp
- def draw_actor_exp(actor, x, y, width = 204)
- # 変数rateに 現在のexp/nextexpを代入
- if actor.next_exp != 0
- rate = actor.now_exp.to_f / actor.next_exp
- else
- rate = 1
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(64, 0, 0, 192)
- color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
- color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
- # 変数expに描画するゲージの幅を代入
- if actor.next_exp != 0
- exp = (width + plus_width) * actor.now_exp * rate_width /
- 100 / actor.next_exp
- else
- exp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, exp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # オリジナルのEXP描画処理を呼び出し
- draw_actor_exp_original(actor, x, y)
- end
- #--------------------------------------------------------------------------
- # ● 延迟时间描画
- #--------------------------------------------------------------------------
- def draw_actor_delay_time(actor, x, y, width = 144)
- # 変数rateに 現在のSP/MSPを代入
- if actor.delay_time_max != 0
- rate = actor.delay_time.to_f / actor.delay_time_max
- else
- rate = 0
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 64, 0, 192)
- color5 = Color.new(100 * rate, 100 * rate, 0, 192)
- color6 = Color.new(255 * rate, 255 * rate, 0, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.delay_time_max != 0
- sp = (width + plus_width) * actor.delay_time * rate_width / 100 / actor.delay_time_max
- else
- sp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, sp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # 描绘字符串 "行动时间"
- self.contents.font.color = system_color
- self.contents.font.size = 20
- self.contents.draw_text(x, y, 120, 32, 'Delay')
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 120, 32, actor.delay_time.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 咏唱时间描画
- #--------------------------------------------------------------------------
- def draw_actor_casting_time(actor, x, y, width = 144)
- # 変数rateに 現在のSP/MSPを代入
- time = actor.casting_time_max - actor.casting_time
- if actor.casting_time_max != 0
- rate = time.to_f / actor.casting_time_max
- else
- rate = 0
- end
- # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正
- # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅
- # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め
- # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め
- # align3:ゲージタイプ 0:左詰め 1:右詰め
- plus_x = 0
- rate_x = 0
- plus_y = 25
- plus_width = 0
- rate_width = 100
- height = 10
- align1 = 1
- align2 = 2
- align3 = 0
- # グラデーション設定 grade1:空ゲージ grade2:実ゲージ
- # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重))
- grade1 = 1
- grade2 = 0
- # 色設定。color1:外枠,color2:中枠
- # color3:空ゲージダークカラー,color4:空ゲージライトカラー
- # color5:実ゲージダークカラー,color6:実ゲージライトカラー
- color1 = Color.new(0, 0, 0, 192)
- color2 = Color.new(255, 255, 192, 192)
- color3 = Color.new(0, 0, 0, 192)
- color4 = Color.new(0, 64, 0, 192)
- color5 = Color.new(100 * rate, 100 * rate, 0, 192)
- color6 = Color.new(255 * rate, 255 * rate, 0, 192)
- # 変数spに描画するゲージの幅を代入
- if actor.casting_time_max != 0
- sp = (width + plus_width) * time * rate_width / 100 / actor.casting_time_max
- else
- sp = (width + plus_width) * rate_width / 100
- end
- # ゲージの描画
- gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
- width, plus_width + width * rate_width / 100,
- height, sp, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- # 描绘字符串 "行动时间"
- self.contents.font.color = system_color
- self.contents.font.size = 20
- self.contents.draw_text(x, y, 120, 32, 'Cast')
- self.contents.font.color = normal_color
- self.contents.draw_text(x, y, 120, 32, time.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● ゲージの描画
- #--------------------------------------------------------------------------
- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
- color1, color2, color3, color4, color5, color6, grade1, grade2)
- case align1
- when 1
- x += (rect_width - width) / 2
- when 2
- x += rect_width - width
- end
- case align2
- when 1
- y -= height / 2
- when 2
- y -= height
- end
- # 枠描画
- self.contents.fill_rect(x, y, width, height, color1)
- self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
- if align3 == 0
- if grade1 == 2
- grade1 = 3
- end
- if grade2 == 2
- grade2 = 3
- end
- end
- if (align3 == 1 and grade1 == 0) or grade1 > 0
- color = color3
- color3 = color4
- color4 = color
- end
- if (align3 == 1 and grade2 == 0) or grade2 > 0
- color = color5
- color5 = color6
- color6 = color
- end
- # 空ゲージの描画
- self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
- color3, color4, grade1)
- if align3 == 1
- x += width - gauge
- end
- # 実ゲージの描画
- self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
- color5, color6, grade2)
- end
- end
- #------------------------------------------------------------------------------
- # Bitmapクラスに新たな機能を追加します。
- #==============================================================================
- class Bitmap
- #--------------------------------------------------------------------------
- # ● 矩形をグラデーション表示
- # color1 : スタートカラー
- # color2 : エンドカラー
- # align : 0:横にグラデーション
- # 1:縦にグラデーション
- # 2:斜めにグラデーション(激重につき注意)
- #--------------------------------------------------------------------------
- def gradation_rect(x, y, width, height, color1, color2, align = 0)
- if align == 0
- for i in x...x + width
- red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - x) / (width - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - x) / (width - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - x) / (width - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(i, y, 1, height, color)
- end
- elsif align == 1
- for i in y...y + height
- red = color1.red +
- (color2.red - color1.red) * (i - y) / (height - 1)
- green = color1.green +
- (color2.green - color1.green) * (i - y) / (height - 1)
- blue = color1.blue +
- (color2.blue - color1.blue) * (i - y) / (height - 1)
- alpha = color1.alpha +
- (color2.alpha - color1.alpha) * (i - y) / (height - 1)
- color = Color.new(red, green, blue, alpha)
- fill_rect(x, i, width, 1, color)
- end
- elsif align == 2
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- elsif align == 3
- for i in x...x + width
- for j in y...y + height
- red = color1.red + (color2.red - color1.red) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- green = color1.green + (color2.green - color1.green) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- blue = color1.blue + (color2.blue - color1.blue) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- alpha = color1.alpha + (color2.alpha - color1.alpha) *
- ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
- color = Color.new(red, green, blue, alpha)
- set_pixel(i, j, color)
- end
- end
- end
- end
- end
复制代码 和一个彩虹神剑及彩虹神剑补丁:- ==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 = false
- 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
- ###########################################################################
- if @battler.dead?
- self.bitmap = RPG::Cache.battler(@battler.id.to_s + "Dead", @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
- if (@battler.dead? or @battler.hidden) and @battler.is_a?(Game_Enemy)
- ###########################################################################
- 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)
- if @battler.is_a?(Game_Enemy)
- ###########################################################################
- appear
- ###########################################################################
- else
- self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- @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)
- collapse
- else
- $game_system.se_play($data_system.actor_collapse_se)
- # 角色战斗图变为角色ID+"Dead"的名字的战斗图
- self.bitmap = RPG::Cache.battler(@battler.id.to_s + "Dead", @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- @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
复制代码 补丁:- class Game_Battler
- # 声明一个实例变量判断是否需要显示固定伤害
- attr_accessor :battle_solid_damage
- end
- class Scene_Battle
- def update_phase4_step1
- # 隐藏帮助窗口
- @help_window.visible = false
- # 判定胜败
- if judge
- # 胜利或者失败的情况下 : 过程结束
- return
- end
- # 强制行动的战斗者不存在的情况下
- if $game_temp.forcing_battler == nil
- # 设置战斗事件
- setup_battle_event
- # 执行战斗事件中的情况下
- if $game_system.battle_interpreter.running?
- return
- end
- end
- # 强制行动的战斗者存在的情况下
- if $game_temp.forcing_battler != nil
- # 在头部添加后移动
- @action_battlers.delete($game_temp.forcing_battler)
- @action_battlers.unshift($game_temp.forcing_battler)
- end
- # 未行动的战斗者不存在的情况下 (全员已经行动)
- if @action_battlers.size == 0
- # 开始同伴命令回合
- start_phase2
- return
- end
- # 初始化动画 ID 和公共事件 ID
- @animation1_id = 0
- @animation2_id = 0
- @common_event_id = 0
- # 未行动的战斗者移动到序列的头部
- @active_battler = @action_battlers.shift
- # 如果已经在战斗之外的情况下
- if @active_battler.index == nil
- return
- end
- # 连续伤害
- if @active_battler.hp > 0 and @active_battler.slip_damage?
- @active_battler.slip_damage_effect
- @active_battler.damage_pop = true
- @active_battler.battle_solid_damage = true
- end
- # 自然解除状态
- @active_battler.remove_states_auto
- # 刷新状态窗口
- @status_window.refresh
- # 移至步骤 2
- @phase4_step = 2
- end
- end
- class Sprite_Battler < RPG::Sprite
- 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
- ###########################################################################
- if @battler.dead?
- self.bitmap = RPG::Cache.battler(@battler.id.to_s + "Dead", @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
- if (@battler.dead? or @battler.hidden) and @battler.is_a?(Game_Enemy)
- ###########################################################################
- 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)
- if @battler.is_a?(Game_Enemy)
- ###########################################################################
- appear
- ###########################################################################
- else
- self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- @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
- # 显示固定伤害
- if @battler.battle_solid_damage
- damage(@battler.damage, @battler.critical)
- @battler.battle_solid_damage = false
- end
- @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)
- collapse
- else
- $game_system.se_play($data_system.actor_collapse_se)
- # 角色战斗图变为角色ID+"Dead"的名字的战斗图
- self.bitmap = RPG::Cache.battler(@battler.id.to_s + "Dead", @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- @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 +=3
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- when 6..8
- self.x -=3
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- when 3..5
- self.x +=3
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- when 2
- self.x -=3
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- when 1
- self.x +=3
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- end
- @flash_shake -= 1
- end
- end
- end
- class Interpreter
- def command_338
- # 获取操作值
- value = operate_value(0, @parameters[2], @parameters[3])
- # 处理循环
- iterate_battler(@parameters[0], @parameters[1]) do |battler|
- # 战斗者存在的情况下
- if battler.exist?
- # 更改 HP
- battler.hp -= value
- # 如果在战斗中
- if $game_temp.in_battle
- # 设置伤害
- battler.damage = value
- battler.damage_pop = true
- battler.battle_solid_damage = true
- end
- end
- end
- # 继续
- return true
- end
- end
复制代码 他们发生了冲突,删去发生冲突彩虹神剑的第266及269行后,分段伤害就被固定了,不会移动了
请高手帮我改一改 |
|