Project1

标题: 求整合一下这两个脚本。。。 [打印本页]

作者: CR~    时间: 2014-5-7 11:46
标题: 求整合一下这两个脚本。。。
敌人的血条脚本(帮助兰的血条盖住的战斗力)
  1. class Window_Help < Window_Base
  2.   def set_enemy(actor)
  3.     self.contents.clear
  4.     draw_actor_name(actor, 4, 0)
  5.     draw_actor_state(actor, 140, 0)
  6.     carol3_draw_hp_bar(actor, 284, 0)
  7.     carol3_draw_sp_bar(actor, 460, 0)
  8.     @text = nil
  9.     self.visible = true
  10.   end  
  11.   def carol3_draw_hp_bar(actor, x, y, width = 128) #宽度可调
  12.     self.contents.font.color = system_color
  13.     w = width * actor.hp / [actor.maxhp,1].max
  14.     if actor.maxhp != 0
  15.       rate = actor.hp.to_f / actor.maxhp
  16.     else
  17.       rate = 0
  18.     end
  19.     color1 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 150)
  20.     self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
  21.     self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
  22.      self.contents.fill_rect(x+1, y+17, w,6,color1)
  23.     self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
  24.      self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
  25.     self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
  26.     self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
  27.     self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
  28.     self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
  29.     self.contents.draw_text(x-53,y,128,32,$data_system.words.hp,1)
  30.     if actor.hp>actor.maxhp/3
  31.       self.contents.font.color = Color.new(255, 255, 255, 250)
  32.     end
  33.     if actor.hp>=actor.maxhp/6 and actor.maxhp/3>actor.hp
  34.       self.contents.font.color = Color.new(200, 200, 0, 255)
  35.     end
  36.     if actor.maxhp/6>actor.hp
  37.       self.contents.font.color = Color.new(200, 0, 0, 255)
  38.     end
  39.     self.contents.draw_text(x+47,y,128,32,actor.hp.to_s,1)
  40.   end
  41.   def carol3_draw_sp_bar(actor, x, y, width = 128)
  42.     self.contents.font.color = system_color
  43.     if actor.maxsp != 0
  44.       rate = actor.sp.to_f / actor.maxsp
  45.     else
  46.       rate = 0
  47.     end
  48.     color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  49.     w = width * actor.sp / [actor.maxsp,1].max  
  50.     self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
  51.     self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
  52.      self.contents.fill_rect(x+1, y+17, w,6,color2)
  53.     self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
  54.      self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
  55.     self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
  56.     self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
  57.     self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
  58.     self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
  59.     self.contents.draw_text(x-53,y,128,32,$data_system.words.sp,1)
  60.     if actor.hp>actor.maxsp/3
  61.       self.contents.font.color = Color.new(255, 255, 255, 250)
  62.     end
  63.     if actor.hp>=actor.maxsp/6 and actor.maxsp/3>actor.sp
  64.       self.contents.font.color = Color.new(200, 200, 0, 255)
  65.     end
  66.     if actor.maxsp/6>actor.sp
  67.       self.contents.font.color = Color.new(200, 0, 0, 255)
  68.     end
  69.     self.contents.draw_text(x+47,y,128,32,actor.sp.to_s,1)
  70.   end
  71. end  
