查看: 1578|回复: 0

[已经解决] 【已解决】把兵力HP747 747 改为最大值效果=兵力HP747

[复制链接]
梦石
0
星屑
7306
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2022-11-22 08:51:21 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 金芒芒 于 2022-11-22 11:02 编辑
  1. #==============================================================================
  2. # ■ Window_Status
  3. #------------------------------------------------------------------------------
  4. #  人物状态窗口。
  5. #==============================================================================
  6. class Window_Status < Window_Base
  7.   CLASS_ON = false #状态条开启与不开启
  8.   attr_reader   :actor
  9.   def actor
  10.     return @actor
  11.   end
  12.   def actor=(actor)
  13.     @actor = actor
  14.   end
  15.   
  16.   def blue_color
  17.     return Color.new(141,157,180)
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 初始化对像
  21.   #     actor : 角色
  22.   #--------------------------------------------------------------------------
  23.   def initialize(actor = $game_party.actors[0])
  24.     @back = Sprite.new
  25.     @back.bitmap = RPG::Cache.menu("Status")
  26.     @actor = actor
  27.     @new_p = [nil]
  28.     @new_maxhp = nil
  29.     @new_maxsp = nil
  30.     #super(origin_x+320, origin_y+130, 122+64, 480
  31.     super(origin_x+320, origin_y+130, 1200, 700)
  32.     self.contents = Bitmap.new(width-32, height-32)
  33.     #self.windowskin = RPG::Cache.windowskin("")
  34.     self.opacity = 0
  35.     refresh
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 活动窗口用原始x y坐标
  39.   #--------------------------------------------------------------------------  
  40.   def origin_x
  41.     return 220
  42.   end
  43.   def origin_y
  44.     return 64
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # ● 一些方法的重载
  48.   #--------------------------------------------------------------------------  
  49.   def dispose
  50.     @back.dispose
  51.     super
  52.   end
  53.   def x=(x)
  54.     @back.x = x-origin_x
  55.     super(x-16)
  56.   end
  57.   def x
  58.     return super+16
  59.   end
  60.   def y=(y)
  61.     @back.y = y
  62.     super(y)
  63.   end
  64.   def z=(z)
  65.     @back.z=z-5
  66.     super(z)
  67.   end
  68.   def visible=(visible)
  69.     @back.visible=visible
  70.     super(visible)
  71.   end
  72.   def contents_opacity=(opacity)
  73.     @back.opacity=opacity
  74.     super(opacity)
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # ● 刷新
  78.   #--------------------------------------------------------------------------
  79.   def refresh(actor = @actor)
  80.     @actor = actor
  81.     self.contents.clear
  82.    
  83.     @new_maxhp = nil
  84.     @new_maxsp = nil
  85.     for i in 0 ... @new_p.size
  86.       @new_p[i] = nil
  87.     end
  88.     draw_actor_name(16, 96-32)
  89.     if CLASS_ON #显示职业的情况
  90.       draw_actor_level(12,126-32)#描绘等级
  91.       draw_actor_class(12,126-32+14)#描绘职业
  92.       draw_actor_hsp(12,126-32+28, 0,@new_maxhp )#描绘hp
  93.      # draw_actor_hsp(12,126-32+42,1,@new_maxsp )#描绘sp
  94.      # draw_actor_cp(12,126-32+56)#描绘cp
  95.     else
  96.       draw_actor_level(12,126-32)#描绘等级
  97.       draw_actor_hsp(380,240-32+4+16,0,@new_maxhp )#描绘hp
  98.      # draw_actor_hsp(12, 126-32+4+32,1,@new_maxsp )#描绘sp
  99.     #  draw_actor_cp(12,126-32+4+48)#描绘cp
  100.     end
  101.     #描绘各种属性
  102.     for i in 0 ...8
  103.       draw_actor_parameters(380, 128-32+4+i*16, i,@new_p[i] )
  104.     end
  105.     draw_actor_state(actor, 12, 208-32+12+i*16)
  106.     #描绘经验
  107.     draw_actor_exp(12, 368-32)
  108.   end
  109.   #--------------------------------------------------------------------------
  110.   # ● 描绘能力值
  111.   #     actor : 角色
  112.   #     x     : 描画目标 X 坐标
  113.   #     y     : 描画目标 Y 坐标
  114.   #     type  : 能力值种类 (0~6)
  115.   #--------------------------------------------------------------------------
  116.   def draw_actor_parameters( x, y, type=0, new=nil )
  117.     self.contents.fill_rect(x, y, 122, 14, Color.new(0, 0, 0, 0))
  118.     @color = Color.new(0,0,0)
  119.     @color = normal_color
  120.     up_color = system_color
  121.     down_color = knockout_color
  122.     ud = RPG::Cache.menu_icon("null")
  123.     case type
  124.     when 0
  125.       word = $data_system.words.atk
  126.       old = @actor.atk
  127.     when 1
  128.       word = $data_system.words.pdef
  129.       old = @actor.pdef
  130.     when 2
  131.       word = $data_system.words.mdef
  132.       old = @actor.mdef
  133.     when 3
  134.       word = $data_system.words.str
  135.       old = @actor.str
  136.     when 4
  137.       word = $data_system.words.dex
  138.       old = @actor.dex
  139.     when 5
  140.       word = $data_system.words.agi
  141.       old = @actor.agi
  142.     when 6
  143.       word = $data_system.words.int
  144.       old = @actor.int
  145.     when 7
  146.       word = "AGL"
  147.       old = @actor.eva
  148.     end

  149.     if new  != nil
  150.       @color = normal_color
  151.       if new > old
  152.         @color = up_color
  153.         ud = RPG::Cache.menu_icon("up")
  154.       end
  155.       if new < old
  156.         @color = down_color
  157.         ud = RPG::Cache.menu_icon("down")
  158.       end
  159.       value = new
  160.     else
  161.       @color= normal_color
  162.       value = old
  163.     end
  164.    
  165.     self.contents.font.size = 12
  166.     self.contents.font.color = black_color
  167.     self.contents.draw_text(x+1, y+1, 20, self.contents.font.size, word)
  168.     self.contents.font.color = blue_color
  169.     self.contents.draw_text(x, y, 20, self.contents.font.size, word)
  170.    
  171.     self.contents.font.color = black_color
  172.     self.contents.draw_text(x+1, y+1, 66, self.contents.font.size, value.to_s, 2)
  173.     self.contents.font.color = @color
  174.     self.contents.draw_text(x, y, 66, self.contents.font.size, value.to_s, 2)
  175.     self.contents.blt(x+66, y, ud, Rect.new(0,0,12, 12) )
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # ● 描绘hsp
  179.   #--------------------------------------------------------------------------
  180.   def draw_actor_hsp(x, y, type=0, new=nil)
  181.     self.contents.fill_rect(x, y, 122, 14, Color.new(0, 0, 0, 0))
  182.     case type
  183.     when 0
  184.       word = $data_system.words.hp
  185.       hsp = @actor.hp
  186.       mhsp = @actor.maxhp
  187. #   when 1
  188. #     word = $data_system.words.sp
  189.   #    hsp = @actor.sp
  190. #     mhsp = @actor.maxsp
  191.     end
  192.     ud = RPG::Cache.menu_icon("null")
  193.     # 描绘字符串 "HP"
  194.     self.contents.font.size = 12
  195.     self.contents.font.color = black_color
  196.     self.contents.draw_text(x+1, y+1, 24, self.contents.font.size, word)
  197.     self.contents.font.color = title_color
  198.     self.contents.draw_text(x, y, 24, self.contents.font.size, word)
  199.     # 描绘 HP
  200.   #  self.contents.font.color = black_color
  201.   #  self.contents.draw_text(x+1, y+1, 52, self.contents.font.size, hsp.to_s, 2)
  202. #   self.contents.font.color = hsp == 0 ? knockout_color :
  203. #   (hsp <= mhsp / 4 ? crisis_color : normal_color)
  204. #   self.contents.draw_text(x, y, 52, self.contents.font.size, hsp.to_s, 2)
  205.     # 描绘 MaxHP
  206. #   self.contents.font.color = black_color
  207. #   self.contents.draw_text(x + 52+1, y+1, 12, self.contents.font.size, "/")
  208. #  self.contents.font.color = normal_color
  209.   #  self.contents.draw_text(x + 52, y, 12, self.contents.font.size, "/")
  210.    
  211.     up_color = system_color
  212.     down_color = knockout_color
  213.     if new  != nil
  214.       @color = normal_color
  215.       if new > mhsp
  216.         @color= up_color
  217.         ud = RPG::Cache.menu_icon("up")
  218.       end
  219.       if  new < mhsp
  220.         @color = down_color
  221.         ud = RPG::Cache.menu_icon("down")
  222.       end
  223.       hp_value = new
  224.     else
  225.       @color = normal_color
  226.       hp_value = mhsp
  227.     end
  228.     self.contents.font.color = black_color
  229.     self.contents.draw_text(x+64-6+1, y+1, 32,self.contents.font.size, hp_value.to_s,2)
  230.     self.contents.font.color = @color
  231.     self.contents.draw_text(x+64-6, y, 32,self.contents.font.size, hp_value.to_s,2)
  232.     self.contents.blt(x+96-6, y, ud, Rect.new(0,0,24, 24) )
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 描绘名字
  236.   #--------------------------------------------------------------------------
  237.   def draw_actor_name(x, y)
  238.     self.contents.font.size = 18
  239.     self.contents.font.color = black_color
  240.     self.contents.draw_text(x+76, y+1, 90, 18, @actor.name,1)
  241.     self.contents.font.color = normal_color
  242.     self.contents.draw_text(x+75, y, 90, 18, @actor.name,1)
  243.   end
  244.   #--------------------------------------------------------------------------
  245.   # ● 描绘等级 126 12
  246.   #--------------------------------------------------------------------------
  247.   def draw_actor_level( x, y)
  248.     self.contents.font.size = 20
  249.     self.contents.font.color = black_color
  250.     self.contents.draw_text(x+1, y, 32, self.contents.font.size, "等级")
  251.     self.contents.font.color = title_color
  252.     self.contents.draw_text(x+10, y+275, 32, self.contents.font.size, "等级")#Level
  253.    
  254.     self.contents.font.size = 20
  255.     self.contents.font.color = black_color
  256.     self.contents.draw_text(x+1, y, 86, self.contents.font.size, @actor.level.to_s, 2)
  257.     self.contents.font.color = normal_color
  258.     self.contents.draw_text(x, y+275, 86, self.contents.font.size, @actor.level.to_s, 2)
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● 描绘职业
  262.   #--------------------------------------------------------------------------
  263.   def draw_actor_class( x, y)
  264.     self.contents.font.size = 14
  265.     self.contents.font.color = black_color
  266.     self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "Class")
  267.     self.contents.font.color = title_color
  268.     self.contents.draw_text(x, y, 32, self.contents.font.size, "Class")
  269.     self.contents.font.size = 12
  270.     self.contents.font.color = black_color
  271.     self.contents.draw_text(x+1, y+1+2, 88, self.contents.font.size, actor.class_name, 2)
  272.     self.contents.font.color = normal_color
  273.     self.contents.draw_text(x, y+2, 88, self.contents.font.size, actor.class_name, 2)
  274.   end
  275.   #--------------------------------------------------------------------------
  276.   # ● 描绘CP
  277.   #--------------------------------------------------------------------------
  278. # def draw_actor_cp( x, y)
  279.    # 描绘字符串 "CP"
  280.   #  self.contents.font.size = 12
  281.   #  self.contents.font.color = black_color
  282.   #  self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "CP")
  283.   #  self.contents.font.color = title_color
  284.    # self.contents.draw_text(x, y, 32, self.contents.font.size, "CP")
  285.   #  self.contents.font.color = black_color
  286.   #  self.contents.draw_text(x+1, y+1, 90, self.contents.font.size, actor.cp_store.to_s, 2)
  287.   #  self.contents.font.color = normal_color
  288.   #  self.contents.draw_text(x, y, 90, self.contents.font.size, actor.cp_store.to_s, 2)
  289. # end
  290.   #--------------------------------------------------------------------------
  291.   # ● 描绘经验值
  292.   #--------------------------------------------------------------------------
  293.   def draw_actor_exp(x, y)
  294.     self.contents.font.size = 12
  295.       
  296.     self.contents.font.color = black_color
  297.     self.contents.draw_text(x+1, y+1, 32, self.contents.font.size, "EXP")
  298.     self.contents.font.color = title_color
  299.     self.contents.draw_text(x, y, 32, self.contents.font.size, "EXP")
  300.    
  301.     self.contents.font.color = black_color
  302.     self.contents.draw_text(x+1, y+1, 96, self.contents.font.size, @actor.exp.to_s, 2)
  303.     self.contents.font.color = normal_color
  304.     self.contents.draw_text(x, y, 96, self.contents.font.size, @actor.exp.to_s, 2)
  305.    
  306.     self.contents.font.color = black_color
  307.     self.contents.draw_text(x+1, y+14+1, 32, self.contents.font.size, "NEXT")
  308.     self.contents.font.color = title_color
  309.     self.contents.draw_text(x, y+14, 32, self.contents.font.size, "NEXT")
  310.     self.contents.font.color = black_color
  311.     self.contents.draw_text(x+1, y+14+1, 96, self.contents.font.size, @actor.next_exp_s, 2)
  312.     self.contents.font.color = normal_color
  313.     self.contents.draw_text(x, y+14, 96, self.contents.font.size, @actor.next_exp_s, 2)
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # ● 设定属性变化
  317.   #--------------------------------------------------------------------------
  318.   def set_parameters(atk=nil,pdef=nil,mdef=nil,str=nil,dex=nil,agi=nil,int=nil,maxhp=nil,maxsp=nil, eva = nil )
  319.     if @new_p[0] != atk
  320.       @new_p[0]= atk
  321.       draw_actor_parameters(28, 208-32+4+0*16, 0,@new_p[0] )
  322.     end
  323.     if @new_p[1] != pdef
  324.       @new_p[1] = pdef
  325.       draw_actor_parameters(28, 208-32+4+1*16, 1,@new_p[1] )
  326.     end
  327.     if @new_p[2] != mdef
  328.       @new_p[2] = mdef
  329.       draw_actor_parameters(28, 208-32+4+2*16, 2,@new_p[2] )
  330.     end
  331.     if @new_p[3] != str
  332.       @new_p[3] = str
  333.       draw_actor_parameters(28, 208-32+4+3*16, 3,@new_p[3] )
  334.     end
  335.     if @new_p[4] != dex
  336.       @new_p[4] = dex
  337.       draw_actor_parameters(28, 208-32+4+4*16, 4,@new_p[4] )
  338.     end
  339.     if @new_p[5] != agi
  340.       @new_p[5] = agi
  341.       draw_actor_parameters(28, 208-32+4+5*16, 5,@new_p[5] )
  342.     end
  343.     if @new_p[6] != int
  344.       @new_p[6] = int
  345.       draw_actor_parameters(28, 208-32+4+6*16, 6,@new_p[6] )
  346.     end
  347.     #回避修正
  348.     if @new_p[7] != eva
  349.       @new_p[7] = eva
  350.       draw_actor_parameters(28, 208-32+4+7*16, 7,@new_p[7] )
  351.     end

  352.     if @new_maxhp != maxhp
  353.       @new_maxhp = maxhp
  354.       if CLASS_ON #显示职业的情况
  355.         draw_actor_hsp(12,126-32+28, 0,@new_maxhp )#描绘hp
  356.       else
  357.         draw_actor_hsp(12, 126-32+4+16,0,@new_maxhp )#描绘hp
  358.       end
  359.     end
  360.   #  if @new_maxsp != maxsp
  361.    #   @new_maxsp = maxsp
  362.   #    if CLASS_ON #显示职业的情况
  363.    #     draw_actor_hsp(12,126-32+42,1,@new_maxsp )#描绘sp
  364.    #   else
  365.    #     draw_actor_hsp(12, 126-32+4+32,1,@new_maxsp )#描绘sp
  366.    #   end
  367.    # end

  368.   end
  369.    
  370. end
复制代码
HP最大值.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部