#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
#需要调整的项目:
#界面的重新设计
class Window_SkillHelp < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(320-50, 0, 320+50,416)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $game_temp.in_battle
      self.height = 256+64
      self.back_opacity = 160
    end
  end   
  #--------------------------------------------------------------------------
  # ● 设置文本
  #     text  : 窗口显示的字符串
  #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  #--------------------------------------------------------------------------
  def set_text2(skill)
    if skill !=nil
      fontsize=18        #定义文字大小
      infx=100           #定义说明文字左边内容的宽度
      y=20               #定义行距
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.font.size = fontsize
      xx=0 
      yy=0
      s=[]
      s=skill.description.scan(/./)
      space = self.contents.text_size(" ").width
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y
          xx=4
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      self.contents.font.size = fontsize
################################################################################
      xx=0
      yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
      xx=infx
      self.contents.font.color=normal_color
      case skill.scope
      when 0
        i="无"
        when 1
          i="敌方单体"
          when 2
            i="敌方全体"
            when 3
              i="我方单体"
              when 4
                i="我方全体"
                when 5
                  i="我方濒死单体"
                  when 6
                    i="我方濒死全体"
                    when 7
                      i="自身"
      end
      self.contents.draw_text(xx, yy, infx, sss.height, i)
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "基础威力")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.power.to_s)
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "ATK影响度")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, "ATK "+skill.atk_f.to_s)      
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "四维分布")
      xx=infx
      self.contents.font.color=normal_color
      if skill.str_f>1
        self.contents.font.color=Color.new(255,0,0,255)
        self.contents.draw_text(xx, yy, infx*2, sss.height, "力量 "+skill.str_f.to_s)
        xx+=80
      end
      if skill.dex_f>1
        self.contents.font.color=Color.new(34,127,56,255)
        self.contents.draw_text(xx, yy, infx*2, sss.height, "敏捷 "+skill.dex_f.to_s)
        xx+=80
      end
      if skill.agi_f>1
        self.contents.font.color=Color.new(255,241,0,255)
        self.contents.draw_text(xx, yy, infx*2, sss.height, "速度 "+skill.agi_f.to_s)
        xx+=80
      end
      if skill.int_f>1&&xx>260
        yy+=y
        xx=infx
        self.contents.font.color=Color.new(0,117,169,255)
        self.contents.draw_text(xx, yy, infx*2, sss.height, "法强 "+skill.int_f.to_s)
      end
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性占比")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, "物理 "+skill.pdef_f.to_s+"  魔法 "+skill.mdef_f.to_s)      
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "伤害浮动度(%)")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.variance.to_s) 
      xx=0
      yy+=y
################################################################################
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "基础命中")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.hit.to_s)
      xx=0 
      yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "回避修正")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.eva_f.to_s)
      xx=0 
      yy+=y
################################################################################
      element=""
      race=""      
      for i in skill.element_set#这里是,属性与种族的区别
        if i <=25#1-25为属性
          element =element+" "+$data_system.elements[i]
        elsif i>25 and i<=50#25-50位种族
          race=race+" "+$data_system.elements[i]
        end
        if i>50
          break
        end
      end
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "特效对象种族")
      xx=infx-space
      self.contents.font.color=normal_color
      s=[]
      s=race.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y
          xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      yy+=y
      xx=0
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "附加属性")
      xx=infx-space
      self.contents.font.color=normal_color
      s=[]
      s=element.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y
          xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      xx=0 
      yy+=y
################################################################################
      race=""
      for i in skill.plus_state_set
          race=race+"["+$data_states[i].name+"]"
      end
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "状态变化")
      xx=infx
      self.contents.font.color=normal_color
      s=[]
      s=race.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y
          xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      xx=0 
      yy+=y
################################################################################
      race=""
      for i in skill.minus_state_set
          race=race+"["+$data_states[i].name+"]"
      end
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "解除效果")
      xx=infx
      self.contents.font.color=normal_color
      s=[]
      s=race.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y
          xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      @actor = nil
    end
    self.visible = true
    xx=0
    yy+=y
################################################################################
    self.contents.font.color=system_color
    self.contents.draw_text(xx, yy, infx, sss.height, "冷却时间")
    xx=infx
    self.contents.font.color=normal_color
    if $data_skills[skill.id].cooldown>0
      self.contents.draw_text(xx, yy, infx*2, sss.height,$data_skills[skill.id].cooldown.to_s+"回合 ")
      self.contents.draw_text(xx+60, yy, infx*2, sss.height,"剩余"+@cooldowns[skill.id]+"回合")
    else 
      self.contents.draw_text(xx, yy, infx*2, sss.height,"无")
    end
    xx=0
    yy+=y
  end
end