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

Project1

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

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1502
在线时间
606 小时
注册时间
2011-6-11
帖子
225
跳转到指定楼层
1
发表于 2019-1-12 12:10:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  #--------------------------------------------------------------------------
  # 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

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

2
发表于 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
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9617
在线时间
566 小时
注册时间
2017-9-28
帖子
208
3
发表于 2019-1-13 20:59:09 | 只看该作者
RUBY 代码复制
  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 认可答案

查看全部评分

喵喵喵
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-26 03:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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