复制代码
战斗力脚本
  1. #【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】
  2. =begin
  3. ===============================================================================
  4. ★【战斗力】★
  5. -------------------------------------------------------------------------------
  6.   by ->  芯☆淡茹水
  7. ===============================================================================
  8. ◎ 使用方法:复制该脚本,插入到 main 前。
  9. -------------------------------------------------------------------------------
  10.   该脚本在状态窗口增加描绘角色战斗力,在帮助栏增加描绘角色和敌人的战斗力。
  11.   要在其他地方描绘角色战斗力,在欲描绘的地方写入:draw_actor_ce(actor, x, y)
  12.                                             敌人:draw_enemy_ce(enemy, x, y)
  13.   欲调用战斗力数值,先指定角色/敌人,然后:actor.ce / enemy.ce
  14. ===============================================================================
  15. ◆ 角色战斗力的构成:
  16. -------------------------------------------------------------------------------
  17.        1.角色:力量 + 敏捷 + 速度 + 魔力
  18. -------------------------------------------------------------------------------
  19.        2.武器:攻击力 + 物防 + 魔防 + 力量↑ + 敏捷↑ + 速度↑ + 魔力↑
  20.                + 属性攻击数 X 100 + 附加状态数 X 100 + 解除状态数 X 50
  21. -------------------------------------------------------------------------------
  22.        3.防具:物防 + 魔防 + 力量↑ + 敏捷↑ + 速度↑ + 魔力↑
  23.                + 属性防御数 X 100 + 状态防御数 X 100 + 自动状态 X 100
  24. -------------------------------------------------------------------------------
  25.    总战斗力 = 1(角色)+ 2(武器)+ 3(防具)
  26. ===============================================================================
  27. ◆ 敌人战斗力的构成:
  28. --------------------------------------------------------------------------------
  29.    敌人战斗力 = 力量 + 敏捷 + 速度 + 魔力 + 攻击力 + 物防 + 魔防 + 回避
  30. ===============================================================================
  31. =end   #【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】
  32. #==============================================================================
  33. class Game_Actor < Game_Battler
  34.   #--------------------------------------------------------------------------
  35.   # ● 武器品质
  36.   #--------------------------------------------------------------------------
  37.   def weapon_quality(id)
  38.     weapon = $data_weapons[id]
  39.     n = weapon.atk + weapon.pdef + weapon.mdef + weapon.str_plus +
  40.         weapon.dex_plus + weapon.agi_plus + weapon.int_plus
  41.     if weapon.element_set != nil
  42.       n += weapon.element_set.size * 100
  43.     end
  44.     if weapon.plus_state_set != nil
  45.       n += weapon.plus_state_set.size * 100
  46.     end
  47.     if weapon.minus_state_set != nil
  48.       n += weapon.minus_state_set.size * 50
  49.     end
  50.     return n
  51.   end
  52.   #---------------------------------------------------------------------------
  53.   #● 防具品质
  54.   #---------------------------------------------------------------------------
  55.   def armor_quality(id)
  56.     armor = $data_armors[id]
  57.     n = armor.pdef + armor.mdef + armor.str_plus + armor.dex_plus +
  58.         armor.agi_plus + armor.int_plus
  59.     if armor.guard_element_set != nil
  60.       n += armor.guard_element_set.size * 100
  61.     end
  62.     if armor.guard_state_set != nil
  63.       n += armor.guard_state_set.size * 100
  64.     end
  65.     if armor.auto_state_id > 0
  66.       n += 100
  67.     end
  68.     return n
  69.   end
  70.   #---------------------------------------------------------------------------
  71.   #● 角色战斗力
  72.   #---------------------------------------------------------------------------
  73.   def ce
  74.     weapon = $data_weapons[@weapon_id]
  75.     armor1 = $data_armors[@armor1_id]
  76.     armor2 = $data_armors[@armor2_id]
  77.     armor3 = $data_armors[@armor3_id]
  78.     armor4 = $data_armors[@armor4_id]
  79.     n = str + dex + agi + int
  80.     n += weapon != nil ? weapon_quality(@weapon_id) : 0
  81.     n += armor1 != nil ?  armor_quality(@armor1_id) : 0
  82.     n += armor2 != nil ?  armor_quality(@armor2_id) : 0
  83.     n += armor3 != nil ?  armor_quality(@armor3_id) : 0
  84.     n += armor4 != nil ?  armor_quality(@armor4_id) : 0
  85.     return n
  86.   end
  87. end
  88. #==============================================================================
  89. class Window_Base < Window
  90.   #---------------------------------------------------------------------------
  91.   #● 战斗力描绘
  92.   #---------------------------------------------------------------------------
  93.   def draw_actor_ce(actor, x, y)
  94.     self.contents.font.color = system_color
  95.     self.contents.draw_text(x, y, 96, 32, "战斗力:")
  96.     self.contents.font.color = normal_color
  97.     self.contents.draw_text(x + 94, y, 164, 32, actor.ce.to_s)
  98.   end
  99.   #-------------------------------------------4--------------------------------
  100.   #● 敌人战斗力描绘
  101.   #---------------------------------------------------------------------------
  102.   def draw_enemy_ce(enemy, x, y)
  103.     self.contents.font.color = system_color
  104.     self.contents.draw_text(x, y, 96, 32, "战斗力:")
  105.     self.contents.font.color = normal_color
  106.     self.contents.draw_text(x + 94, y, 164, 32, enemy.ce.to_s)
  107.   end
  108. end
  109. #==============================================================================
  110. class Window_Status < Window_Base
  111.   #--------------------------------------------------------------------------
  112.   # ● 刷新
  113.   #--------------------------------------------------------------------------
  114.   def refresh
  115.     self.contents.clear
  116.     draw_actor_graphic(@actor, 40, 112)
  117.     draw_actor_name(@actor, 4, 0)
  118.     draw_actor_class(@actor, 4 + 144, 0)
  119.     draw_actor_level(@actor, 96, 32)
  120.     draw_actor_state(@actor, 96, 64)
  121.     draw_actor_hp(@actor, 96, 112, 172)
  122.     draw_actor_sp(@actor, 96, 144, 172)
  123.     draw_actor_parameter(@actor, 96, 192, 0)
  124.     draw_actor_parameter(@actor, 96, 224, 1)
  125.     draw_actor_parameter(@actor, 96, 256, 2)
  126.     draw_actor_parameter(@actor, 96, 304, 3)
  127.     draw_actor_parameter(@actor, 96, 336, 4)
  128.     draw_actor_parameter(@actor, 96, 368, 5)
  129.     draw_actor_parameter(@actor, 96, 400, 6)
  130.     self.contents.font.color = system_color
  131.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  132.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  133.     draw_actor_ce(@actor, 319, 120)
  134.     self.contents.font.color = normal_color
  135.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  136.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  137.     self.contents.font.color = system_color
  138.     self.contents.draw_text(320, 160, 96, 32, "装备")
  139.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  140.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
  141.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
  142.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
  143.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
  144.   end
  145.   def dummy
  146.     self.contents.font.color = system_color
  147.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  148.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  149.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  150.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  151.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  152.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  153.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  154.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  155.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  156.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  157.   end
  158. end
  159. class Game_Enemy < Game_Battler
  160.   #============================================================================
  161.   def ce
  162.     n = base_str + base_dex + base_agi + base_int + base_atk + base_pdef +
  163.         base_mdef + base_eva
  164.     return n
  165.   end
  166. end
  167. #==============================================================================
  168. class Window_Help < Window_Base
  169.   def set_actor(actor)
  170.     if actor != @actor
  171.       self.contents.clear
  172.       draw_actor_name(actor, 4, 0)
  173.       draw_actor_ce(actor, 460, 0)
  174.       draw_actor_state(actor, 102, 0)
  175.       draw_actor_hp(actor, 184, 0)
  176.       draw_actor_sp(actor, 320, 0)
  177.       [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  178.       @text = nil
  179.       self.visible = true
  180.     end
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 设置敌人
  184.   #     enemy : 要显示名字和状态的敌人
  185.   #--------------------------------------------------------------------------
  186.   def set_enemy(enemy)
  187.     text = enemy.name
  188.     draw_enemy_ce(enemy, 460, 0)
  189.     state_text = make_battler_state_text(enemy, 112, false)
  190.     if state_text != ""
  191.       text += "  " + state_text
  192.     end
  193.     set_text(text, 1)
  194.   end
  195. end
  196. #==============================================================================
  197.    
复制代码

作者: 芯☆淡茹水    时间: 2014-5-7 11:46
  1. #【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】
  2. =begin
  3. ===============================================================================
  4. ★【战斗力】★
  5. -------------------------------------------------------------------------------
  6.   by ->  芯☆淡茹水
  7. ===============================================================================
  8. ◎ 使用方法:复制该脚本,插入到 main 前。
  9. -------------------------------------------------------------------------------
  10.   该脚本在状态窗口增加描绘角色战斗力,在帮助栏增加描绘角色和敌人的战斗力。
  11.   要在其他地方描绘角色战斗力,在欲描绘的地方写入:draw_actor_ce(actor, x, y)
  12.                                             敌人:draw_enemy_ce(enemy, x, y)
  13.   欲调用战斗力数值,先指定角色/敌人,然后:actor.ce / enemy.ce
  14. ===============================================================================
  15. ◆ 角色战斗力的构成:
  16. -------------------------------------------------------------------------------
  17.        1.角色:力量 + 敏捷 + 速度 + 魔力
  18. -------------------------------------------------------------------------------
  19.        2.武器:攻击力 + 物防 + 魔防 + 力量↑ + 敏捷↑ + 速度↑ + 魔力↑
  20.                + 属性攻击数 X 100 + 附加状态数 X 100 + 解除状态数 X 50
  21. -------------------------------------------------------------------------------
  22.        3.防具:物防 + 魔防 + 力量↑ + 敏捷↑ + 速度↑ + 魔力↑
  23.                + 属性防御数 X 100 + 状态防御数 X 100 + 自动状态 X 100
  24. -------------------------------------------------------------------------------
  25.    总战斗力 = 1(角色)+ 2(武器)+ 3(防具)
  26. ===============================================================================
  27. ◆ 敌人战斗力的构成:
  28. --------------------------------------------------------------------------------
  29.    敌人战斗力 = 力量 + 敏捷 + 速度 + 魔力 + 攻击力 + 物防 + 魔防 + 回避
  30. ===============================================================================
  31. =end   #【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】【】
  32. #==============================================================================
  33. class Game_Actor < Game_Battler
  34.   #--------------------------------------------------------------------------
  35.   # ● 武器品质
  36.   #--------------------------------------------------------------------------
  37.   def weapon_quality(id)
  38.     weapon = $data_weapons[id]
  39.     n = weapon.atk + weapon.pdef + weapon.mdef + weapon.str_plus +
  40.         weapon.dex_plus + weapon.agi_plus + weapon.int_plus
  41.     if weapon.element_set != nil
  42.       n += weapon.element_set.size * 100
  43.     end
  44.     if weapon.plus_state_set != nil
  45.       n += weapon.plus_state_set.size * 100
  46.     end
  47.     if weapon.minus_state_set != nil
  48.       n += weapon.minus_state_set.size * 50
  49.     end
  50.     return n
  51.   end
  52.   #---------------------------------------------------------------------------
  53.   #● 防具品质
  54.   #---------------------------------------------------------------------------
  55.   def armor_quality(id)
  56.     armor = $data_armors[id]
  57.     n = armor.pdef + armor.mdef + armor.str_plus + armor.dex_plus +
  58.         armor.agi_plus + armor.int_plus
  59.     if armor.guard_element_set != nil
  60.       n += armor.guard_element_set.size * 100
  61.     end
  62.     if armor.guard_state_set != nil
  63.       n += armor.guard_state_set.size * 100
  64.     end
  65.     if armor.auto_state_id > 0
  66.       n += 100
  67.     end
  68.     return n
  69.   end
  70.   #---------------------------------------------------------------------------
  71.   #● 角色战斗力
  72.   #---------------------------------------------------------------------------
  73.   def ce
  74.     weapon = $data_weapons[@weapon_id]
  75.     armor1 = $data_armors[@armor1_id]
  76.     armor2 = $data_armors[@armor2_id]
  77.     armor3 = $data_armors[@armor3_id]
  78.     armor4 = $data_armors[@armor4_id]
  79.     n = str + dex + agi + int
  80.     n += weapon != nil ? weapon_quality(@weapon_id) : 0
  81.     n += armor1 != nil ?  armor_quality(@armor1_id) : 0
  82.     n += armor2 != nil ?  armor_quality(@armor2_id) : 0
  83.     n += armor3 != nil ?  armor_quality(@armor3_id) : 0
  84.     n += armor4 != nil ?  armor_quality(@armor4_id) : 0
  85.     return n
  86.   end
  87. end
  88. #==============================================================================
  89. class Window_Base < Window
  90.   #---------------------------------------------------------------------------
  91.   #● 战斗力描绘
  92.   #---------------------------------------------------------------------------
  93.   def draw_actor_ce(actor, x, y)
  94.     self.contents.font.color = system_color
  95.     self.contents.draw_text(x, y, 96, 32, "战斗力:")
  96.     self.contents.font.color = normal_color
  97.     self.contents.draw_text(x + 94, y, 164, 32, actor.ce.to_s)
  98.   end
  99.   #-------------------------------------------4--------------------------------
  100.   #● 敌人战斗力描绘
  101.   #---------------------------------------------------------------------------
  102.   def draw_enemy_ce(enemy, x, y)
  103.     self.contents.font.color = system_color
  104.     self.contents.draw_text(x, y, 96, 32, "战斗力:")
  105.     self.contents.font.color = normal_color
  106.     self.contents.draw_text(x + 94, y, 164, 32, enemy.ce.to_s)
  107.   end
  108. end
  109. #==============================================================================
  110. class Window_Status < Window_Base
  111.   #--------------------------------------------------------------------------
  112.   # ● 刷新
  113.   #--------------------------------------------------------------------------
  114.   def refresh
  115.     self.contents.clear
  116.     draw_actor_graphic(@actor, 40, 112)
  117.     draw_actor_name(@actor, 4, 0)
  118.     draw_actor_class(@actor, 4 + 144, 0)
  119.     draw_actor_level(@actor, 96, 32)
  120.     draw_actor_state(@actor, 96, 64)
  121.     draw_actor_hp(@actor, 96, 112, 172)
  122.     draw_actor_sp(@actor, 96, 144, 172)
  123.     draw_actor_parameter(@actor, 96, 192, 0)
  124.     draw_actor_parameter(@actor, 96, 224, 1)
  125.     draw_actor_parameter(@actor, 96, 256, 2)
  126.     draw_actor_parameter(@actor, 96, 304, 3)
  127.     draw_actor_parameter(@actor, 96, 336, 4)
  128.     draw_actor_parameter(@actor, 96, 368, 5)
  129.     draw_actor_parameter(@actor, 96, 400, 6)
  130.     self.contents.font.color = system_color
  131.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  132.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  133.     draw_actor_ce(@actor, 319, 120)
  134.     self.contents.font.color = normal_color
  135.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  136.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  137.     self.contents.font.color = system_color
  138.     self.contents.draw_text(320, 160, 96, 32, "装备")
  139.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  140.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 256)
  141.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 304)
  142.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 352)
  143.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 400)
  144.   end
  145.   def dummy
  146.     self.contents.font.color = system_color
  147.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  148.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  149.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  150.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  151.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  152.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  153.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  154.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  155.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  156.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  157.   end
  158. end
  159. class Game_Enemy < Game_Battler
  160.   #============================================================================
  161.   def ce
  162.     n = base_str + base_dex + base_agi + base_int + base_atk + base_pdef +
  163.         base_mdef + base_eva
  164.     return n
  165.   end
  166. end
  167. #==============================================================================
  168. class Window_Help < Window_Base
  169.   #------------------------------------------------------------------------
  170.   def set_actor(actor)
  171.     if actor != @actor
  172.       self.contents.clear
  173.       draw_actor_name(actor, 4, 0)
  174.       draw_actor_ce(actor, 460, 0)
  175.       draw_actor_state(actor, 102, 0)
  176.       draw_actor_hp(actor, 184, 0)
  177.       draw_actor_sp(actor, 320, 0)
  178.       [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  179.       @text = nil
  180.       self.visible = true
  181.     end
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● 设置敌人
  185.   #     enemy : 要显示名字和状态的敌人
  186.   #--------------------------------------------------------------------------
  187.   def set_enemy(enemy)
  188.     self.contents.clear
  189.     draw_enemy_ce(enemy, 470, 0)
  190.     draw_actor_name(enemy, 4, 0)
  191.     draw_actor_state(enemy, 110, 0)
  192.     carol3_draw_hp_bar(enemy, 184, 0)
  193.     carol3_draw_sp_bar(enemy, 324, 0)
  194.     @text = nil
  195.     self.visible = true
  196.   end  
  197.   #---------------------------------------------------------------------------
  198.   def carol3_draw_hp_bar(actor, x, y, width = 128) #宽度可调
  199.     self.contents.font.color = system_color
  200.     w = width * actor.hp / [actor.maxhp,1].max
  201.     if actor.maxhp != 0
  202.       rate = actor.hp.to_f / actor.maxhp
  203.     else
  204.       rate = 0
  205.     end
  206.     color1 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 150)
  207.     self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
  208.     self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
  209.      self.contents.fill_rect(x+1, y+17, w,6,color1)
  210.     self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
  211.      self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
  212.     self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
  213.     self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
  214.     self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
  215.     self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
  216.     self.contents.draw_text(x-53,y,128,32,$data_system.words.hp,1)
  217.     if actor.hp>actor.maxhp/3
  218.       self.contents.font.color = Color.new(255, 255, 255, 250)
  219.     end
  220.     if actor.hp>=actor.maxhp/6 and actor.maxhp/3>actor.hp
  221.       self.contents.font.color = Color.new(200, 200, 0, 255)
  222.     end
  223.     if actor.maxhp/6>actor.hp
  224.       self.contents.font.color = Color.new(200, 0, 0, 255)
  225.     end
  226.     self.contents.draw_text(x+47,y,128,32,actor.hp.to_s,1)
  227.   end
  228.   #------------------------------------------------------------------------
  229.   def carol3_draw_sp_bar(actor, x, y, width = 128)
  230.     self.contents.font.color = system_color
  231.     if actor.maxsp != 0
  232.       rate = actor.sp.to_f / actor.maxsp
  233.     else
  234.       rate = 0
  235.     end
  236.     color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  237.     w = width * actor.sp / [actor.maxsp,1].max  
  238.     self.contents.fill_rect(x+1, y+15, width+2,1, Color.new(0, 0, 0, 255))
  239.     self.contents.fill_rect(x+1, y+16, width+2,1, Color.new(255, 255, 192, 192))
  240.      self.contents.fill_rect(x+1, y+17, w,6,color2)
  241.     self.contents.fill_rect(x+1, y+23, width+2,1, Color.new(255, 255, 192, 192))
  242.      self.contents.fill_rect(x+1, y+24, width+2,1, Color.new(0, 0, 0, 255))
  243.     self.contents.fill_rect(x, y+16, 1,8, Color.new(255, 255, 192, 192))
  244.     self.contents.fill_rect(x-1, y+15, 1,10, Color.new(0, 0, 0, 255))
  245.     self.contents.fill_rect(x+129, y+16, 1,8, Color.new(255, 255, 192, 192))
  246.     self.contents.fill_rect(x+130, y+15, 1,10, Color.new(0, 0, 0, 255))
  247.     self.contents.draw_text(x-53,y,128,32,$data_system.words.sp,1)
  248.     if actor.hp>actor.maxsp/3
  249.       self.contents.font.color = Color.new(255, 255, 255, 250)
  250.     end
  251.     if actor.hp>=actor.maxsp/6 and actor.maxsp/3>actor.sp
  252.       self.contents.font.color = Color.new(200, 200, 0, 255)
  253.     end
  254.     if actor.maxsp/6>actor.sp
  255.       self.contents.font.color = Color.new(200, 0, 0, 255)
  256.     end
  257.     self.contents.draw_text(x+47,y,128,32,actor.sp.to_s,1)
  258.   end
  259. end
  260. #==============================================================================
复制代码

作者: CR~    时间: 2014-5-7 13:27
芯☆淡茹水 发表于 2014-5-7 11:46

非常感谢!~




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