赞 | 0 |
VIP | 10 |
好人卡 | 49 |
积分 | 10 |
经验 | 22958 |
最后登录 | 2020-8-1 |
在线时间 | 2161 小时 |
Lv3.寻梦者 酱油的
- 梦石
- 0
- 星屑
- 1035
- 在线时间
- 2161 小时
- 注册时间
- 2007-12-22
- 帖子
- 3271
|
显示装备样子:
新幫助·武器&裝備
新幫助·物品&技能
或者:
http://rpg.blue/web/htm/news957.htm
隨機生成:
- class Radom_Creation
- attr_reader :t
- attr_reader :l_t
- attr_reader :level_set
- attr_reader :worst_level_set
- attr_reader :best_quality
- attr_reader :identified_control
- attr_reader :ident_rate
- attr_reader :cost
- attr_reader :f_atk
- attr_reader :f_mdef
- attr_reader :f_pdef
- attr_reader :state_set
- attr_reader :element_set
- attr_reader :f_duration
- def initialize
- #?/1000
- @t = 300 # 中品(質量總在水平三份之一至二之間)
- @l_t = 100 # 上品(質量總在水平三份之二以上)
- # 1000 - S -LS #下品(質量總在水平三份之一以下)
- #--------------------#
- @best_quality = 0 #
- #----------------#---#
- @level_set = [] #
- #--------------------#
- # 生成屬性,狀態,自動狀態等消耗的基準值
- @cost = 5
- # 屬性組
- @element_set = [1,2,3,4,5,6,7]
- # 狀態組
- @state_set = [2,3,4,5,6,7,8]
- # 1基準值對應的攻擊力附加
- @f_atk = 2
- # 1基準值對應的物理防禦力附加
- @f_pdef = 2
- # 1基準值對應的魔法防禦力附加
- @f_mdef = 2
- # 總基準與耐久度的關係
- @f_duration = 300
-
- # @level_set.push [品質基準, 顔色, 前序,後序]
- # 出現機率 = 基準/總基準
- # 品質爲越先越好
- @level_set.push [5, 14, "傳說的"] # 特等
- @level_set.push [10, 13, "罕有的"] # 次等
- @level_set.push [15, 12,"珍貴的"] # 低等
- @level_set.push [10, 11,"不錯的"] # 劣等
- @level_set.push [10, 11,"良好的"] # 劣等
- @level_set.push [15, 10,"微好的"] # 劣等
- @level_set.push [15, 10,"一般的"] # 劣等
- @level_set.push [16, 0] # 劣等
- # 失去效用中
- # 質量爲0以下的等級[顔色, 最差質, 前序,後序]
- @worst_level_set = [9,-10]
- # 是否開啓鑒定系統?
- # 0=否,1=是
- @identified_control = 1
- @ident_rate = 0.5 #鑒定費用,原價的?倍
- #-------------------------#
- if @level_set.size > 0 #
- for i in @level_set #
- #-------------------------#
- @best_quality += i[0]
- #-------#
- end #
- end #
- end #
- end #
- #-------#
- module RPG
- class Weapon
- #---------------------------#
- attr_accessor :needed # 判斷需要
- #---------------------------#------------#
- def needed #
- needed = @needed #
- return needed != nil ? @needed : true #
- end #
- #----------------------------------------#
- #--------------------------#
- attr_accessor :color # 随機生成
- attr_accessor :quality #
- #--------------------------#-------------#
- def color #
- color = @color #
- return color != nil ? @color : 0 # 随機生成
- end #
- #----------------------------------------#-#
- def quality #
- quality = @quality #
- return quality != nil ? @quality : 0 # 随機生成
- end #
- #------------------------------------------#
- #-----------------------------#
- attr_accessor :identified #
- #-----------------------------#------------------------#
- def identified #
- identified = @identified #
- return identified != nil ? @identified : true # 武器鑒定
- end #
- #------------------------------------------------------#
- #-----------------------------------------#
- attr_accessor :max_duration # 耐久度
- attr_accessor :current_duration #
- def max_duration #
- max_duration = @duration #------------#
- return max_duration !=nil ? @max_duration : 1000 #
- end #
- def current_duration #
- current_duration = @current_duration #--------#
- return current_duration !=nil ? @current_duration : 1000 #
- end #
- #------------------------------#--------------------------------#
- end
- class Armor
- #---------------------------#
- attr_accessor :needed # 判斷需要
- #---------------------------#------------#
- def needed #
- needed = @needed #
- return needed != nil ? @needed : true #
- end #
- attr_accessor :color # 随機生成
- attr_accessor :quality #
- def color #
- color = @color #
- return color != nil ? @color : 0 # 随機生成
- end #
- def quality #
- quality = @quality #
- return quality != nil ? @quality : 0 # 随機生成
- end #
- attr_accessor :identified #
- def identified #
- identified = @identified #
- return identified != nil ? @identified : true # 武器鑒定
- end #
- attr_accessor :max_duration # 耐久度
- attr_accessor :current_duration #
- def max_duration #
- max_duration = @duration #------------#
- return max_duration !=nil ? @max_duration : 1000 #
- end #
- def current_duration #
- current_duration = @current_duration #--------#
- return current_duration !=nil ? @current_duration : 1000 #
- end #
- end
- end
- # 重點:quality
- class Game_Party
- def gain_weapon(weapon_id, n)
- setting = Radom_Creation.new
- identified_control = setting.identified_control
- if weapon_id > 0
- #--------------
- # 装备栏中卸下的武器不进行随机处理
- #
- if $scene.is_a?(Scene_Equip)
- get_weapon(weapon_id, n)
- return
- # -------------
- # 或者「真の窗口風格·に·Step2」
- #
- elsif $scene.is_a?(Deatwo_Smith_Shop2)
- get_weapon(weapon_id, n)
- return
- #--------------
- # 商店购买 則原版複製
- #
- elsif $scene.is_a?(Scene_Shop)
- gain_weapon_f_shop(weapon_id, n)
- return
- #--------------
- # 此外 皆隨機生成
- #
- else
- # 鑒定系統開啓
- if identified_control == 1 and $data_weapons[weapon_id].identified == true and rand(50)<40
- #-生成沒有鉴定的武器
- unidentify_weapon(weapon_id, n)
- else
- # 自動生成武器
- for j in 0...n
- # 取得設定
- t = setting.t
- l_t =setting.l_t
- best_quality = setting.best_quality
- level_set = setting.level_set
- worst_level_set = setting.worst_level_set
- #------------------
- a = rand(1000)
- b = 1000 - t - l_t # 上下分岐
- b2 = 1000 - t # 上中分岐
- if a > b # 成功
- if a > b2 # 中品
- s = 1
- else # 上品
- s = 2
- end
- else #下品
- s = 0
- end
- b = (best_quality * 1/3).round
- case s
- when 0
- vid = 0
- new_slots = rand(2)+3
- when 1
- vid = (best_quality * 1/3).round
- new_slots = rand(3)+2
- when 2
- vid = (best_quality * 2/3).round
- new_slots = rand(5)
- end
- # 初始化new值
- weapon = $data_weapons[weapon_id]
- new_name = weapon.name.split(/(未鑑定)/)[0]
- new_des = weapon.description
-
- new_price = weapon.price
-
- new_atk = weapon.atk
- new_pdef = weapon.pdef
- new_mdef = weapon.mdef
-
- new_str = weapon.str_plus
- new_dex = weapon.dex_plus
- new_agi = weapon.agi_plus
- new_int = weapon.int_plus
-
- new_element = weapon.element_set.clone
- new_state = weapon.plus_state_set.clone
- new_duration = weapon.max_duration
-
- # 取得quality總量
- xio = rand(b)+vid
- =begin
- #--再折損值
- if worst_level_set!=nil
- if worst_level_set[1]!=nil
- xio -= rand(worst_level_set[1])
- end
- end
- =end
- # 初始化quality
- quality = 0
- # 如果設定增加屬性以及狀態:
- if setting.element_set.size > 0 and setting.state_set.size > 0
- kind = rand(3)
- # 否則
- else
- kind = rand(2)
- end
- for i in 1..10
- if xio < 2
- break
- end
- case kind
- when 0
- # 附加一攻兩防
- a_a = rand(xio/3).round
- a_p = rand(xio/3).round
- a_m = rand(xio/3).round
- new_atk += a_a * setting.f_atk
- new_pdef += a_p * setting.f_pdef
- new_mdef += a_m * setting.f_mdef
- xio -= (a_a + a_p + a_m)
- quality += (a_a + a_p + a_m)
- # 附加四參數
- when 1
- a_s = rand(xio/4).round
- a_d = rand(xio/4).round
- a_g = rand(xio/4).round
- a_i = rand(xio/4).round
- new_str += a_s
- new_dex += a_d
- new_agi += a_g
- new_int += a_i
- xio -= (a_s + a_d + a_g +a_i)
- quality +=(a_s + a_d + a_g +a_i)
- # 附加屬性以及狀態
- when 2
- #錯誤報告-------
- p "未曾設定element_set於隨機武器·基本定義" if setting.element_set.size < 1
- p "未曾設定state_set於隨機武器·基本定義" if setting.state_set.size < 1
- p "請修改「隨機武器·核心」" unless setting.element_set.size > 0 and setting.state_set.size > 0
- #---------------
- dio = rand(xio/2).round
- cost = setting.cost
- if xio >= cost
- sc_kind = rand(2)
- case sc_kind
- when 0
- n_el = setting.element_set[rand(setting.element_set.size)]
- new_element = new_element|[n_el]
- quality += cost
- xio -= cost
- when 1
- n_st = setting.state_set[rand(setting.state_set.size)]
- new_state = new_state|[n_st]
- quality += cost
- xio -= cost
- end
- end
- end
- end
- #---------
- # p quality
- if new_element.include?(8)
- new_name = "闇之"+ new_name
- elsif new_element.include?(8)
- new_name = "光之"+ new_name
- end
-
-
- # 新的顔色 及 名字
- q = best_quality
- new_color = 0
- if level_set !=nil
- for i in level_set
- if i[0] != nil
- q -= i[0]
- # p q
- if quality > q
- if i [1]!= nil
- new_color = i[1]
- end
- if i[2]!=nil
- new_name = i[2] + new_name
- end
- if i[3]!=nil
- new_name = new_name + i[3]
- end
- break
- end
- end
- end
- end
- if quality < 0
- if worst_level_set!=nil
- new_color = worst_level_set[0]
- if worst_level_set[2]!=nil
- new_name = new_name + worst_level_set[2]
- end
- if worst_level_set[3]!=nil
- new_name = new_name + worst_level_set[3]
- end
- end
- end
- new_duration = quality*setting.f_duration
- #------------------
-
-
- if $data_weapons[weapon_id].identified == true
- # 母本數據複製
- new_weapon = $data_weapons[weapon_id].clone
- # 産生新Id
- need = 0
- for x in 1...$data_weapons.size
- if $data_weapons[x].needed == false
- need = x
- break
- end
- end
- if need == 0
- new_weapon.id = $data_weapons.size
- else
- new_weapon.id = need
- end
- # 更新數據
- new_weapon.name = new_name
- new_weapon.description = new_des
- new_weapon.atk = new_atk
- new_weapon.pdef = new_pdef
- new_weapon.mdef = new_mdef
- new_weapon.price = new_price
- new_weapon.str_plus = new_str
- new_weapon.dex_plus = new_dex
- new_weapon.agi_plus = new_agi
- new_weapon.int_plus = new_int
- new_weapon.color = new_color
- new_weapon.quality = quality
- new_weapon.slots = new_slots
- new_weapon.element_set = new_element
- new_weapon.plus_state_set = new_state
- new_weapon.max_duration = new_duration
- new_weapon.current_duration = new_duration
- new_weapon.needed = true
- # 添加入數據库
- $data_weapons.push(new_weapon)
- # 职业可裝備武器數組更新
- renew_weapon_f_classes(weapon_id, new_weapon.id)
- # 增加武器
- get_weapon(new_weapon.id, 1)
- else
- # 更新數據
- weapon.name = new_name
- weapon.description = new_des
- weapon.atk = new_atk
- weapon.pdef = new_pdef
- weapon.mdef = new_mdef
- weapon.price = new_price
- weapon.str_plus = new_str
- weapon.dex_plus = new_dex
- weapon.agi_plus = new_agi
- weapon.int_plus = new_int
- weapon.color = new_color
- weapon.quality = quality
- weapon.slots = new_slots
- weapon.element_set = new_element
- weapon.plus_state_set = new_state
- weapon.max_duration = new_duration
- weapon.current_duration = new_duration
- weapon.needed = true
- # 取消未鑒定標志
- weapon.identified = true
- # 增加武器
- get_weapon(weapon.id, 1)
- end
- end
- end
- end
- end
- end
- #--------------
- # 生成沒有鉴定的武器
- #
- def unidentify_weapon(weapon_id, n)
- for j in 0...n
- weapon = $data_weapons[weapon_id].clone
- weapon.id = $data_weapons.size
- weapon.name +="(未鑑定)"
- weapon.identified =false
- weapon.needed = true
- $data_weapons.push(weapon)
- # 职业可装备武器数组更新~
- renew_weapon_f_classes(weapon_id, weapon.id)
- # 增加武器
- get_weapon(weapon.id, 1)
- end
- end
- #--------------
- # 职业可装备武器组更新
- #
- def renew_weapon_f_classes(weapon_id, new_weapon_id)
- for i in 1...$data_classes.size
- if $data_classes[i].weapon_set.include?(weapon_id)
- $data_classes[i].weapon_set.push(new_weapon_id)
- end
- end
- end
- #--------------
- # 增加武器
- #
- def get_weapon(weapon_id, n)
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- end
- #--------------
- # 失去武器
- #
- def lose_weapon(weapon_id, n)
- if weapon_id > 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) - n, 0].max, 99].min
- end
- end
- #--------------
- # 消除武器
- #
- def detele_weapon(weapon_id, n)
- if weapon_id > 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) - n, 0].max, 99].min
- $data_weapons[weapon_id].needed == false
- end
- end
- end
- # 重點:quality
- class Game_Party
- def gain_armor(armor_id, n)
- setting = Radom_Creation.new
- identified_control = setting.identified_control
- if armor_id > 0
- #--------------
- # 装备栏中卸下的武器不进行随机处理
- #
- if $scene.is_a?(Scene_Equip)
- get_armor(armor_id, n)
- return
- # -------------
- # 或者「真の窗口風格·に·Step2」
- #
- elsif $scene.is_a?(Deatwo_Smith_Shop2)
- get_armor(armor_id, n)
- return
- #--------------
- # 商店购买 則原版複製
- #
- elsif $scene.is_a?(Scene_Shop)
- gain_armor_f_shop(armor_id, n)
- return
- #--------------
- # 此外 皆隨機生成
- #
- else
- # 鑒定系統開啓
- if identified_control == 1 and $data_armors[armor_id].identified == true and rand(50)<40
- #-生成沒有鉴定的武器
- unidentify_armor(armor_id, n)
- elsif
- for j in 1..n
- # 取得設定
- t = setting.t
- l_t =setting.l_t
- best_quality = setting.best_quality
- level_set = setting.level_set
- worst_level_set = setting.worst_level_set
- #---------------
- a = rand(1000)
- b = 1000 - t - l_t # 上下分岐
- b2 = 1000 - t # 上中分岐
- if a > b # 成功
- if a > b2 # 中品
- s = 1
- else # 上品
- s = 2
- end
- else #下品
- s = 0
- end
- b = (best_quality * 1/3).round
- case s
- when 0
- vid = 0
- new_slots = rand(2)+3
- when 1
- vid = (best_quality * 1/3).round
- new_slots = rand(3)+2
- when 2
- vid = (best_quality * 2/3).round
- new_slots = rand(5)
- end
-
- armor = $data_armors[armor_id]
- new_name = armor.name.split(/(未鑑定)/)[0]
- new_des = armor.description
- new_price = armor.price
- new_str = armor.str_plus
- new_dex = armor.dex_plus
- new_agi = armor.agi_plus
- new_int = armor.int_plus
- new_pdef = armor.pdef
- new_mdef = armor.mdef
- new_element = armor.guard_element_set
- new_state = armor.guard_state_set
- new_duration = armor.max_duration
- # 取得quality總量
- xio = rand(b)+vid
- =begin
- #--再折損值
- if worst_level_set!=nil
- if worst_level_set[1]!=nil
- xio -= rand(worst_level_set[1])
- end
- end
- =end
- # 初始化quality
- quality = 0
- # 如果設定增加屬性以及狀態:
- if setting.element_set.size > 0 and setting.state_set.size > 0
- kind = rand(3)
- # 否則
- else
- kind = rand(2)
- end
- for i in 1..10
- if xio < 2
- break
- end
- case kind
- when 0
- # 附加兩防
- a_p = rand(xio/3).round
- a_m = rand(xio/3).round
- new_pdef += a_p * setting.f_pdef
- new_mdef += a_m * setting.f_mdef
- xio -= (a_p + a_m)
- quality += (a_p + a_m)
- # 附加四參數
- when 1
- a_s = rand(xio/4).round
- a_d = rand(xio/4).round
- a_g = rand(xio/4).round
- a_i = rand(xio/4).round
- new_str += a_s
- new_dex += a_d
- new_agi += a_g
- new_int += a_i
- xio -= (a_s + a_d + a_g +a_i)
- quality +=(a_s + a_d + a_g +a_i)
- # 附加屬性以及狀態
- when 2
- #錯誤報告-------
- p "未曾設定element_set於隨機裝備·基本定義" if setting.element_set.size < 1
- p "未曾設定state_set於隨機裝備·基本定義" if setting.state_set.size < 1
- p "請修改「隨機裝備·核心」" unless setting.element_set.size > 0 and setting.state_set.size > 0
- #---------------
- dio = rand(xio/2).round
- cost = setting.cost
- if xio >= cost
- sc_kind = rand(2)
- case sc_kind
- when 0
- n_el = setting.element_set[rand(setting.element_set.size)]
- new_element = new_element|[n_el]
- quality += cost
- xio -= cost
- when 1
- n_st = setting.state_set[rand(setting.state_set.size)]
- new_state = new_state|[n_st]
- quality += cost
- xio -= cost
- end
- end
- end
- end
- #
- if new_element.include?(8)
- new_name = "闇之"+ new_name
- elsif new_element.include?(8)
- new_name = "光之"+ new_name
- end
- q = best_quality
- new_color = 0
- if level_set !=nil
- for i in level_set
- if i[0] != nil
- q -= i[0]
- # p q
- if quality > q
- if i [1]!= nil
- new_color = i[1]
- end
- if i[2]!=nil
- new_name = i[2] + new_name
- end
- if i[3]!=nil
- new_name = new_name + i[3]
- end
- break
- end
- end
- end
- end
- if quality < 0
- if worst_level_set!=nil
- new_color = worst_level_set[0]
- if worst_level_set[2]!=nil
- new_name = new_name + worst_level_set[2]
- end
- if worst_level_set[3]!=nil
- new_name = new_name + worst_level_set[3]
- end
- end
- end
- new_duration = quality*setting.f_duration
- #------------------
-
- if $data_armors[armor_id].identified == true
- new_armor = $data_armors[armor_id].clone
- need = 0
- for x in 1...$data_armors.size
- if $data_armors[x].needed == false
- need = x
- break
- end
- end
- if need == 0
- new_armor.id = $data_armors.size
- else
- new_armor.id = need
- end
- new_armor.name = new_name
- new_armor.description = new_des
- new_armor.price = new_price
- new_armor.pdef = new_pdef
- new_armor.mdef = new_mdef
- new_armor.str_plus = new_str
- new_armor.dex_plus = new_dex
- new_armor.agi_plus = new_agi
- new_armor.int_plus = new_int
- new_armor.color = new_color
- new_armor.quality = quality
- new_armor.slots = new_slots
- new_armor.guard_element_set = new_element
- new_armor.guard_state_set = new_state
- new_armor.max_duration = new_duration
- new_armor.current_duration = new_duration
- new_armor.needed = true
-
- # 添加入數據库
- $data_armors.push(new_armor)
- # 职业可裝備武器數組更新
- renew_armor_f_classes(armor_id, new_armor.id)
- # 增加武器
- get_armor(new_armor.id, 1)
- else
- armor.name = new_name
- armor.description = new_des
- armor.price = new_price
- armor.pdef = new_pdef
- armor.mdef = new_mdef
- armor.str_plus = new_str
- armor.dex_plus = new_dex
- armor.agi_plus = new_agi
- armor.int_plus = new_int
- armor.color = new_color
- armor.quality = quality
- armor.slots = new_slots
- armor.guard_element_set = new_element
- armor.guard_state_set = new_state
- armor.max_duration = new_duration
- armor.current_duration = new_duration
- armor.needed = true
- # 取消未鑒定標志
- armor.identified = true
- # 增加武器
- get_armor(armor.id, 1)
- end
- end
- end
- end
- end
- end
- #--------------
- # 生成沒有鉴定的裝備
- #
- def unidentify_armor(armor_id, n)
- for j in 0...n
- armor = $data_armors[armor_id].clone
- armor.id = $data_armors.size
- armor.name +="(未鑑定)"
- armor.identified =false
- armor.needed = true
- $data_armors.push(armor)
- # 职业可装备武器数组更新~
- renew_armor_f_classes(armor_id, armor.id)
- # 增加武器
- get_armor(armor.id, 1)
- end
- end
- #--------------
- # 职业可装备武器组更新
- #
- def renew_armor_f_classes(armor_id, new_armor_id)
- for i in 1...$data_classes.size
- if $data_classes[i].armor_set.include?(armor_id)
- $data_classes[i].armor_set.push(new_armor_id)
- end
- end
- end
- #--------------
- # 增加武器
- #
- def get_armor(armor_id, n)
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- end
- #--------------
- # 失去裝備
- #
- def lose_armor(armor_id, n)
- if armor_id > 0
- @armors[armor_id] = [[armor_number(armor_id) - n, 0].max, 99].min
- end
- end
- end
- class Game_Party
- #--------------
- # 商店購買武器 則原版本複製
- #
- def gain_weapon_f_shop(weapon_id, n)
- if weapon_id > 0
- # 商店购买
- if $scene.is_a?(Scene_Shop)
- for j in 1..n
- weapon = $data_weapons[weapon_id].clone
- weapon.id = $data_weapons.size
- weapon.needed = true
- $data_weapons.push(weapon)
- # 职业可装备武器数组更新~
- for i in 1...$data_classes.size
- if $data_classes[i].weapon_set.include?(weapon_id)
- $data_classes[i].weapon_set.push(weapon.id)
- end
- end
- @weapons[weapon.id] = [[weapon_number(weapon.id) + 1, 0].max, 99].min
- end
- end
- end
- end
- #--------------
- # 商店購買裝備 則原版本複製
- #
- def gain_armor_f_shop(armor_id, n)
- if armor_id > 0
- # 商店购买
- if $scene.is_a?(Scene_Shop)
- for j in 1..n
- armor = $data_armors[armor_id].clone
- armor.id = $data_armors.size
- armor.needed = true
- $data_armors.push(armor)
- # 职业可装备裝備数组更新~
- for i in 1...$data_classes.size
- if $data_classes[i].armor_set.include?(armor_id)
- $data_classes[i].armor_set.push(armor.id)
- end
- end
- @armors[armor.id] = [[armor_number(armor.id) + 1, 0].max, 99].min
- end
- end
- end
- end
- end
复制代码 |
|