设为首页收藏本站

仙剑之十里坡

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
查看: 2765|回复: 1
打印 上一主题 下一主题

商店购买时 显示全部能力的变化 脚本

[复制链接]

67

主题

2

听众

2064

积分

仗剑行侠

会员等级: 5

  • TA的每日心情
    无聊
    2013-8-16 09:01
  • 签到天数: 161 天

    [LV.7]常住仙友III

    精华
    0
    积分
    2064
    历练
    0
    声望
    43
    人气
    3
    单身中……
    帮我摆脱单身吧
    跳转到指定楼层
    1
    发表于 2010-11-7 20:08:34 |只看该作者 |倒序浏览
    本帖最后由 御剑奇侠 于 2010-11-9 19:35 编辑

    复制全部脚本内容,在Main脚本之前按insert,插入此脚本全部内容。亦可替代掉原来的同名教本。


    1. #==============================================================================
    2. # ■ Window_ShopStatus
    3. #------------------------------------------------------------------------------
    4. #  商店画面、显示物品所持数与角色装备的窗口。
    5. #==============================================================================
    6. class Window_ShopStatus < Window_Base
    7.   #--------------------------------------------------------------------------
    8.   # ● 初始化对像
    9.   #--------------------------------------------------------------------------
    10.   def initialize
    11.     super(368, 128, 272, 352)
    12.     self.contents = Bitmap.new(width - 32, height - 32)
    13.     self.contents.font.size = 16
    14.     @item = nil
    15.     refresh
    16.   end
    17.   #--------------------------------------------------------------------------
    18.   # ● 刷新
    19.   #--------------------------------------------------------------------------
    20.   def refresh
    21.     self.contents.clear
    22.     if @item == nil
    23.       return
    24.     end
    25.     case @item
    26.     when RPG::Item
    27.       number = $game_party.item_number(@item.id)
    28.     when RPG::Weapon
    29.       number = $game_party.weapon_number(@item.id)
    30.     when RPG::Armor
    31.       number = $game_party.armor_number(@item.id)
    32.     end
    33.     self.contents.font.color = system_color
    34.     self.contents.draw_text(4, 0, 200, 32, "所持数")
    35.     self.contents.font.color = normal_color
    36.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    37.     if @item.is_a?(RPG::Item)
    38.       return
    39.     end
    40.     # 添加装备品信息
    41.     for i in 0...$game_party.actors.size
    42.       # 获取角色
    43.       actor = $game_party.actors
    44.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
    45.       if actor.equippable?(@item)
    46.         self.contents.font.color = normal_color
    47.       else
    48.         self.contents.font.color = disabled_color
    49.       end
    50.       # 描绘角色名字
    51.       j = 70
    52.       self.contents.draw_text(0, 32 + j * i, 120, 32, actor.name)
    53.       # 获取当前的装备品
    54.       if @item.is_a?(RPG::Weapon)
    55.         item1 = $data_weapons[actor.weapon_id]
    56.       elsif @item.kind == 0
    57.         item1 = $data_armors[actor.armor1_id]
    58.       elsif @item.kind == 1
    59.         item1 = $data_armors[actor.armor2_id]
    60.       elsif @item.kind == 2
    61.         item1 = $data_armors[actor.armor3_id]
    62.       else
    63.         item1 = $data_armors[actor.armor4_id]
    64.       end
    65.       # 可以装备的情况
    66.       #if actor.equippable?(@item)
    67.         # 武器的情况
    68.         i += 1
    69.         if @item.is_a?(RPG::Weapon)
    70.          
    71.          
    72.          
    73.           atk1 = item1 != nil ? item1.atk : 0
    74.           atk2 = @item != nil ? @item.atk : 0
    75.          
    76.           pdef1 = item1 != nil ? item1.pdef : 0
    77.           pdef2 = @item != nil ? @item.pdef : 0
    78.          
    79.           str1 = item1 != nil ? item1.str_plus : 0
    80.           str2 = @item != nil ? @item.str_plus : 0
    81.          
    82.           dex1 = item1 != nil ? item1.dex_plus : 0
    83.           dex2 = @item != nil ? @item.dex_plus : 0
    84.          
    85.           agi1 = item1 != nil ? item1.agi_plus : 0
    86.           agi2 = @item != nil ? @item.agi_plus : 0
    87.          
    88.           int1 = item1 != nil ? item1.int_plus : 0
    89.           int2 = @item != nil ? @item.int_plus : 0
    90.          
    91.          
    92.           @atk = atk2 - atk1
    93.           @str = str2 - str1
    94.           @dex = dex2 - dex1
    95.           @agi = agi2 - agi1
    96.           @int = int2 - int1
    97.           @pdef = pdef2 - pdef1
    98.          
    99.          
    100.          
    101.          
    102.          
    103.          
    104.          
    105.         x = -16
    106.         self.contents.draw_text(80*0,        x+j * i, 112, 32,"攻击",0)
    107.         self.contents.draw_text(80*1,        x+j * i, 112, 32,"力量",0)
    108.         self.contents.draw_text(80*2,        x+j * i, 112, 32,"速度",0)
    109.         self.contents.draw_text(80*0,        x+j * i+16, 112, 32,"敏捷",0)
    110.         self.contents.draw_text(80*1,        x+j * i+16, 112, 32,"魔力",0)
    111.         self.contents.draw_text(80*2,        x+j * i+16, 112, 32,"防御",0)

    复制代码

    分享到: QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    转播转播0 分享淘帖0 分享分享0 收藏收藏0
    蜉蝣之羽,衣裳楚楚。心之忧矣,於我归处?
    蜉蝣之翼,采采衣服。心之忧矣,於我归息?
    蜉蝣掘阅,麻衣如雪。心之忧矣,於我归说?

    67

    主题

    2

    听众

    2064

    积分

    仗剑行侠

    会员等级: 5

  • TA的每日心情
    无聊
    2013-8-16 09:01
  • 签到天数: 161 天

    [LV.7]常住仙友III

    精华
    0
    积分
    2064
    历练
    0
    声望
    43
    人气
    3
    单身中……
    帮我摆脱单身吧
    2
    发表于 2010-11-7 20:09:01 |只看该作者
    #---------------------------------------------------------------------
            q=40-10
            if atk2 >= atk1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*0+q,      x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*0+q,       x+j * i, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if str2 >= str1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if dex2 >= dex1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,"↓",0)
            end
          
            #---------------------------------------------------------------------
            if agi2 >= agi1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*0+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*0+q,       x+j * i+16, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if int2 >= int1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*1+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*1+q,       x+j * i+16, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if pdef2 >= pdef1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*2+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*2+q,       x+j * i+16, 112, 32,"↓",0)
            end

            
            
            
            
            
            
            #---------------------------------------------------------------------
            self.contents.font.color = Color.new(159,251,162,255)
            q=50
            self.contents.draw_text(80*0+q,    x+j * i, 112, 32,@atk.abs.to_s,0)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,@str.abs.to_s,0)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,@dex.abs.to_s,0)
            
            #---------------------------------------------------------------------
            self.contents.draw_text(80*0+q,     x+j * i+16, 112, 32,@agi.abs.to_s,0)
            self.contents.draw_text(80*1+q,     x+j * i+16, 112, 32,@int.abs.to_s,0)
            self.contents.draw_text(80*2+q,     x+j * i+16, 112, 32,@pdef.abs.to_s,0)
             
             
             
             
             
             
             
             
             
             
             
             
             
            end
            # 防具的情况
            if @item.is_a?(RPG::Armor)

             
             
              str1 = item1 != nil ? item1.str_plus : 0
              str2 = @item != nil ? @item.str_plus : 0
              dex1 = item1 != nil ? item1.dex_plus : 0
              dex2 = @item != nil ? @item.dex_plus : 0

             
              agi1 = item1 != nil ? item1.agi_plus : 0
              agi2 = @item != nil ? @item.agi_plus : 0
              int1 = item1 != nil ? item1.int_plus : 0
              int2 = @item != nil ? @item.int_plus : 0
             
             
             
              pdef1 = item1 != nil ? item1.pdef : 0
              pdef2 = @item != nil ? @item.pdef : 0
              mdef1 = item1 != nil ? item1.mdef : 0
              mdef2 = @item != nil ? @item.mdef : 0
             
             
              @str  = str2 - str1
              @dex  = dex2 - dex1
              @agi  = agi2 - agi1
              @int  = int2 - int1
              @pdef = pdef2 - pdef1
              @mdef = mdef2 - mdef1
            x=-16  
            self.contents.draw_text(80*0,        x+j * i, 112, 32,"力量",0)
            self.contents.draw_text(80*1,        x+j * i, 112, 32,"速度",0)
            self.contents.draw_text(80*2,        x+j * i, 112, 32,"敏捷",0)
            self.contents.draw_text(80*0,        x+j * i+16, 112, 32,"魔力",0)
            self.contents.draw_text(80*1,        x+j * i+16, 112, 32,"防御",0)
            self.contents.draw_text(80*2,        x+j * i+16, 112, 32,"魔御",0)
            
            #---------------------------------------------------------------------
            q=30
            if str2 >= str1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*0+q,       x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*0+q,       x+j * i, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if dex2 >= dex1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if agi2 >= agi1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,"↓",0)
            end
          
            #---------------------------------------------------------------------
            if int2 >= int1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*0+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*0+q,       x+j * i+16, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            q=40-10
            if pdef2 >= pdef1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*1+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*1+q,       x+j * i+16, 112, 32,"↓",0)
            end
            #---------------------------------------------------------------------
            if mdef2 >= mdef1
            self.contents.font.color = Color.new(159,251,162,255)
            self.contents.draw_text(80*2+q,       x+j * i+16, 112, 32,"↑",0)
            else
            self.contents.font.color = Color.new(255,0,0,255)
            self.contents.draw_text(80*2+q,       x+j * i+16, 112, 32,"↓",0)
            end
            
            
            #---------------------------------------------------------------------
            self.contents.font.color = Color.new(159,251,162,255)
            q=50
            self.contents.draw_text(80*0+q,     x+j * i, 112, 32,@str.abs.to_s,0)
            self.contents.draw_text(80*1+q,    x+j * i, 112, 32,@dex.abs.to_s,0)
            self.contents.draw_text(80*2+q,    x+j * i, 112, 32,@agi.abs.to_s,0)
            
            #---------------------------------------------------------------------
            self.contents.draw_text(80*0+q,     x+j * i+16, 112, 32,@int.abs.to_s,0)
            self.contents.draw_text(80*1+q,       x+j * i+16, 112, 32,@pdef.abs.to_s,0)
            self.contents.draw_text(80*2+q,       x+j * i+16, 112, 32,@mdef.abs.to_s,0)
            end
            end
            
            
            
            
          self.contents.font.color = normal_color
          i -= 1
          #self.contents.font.size = 22
          # 描绘物品
          if item1 != nil
            x = 4
            y = 64 + 64 * i + 32
            #bitmap = RPG::Cache.icon(item1.icon_name)
            #opacity = self.contents.font.color == normal_color ? 255 : 128
            #self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
            #self.contents.draw_text(x + 28, y, 212, 32, item1.name)
          end
        end
      #end
      #--------------------------------------------------------------------------
      # ● 设置物品
      #     item : 新的物品
      #--------------------------------------------------------------------------
      def item=(item)
        if @item != item
          @item = item
          refresh
        end
      end
    end
    蜉蝣之羽,衣裳楚楚。心之忧矣,於我归处?
    蜉蝣之翼,采采衣服。心之忧矣,於我归息?
    蜉蝣掘阅,麻衣如雪。心之忧矣,於我归说?
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 加入我们

    手机版|Archiver|仙剑之十里坡 ( 苏ICP备11022766号 )  

    GMT+8, 2024-5-5 03:01 , Processed in 0.475677 second(s), 32 queries .

    Powered by Discuz! X2.5

    © 2001-2012 Comsenz Inc.

    回顶部