Project1
标题:
武器升级用的脚本如何让某装备不可已升级
[打印本页]
作者:
卓越大白痴
时间:
2008-12-18 09:26
标题:
武器升级用的脚本如何让某装备不可已升级
这个是武器升级用的脚本 如何让某装备不可已升级
因为要做特效装备
class Basic_Works_F_Upgrade
def smith_weapon(weapon_id, n)
#==============================================================================
# 正體
#==============================================================================
if weapon_id > 0
# 取得ID
weapon = $data_weapons[weapon_id]
else
return
end
# 取得設定
if @control_8 == 1
setting = Radom_Creation.new
best_quality = setting.best_quality
level_set = setting.level_set
worst_level_set = setting.worst_level_set
end
#=====>最終等級
max_lv = @max_f_weapon
a = rand(1000)
exlent_add = @atk_s + @pdef_s + @mdef_s + @str_s + @dex_s + @agi_s + @int_s
worst_add = 0 - @atk_f - @pdef_f - @mdef_f - @str_f - @dex_f - @agi_f - @int_f
# p exlent_add
# p worst_add
s_rate = @proportion_s
r_rate = @proportion_r
ex_rate = @proportion_ex
if @control_14 == 1
s_rate -= @up_rate * weapon.lv
r_rate += @up_rate/2.round * weapon.lv
if @control_1 == 1
ex_rate -= @up_rate/2.round * weapon.lv
end
end
case @control_1 # 可能高低等變化嗎?
when 0 # 不可能
b = 1000 - s_rate # 成敗分岐
b2 = b - r_rate # 下降與否分岐
if a > b # 成功
s = 1
else
if a > b2
#還原
s = 3
else
#失敗
s = 0
end
end
when 1 # 可能
# p ""
b = 1000 - s_rate - ex_rate# 成敗空白分岐
b2 = b + s_rate # 優劣分岐
b3 = b - r_rate
if a > b # 成功
if a > b2 # 劣質提昇
s = 2 # ex
else # 優質提昇
s = 1 # s
end
else #失敗
if a > b3
s = 3
else
s = 0
end
end
end
# 卑鄙地爆掉 Q Q
if s== 0 and @control_10 == 1
if @proportion_b > rand(1000)
return
end
end
# 還原 ~.~
if s == 3
$game_party.weapons[weapon.id] = [[$game_party.weapon_number(weapon.id) + n, 0].max, 99].min
return
end
# 取得附加值
case s
when 0 # 當失敗時
add_atk = -@atk_f
add_pdef = -@pdef_f
add_mdef = -@mdef_f
add_str = -@str_f
add_dex = -@dex_f
add_agi = -@agi_f
add_int = -@int_f
p_rate = 1/@pri_f
if @control_2 == 1
r_n = -@discount_f
end
add_lv = -1
when 1 # 當劣質提昇成功時
add_atk = @atk_s
add_pdef = @pdef_s
add_mdef = @mdef_s
add_str = @str_s
add_dex = @dex_s
add_agi = @agi_s
add_int = @int_s
p_rate = 1/@pri_s
if @control_2 == 1
r_n = @discount_s
end
add_lv = 1
when 2 # 當優質提昇成功時
add_atk = @atk_ex
add_pdef = @pdef_ex
add_mdef = @mdef_ex
add_str = @str_ex
add_dex = @dex_ex
add_agi = @agi_ex
add_int = @int_ex
p_rate = 1/@pri_ex
if @control_2 == 1
r_n = @discount_ex
end
add_lv = 1
end
# p s
# p "L" if add_int == 5
case @control_2 # 會隨即折損嗎?
when 1 # 會
add_atk -= rand(r_n)
add_pdef -= rand(r_n)
add_mdef -= rand(r_n)
add_str -= rand(r_n)
add_dex -= rand(r_n)
add_agi -= rand(r_n)
add_int -= rand(r_n)
end
if $data_weapons[weapon_id].lv < max_lv
# 取得原生數據
main_atk = weapon.atk # 原生atk_plus
main_name = weapon.name # 原生name
main_des = weapon.description # 原生description
main_str = weapon.str_plus # 原生str_plus
main_dex = weapon.dex_plus # 原生dex_plus
main_agi = weapon.agi_plus # 原生agi_plus
main_int = weapon.int_plus # 原生int_plus
main_pdef = weapon.pdef # 原生物防
main_mdef = weapon.mdef # 原生魔防
main_price = weapon.price # 原生price
main_element = weapon.element_set # 附加屬性組
main_lv = weapon.lv
# 當與隨即物品生成結合時,取得原本品質
if @control_8 == 1
new_quality = weapon.quality
end
# 當等級等於0而失敗時,等級不再下降
if $data_weapons[weapon_id].lv == 0 and s == 0
$game_party.weapons[weapon_id] = [[$game_party.weapon_number(weapon_id) + n, 0].max, 99].min
return
end
new_atk = add_atk + main_atk # 新的atk_plus
# 當等級等於0時,取消lv加序
if $data_weapons[weapon_id].lv == 0
new_name = main_name
else
if @control_3 == 1 and @control_12 == 2
new_name = main_name.split(/級/)[1]
# p "yes"
else
new_name = main_name.split(/+/)[0] # 新的name
end
end
# p new_name
# 取得新的數據
new_des = main_des # 新的description
new_str = add_str + main_str# 新的str_plus
new_dex = add_dex + main_dex # 新的dex_plus
new_agi = add_agi + main_agi # 新的agi_plus
new_int = add_int + main_int # 新的int_plus
new_pdef = add_pdef + main_pdef # 新的物防
new_mdef = add_mdef + main_mdef # 新的魔防
new_price = p_rate * main_price # 新的價格
# 當與隨即物品生成結合時,取得新的品質
if @control_8 == 1
new_quality += add_atk + add_str + add_dex + add_agi + add_int + add_pdef + add_mdef
end
new_lv = add_lv + main_lv # 新的等級
elsif $data_weapons[weapon_id].lv == max_lv # 當等級達到最高,返回
$game_party.weapons[weapon_id] = [[$game_party.weapon_number(weapon_id) + n, 0].max, 99].min
return
else # 當等級超過最高,修正
$game_party.weapons[weapon_id] = [[$game_party.weapon_number(weapon_id) + n, 0].max, 99].min
if @control_3 == 1 and @control_12 == 2
new_name = max_lv.to_s + "級" + main_name.split(/級/)[1] # 新的name
else
new_name = main_name.split(/+/)[0] + "+" + max_lv.to_s # 新的name
end
$data_weapons[weapon_id].lv = max_lv # 修正lv
return
end
new_element = main_element
# 當可能附加新的屬性時
if @control_3 == 1
exlent_add += exlent_add / 5
# 錯誤追踪
p "check「@element_plus」in 武器昇級·基本定義! It cannot be empty!" if @element_plus.size == 0
if @proportion_ep > rand(1000) and s > 0 and @element_plus.size > 0
# 隨即挑選屬性
r_element = @element_plus[rand(@element_plus.size)]
element_text = $data_system.elements[r_element]
# 如果與已有屬性相符則無效
if main_element.include? r_element
new_name += ""
new_des += ""
# p "include"
else
# p "not-include"
new_element = [r_element] | main_element
# 修正新的價格
new_price = new_price * @pri_ep
if @control_8 == 1
# 取得新的品質
new_quality += @str_s/2
end
if @control_11 == 1
new_ori_record = weapon.ori_record2.clone
new_ori_record[0].push r_element
end
# 附加前後序
case @control_12
when 1 # 名字前面加東東
case @control_13
when 0
new_name = @b_name + new_name
when 1
new_name = element_text + @b_name + new_name
when 2
new_name = @b_name + element_text + new_name
end
when 2 # 名字後面加東東
case @control_13
when 0
new_name = new_name + @p_name
when 1
new_name = new_name + element_text + @p_name
when 2
new_name = new_name + @p_name + element_text
end
when 3 # 描述前面加西西
case @control_13
when 0
new_des = @b_text + new_des
when 1
new_des = element_text + @b_text + new_des
when 2
new_des = @b_text + element_text + new_des
end
when 4 # 描述後面加西西
case @control_13
when 0
new_des = new_des + @p_text
when 1
new_des = new_des + element_text + @p_text
when 2
new_des = new_des + @p_text + element_text
end
# when 0 # 我不喜歡有描述!
end
end
end
end
# 更正新的名字
if $data_weapons[weapon_id].lv == 1 and s == 0
else
if @control_3 == 1 and @control_12 == 2
# p new_name
new_name = new_lv.to_s + "級" + new_name # 新的new_name
else
new_name = new_name + "+" + new_lv.to_s # 新的new_name
end
end
# 修正名字顔色
if @control_8 == 1
q = best_quality
end
if @control_8 == 1
if level_set.empty? == true
new_color = 0
else
for i in level_set
if i[0] != nil
q -= i[0]
# p q
if new_quality > q
if i [1] != nil
new_color = i[1]
break
end
end
end
end
end
end
if @control_8 == 1
if new_quality < 0
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
weapon.max_duration *= 1.1
weapon.name = new_name
weapon.description = new_des
weapon.price = new_price.round
weapon.atk = new_atk
weapon.pdef = new_pdef
weapon.mdef = new_mdef
weapon.str_plus = new_str
weapon.dex_plus = new_dex
weapon.agi_plus = new_agi
weapon.int_plus = new_int
weapon.element_set = new_element
weapon.lv = new_lv
if @control_8 == 1
weapon.quality = new_quality
weapon.color = new_color
end
if @control_11 == 1
weapon.ori_record = new_ori_record
end
$game_party.weapons[weapon.id] = [[$game_party.weapon_number(weapon.id) + n, 0].max, 99].min
=begin
# 更新武器數據库
save_data($data_weapons, "Data/Weapons.rxdata")
save_data($data_classes, "Data/Classes.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
=end
end
end
复制代码
[LINE]1,#dddddd[/LINE]
此贴于 2008-12-21 13:28:48 被版主darkten提醒,请楼主看到后对本贴做出回应。
[LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
706756524
时间:
2008-12-21 05:41
提示:
作者被禁止或删除 内容自动屏蔽
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1