=begin ---------------------------------------------------------------------------------
#需要能力值才能装备 改编自到达一定等级才能装备的武器和防具 By凌冰
#用法:在武器、防具的说明里添加LV等级(后面的等级写个数字)STR力量(后面的力量写个数字)
#DEX灵巧(后面的灵巧写个数字)AGI速度(后面的速度写个数字)INT魔力(后面的魔力写个数字)
#可以空缺,空缺项默认为1
#建议和升级加点脚本配合使用
=end #---------------------------------------------------------------------------------
module RPG
#--------------------------------------------------------------------------
# ● Cache追加
#--------------------------------------------------------------------------
module Cache
def self.faces(filename)
self.load_bitmap("Graphics/Faces/", filename)
end
def self.menu(filename)
self.load_bitmap("Graphics/Menu/", filename)
end
def self.images(filename)
self.load_bitmap("Graphics/Images/", filename)
end
def self.menu(filename)
self.load_bitmap("Graphics/Menu/", filename)
end
def self.menu_icon(filename)
self.load_bitmap("Graphics/Menu_Icons/", filename)
end
def self.crystal(filename)
self.load_bitmap("Graphics/Crystal/", filename)
end
def self.members(filename)
self.load_bitmap("Graphics/Members/", filename)
end
def self.mission(filename)
self.load_bitmap("Graphics/Mission/", filename)
end
def self.cook(filename)
self.load_bitmap("Graphics/Cook/", filename)
end
end
#--------------------------------------------------------------------------
# ● 结晶回路用全局变量
#--------------------------------------------------------------------------
# 结晶石防具数据库起始ID,此为第一件结晶石的ID,其后不得再含有普通的防具。
ARMOR_BEGIN = 201
# 结晶石技能数据库起始ID,此为第一个结晶石技能的ID,其后不得再含有普通的技能。
SKILL_BEGIN = 201
class Skill
# 技能数据库,用来设置根据结晶属性值的多少学会的技能。
# 设置方法与防具数据库类似,勾选属性一栏的对应属性,然后通过名称给予需要的
# 结晶属性值。
if self.id >= SKILL_BEGIN
def name
return @name.split(/,/)[0]
end
def require_element
data = @name.split(/,/)[1].split(/@/)
final = []
for i in 0...CRYSTAL::ELE_NUMBER
if self.element_set.include?(i + 1)
if data.empty?
raise ("#{@id}号技能的属性未设置")
end
final[i] = data.shift.to_i
else
final[i] = 0
end
end
return final
end
def description
return @description.split(/,/)[0]
end
def element
return @description.split(/,/)[1].to_i
end
end
end
class Weapon
def level
return 1 if @description.split(/LV/)[1] == nil
return @description.split(/LV/)[1]
end
def str
return 1 if @description.split(/STR/)[1] == nil
return @description.split(/STR/)[1]
end
def dex
return 1 if @description.split(/DEX/)[1] == nil
return @description.split(/DEX/)[1]
end
def agi
return 1 if @description.split(/AGI/)[1] == nil
return @description.split(/AGI/)[1]
end
def int
return 1 if @description.split(/INT/)[1] == nil
return @description.split(/INT/)[1]
end
# def description
# return @description.split(/LV/)[0] + "{装备等级" + level + "}"
# end
end
#--------------------------------------------------------------------------
# ● 结晶回路的各个属性定义
#--------------------------------------------------------------------------
class Armor
# 防具数据库,结晶石是通过防具数据库进行设置的。
# 设置方法:
# 在属性防御上勾选此结晶所包含的属性,之后在名称栏中通过半角逗号分隔,将具
# 体属性值写于其中。如范例中:“火神的愤怒,25@5”,同时勾选了炎和雷属性,根
# 据从上到下的先后次序,炎属性为25,雷属性为5。
# 结晶石本身的属性以及本身的等级,通过描述一栏后追加分隔符的方法来给定。
# 具体可参考范例。
if self.id >= ARMOR_BEGIN
#--------------------------------------------------------------------------
# ● 重新定义名字
#--------------------------------------------------------------------------
def name
return @name.split(/,/)[0]
end
#--------------------------------------------------------------------------
# ● 定义结晶回路包含的属性值
#--------------------------------------------------------------------------
def crystal_element
return Array.new(CRYSTAL::ELE_NUMBER, 0) if @name.split(/,/).size == 1
data = @name.split(/,/)[1].split(/@/)
final = []
for i in 0...CRYSTAL::ELE_NUMBER
if self.guard_element_set.include?(i + 1)
if data.empty?
raise ("#{@id}号结晶石的属性未设置")
end
final[i] = data.shift.to_i
else
final[i] = 0
end
end
return final
end
#--------------------------------------------------------------------------
# ● 重新定义结晶回路的描述
#--------------------------------------------------------------------------
def description
return @description.split(/,/)[0]
end
#--------------------------------------------------------------------------
# ● 定义结晶回路的主要属性
#--------------------------------------------------------------------------
def element
return @description.split(/,/)[1].to_i
end
#--------------------------------------------------------------------------
# ● 定义结晶回路的等级
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
# ● 定义结晶回路的价格 也就是耗费的各个耀晶片数量
#--------------------------------------------------------------------------
def cost_sepich
@data = $data_armors[self.id+1].description.split(/#/)
final = []
for i in 0...CRYSTAL::ELE_NUMBER
if $data_armors[self.id+1].guard_element_set.include?(i+1)
if @data.empty?
break
end
final[i] = @data.shift.to_i
else
final[i] = 0
end
end
return final
end
#--------------------------------------------------------------------------
# ● 定义结晶回路的种类 为了让同样的回路不能装备多个用
#--------------------------------------------------------------------------
def cry_type
return $data_armors[self.id+1].name.to_i
end
end
def level
if self.id >= ARMOR_BEGIN
return @description.split(/,/)[2].to_i
else
return 1 if @description.split(/LV/)[1] == nil
return @description.split(/LV/)[1]
end
end
def str
return 1 if @description.split(/STR/)[1] == nil
return @description.split(/STR/)[1]
end
def dex
return 1 if @description.split(/DEX/)[1] == nil
return @description.split(/DEX/)[1]
end
def agi
return 1 if @description.split(/AGI/)[1] == nil
return @description.split(/AGI/)[1]
end
def int
return 1 if @description.split(/INT/)[1] == nil
return @description.split(/INT/)[1]
end
# def description
# return @description.split(/LV/)[0] + "{装备等级" + level + "}"
# end
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 可以装备判定
# item : 物品
#--------------------------------------------------------------------------
def equipable?(item)
# 武器的情况
if item.is_a?(RPG::Weapon)
# 包含当前的职业可以装备武器的场合
if $data_classes[@class_id].weapon_set.include?(item.id) and item.level.to_i<=@level
if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
return true
end
end
end
# 防具的情况
if item.is_a?(RPG::Armor)
# 不包含当前的职业可以装备武器的场合
if $data_classes[@class_id].armor_set.include?(item.id) and item.level.to_i<=@level
if item.str.to_i<= str and item.dex.to_i<= dex and item.agi.to_i<= agi and item.int.to_i<= int
return true
end
end
end
return false
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以装备的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) and @actor.equipable?($data_weapons[i])
@data.push($data_weapons[i])
end
end
end
# 添加可以装备的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i) and @actor.equipable?($data_armors[i])
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# 添加空白
@data.push(nil)
# 生成位图、描绘全部项目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
end