查看: 2901|回复: 3

[已经解决] 请问这段脚本怎么改成百分百成功率

[复制链接]
梦石
0
星屑
1912
在线时间
648 小时
注册时间
2011-6-11
回帖
207
发表于 2019-1-12 12:10:53 | 显示全部楼层 |阅读模式

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

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

×
  #--------------------------------------------------------------------------
  # X☆R: 装备拆解。
  #--------------------------------------------------------------------------
  def demolish
    if self.is_a?(X☆R_Weapon)
      materials = $data_weapons[@id].materials
    else
      materials = $data_armors[@id].materials
    end
    ma = materials.keys.clone
    if ma.size > 0
      n = 30 * ma.size
      until n <= 0
        id = ma[rand (ma.size)]
        if (rand 100) < n and id != nil
          $game_party.gain_item(id, 1)
          ma.delete(id)
        end
        n -= 30
      end
    end
    if @level >= 2
      n = @level / 2 * 10
      items = X☆R::Lup_Items.keys.clone
      until n <= 0
        if (rand 100) < n
          $game_party.gain_item(items[rand(items.size)], 1)
        end
        n -= 10
      end
    end
    if @gem != []
      n = 10 * gem_size
      until n <= 0
        id = @gem[rand (@gem.size)]
        if (rand 100) < n and id != nil
          $game_party.gain_item(id, 1)
          @gem.delete(id)
        end
        n -= 10
      end
    end
    if self.is_a?(X☆R_Weapon)
      $game_party.lose_weapon(@index)
    else
      $game_party.lose_armor(@index)
    end
  end
梦石
0
星屑
9292
在线时间
2504 小时
注册时间
2011-5-20
回帖
14521

开拓者

发表于 2019-1-13 00:42:49 | 显示全部楼层
把 (rand 100) < n和相关的连接词全部去掉或者随便改个n==n之类的可以返回true的条件就行了
(rand 100)<n就是判断是否成功分解的部分

点评

最簡单改成if true ... end  发表于 2019-1-17 15:42
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

梦石
0
星屑
9917
在线时间
582 小时
注册时间
2017-9-28
回帖
207
发表于 2019-1-13 20:59:09 | 显示全部楼层

  1.   #--------------------------------------------------------------------------
  2.   # X☆R: 装备拆解。
  3.   #--------------------------------------------------------------------------
  4.   def demolish
  5.     if self.is_a?(X☆R_Weapon)
  6.       materials = $data_weapons[@id].materials
  7.     else
  8.       materials = $data_armors[@id].materials
  9.     end
  10.     ma = materials.keys.clone
  11.     if ma.size > 0
  12.       n = 30 * ma.size
  13.       until n <= 0
  14.         id = ma[rand (ma.size)]
  15.         # if (rand 100) < n and id != nil
  16.           $game_party.gain_item(id, 1)
  17.           ma.delete(id)
  18.         # end
  19.         n -= 30
  20.       end
  21.     end
  22.     if @level >= 2
  23.       n = @level / 2 * 10
  24.       items = X☆R::Lup_Items.keys.clone
  25.       until n <= 0
  26.         # if (rand 100) < n
  27.           $game_party.gain_item(items[rand(items.size)], 1)
  28.         # end
  29.         n -= 10
  30.       end
  31.     end
  32.     if @gem != []
  33.       n = 10 * gem_size
  34.       until n <= 0
  35.         id = @gem[rand (@gem.size)]
  36.         # if (rand 100) < n and id != nil
  37.           $game_party.gain_item(id, 1)
  38.           @gem.delete(id)
  39.         # end
  40.         n -= 10
  41.       end
  42.     end
  43.     if self.is_a?(X☆R_Weapon)
  44.       $game_party.lose_weapon(@index)
  45.     else
  46.       $game_party.lose_armor(@index)
  47.     end
  48.   end
复制代码

评分

参与人数 1星屑 +50 收起 理由
RyanBern + 50 认可答案

查看全部评分

喵喵喵
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部