赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 2599 |
最后登录 | 2017-7-19 |
在线时间 | 47 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 47 小时
- 注册时间
- 2013-7-14
- 帖子
- 46
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 hys111111 于 2014-7-9 10:54 编辑
状态叠加:- #==============================================================================
- # Date 12-31-2005
- # 重定义类:Window_Base, Window_Help
- #==============================================================================
- # 脚本功能:
- # 实现战斗中和菜单中用图标显示状态,代替原来的文字显示。
- # 默认最多同时显示5个状态
- #------------------------------------------------------------------------------
- # 设置方法:
- # 一个状态对应的图标文件名为“状态的动画ID.png”
- # 例如某状态的动画ID为50,那么它的图标就是“Icons\50.png”
- # 如果找不到对应的文件,会报错
- #==============================================================================
-
- # 注意,在ICON_STATE_IDS中写上需要带图标的状态ID
- # ICON_STATE_IDS是一个数组,数组的方法请参考帮助文件
- # 例如:
- # 只要1,5,8号状态带图标,就这样:ICON_STATE_IDS = [1,5,8]
- # 要20到50号状态带图标:ICON_STATE_IDS = 20..50
-
- ICON_STATE_IDS = [40..80]
-
- #==============================================================================
- # ■ Window_Base
- #------------------------------------------------------------------------------
- # 游戏中全部窗口的超级类。
- #==============================================================================
-
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 描绘状态
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- # width : 描画目标的宽
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 120)
- state_size = 0
- for state in actor.states
- # 图标数量超出宽度就中断循环
- if state_size >= width / 24 - 1
- break
- end
- # 此状态不带图标就跳过
- if !ICON_STATE_IDS.include?(state)
- next
- end
- bitmap = RPG::Cache.icon($data_states[state].name + ".png")
- if actor.states_turn[state] >= $data_states[state].hold_turn/2
- opacity = 255
- else
- opacity = 100
- end
- # 这里的图标大小默认是24x24,要改就改下面那个Rect.new(0, 0, 24, 24)
- self.contents.blt(x + 24 * state_size ,y ,bitmap, Rect.new(0, 0, 24, 24), opacity)
- state_size += 1
- end
- end
- end
-
-
- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 特技及物品的说明、角色的状态显示的窗口。
- #==============================================================================
-
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 设置敌人
- # enemy : 要显示名字和状态的敌人
- #--------------------------------------------------------------------------
- def set_enemy(enemy)
- # 描绘状态图标
- state_size = 0
- for state in enemy.states
- # 图标数量超出宽度就中断循环
- if state_size >= width / 16
- break
- end
- # 此状态不带图标就跳过
- if !ICON_STATE_IDS.include?(state)
- next
- end
- bitmap = RPG::Cache.icon($data_states[state].name + "_sta.png")
- if enemy.states_turn[state] >= $data_states[state].hold_turn/2
- opacity = 255
- else
- opacity = 100
- end
- self.contents.blt(70 + 16 * state_size, 0, bitmap, Rect.new(0, 0, 24, 24), opacity)
- state_size += 1
- end
- # 描绘敌人名字
- set_text(enemy.name, 1)
- end
- end
-
- class Game_Battler
- attr_reader :states_turn # 声明状态剩余回合
- end
- 伤害美化:#==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- # ————————————————————————————————————
- # HP/SP/EXPゲージ表示スクリプト Ver 1.00
- # 配布元・サポートURL
- # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
- #==============================================================================
- # ■ 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
- #--------------------------------------------------------------------------
- # ● 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 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
- #==============================================================================
- # ■ Spriteモジュール
- #------------------------------------------------------------------------------
- # アニメーションの管理を行うモジュールです。
- #==============================================================================
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
- # ============================================================================
- # 伤害效果美化 v1.0 by SailCat
- # ============================================================================
- # 脚本使用说明:
- # 1.使用时需要将Damage.png复制到你的游戏的Graphics/Pictures目录下
- # 2.Damage.png文件的格式:
- # 大小为180 x 96
- # (0, 0) - (179, 31)为伤害值的数字表,其中每个数字宽18,高32
- # (0, 32) - (179, 63)为回复值(伤害负值)的数字表,其中每个数字宽18,高32
- # (0, 64) - (89, 95)为会心一击标记的图画,长宽为90 x 32
- # (90, 64) - (179, 95)为未命中标记的图画,长宽为90 x 32
- # ============================================================================
- 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(162, 64)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- # 伤害值是数值的情况下
- if value.is_a?(Numeric)
- # 分割伤害值字符串
- damage_array = damage_string.scan(/./)
- damage_x = 81 - damage_string.size * 9
- # 伤害值为负的情况下
- if value < 0
- # 调用回复数字表
- rect_y = 32
- else
- # 调用伤害数字表
- rect_y = 0
- end
- # 循环伤害值字符串
- for char in damage_array
- number = char.to_i
- # 显示伤害数字
- bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
- Rect.new(number * 18, rect_y, 18, 32))
- # 后移一位
- damage_x += 18
- end
- # 伤害值不是数值的情况
- else
- # 如果伤害值不是 Miss
- unless value == "Miss"
- # 系统默认描画字符串
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
- # Miss 的情况下
- else
- # 显示未击中图画
- bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
- 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 = 81
- @_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
- end
- end
- #==============================================================================
- # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
- #==============================================================================
复制代码 |
|