赞 | 0 |
VIP | 2 |
好人卡 | 10 |
积分 | 1 |
经验 | 7625 |
最后登录 | 2014-3-16 |
在线时间 | 122 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 122 小时
- 注册时间
- 2008-7-3
- 帖子
- 724
|
本帖最后由 沙之爱罗 于 2010-11-15 13:11 编辑
在菜单里显示用这个- #==============================================================================
- # ■ 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 = 95)
- # 変数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 = 50
- 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 = 95)
- # 変数rateに 現在のSP/MSPを代入
- # n.truncate
- # kds_sp =
- 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 = 50
- 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 = 0)
- # 変数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モジュール
- #------------------------------------------------------------------------------
- # アニメーションの管理を行うモジュールです。
- #==============================================================================
- module RPG
- class Sprite < ::Sprite
- def kds_hp
- return @kds_hp
- end
-
- def damage(value, critical)
- dispose_damage
- if value.is_a?(Numeric)
- damage_string = value.abs.to_s
- else
- damage_string = value.to_s
- end
- bitmap = Bitmap.new(160, 48)
- bitmap.font.name = "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, 255, 255)
- 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
- if @battler.is_a?(Game_Actor)
- @_damage_sprite.x = self.x
- @_damage_sprite.x -= self.bitmap.width/2
- @_damage_sprite.x += 140
- elsif @battler.is_a?(Game_Enemy)
- @_damage_sprite.x = self.x
- @_damage_sprite.x -= self.bitmap.width/2
- @_damage_sprite.x += 140
- end
-
-
-
- @_damage_sprite.y = self.y - self.oy / 2
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 如果在战斗力显示血条用这个
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ————————————————————————————————————
- # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
- # by 桜雅 在土
- #==============================================================================
- # ■ Window_BattleStatus
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :update_cp_only # CPメーターのみの更新
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias xrxs_bp7_initialize initialize
- def initialize
- # 初期化
- @previous_hp = []
- @previous_sp = []
- # 呼び戻す
- xrxs_bp7_initialize
- # ↓Full-Viewの場合は下二行の # を消してください。
- #self.opacity = 0
- #self.back_opacity = 0
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- alias xrxs_bp7_refresh refresh
- def refresh
- # CPメーターの更新のみ の場合
- if @update_cp_only
- xrxs_bp7_refresh
- return
- end
- # 変更するものがない場合、飛ばす
- @item_max = $game_party.actors.size
- bool = false
- for i in 0...@item_max
- actor = $game_party.actors[i]
- if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
- bool = true
- end
- end
- return if bool == false
- # 描写を開始
- self.contents.clear
- for i in 0...@item_max
- actor = $game_party.actors[i]
- actor_x = i * 160 + 21
- # 歩行キャラグラフィックの描写
- draw_actor_graphic(actor, actor_x - 9, 116)
- # HP/SPメーターの描写
- draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)
- draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)
- # HP数値の描写
- self.contents.font.size = 24 # HP/SP数値の文字の大きさ
- self.contents.font.color = Color.new(0,0,0,192)
- self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)
- # SP数値の描写
- self.contents.font.color = Color.new(0,0,0,192)
- self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
- # 用語「HP」と用語「SP」の描写
- self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ
- self.contents.font.color = Color.new(0,0,0,192)
- self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
- self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
- self.contents.font.color = system_color # 用語「HP/SP」の文字の色
- self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)
- self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)
- # ステートの描写
- draw_actor_state(actor, actor_x, 100)
- # 値を更新
- @previous_hp[i] = actor.hp
- @previous_hp[i] = actor.hp
- end
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● HPメーター の描画
- #--------------------------------------------------------------------------
- def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
- w = width * actor.hp / [actor.maxhp,1].max
- hp_color_1 = Color.new(255, 0, 0, 192)
- hp_color_2 = Color.new(255, 255, 0, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- end
- #--------------------------------------------------------------------------
- # ● SPメーター の描画
- #--------------------------------------------------------------------------
- def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
- w = width * actor.sp / [actor.maxsp,1].max
- hp_color_1 = Color.new( 0, 0, 255, 192)
- hp_color_2 = Color.new( 0, 255, 255, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- end
- #--------------------------------------------------------------------------
- # ● 名前の描画
- #--------------------------------------------------------------------------
- alias xrxs_bp7_draw_actor_name draw_actor_name
- def draw_actor_name(actor, x, y)
- xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
- end
- #--------------------------------------------------------------------------
- # ● ステートの描画
- #--------------------------------------------------------------------------
- alias xrxs_bp7_draw_actor_state draw_actor_state
- def draw_actor_state(actor, x, y, width = 120)
- xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
- end
- #--------------------------------------------------------------------------
- # ● HP の描画
- #--------------------------------------------------------------------------
- alias xrxs_bp7_draw_actor_hp draw_actor_hp
- def draw_actor_hp(actor, x, y, width = 144)
- xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
- end
- #--------------------------------------------------------------------------
- # ● SP の描画
- #--------------------------------------------------------------------------
- alias xrxs_bp7_draw_actor_sp draw_actor_sp
- def draw_actor_sp(actor, x, y, width = 144)
- xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias xrxs_bp7_update update
- def update
- xrxs_bp7_update
- # メッセージウィンドウ表示中の場合
- if $game_temp.message_window_showing
- @status_window.update_cp_only = true
- else
- @status_window.update_cp_only = false
- end
- end
- end
- #==============================================================================
- # ◇ 外部ライブラリ
- #==============================================================================
- class Window_Base
- #--------------------------------------------------------------------------
- # ● ライン描画 軽量版 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_lineght(start_x, start_y, end_x, end_y, start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- self.contents.set_pixel(x, y, start_color)
- end
- end
- #--------------------------------------------------------------------------
- # ● ライン描画 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.contents.set_pixel(x, y, start_color)
- else
- self.contents.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.contents.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 怪物的话用这个
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- # ■ エネミーHP&SP(ver 0.98)
- # □ カスタマイズポイント
- #==============================================================================
- module PLAN_HPSP_DRAW
- FONT_NAME = ["黑体", "楷体", "宋体"] # フォント
- FONT_SIZE = 14 # フォントサイズ
- FONT_BOLD = true # 太字
- FONT_ITALIC = true # 斜体
- DRAW_NAME = false # 名前の描画
- DRAW_HP = true # HP の描画
- DRAW_SP = true # SP の描画
- DRAW_WIDTH = 80 # 描画幅
- DRAW_HEIGHT = 3 * 32 # 描画高さ
- DRAW_SPACE = 0 # 行間
- DRAW_Y = 36 # Y 座標修正値
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_initialize initialize
- def initialize(viewport, battler = nil)
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_initialize(viewport, battler)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
- x = @battler.screen_x - width / 2
- y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
- @enemy_hpsp_window = Window_Base.new(x, y, width, height)
- @enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
- @enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
- @enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
- @enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
- @enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
- y = 0
- @old_enemy_hpsp = []
- one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
- if PLAN_HPSP_DRAW::DRAW_NAME
- @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- @old_enemy_hpsp.push(@battler.name)
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- @old_enemy_hpsp.push(@battler.hp)
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
- @old_enemy_hpsp.push(@battler.sp)
- end
- @enemy_hpsp_window.opacity = 0
- @enemy_hpsp_window.contents_opacity = 0
- @enemy_hpsp_window.z = -2
- end
- end
- #--------------------------------------------------------------------------
- # ● 解放
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_dispose dispose
- def dispose
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.dispose
- end
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_dispose
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update update
- def update
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.visible = @battler_visible
- # スプライトの座標を設定
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- @enemy_hpsp_window.x = self.x - width / 2
- @now_enemy_hpsp = []
- if PLAN_HPSP_DRAW::DRAW_NAME
- @now_enemy_hpsp.push(@battler.name)
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @now_enemy_hpsp.push(@battler.hp)
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @now_enemy_hpsp.push(@battler.sp)
- end
- if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
- @old_enemy_hpsp = @now_enemy_hpsp
- @enemy_hpsp_window.contents.clear
- y = 0
- width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
- one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
- if PLAN_HPSP_DRAW::DRAW_NAME
- @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- end
- if PLAN_HPSP_DRAW::DRAW_HP
- @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
- y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
- end
- if PLAN_HPSP_DRAW::DRAW_SP
- @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
- end
- Graphics.frame_reset
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● visible の設定
- #--------------------------------------------------------------------------
- if !method_defined?("plan_enemy_hpsp_draw_visible=")
- alias plan_enemy_hpsp_draw_visible= visible=
- end
- def visible=(bool)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.visible = bool
- end
- # 元のメソッドに戻す
- self.plan_enemy_hpsp_draw_visible=(bool)
- end
- #--------------------------------------------------------------------------
- # ● 不透明度の設定
- #--------------------------------------------------------------------------
- if !method_defined?("plan_enemy_hpsp_draw_opacity=")
- alias plan_enemy_hpsp_draw_opacity= opacity=
- end
- def opacity=(n)
- # 元のメソッドに戻す
- self.plan_enemy_hpsp_draw_opacity=(n)
- # エネミーの場合
- if @battler.is_a?(Game_Enemy)
- @enemy_hpsp_window.contents_opacity = n
- end
- end
- end
-
-
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :enemy_hpsp_refresh
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_initialize initialize
- def initialize
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_initialize
- @enemy_hpsp_refresh = false
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # ● プレバトルフェーズ開始 (エネミー名+アルファベット用)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_start_phase1 start_phase1
- def start_phase1
- $game_temp.enemy_hpsp_refresh = true
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_start_phase1
- end
- #--------------------------------------------------------------------------
- # ● パーティコマンドフェーズ開始 (エネミー名+アルファベット用)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_start_phase2 start_phase2
- def start_phase2
- $game_temp.enemy_hpsp_refresh = false
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_start_phase2
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
- def update_phase4_step5
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update_phase4_step5
- $game_temp.enemy_hpsp_refresh = true
- end
- #--------------------------------------------------------------------------
- # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
- #--------------------------------------------------------------------------
- alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
- def update_phase4_step6
- # 元のメソッドに戻す
- plan_enemy_hpsp_draw_update_phase4_step6
- $game_temp.enemy_hpsp_refresh = false
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 名前の描画
- #--------------------------------------------------------------------------
- def draw_actor_name(actor, x, y, width = 120, align = 0)
- self.contents.font.color = normal_color
- align = 1 if $scene.is_a?(Scene_Battle)
- self.contents.draw_text(x, y, width, 32, actor.name, align)
- end
- #--------------------------------------------------------------------------
- # ● ステートの描画
- #--------------------------------------------------------------------------
- def draw_actor_state(actor, x, y, width = 120)
- # 元のメソッドに戻す
- text = make_battler_state_text(actor, width, true)
- self.contents.draw_text(x, y, width, 32, text, 1)
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- class Window_Base < Window
- def draw_actor_hp2222(actor, x, y, width = 100, height=8)
- y+=3
- olx = x
- oly = y
- w = width * actor.hp / [actor.maxhp,1].max
- hp_color_1 = Color.new(255, 0, 0, 192)
- hp_color_2 = Color.new(255, 255, 0, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x = olx
- y = oly-14
- # 描绘字符串 "HP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- # 计算描绘 MaxHP 所需的空间
- if width - 32 >= 108
- hp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- hp_x = x + width - 48
- flag = false
- end
- # 描绘 HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
- # 描绘 MaxHP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
- end
- end
- def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
- y+=3
- olx = x
- oly = y
- w = width * actor.sp / [actor.maxsp,1].max
- hp_color_1 = Color.new( 0, 0, 255, 192)
- hp_color_2 = Color.new( 0, 255, 255, 192)
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x -= 1
- y += (height/4).floor
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
- x -= 1
- y += (height/4).ceil
- self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
- draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
- x = olx
- y = oly-14
- # 描绘字符串 "SP"
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- # 计算描绘 MaxSP 所需的空间
- if width - 32 >= 108
- sp_x = x + width - 108
- flag = true
- elsif width - 32 >= 48
- sp_x = x + width - 48
- flag = false
- end
- # 描绘 SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
- # 描绘 MaxSP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
- self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
- end
- end
- #--------------------------------------------------------------------------
- # ● ライン描画 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.contents.set_pixel(x, y, start_color)
- else
- self.contents.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.contents.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
评分
-
查看全部评分
|