Project1
标题:
武器三合一腳本中如何筛选脚本
[打印本页]
作者:
shiley
时间:
2008-3-20 20:56
标题:
武器三合一腳本中如何筛选脚本
武器隨機生成,强化,魔石添加,三合一腳本
这个脚本中,我就想要显示装备样子和随即生成选项,需要怎么做啊?
他的随即生成可以生成所有的装备,还带装备鉴定功能。
本来我想自己提炼的,不过他的脚本里面有太多的东西,确实找不准。
谢谢 [LINE]1,#dddddd[/LINE]
版务信息:本贴由楼主自主结贴~
作者:
禾西
时间:
2008-3-20 20:59
所以作者已經申請撤下教程,重製新版……囧rz [LINE]1,#dddddd[/LINE]
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
作者:
shiley
时间:
2008-3-20 21:10
hoho,你是作者啊?我刚看到你下面的签名。期待啊。禾大,你什么时候能出来新的?
作者:
禾西
时间:
2008-3-20 21:26
不要太期望……按照禾西現在的龜爬速度……快則這個星期六之前,慢則兩個星期以後……
作者:
shiley
时间:
2008-3-20 21:32
。。。。。。。。。。。。。。。。。。。。。。。。怎么差这么多天?你就快点嘛!!!
要不你就先告诉我你以前的那个里面,如何提炼我要的几个脚本,谢谢
作者:
禾西
时间:
2008-3-20 21:47
显示装备样子:
新幫助·武器&裝備
新幫助·物品&技能
或者:
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
复制代码
作者:
禾西
时间:
2008-3-20 21:48
#==============================================================================
# ■ Materia_Command_Zero
#------------------------------------------------------------------------------
# 选择的窗口
#==============================================================================
class Confirm_Identification < Window_Selectable
attr_accessor :price
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(230, 200, 240, 200)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 255
@item_max = 2
@commands = ["哇塞林良!", "你黑!我付!"]
refresh
self.index =0
@price = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
a = @price.to_s
text = "鑒定這個要#{a}G的哦!"
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(5, -5, 240, 45,text )
self.contents.font.color = normal_color
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
y = (index+1) * 30 - 5
self.contents.draw_text(5, y, 240, 45, @commands[index])
end
#--------------------------------------------------------------------------
# ● 刷新光标矩形
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set( 5, (@index+1) * 30, (self.width-35), (self.height/3-35))
end
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# 物品画面、战斗画面、显示浏览物品的窗口。
#==============================================================================
class Item_Identification < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 64-64, 640, 416+64)
@column_max = 2
@price_rate = Radom_Creation.new.ident_rate
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
cost_price = item.price*@price_rate
if $game_party.gold >= (cost_price.round) and item.identified == false
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
=begin
# 照樣子是取消討厭的圖標------------------------------------------------------#
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.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)
=end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
# -------------------
# 修改開始
@help_window.set_text(item)
#校正帮助窗口位置
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
# 修改終了
# -------------------
end
end
class Main_Identification
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
@price_f_ident = Radom_Creation.new.ident_rate
# 生成幫助窗口
@help_window = Window_Help_Self.new
@help_window.visible =true
# 生成物品窗口
@items_window = Item_Identification.new
@items_window.active = true
@items_window.help_window = @help_window
# 生成選項窗口
@command_window = Confirm_Identification.new
@command_window.active = false
@command_window.visible = false
# 在界面留白(黑)处生成地图画面(需对应释放)
# @spriteset = Spriteset_Map.new
#
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
#
# 释放窗口
@items_window.dispose
@help_window.dispose
@command_window.dispose
# 释放留白处之地图背景图
# @spriteset.dispose
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@items_window.update
@help_window.update
@command_window.update
# 人物窗口激活的情况下:調用 update_actor
if @items_window.active
update_items
return
end
# 選項窗口激活的情况下:調用 update_command
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (人物窗口激活的情况下)
#--------------------------------------------------------------------------
def update_items
# 按下 B or Esc 键的情况下
if Input.trigger?(Input::B)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到地图画面
$scene = Scene_Map.new
return
end
# 按下 C or Space 键的情况下
if Input.trigger?(Input::C)
@item = @items_window.item
if @item == nil or @item.identified == true
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
@items_window.active = false
@help_window.visible = false
@command_window.price = (@item.price*@price_f_ident).round
@command_window.refresh
@command_window.active = true
@command_window.visible = true
@command_window.index = 0
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (選項窗口激活的情况下)
#--------------------------------------------------------------------------
def update_command
# 按下 B or Esc 键的情况下
if Input.trigger?(Input::B)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 切换到人物窗口
@items_window.active = true
@help_window.visible = true
@command_window.visible = false
@command_window.active = false
@command_window.index = -1
return
end
# 按下 C or Space 键的情况下
if Input.trigger?(Input::C)
case @command_window.index
when 0
@items_window.active = true
@command_window.visible = false
@command_window.active = false
@command_window.index = -1
when 1
# 演奏确定 SE
if $game_party.gold < (@item.price*@price_f_ident).round or
@item.identified == true
#
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
$game_party.lose_gold((@item.price*@price_f_ident).round)
case @item
when RPG::Item
when RPG::Weapon
$game_party.lose_weapon(@item.id, 1)
$game_party.gain_weapon(@item.id, 1)
when RPG::Armor
$game_party.lose_armor(@item.id, 1)
$game_party.gain_armor(@item.id, 1)
end
@help_window.non_auto_update # 手動更新畫面=.=
# 切换到人物窗口
@command_window.visible = false
@command_window.active = false
@command_window.index = -1
@help_window.visible = true
@items_window.active = true
@items_window.refresh
end
end
end
end#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.identified == false
self.contents.font.color = disabled_color
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x + 28-28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240-28, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256-28, y, 24, 32, number.to_s, 2)
end
endclass Scene_Equip
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的装备数据
item = @item_window.item
#----------------------------------#
if item!=nil
if item.identified == false
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
end
#----------------------------------#
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 变更装备
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# 再生成右侧窗口、物品窗口的内容
@right_window.refresh
@item_window.refresh
@item_window.index = -1
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
return
end
end
end
复制代码
作者:
禾西
时间:
2008-3-20 21:53
最初的時候,腳本寫得太過冗長了……新版會减少一點功能與代碼。
(魔石系統由4000行縮少到1800行……大囧)
之所以差那么多是因爲如果星期六之前不完成,下次回到家就是兩個星期以後……
作者:
shiley
时间:
2008-3-20 22:00
哦,嗬嗬,禾大辛苦,我用你给的代码先作着,以后有了在替换,期待禾大新的脚本
作者:
shiley
时间:
2008-3-20 22:03
ps。问个地球问题,你们火星人总是喜欢说:“大囧”,请问那个“囧”是什么字?怎么念?什么意思?hoho
作者:
shiley
时间:
2008-3-20 22:09
随即生成的165行发生错误
elsif $scene.is_a?(Deatwo_Smith_Shop2)
get_weapon(weapon_id, n)
return
作者:
禾西
时间:
2008-3-20 22:12
凡是出現錯誤的代碼都删掉,主要都是跟其他系統交錯的廢代碼
作者:
shiley
时间:
2008-3-20 22:13
ok了,那个字什么意思啊?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1