Project1

标题: 请问如何将此显血槽的脚本改成不显示敌人血槽的脚本? [打印本页]

作者: 爆焰    时间: 2011-10-25 12:38
标题: 请问如何将此显血槽的脚本改成不显示敌人血槽的脚本?
  1. # ————————————————————————————————————
  2. #==============================================================================
  3. # ■ Window_BattleStatus
  4. #==============================================================================
  5. class Window_BattleStatus < Window_Base
  6.   #--------------------------------------------------------------------------
  7.   # ● 公開インスタンス変数
  8.   #--------------------------------------------------------------------------
  9.   attr_accessor :update_cp_only # CPメーターのみの更新
  10.   #--------------------------------------------------------------------------
  11.   # ● オブジェクト初期化
  12.   #--------------------------------------------------------------------------
  13.   alias xrxs_bp7_initialize initialize
  14.   def initialize
  15.     # 初期化
  16.     @previous_hp = []
  17.     @previous_sp = []
  18.     # 呼び戻す
  19.     xrxs_bp7_initialize
  20.     # ↓Full-Viewの場合は下二行の # を消してください。
  21.     #self.opacity = 0
  22.     #self.back_opacity = 0
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● リフレッシュ
  26.   #--------------------------------------------------------------------------
  27.   alias xrxs_bp7_refresh refresh
  28.   def refresh
  29.     # CPメーターの更新のみ の場合
  30.     if @update_cp_only
  31.       xrxs_bp7_refresh
  32.       return
  33.     end
  34.     # 変更するものがない場合、飛ばす
  35.     @item_max = $game_party.actors.size
  36.     bool = false
  37.     for i in 0...@item_max
  38.       actor = $game_party.actors[i]
  39.       if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  40.         bool = true
  41.       end
  42.     end
  43.     return if bool == false
  44.     # 描写を開始
  45.     self.contents.clear
  46.     for i in 0...@item_max
  47.       actor = $game_party.actors[i]
  48.       actor_x = i * 160 + 21
  49.       # 歩行キャラグラフィックの描写
  50.       draw_actor_graphic(actor, actor_x - 0, 0)
  51.       # HP/SPメーターの描写
  52.       draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)
  53.       draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)
  54.       # HP数値の描写
  55.       self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  56.       self.contents.font.color = Color.new(0,0,0,192)
  57.       self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)
  58.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  59.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  60.       self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)
  61.       # SP数値の描写
  62.       self.contents.font.color = Color.new(0,0,0,192)
  63.       self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  64.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  65.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  66.       self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  67.       # 用語「HP」と用語「SP」の描写
  68.       self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ
  69.       self.contents.font.color = Color.new(0,0,0,192)
  70.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  71.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  72.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  73.       self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)
  74.       self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)
  75.       # ステートの描写
  76.       draw_actor_state(actor, actor_x, 100)
  77.       # 値を更新
  78.       @previous_hp[i] = actor.hp
  79.       @previous_hp[i] = actor.hp
  80.     end
  81.   end
  82. end
  83. #==============================================================================
  84. # ■ Window_Base
  85. #==============================================================================
  86. class Window_Base < Window
  87.   #--------------------------------------------------------------------------
  88.   # ● HPメーター の描画
  89.   #--------------------------------------------------------------------------
  90.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  91.     w = width * actor.hp / [actor.maxhp,1].max
  92.     hp_color_1 = Color.new(255, 0, 0, 192)
  93.     hp_color_2 = Color.new(255, 255, 0, 192)
  94.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  95.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  96.     x -= 1
  97.     y += (height/4).floor
  98.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  99.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  100.     x -= 1
  101.     y += (height/4).ceil
  102.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  103.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  104.     x -= 1
  105.     y += (height/4).ceil
  106.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  107.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● SPメーター の描画
  111.   #--------------------------------------------------------------------------
  112.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  113.     w = width * actor.sp / [actor.maxsp,1].max
  114.     hp_color_1 = Color.new( 0, 0, 255, 192)
  115.     hp_color_2 = Color.new( 0, 255, 255, 192)
  116.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  117.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  118.     x -= 1
  119.     y += (height/4).floor
  120.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  121.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  122.     x -= 1
  123.     y += (height/4).ceil
  124.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  125.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  126.     x -= 1
  127.     y += (height/4).ceil
  128.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  129.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● 名前の描画
  133.   #--------------------------------------------------------------------------
  134.   alias xrxs_bp7_draw_actor_name draw_actor_name
  135.   def draw_actor_name(actor, x, y)
  136.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● ステートの描画
  140.   #--------------------------------------------------------------------------
  141.   alias xrxs_bp7_draw_actor_state draw_actor_state
  142.   def draw_actor_state(actor, x, y, width = 120)
  143.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  144.   end
  145.   #--------------------------------------------------------------------------
  146.   # ● HP の描画
  147.   #--------------------------------------------------------------------------
  148.   alias xrxs_bp7_draw_actor_hp draw_actor_hp
  149.   def draw_actor_hp(actor, x, y, width = 144)
  150.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  151.   end
  152.   #--------------------------------------------------------------------------
  153.   # ● SP の描画
  154.   #--------------------------------------------------------------------------
  155.   alias xrxs_bp7_draw_actor_sp draw_actor_sp
  156.   def draw_actor_sp(actor, x, y, width = 144)
  157.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  158.   end
  159. end
  160. #==============================================================================
  161. # ■ Scene_Battle
  162. #==============================================================================
  163. class Scene_Battle
  164.   #--------------------------------------------------------------------------
  165.   # ● フレーム更新
  166.   #--------------------------------------------------------------------------
  167.   alias xrxs_bp7_update update
  168.   def update
  169.     xrxs_bp7_update
  170.     # メッセージウィンドウ表示中の場合
  171.     if $game_temp.message_window_showing
  172.       @status_window.update_cp_only = true      
  173.     else
  174.       @status_window.update_cp_only = false
  175.     end
  176.   end
  177. end
  178. #==============================================================================
  179. # ◇ 外部ライブラリ
  180. #==============================================================================
  181. class Window_Base
  182.   #--------------------------------------------------------------------------
  183.   # ● ライン描画 軽量版 by 桜雅 在土
  184.   #--------------------------------------------------------------------------
  185.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  186.     # 描写距離の計算。大きめに直角時の長さ。
  187.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  188.     # 描写開始
  189.     for i in 1..distance
  190.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  191.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  192.       self.contents.set_pixel(x, y, start_color)
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● ライン描画 by 桜雅 在土
  197.   #--------------------------------------------------------------------------
  198.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  199.     # 描写距離の計算。大きめに直角時の長さ。
  200.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  201.     # 描写開始
  202.     if end_color == start_color
  203.       for i in 1..distance
  204.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  205.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  206.         if width == 1
  207.           self.contents.set_pixel(x, y, start_color)
  208.         else
  209.           self.contents.fill_rect(x, y, width, width, start_color)
  210.         end
  211.       end
  212.     else
  213.       for i in 1..distance
  214.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  215.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  216.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  217.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  218.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  219.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  220.         if width == 1
  221.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  222.         else
  223.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  224.         end
  225.       end
  226.     end
  227.   end
  228. end


  229. #==============================================================================
  230. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  231. #==============================================================================#==============================================================================
  232. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  233. #==============================================================================
  234. # ■ エネミーHP&SP(ver 0.98)

  235. # □ カスタマイズポイント
  236. #==============================================================================
  237. module PLAN_HPSP_DRAW
  238. FONT_NAME         = ["黑体", "楷体", "宋体"]    # フォント
  239. FONT_SIZE         =  14                               # フォントサイズ
  240. FONT_BOLD         = true                              # 太字
  241. FONT_ITALIC       = true                              # 斜体

  242. DRAW_NAME         = false                             # 名前の描画
  243. DRAW_HP           = true                              # HP の描画
  244. DRAW_SP           = true                              # SP の描画

  245. DRAW_WIDTH        =  80                               # 描画幅
  246. DRAW_HEIGHT       = 3 * 32                            # 描画高さ
  247. DRAW_SPACE        =   0                               # 行间
  248. DRAW_Y            =  36                               # Y 座标修正値
  249. end


  250. #==============================================================================
  251. # ■ Sprite_Battler
  252. #==============================================================================

  253. class Sprite_Battler < RPG::Sprite
  254. #--------------------------------------------------------------------------
  255. # ● オブジェクト初期化
  256. #--------------------------------------------------------------------------
  257. alias plan_enemy_hpsp_draw_initialize initialize
  258. def initialize(viewport, battler = nil)
  259.   # 元のメソッドに戻す
  260.   plan_enemy_hpsp_draw_initialize(viewport, battler)
  261.   # エネミーの场合
  262.   if @battler.is_a?(Game_Enemy)
  263.     width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  264.     height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
  265.     x = @battler.screen_x - width / 2
  266.     y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
  267.     @enemy_hpsp_window = Window_Base.new(x, y, width, height)
  268.     @enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
  269.     @enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
  270.     @enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
  271.     @enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
  272.     @enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
  273.     y = 0
  274.     @old_enemy_hpsp = []
  275.     one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  276.     if PLAN_HPSP_DRAW::DRAW_NAME
  277.       @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  278.       y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  279.       @old_enemy_hpsp.push(@battler.name)
  280.     end
  281.     if PLAN_HPSP_DRAW::DRAW_HP
  282.       @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  283.       y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  284.       @old_enemy_hpsp.push(@battler.hp)
  285.     end
  286.     if PLAN_HPSP_DRAW::DRAW_SP
  287.       @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  288.       @old_enemy_hpsp.push(@battler.sp)
  289.     end
  290.     @enemy_hpsp_window.opacity = 0
  291.     @enemy_hpsp_window.contents_opacity = 0
  292.     @enemy_hpsp_window.z = -2
  293.   end
  294. end
  295. #--------------------------------------------------------------------------
  296. # ● 解放
  297. #--------------------------------------------------------------------------
  298. alias plan_enemy_hpsp_draw_dispose dispose
  299. def dispose
  300.   # エネミーの场合
  301.   if @battler.is_a?(Game_Enemy)
  302.     @enemy_hpsp_window.dispose
  303.   end
  304.   # 元のメソッドに戻す
  305.   plan_enemy_hpsp_draw_dispose
  306. end
  307. #--------------------------------------------------------------------------
  308. # ● フレーム更新
  309. #--------------------------------------------------------------------------
  310. alias plan_enemy_hpsp_draw_update update
  311. def update
  312.   # 元のメソッドに戻す
  313.   plan_enemy_hpsp_draw_update
  314.   # エネミーの场合
  315.   if @battler.is_a?(Game_Enemy)
  316.     @enemy_hpsp_window.visible = @battler_visible
  317.   # スプライトの座标を设定
  318.     width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  319.     @enemy_hpsp_window.x = self.x - width / 2
  320.     @now_enemy_hpsp = []
  321.     if PLAN_HPSP_DRAW::DRAW_NAME
  322.       @now_enemy_hpsp.push(@battler.name)
  323.     end
  324.     if PLAN_HPSP_DRAW::DRAW_HP
  325.       @now_enemy_hpsp.push(@battler.hp)
  326.     end
  327.     if PLAN_HPSP_DRAW::DRAW_SP
  328.       @now_enemy_hpsp.push(@battler.sp)
  329.     end
  330.     if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
  331.       @old_enemy_hpsp = @now_enemy_hpsp
  332.       @enemy_hpsp_window.contents.clear
  333.       y = 0
  334.       width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
  335.       one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
  336.       if PLAN_HPSP_DRAW::DRAW_NAME
  337.         @enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
  338.         y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  339.       end
  340.       if PLAN_HPSP_DRAW::DRAW_HP
  341.         @enemy_hpsp_window.draw_actor_hp2222(@battler, 0, y, width - 32)
  342.         y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
  343.       end
  344.       if PLAN_HPSP_DRAW::DRAW_SP
  345.         @enemy_hpsp_window.draw_actor_sp2222(@battler, 0, y, width - 32)
  346.       end
  347.       Graphics.frame_reset
  348.     end
  349.   end
  350. end
  351. #--------------------------------------------------------------------------
  352. # ● visible の设定
  353. #--------------------------------------------------------------------------
  354. if !method_defined?("plan_enemy_hpsp_draw_visible=")
  355.   alias plan_enemy_hpsp_draw_visible= visible=
  356. end
  357. def visible=(bool)
  358.   # エネミーの场合
  359.   if @battler.is_a?(Game_Enemy)
  360.     @enemy_hpsp_window.visible = bool
  361.   end
  362.   # 元のメソッドに戻す
  363.   self.plan_enemy_hpsp_draw_visible=(bool)
  364. end
  365. #--------------------------------------------------------------------------
  366. # ● 不透明度の设定
  367. #--------------------------------------------------------------------------
  368. if !method_defined?("plan_enemy_hpsp_draw_opacity=")
  369.   alias plan_enemy_hpsp_draw_opacity= opacity=
  370. end
  371. def opacity=(n)
  372.   # 元のメソッドに戻す
  373.   self.plan_enemy_hpsp_draw_opacity=(n)
  374.   # エネミーの场合
  375.   if @battler.is_a?(Game_Enemy)
  376.     @enemy_hpsp_window.contents_opacity = n
  377.   end
  378. end

  379. end





  380. #==============================================================================
  381. # ■ Game_Temp
  382. #==============================================================================

  383. class Game_Temp
  384. #--------------------------------------------------------------------------
  385. # ● 公开インスタンス変数
  386. #--------------------------------------------------------------------------
  387. attr_accessor :enemy_hpsp_refresh
  388. #--------------------------------------------------------------------------
  389. # ● オブジェクト初期化
  390. #--------------------------------------------------------------------------
  391. alias plan_enemy_hpsp_draw_initialize initialize
  392. def initialize
  393.   # 元のメソッドに戻す
  394.   plan_enemy_hpsp_draw_initialize
  395.   @enemy_hpsp_refresh = false
  396. end
  397. end

  398. #==============================================================================
  399. # ■ Scene_Battle
  400. #==============================================================================

  401. class Scene_Battle
  402. #--------------------------------------------------------------------------
  403. # ● プレバトルフェーズ开始 (エネミー名+アルファベット用)
  404. #--------------------------------------------------------------------------
  405. alias plan_enemy_hpsp_draw_start_phase1 start_phase1
  406. def start_phase1
  407.   $game_temp.enemy_hpsp_refresh = true
  408.   # 元のメソッドに戻す
  409.   plan_enemy_hpsp_draw_start_phase1
  410. end
  411. #--------------------------------------------------------------------------
  412. # ● パーティコマンドフェーズ开始 (エネミー名+アルファベット用)
  413. #--------------------------------------------------------------------------
  414. alias plan_enemy_hpsp_draw_start_phase2 start_phase2
  415. def start_phase2
  416.   $game_temp.enemy_hpsp_refresh = false
  417.   # 元のメソッドに戻す
  418.   plan_enemy_hpsp_draw_start_phase2
  419. end
  420. #--------------------------------------------------------------------------
  421. # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  422. #--------------------------------------------------------------------------
  423. alias plan_enemy_hpsp_draw_update_phase4_step5 update_phase4_step5
  424. def update_phase4_step5
  425.   # 元のメソッドに戻す
  426.   plan_enemy_hpsp_draw_update_phase4_step5
  427.   $game_temp.enemy_hpsp_refresh = true
  428. end
  429. #--------------------------------------------------------------------------
  430. # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  431. #--------------------------------------------------------------------------
  432. alias plan_enemy_hpsp_draw_update_phase4_step6 update_phase4_step6
  433. def update_phase4_step6
  434.   # 元のメソッドに戻す
  435.   plan_enemy_hpsp_draw_update_phase4_step6
  436.   $game_temp.enemy_hpsp_refresh = false
  437. end
  438. end


  439. #==============================================================================
  440. # ■ Window_Base
  441. #==============================================================================

  442. class Window_Base < Window
  443. #--------------------------------------------------------------------------
  444. # ● 名前の描画
  445. #--------------------------------------------------------------------------
  446. def draw_actor_name(actor, x, y, width = 120, align = 0)
  447.   self.contents.font.color = normal_color
  448.   align = 1 if $scene.is_a?(Scene_Battle)
  449.   self.contents.draw_text(x, y, width, 32, actor.name, align)
  450. end
  451. #--------------------------------------------------------------------------
  452. # ● ステートの描画
  453. #--------------------------------------------------------------------------
  454. def draw_actor_state(actor, x, y, width = 120)
  455.   # 元のメソッドに戻す
  456.   text = make_battler_state_text(actor, width, true)
  457.   self.contents.draw_text(x, y, width, 32, text, 1)
  458. end
  459. end


  460. #==============================================================================
  461. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  462. #==============================================================================

  463. class Window_Base < Window
  464. def draw_actor_hp2222(actor, x, y, width = 100, height=8)
  465.    y+=3
  466.    olx = x
  467.    oly = y
  468.    w = width * actor.hp / [actor.maxhp,1].max
  469.    hp_color_1 = Color.new(255, 0, 0, 192)
  470.    hp_color_2 = Color.new(255, 255, 0, 192)
  471.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  472.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  473.    x -= 1
  474.    y += (height/4).floor
  475.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  476.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  477.    x -= 1
  478.    y += (height/4).ceil
  479.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  480.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  481.    x -= 1
  482.    y += (height/4).ceil
  483.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  484.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  485.    x = olx
  486.    y = oly-14  
  487.    # 描绘字符串 "HP"
  488.    self.contents.font.color = system_color
  489.    self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  490.    # 计算描绘 MaxHP 所需的空间
  491.    if width - 32 >= 108
  492.      hp_x = x + width - 108
  493.      flag = true
  494.    elsif width - 32 >= 48
  495.      hp_x = x + width - 48
  496.      flag = false
  497.    end
  498.    # 描绘 HP
  499.    self.contents.font.color = actor.hp == 0 ? knockout_color :
  500.      actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  501.    self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  502.    # 描绘 MaxHP
  503.    if flag
  504.      self.contents.font.color = normal_color
  505.      self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  506.      self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
  507.    end   
  508. end
  509. def draw_actor_sp2222(actor, x, y, width = 100, height = 8)
  510.    y+=3
  511.    olx = x
  512.    oly = y
  513.    w = width * actor.sp / [actor.maxsp,1].max
  514.    hp_color_1 = Color.new( 0, 0, 255, 192)
  515.    hp_color_2 = Color.new( 0, 255, 255, 192)
  516.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  517.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  518.    x -= 1
  519.    y += (height/4).floor
  520.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  521.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  522.    x -= 1
  523.    y += (height/4).ceil
  524.    self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  525.    draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  526.    x -= 1
  527.    y += (height/4).ceil
  528.    self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  529.    draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  530.    x = olx
  531.    y = oly-14
  532.    # 描绘字符串 "SP"
  533.    self.contents.font.color = system_color
  534.    self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  535.    # 计算描绘 MaxSP 所需的空间
  536.    if width - 32 >= 108
  537.      sp_x = x + width - 108
  538.      flag = true
  539.    elsif width - 32 >= 48
  540.      sp_x = x + width - 48
  541.      flag = false
  542.    end
  543.    # 描绘 SP
  544.    self.contents.font.color = actor.sp == 0 ? knockout_color :
  545.      actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  546.    self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  547.    # 描绘 MaxSP
  548.    if flag
  549.      self.contents.font.color = normal_color
  550.      self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  551.      self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
  552.    end   
  553. end
  554. #--------------------------------------------------------------------------
  555. # ● ライン描画 by 桜雅 在土
  556. #--------------------------------------------------------------------------
  557. def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  558.    # 描写距离の计算。大きめに直角时の长さ。
  559.    distance = (start_x - end_x).abs + (start_y - end_y).abs
  560.    # 描写开始
  561.    if end_color == start_color
  562.      for i in 1..distance
  563.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  564.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  565.        if width == 1
  566.          self.contents.set_pixel(x, y, start_color)
  567.        else
  568.          self.contents.fill_rect(x, y, width, width, start_color)
  569.        end
  570.      end
  571.    else
  572.      for i in 1..distance
  573.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  574.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  575.        r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  576.        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  577.        b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  578.        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  579.        if width == 1
  580.          self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  581.        else
  582.          self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  583.        end
  584.      end
  585.    end
  586. end
  587. end
复制代码
dsu_plus_rewardpost_czw
作者: 熊猫    时间: 2011-10-25 13:31
搜索
  1. @enemy_hpsp_window.visible = @battler_visible
复制代码
改成
  1. @enemy_hpsp_window.visible = false
复制代码





欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1