设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1172|回复: 0
打印 上一主题 下一主题

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7822
在线时间
1345 小时
注册时间
2015-8-15
帖子
753
跳转到指定楼层
1
发表于 2022-11-22 08:51:21 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 金芒芒 于 2022-11-22 11:02 编辑

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

HP最大值.png (660.51 KB, 下载次数: 15)

HP最大值.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-24 00:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表