赞 | 50 |
VIP | 429 |
好人卡 | 14 |
积分 | 8 |
经验 | 146370 |
最后登录 | 2022-6-27 |
在线时间 | 3431 小时 |
Lv2.观梦者 会吐槽的画师
- 梦石
- 0
- 星屑
- 782
- 在线时间
- 3431 小时
- 注册时间
- 2011-6-10
- 帖子
- 6535
|
2楼
楼主 |
发表于 2013-7-4 15:56:46
|
只看该作者
- #==============================================================================
- # 复杂装备系统之随机属性 by 沉影不器
- # protosssonny修改版
- #------------------------------------------------------------------------------
- # 说明: 让装备类似暗黑那样附加随机属性,目前有17种属性元素可供组合,允许按
- # 能力百分比加成.
- #
- # 附加属性的名称允许多个(按能力从小大到排列),用英文逗号隔开,自动按
- # 附加能力大小选择词缀
- #
- # 极品爆率不影响物品掉落机率,而是指掉落的物品带附加属性的机率
- #
- # 获得随机属性装备的方法:
- # 事件脚本中输入 get_weapon(母版武器id, 数量, 附加属性1, 附加属性2...)
- # 或者直接指定附加属性数 get_weapon(母版武器id, 数量, 附加属性数)
- # 将随机生成指定附加属性数的装备
- # 获得防具方法是 get_armor() 参数含义同上
- #
- # 获得普通装备的方法:
- # 事件脚本中输入 get_weapon(母版武器id, 数量)
- # 获得防具方法是 get_armor() 参数含义同上
- #==============================================================================
- # 参数设定
- #==============================================================================
- module Game_Equip
- ## 最大附加属性数
- GiftMax = 6
- ## 附加属性影响价格基数
- GiftPrice = 10
- ## 极品爆率最低值和最高值(0到100)
- Equip_Chance = [0, 100]
-
- ## 附加属性各参数:
- ## name 添加到装备前的修饰词
- ## max 该属性最大值
- ## weight 权重(最大值的权重,用于计算价值,用于计算颜色也行)
- ## percent 是否按百分比计算
- Gift = Struct.new(:name, :max, :weight, :percent)
- Gifts = [
- # 攻击0
- Gift.new("强袭", 100, 40, false),
- Gift.new("强攻", 25, 25, true),
- # 防御2
- Gift.new("坚盾", 100, 40, false),
- Gift.new("硬防", 25, 25, true),
- # 精神4
- Gift.new("凝神", 100, 40, false),
- Gift.new("启迪", 25, 25, true),
- # 敏捷6
- Gift.new("疾影", 100, 40, false),
- Gift.new("飞速", 25, 25, true),
- # hp8
- Gift.new("强心", 800, 40, false),
- Gift.new("健体", 20, 25, true),
- # mp10
- Gift.new("启蒙", 300, 40, false),
- Gift.new("凝聚", 25, 25, true),
- # 命中12
- Gift.new("专注", 12, 40,false),
- # 闪避13
- Gift.new("闪避", 12, 40, false),
- # 暴击14
- Gift.new("必杀", 10, 40, false),
- # 所有主要属性,最多+20%15
- Gift.new("全能", 20, 40, true),
- # 抗魔性 ###(待定) 16
- Gift.new("抗魔", 30, 40, true)
- ]
- end
- #==============================================================================
- # ■ Game_Equip 自定义装备模块
- #==============================================================================
- module Game_Equip
- #--------------------------------------------------------------------------
- # ● 物品(装备)重生
- # item: 物品
- # *gift: 附加属性(留空表示无属性,数字表示指定数量随机属性)
- #--------------------------------------------------------------------------
- def self.reini(item, *gift)
- return if item.nil?
- result = item.clone
- gifts = *gift
- gifts.flatten! if gifts.is_a? Array
- case result
- when RPG::Weapon
- result.inidur
- result.base_id = result.id
- result.id = $data_weapons.size
- when RPG::Armor
- result.inidur
- result.base_id = result.id
- result.id = $data_armors.size
- end
- ## 附加属性为空或指定为(0)时,直接返回母版
- return self.result(result) if gifts.nil? or gifts == 0
- ## 指定附加属性数量时
- if gifts.is_a? Integer
- ## 控制数量
- num = [gifts, GiftMax].min
- gifts = []
- ## 随机生成指定数量的附加属性
- rd = []
- rd_1 = []
- if item.is_a?(RPG::Weapon)
- rd_1 = different_rand(PA::WEAPON_E.size - 1, num)
- for i in 0...num
- rd << PA::WEAPON_E[rd_1[i]]
- end
- end
- if item.is_a?(RPG::Armor)
- case item.kind
- when 0
- rd_1 = different_rand(PA::SHIELD_E.size - 1, num)
- for i in 0...num
- rd << PA::SHIELD_E[rd_1[i]]
- end
- when 1
- rd_1 = different_rand(PA::HELMET_E.size - 1, num)
- for i in 0...num
- rd << PA::HELMET_E[rd_1[i]]
- end
- when 2
- rd_1 = different_rand(PA::CLOTHE_E.size - 1, num)
- for i in 0...num
- rd << PA::CLOTHE_E[rd_1[i]]
- end
- end
- end
- rd.each{|n| gifts.push Game_Gift.new(n)}
- end
- gifts = [gifts].flatten
- return self.result(result) if gifts.empty?
- ## 处理数据
- result.gifts = gifts
- name = ""
- price = 0
- name_num = 0
- name_type = ["良好","上乘","精致","卓越","稀有","传颂"] if item.is_a?(RPG::Weapon)
- name_type = ["良好","上乘","精致","卓越","稀有","传颂"] if item.is_a?(RPG::Armor)
- for gift in gifts
- name_num += 1
- price += (result.price/2)
- end
- ## 设定名称
- if item.id == PA::CRYSTAL and item.is_a?(RPG::Armor)
- if gifts.size > 0
- result.name = "属性水晶[带属性]"
- result.text_color = 12
- end
- else
- name = name_type[name_num - 1]
- result.name = name + "·" + result.name
- ## 设定价格
- result.price += price.round
- ## 设定颜色
- case gifts.size
- when 1
- result.text_color = 12
- when 2
- result.text_color = 29
- when 3
- result.text_color = 17
- when 4
- result.text_color = 20
- when 5
- result.text_color = 26
- when 6
- result.text_color = 31
- end
- end
- return self.result(result)
- end
- #--------------------------------------------------------------------------
- # ● 返回结果
- # item: 物品
- #--------------------------------------------------------------------------
- def self.result(item)
- case item
- when RPG::Item
-
- when RPG::Weapon
- item.id = $data_weapons.size
- $data_weapons << item
- when RPG::Armor
- item.id = $data_armors.size
- $data_armors << item
- end
- return item
- end
- #--------------------------------------------------------------------------
- # ● 物品(装备)重生
- # item_id: 物品id
- # type: 类型
- # *gift: 附加属性(留空表示无属性,数字表示指定数量随机属性)
- #--------------------------------------------------------------------------
- def self.reini_id(item_id, type, *gift)
- ## 排除装备id为零的情况
- return 0 if item_id == 0
- case type
- when 0
- item = $base_weapons[item_id]
- item.base_id = item_id
- when 1
- item = $base_armors[item_id]
- item.base_id = item_id
- end
- return self.reini(item, *gift).id
- end
- end
- #==============================================================================
- # ■ Game_Gift 装备附加能力
- #==============================================================================
- class Game_Gift
- include Game_Equip
- #--------------------------------------------------------------------------
- # ● 读取口
- #--------------------------------------------------------------------------
- attr_reader :type
- attr_reader :value
- attr_reader :name
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize(type = nil, value = nil)
- get_type(type)
- get_value(value)
- get_name
- end
- #--------------------------------------------------------------------------
- # ● 获取属性
- #--------------------------------------------------------------------------
- def get_type(type)
- unless type.nil? or type > Gifts.size or type < 0
- @type = type
- else
- @type = rand(Gifts.size - 1)
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取品质值
- #--------------------------------------------------------------------------
- def get_value(value)
- unless value.nil? or value.abs > max
- @value = value
- else
- a = $game_variables[3]+rand(1 + $game_variables[4])
- @value = max * a / 100
- @value = 1 if @value == 0
- @value = max if @value >= max
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取名称
- #--------------------------------------------------------------------------
- def get_name
- names = Gifts[@type].name.split(/,/)
- n = (@value.abs-1)/(max.to_f/names.size)
- @name = names[n.truncate]
- end
- #--------------------------------------------------------------------------
- # ● 获取最大值
- #--------------------------------------------------------------------------
- def max
- return Gifts[@type].max
- end
- #--------------------------------------------------------------------------
- # ● 获取权重
- #--------------------------------------------------------------------------
- def weight
- return @value > 0 ? @value / max.to_f * Gifts[@type].weight : 0
- end
- #--------------------------------------------------------------------------
- # ● 获取是否百分比
- #--------------------------------------------------------------------------
- def percent
- return Gifts[@type].percent
- end
-
- #--------------------------------------------------------------------------
- # ● 攻击力
- #--------------------------------------------------------------------------
- def atk(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 0 and @type != 1
- if percent
- return $game_actors[actor_id].self_atk * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● 防御力
- #--------------------------------------------------------------------------
- def def(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 2 and @type != 3
- if percent
- return $game_actors[actor_id].self_def * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● 精神
- #--------------------------------------------------------------------------
- def spi(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 4 and @type != 5
- if percent
- return $game_actors[actor_id].self_spi * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● 敏捷
- #--------------------------------------------------------------------------
- def agi(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 6 and @type != 7
- if percent
- return $game_actors[actor_id].self_agi * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● maxhp
- #--------------------------------------------------------------------------
- def maxhp(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 8 and @type != 9
- if percent
- return $game_actors[actor_id].self_maxhp * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● maxmp
- #--------------------------------------------------------------------------
- def maxmp(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 10 and @type != 11
- if percent
- return $game_actors[actor_id].self_maxmp * @value / 100
- else
- return @value
- end
- end
- #--------------------------------------------------------------------------
- # ● 命中
- #--------------------------------------------------------------------------
- def hit
- # 数据类型不符时返回
- return 0 if @type != 12
- return @value
- end
- #--------------------------------------------------------------------------
- # ● 闪避
- #--------------------------------------------------------------------------
- def eva
- # 数据类型不符时返回
- return 0 if @type != 13
- return @value
- end
- #--------------------------------------------------------------------------
- # ● 暴击
- #--------------------------------------------------------------------------
- def cri
- # 数据类型不符时返回
- return 0 if @type != 14
- return @value
- end
- #--------------------------------------------------------------------------
- # ● 所有主要属性
- #--------------------------------------------------------------------------
- def all_atribute(actor_id)
- # 无角色信息时返回
- return 0 unless actor_id
- # 数据类型不符时返回
- return 0 if @type != 15
- return @value
- end
- #--------------------------------------------------------------------------
- # ● 抗魔性
- #--------------------------------------------------------------------------
- def mdf
- # 数据类型不符时返回
- return 0 if @type != 16
- return @value
- end
- #--------------------------------------------------------------------------
- # ● 经验(百分比)(舍弃本属性)
- #--------------------------------------------------------------------------
- def exp
- # 数据类型不符时返回
- return 0 #if @type != 15
- #return @value
- end
- #--------------------------------------------------------------------------
- # ● 高级装备暴率(百分比)(舍弃本属性)
- #--------------------------------------------------------------------------
- def equip_chance
- # 数据类型不符时返回
- return 0 #if @type != 16
- #return @value
- end
- end
- #==============================================================================
- # ■ RPG::BaseItem
- #==============================================================================
- module RPG
- class BaseItem
- ## 颜色
- attr_accessor :text_color
- end
- end
- #==============================================================================
- # ■ RPG::Weapon
- #==============================================================================
- module RPG
- class Weapon < BaseItem
- #------------------------------------------------------------------------
- # 附加属性
- #------------------------------------------------------------------------
- attr_accessor :base_id
- attr_accessor :actor_id
- attr_accessor :gifts
- #------------------------------------------------------------------------
- # 装备基本属性定义
- #------------------------------------------------------------------------
- def base_atk
- return @atk
- end
- def base_def
- return @def
- end
- def base_spi
- return @spi
- end
- def base_agi
- return @agi
- end
- #------------------------------------------------------------------------
- # 攻击力(合)
- #------------------------------------------------------------------------
- def atk
- n = @atk
- [url=home.php?mod=space&uid=322055]@gifts[/url] = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.atk(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 防御力(合)
- #------------------------------------------------------------------------
- def def
- n = @def
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.def(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 魔力(合)
- #------------------------------------------------------------------------
- def spi
- n = @spi
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.spi(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 敏捷(合)
- #------------------------------------------------------------------------
- def agi
- n = @agi
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.agi(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 最大hp(合)
- #------------------------------------------------------------------------
- def maxhp
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.maxhp(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 最大mp(合)
- #------------------------------------------------------------------------
- def maxmp
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.maxmp(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 命中率(合)
- #------------------------------------------------------------------------
- def hit
- n = @hit
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.hit end
- n = 100 if n > 100
- end
- return n
- end
- #------------------------------------------------------------------------
- # 闪避率(合)
- #------------------------------------------------------------------------
- def eva
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.eva end
- n = 100 if n > 100
- end
- return n
- end
- #------------------------------------------------------------------------
- # 暴击率(合)
- #------------------------------------------------------------------------
- def cri
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.cri end
- n = 100 if n > 100
- end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 经验(百分比)(已舍弃不用)
- #--------------------------------------------------------------------------
- def exp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.exp end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 高级装备暴率(百分比)(已舍弃不用)
- #--------------------------------------------------------------------------
- def equip_chance
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.equip_chance end
- return n
- end
- end
- end
- #==============================================================================
- # ■ RPG::Armor
- #==============================================================================
- module RPG
- class Armor < BaseItem
- #------------------------------------------------------------------------
- # 附加属性
- #------------------------------------------------------------------------
- attr_accessor :base_id
- attr_accessor :actor_id
- attr_accessor :gifts
- #------------------------------------------------------------------------
- # 装备基本属性定义
- #------------------------------------------------------------------------
- def base_atk
- return @atk
- end
- def base_def
- return @def
- end
- def base_spi
- return @spi
- end
- def base_agi
- return @agi
- end
- #------------------------------------------------------------------------
- # 攻击力(合)
- #------------------------------------------------------------------------
- def atk
- n = @atk
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.atk(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 防御力(合)
- #------------------------------------------------------------------------
- def def
- n = @def
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.def(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 魔力(合)
- #------------------------------------------------------------------------
- def spi
- n = @spi
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.spi(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 敏捷(合)
- #------------------------------------------------------------------------
- def agi
- n = @agi
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.agi(actor_id) end
- for g in @gifts.compact do n += g.all_atribute(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 最大hp(合)
- #------------------------------------------------------------------------
- def maxhp
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.maxhp(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 最大mp(合)
- #------------------------------------------------------------------------
- def maxmp
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.maxmp(actor_id) end
- end
- return n
- end
- #------------------------------------------------------------------------
- # 命中率(合)
- #------------------------------------------------------------------------
- def hit
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.hit end
- end
- n = 100 if n > 100
- return n
- end
- #------------------------------------------------------------------------
- # 闪避率(合)
- #------------------------------------------------------------------------
- def eva
- n = @eva
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.eva end
- end
- n = 100 if n > 100
- return n
- end
- #------------------------------------------------------------------------
- # 暴击率(合)
- #------------------------------------------------------------------------
- def cri
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.cri end
- end
- n = 100 if n > 100
- return n
- end
- #------------------------------------------------------------------------
- # 抗魔性(合)
- #------------------------------------------------------------------------
- def mdf
- n = 0
- @gifts = [] if @gifts.nil?
- @dur = self.read_note('耐久度').to_i if @dur.nil?
- if @dur > 0
- for g in @gifts.compact do n += g.mdf end
- end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 经验(百分比)(已舍弃不用)
- #--------------------------------------------------------------------------
- def exp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.exp end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 高级装备暴率(百分比)(已舍弃不用)
- #--------------------------------------------------------------------------
- def equip_chance
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.equip_chance end
- return n
- end
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 基本 MaxHP の取得
- #--------------------------------------------------------------------------
- def base_maxhp
- n = actor.parameters[0, @level]
- for item in equips.compact do n += item.maxhp if item.dur > 0 end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取基本 MaxMP
- #--------------------------------------------------------------------------
- def base_maxmp
- n = actor.parameters[1, @level]
- for item in equips.compact do n += item.maxmp if item.dur > 0 end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取自身 MaxHP
- #--------------------------------------------------------------------------
- def self_maxhp
- return actor.parameters[0, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取自身 MaxMP
- #--------------------------------------------------------------------------
- def self_maxmp
- return actor.parameters[1, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取自身攻击力
- #--------------------------------------------------------------------------
- def self_atk
- return actor.parameters[2, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取自身防御力
- #--------------------------------------------------------------------------
- def self_def
- return actor.parameters[3, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取自身精神力
- #--------------------------------------------------------------------------
- def self_spi
- return actor.parameters[4, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取自身敏捷性
- #--------------------------------------------------------------------------
- def self_agi
- return actor.parameters[5, @level]
- end
- #--------------------------------------------------------------------------
- # ● 获取命中率
- #--------------------------------------------------------------------------
- def hit
- n = 80
- for e in equips.compact do n += e.hit if e.dur > 0 end
- n = 100 if n > 100
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取回避率
- #--------------------------------------------------------------------------
- def eva
- n = 5
- for e in equips.compact do n += e.eva if e.dur > 0 end
- n = 100 if n > 100
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取会心一击概率
- #--------------------------------------------------------------------------
- def cri
- n = 4
- n += 4 if actor.critical_bonus
- for e in equips.compact do n += e.cri if e.dur > 0 end
- n = 100 if n > 100
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取抗魔性(等于(魔力+防御)的20分之1)
- #--------------------------------------------------------------------------
- def mdf
- mdf = (self.spi + self.def) / 20
- for e in equips.compact do mdf += equip.mdf if e.dur > 0 end
- return mdf
- end
- #--------------------------------------------------------------------------
- # ● 获取更多经验值(已舍弃不用)
- #--------------------------------------------------------------------------
- def exp_added
- exp = 100
- for equip in equips.compact
- exp += equip.exp
- end
- return exp
- end
- #--------------------------------------------------------------------------
- # ● 获取高级物品暴率(已舍弃不用)
- #--------------------------------------------------------------------------
- def equip_chance
- equip_chance = 0
- for equip in equips.compact
- equip_chance += equip.equip_chance
- end
- return equip_chance
- end
- #--------------------------------------------------------------------------
- # ● 获得经验值 (考虑到附加经验值)(舍弃不用)
- # exp : 经验值增加量
- # show : 显示升级标志
- #--------------------------------------------------------------------------
- #~ def gain_exp(exp, show)
- #~ change_exp([url=home.php?mod=space&uid=13302]@exp[/url] + exp * exp_added, show)
- #~ end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 初始化对象
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- def initialize(actor_id)
- super()
- setup(actor_id)
- @last_skill_id = 0
- end
- #--------------------------------------------------------------------------
- # ● 设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- def setup(actor_id)
- actor = $data_actors[actor_id]
- @actor_id = actor_id
- @name = actor.name
- @character_name = actor.character_name
- @character_index = actor.character_index
- @face_name = actor.face_name
- @face_index = actor.face_index
- @class_id = actor.class_id
- @weapon_id = actor.weapon_id
- @armor1_id = actor.armor1_id
- @armor2_id = actor.armor2_id
- @armor3_id = actor.armor3_id
- @armor4_id = actor.armor4_id
- [url=home.php?mod=space&uid=22147]@level[/url] = actor.initial_level
- @exp_list = Array.new(101)
- make_exp_list
- @exp = @exp_list[@level]
- @skills = []
- for i in self.class.learnings
- learn_skill(i.skill_id) if i.level <= @level
- end
- clear_extra_values
- recover_all
- ## 生成新装备id
- reset_equip_id
- end
- #--------------------------------------------------------------------------
- # ● 装备重设
- #--------------------------------------------------------------------------
- def reset_equip_id
- @weapon_id = Game_Equip.reini_id(@weapon_id, 0)
- @armor1_id = Game_Equip.reini_id(@armor1_id, two_hands_legal? ? 0 : 1)
- @armor2_id = Game_Equip.reini_id(@armor2_id, 1)
- @armor3_id = Game_Equip.reini_id(@armor3_id, 1)
- @armor4_id = Game_Equip.reini_id(@armor4_id, 1)
- end
- #--------------------------------------------------------------------------
- # ● 判断是否可以装备
- # item : 物品
- # base : 是否读取母版数据
- #--------------------------------------------------------------------------
- def equippable?(item, base = true)
- return false if item.nil?
- return false if self.level < item.read_note('装备等级').to_i
- id = base ? item.base_id : item.id
- if item.is_a?(RPG::Weapon)
- return self.class.weapon_set.include?(id)
- elsif item.is_a?(RPG::Armor)
- return false if two_swords_style and item.kind == 0
- return self.class.armor_set.include?(id)
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 更改装备 (指定对象)
- # equip_type : 装备部位 (0..4)
- # item : 武器 or 防具 (nil 为解除装备)
- # test : 测试标志 (战斗测试、以及装备画面的临时装备)
- #--------------------------------------------------------------------------
- def change_equip(equip_type, item, test = false)
- last_item = equips[equip_type]
- unless test
- return if $game_party.item_number(item) == 0 if item != nil
- $game_party.gain_item(last_item, 1)
- $game_party.lose_item(item, 1)
- last_item.actor_id = nil unless last_item.nil?
- end
- item_id = item == nil ? 0 : item.id
- case equip_type
- when 0 # 武器
- @weapon_id = item_id
- unless two_hands_legal? # 违反双手拿取的情况下
- change_equip(1, nil, test) # 解除反手的装备
- end
- when 1 # 盾
- @armor1_id = item_id
- unless two_hands_legal? # 违反双手拿取的情况下
- change_equip(0, nil, test) # 解除反手的装备
- end
- when 2 # 头
- @armor2_id = item_id
- when 3 # 身体
- @armor3_id = item_id
- when 4 # 装饰品
- @armor4_id = item_id
- end
- item.actor_id = self.id unless item.nil?
- end
- end
- #==============================================================================
- # ■ Game_Party
- #==============================================================================
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● 判断持有的空属性的武器
- # item : 物品
- #--------------------------------------------------------------------------
- def has_weapon_no_gifts?(item)
- for i in items
- if i.is_a?(RPG::Weapon)
- if i.gifts == nil or i.gifts == []
- return true if i.base_id == item.id
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断持有的空属性的防具
- # item : 物品
- #--------------------------------------------------------------------------
- def has_armor_no_gifts?(item)
- for i in items
- if i.is_a?(RPG::Armor)
- if i.gifts == nil or i.gifts == []
- return true if i.base_id == item.id
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断持有的武器,防止武器防具判断混淆
- # item : 物品
- # include_equip : 包括装备品
- #--------------------------------------------------------------------------
- def has_weapon_by_base_id?(item, include_equip = false)
- for i in items
- if i.is_a?(RPG::Weapon)
- return true if i.base_id == item.id
- end
- end
- if include_equip
- for actor in members
- for e in actor.equips
- if e.is_a?(RPG::Weapon)
- return true if e.base_id == item.id
- end
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断持有的防具,防止武器防具判断混淆
- # item : 物品
- # include_equip : 包括装备品
- #--------------------------------------------------------------------------
- def has_armor_by_base_id?(item, include_equip = false)
- for i in items
- if i.is_a?(RPG::Armor)
- return true if i.base_id == item.id
- end
- end
- if include_equip
- for actor in members
- for e in actor.equips
- if e.is_a?(RPG::Armor)
- return true if e.base_id == item.id
- end
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 判断持有的武器数量,可以用$game_party.weapon_num($base_weapons[301])判断301号防具的数量
- # item : 物品
- #--------------------------------------------------------------------------
- def weapon_num(item)
- num = 0
- for i in items
- if i.is_a?(RPG::Weapon)
- if i.base_id == item.id
- num +=1
- end
- end
- end
- return num
- end
- #--------------------------------------------------------------------------
- # ● 判断持有的防具数量
- # item : 物品
- #--------------------------------------------------------------------------
- def armor_num(item)
- num = 0
- for i in items
- if i.is_a?(RPG::Armor)
- if i.base_id == item.id
- num +=1
- end
- end
- end
- return num
- end
- #--------------------------------------------------------------------------
- # ● 获得物品
- # item : 物品
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_reini(item, n, include_equip = false, *gift)
- if n < 0
- lose_item(item, -n, include_equip = false)
- else
- case item
- when RPG::Item
- number = item_number(item)
- @items[item.id] = [[number + n, 0].max, 9999].min
- when RPG::Weapon
- j = 1
- for i in 0...n
- while @item[j] != 0
- break if @item[j] == nil
- j += 1
- end
- @item[j] = item
- @weapon[j] = a = Game_Equip.reini(item, *gift)
- @weapon[j].gifts = [] if @weapon[j].gifts == nil
- @weapons[a.id] = 1
- end
- when RPG::Armor
- j = 1
- for i in 0...n
- while @item[j] != 0
- break if @item[j] == nil
- j += 1
- end
- @item[j] = item
- @armor[j] = a = Game_Equip.reini(item, *gift)
- @armor[j].gifts = [] if @armor[j].gifts == nil
- @armors[a.id] = 1
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 减少物品 (减少),商店卖武器防具调用
- # item : 物品
- # n : 个数
- # include_equip : 包括装备品
- #--------------------------------------------------------------------------
- def lose_reini(item, n, include_equip = false )
- number = item_number(item)
- case item
- when RPG::Item
- @items[item.id] = [[number - n, 0].max, 9999].min
- when RPG::Weapon
- @weapons[item.id] = [[number - n, 0].max, 9999].min
- when RPG::Armor
- @armors[item.id] = [[number - n, 0].max, 9999].min
- end
- n -= number
- if include_equip and n > 0
- for actor in members
- while n > 0 and actor.equips.include?(item)
- actor.discard_equip(item)
- n -= 1
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 减少物品 (减少),为了不与商店卖东西冲突
- # item : 物品
- # n : 个数
- # include_equip : 包括装备品
- # type : 全部丢失时要添丢失的装备种类,1、2、3分别对应物品、武器和防具
- # all_lose :全部丢失
- #--------------------------------------------------------------------------
- def weapon_armor_lose_reini(item, n, include_equip = false, type = nil, all_lose = false )
- return if n == 0
- unless all_lose == true
- number = item_number(item)
- case item
- when RPG::Item
- @items[item.id] = [[number - n, 0].max, 9999].min
- when RPG::Weapon
- for i in [email protected]
- unless @weapon[i] == nil
- if @weapon[i].base_id == item.id and @weapons[@weapon[i].id] == 1
- @weapons[@weapon[i].id] = 0
- n -= 1
- break if n == 0
- end
- end
- end
- when RPG::Armor
- for i in [email protected]
- unless @armor[i] == nil
- if @armor[i].base_id == item.id and @armors[@armor[i].id] == 1
- @armors[@armor[i].id] = 0
- n -= 1
- break if n == 0
- end
- end
- end
- end
- n -= number
- if include_equip and n > 0
- for actor in members
- while n > 0 and actor.equips.include?(item)
- actor.discard_equip(item)
- n -= 1
- end
- end
- end
- else #这里all_lose == false
- case type
- when 1
- for i in items
- if i.is_a?(RPG::Item)
- $game_party.lose_item(i, 9999)
- end
- end
- when 2
- for i in items
- if i.is_a?(RPG::Weapon)
- $game_party.lose_item(i, 99)
- end
- end
- when 3
- for i in items
- if i.is_a?(RPG::Armor)
- $game_party.lose_item(i, 99)
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 空属性物品减少,只减少属性为空的武器防具
- # item : 物品
- # type : 种类 武器=1 ,防具=2
- # n : 个数
- #--------------------------------------------------------------------------
- def gifts_nil_lose(item,type ,n)
- if type == 1
- weapons_num = 0
- for i in items
- if i.is_a?(RPG::Weapon)
- if i.gifts == nil or i.gifts == []
- if i.base_id == item.id
- weapons_num += 1
- @weapons[i.id] = 0
- break if n == weapons_num
- end
- end
- end
- end
- elsif type == 2
- armors_num = 0
- for i in items
- if i.is_a?(RPG::Armor)
- if i.gifts == nil or i.gifts == []
- if i.base_id == item.id
- armors_num += 1
- @armors[i.id] = 0
- break if n == armors_num
- end
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 获得物品
- # item_id : 物品id
- # type : 类型(0物品, 1武器, 2防具)
- # n : 个数
- #--------------------------------------------------------------------------
- def gain_reini_byid(item_id, type, n, include_equip = false, *gift)
- case type
- when 0
- item = $data_items[item_id]
- when 1
- item = $base_weapons[item_id]
- when 2
- item = $base_armors[item_id]
- end
- gain_reini(item, n, include_equip, *gift)
- end
- #--------------------------------------------------------------------------
- # ● 极品爆率
- #--------------------------------------------------------------------------
- def equip_chance
- chance = Game_Equip::Equip_Chance[0]
- members.each {|actor| chance += actor.equip_chance}
- return chance
- end
- end
- #==============================================================================
- # ■ Game_Troop
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # ● 敌人角色名称后的文字表
- #--------------------------------------------------------------------------
- LETTER_TABLE = [ 'A','B','C','D','E','F','G','H','I','J',
- 'K','L','M','N','O','P','Q','R','S','T',
- 'U','V','W','X','Y','Z']
- #--------------------------------------------------------------------------
- # ● 按顺序排列数组
- #--------------------------------------------------------------------------
- def convert_integer_array(array)
- result = []
- array.each { |i|
- if i.is_a?(Range)
- result |= i.to_a
- elsif i.is_a?(Integer)
- result |= [i]
- end
- }
- return result
- end
- #--------------------------------------------------------------------------
- # ● 生成掉落装备与敌人队伍的对应列表
- #--------------------------------------------------------------------------
- def equip_id_table
- equip_table = PA::EQUIP_TABLE
- troop_lv = []
- troop_weapon = []
- troop_armor = []
- for i in 0...equip_table.size
- equip_table[i] = convert_integer_array(equip_table[i])
- end
- for i in 0...equip_table.size
- troop_lv << equip_table[i] if i % 3 == 0
- troop_weapon << equip_table[i] if i % 3 == 1
- troop_armor << equip_table[i] if i % 3 == 2
- end
- for i in 0...troop_lv.size
- if troop_lv[i].include?(@troop_id)
- $random_weapon = troop_weapon[i][rand(troop_weapon[i].size)]
- $random_armor = troop_armor[i][rand(troop_armor[i].size)]
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 生成掉落物品队列
- #--------------------------------------------------------------------------
- def make_drop_items
- drop_items = []
- # 每个死亡的敌人掉落物品
- # 除了属性水晶之外,数据库里面设计掉落装备无效化,掉落物品有效。
- for enemy in dead_members
- for di in [enemy.drop_item1, enemy.drop_item2]
- next if di.kind == 0
- next if rand(di.denominator) != 0
- if di.kind == 1 # 掉落物品
- drop_items.push($data_items[di.item_id])
- elsif di.kind == 2 # 掉落武器(无效)
- elsif di.kind == 3 # 掉落防具(除了属性水晶之外无效)
- item = reini_chance($base_armors[PA::CRYSTAL])
- drop_items.push(item)
- end
- end
- end
- # 每个死亡的敌人掉落的装备计算
- for i in 0...dead_members.size
- equip_id_table
- if rand(100) < PA::DROP_PROBABILITY
- type = rand(4)
- case type
- when 0
- item = reini_chance($base_weapons[$random_weapon],true)
- drop_items.push(item)
- when 1,2,3
- item = reini_chance($base_armors[$random_armor],true)
- drop_items.push(item)
- end
- end
- end
- # 每胜利一次,默认属性水晶暴率
- drop_items.push(reini_chance($base_armors[PA::CRYSTAL])) if rand(PA::DROP_CRYSTAL_PRO) == 0
- return drop_items
- end
- #--------------------------------------------------------------------------
- # ● 处理极品爆率
- # normal_troop为false时,才可以获得4个属性以上的装备,用于BOSS装备的掉落
- #--------------------------------------------------------------------------
- def reini_chance(item, normal_troop = false)
- @item = item
- [url=home.php?mod=space&uid=115736]@Chance[/url] = 1 + rand(100)
- @gifts = []
- num = 0
- loop do
- if rand(80) <= @chance and @gifts.size < Game_Equip::GiftMax
- @chance = @chance * 8 / 10
- num += 1
- break if num >= 3 and normal_troop == true #普通敌人最多掉落名器或名装
- break if num >= 6
- else
- break
- end
- end
- gifts = []
- rd = []
- rd_1 = []
- if item.is_a?(RPG::Weapon)
- rd_1 = different_rand(PA::WEAPON_E.size - 1, num)
- for i in 0...num
- rd << PA::WEAPON_E[rd_1[i]]
- end
- end
- if item.is_a?(RPG::Armor)
- case item.kind
- when 0
- rd_1 = different_rand(PA::SHIELD_E.size - 1, num)
- for i in 0...num
- rd << PA::SHIELD_E[rd_1[i]]
- end
- when 1
- rd_1 = different_rand(PA::HELMET_E.size - 1, num)
- for i in 0...num
- rd << PA::HELMET_E[rd_1[i]]
- end
- when 2
- rd_1 = different_rand(PA::CLOTHE_E.size - 1, num)
- for i in 0...num
- rd << PA::CLOTHE_E[rd_1[i]]
- end
- end
- end
- if @item.is_a?(RPG::Armor)
- if @item.id == PA::CRYSTAL
- return Game_Equip.reini(@item, [])
- else
- rd.each{|n| gifts.push Game_Gift.new(n)}
- return Game_Equip.reini(@item, gifts)
- end
- else
- rd.each{|n| gifts.push Game_Gift.new(n)}
- return Game_Equip.reini(@item, gifts)
- end
- end
- end
- #==============================================================================
- # ■ Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- #--------------------------------------------------------------------------
- # ● 计算操作的值
- # operation : 操作 (0:增加 1:减少)
- # operand_type : 运算域类型 (0:常量 1:变量)
- # operand : 运算域 (数值为变量 ID)
- #--------------------------------------------------------------------------
- def operate_value(operation, operand_type, operand)
- if operand_type == 0
- value = operand
- else
- value = $game_variables[operand]
- end
- if operation == 1
- value = -value
- end
- return value
- end
- #--------------------------------------------------------------------------
- # ● 条件分歧
- #--------------------------------------------------------------------------
- def command_111
- result = false
- case @params[0]
- when 0 # 开关
- result = ($game_switches[@params[1]] == (@params[2] == 0))
- when 1 # 变量
- value1 = $game_variables[@params[1]]
- if @params[2] == 0
- value2 = @params[3]
- else
- value2 = $game_variables[@params[3]]
- end
- case @params[4]
- when 0 # 相等
- result = (value1 == value2)
- when 1 # 大于等于
- result = (value1 >= value2)
- when 2 # 小于等于
- result = (value1 <= value2)
- when 3 # 大于
- result = (value1 > value2)
- when 4 # 小于
- result = (value1 < value2)
- when 5 # 不等于
- result = (value1 != value2)
- end
- when 2 # 自我开关
- if @original_event_id > 0
- key = [@map_id, @original_event_id, @params[1]]
- if @params[2] == 0
- result = ($game_self_switches[key] == true)
- else
- result = ($game_self_switches[key] != true)
- end
- end
- when 3 # 计时器
- if $game_system.timer_working
- sec = $game_system.timer / Graphics.frame_rate
- if @params[2] == 0
- result = (sec >= @params[1])
- else
- result = (sec <= @params[1])
- end
- end
- when 4 # 角色
- actor = $game_actors[@params[1]]
- if actor != nil
- case @params[2]
- when 0 # 是同伴
- result = ($game_party.members.include?(actor))
- when 1 # 姓名
- result = (actor.name == @params[3])
- when 2 # 特技
- result = (actor.skill_learn?($data_skills[@params[3]]))
- when 3 # 武器
- ## 判断是否符合母版id
- actor.weapons.each do |weapon|
- if weapon.base_id == @params[3]
- result = true
- break
- end
- end
- when 4 # 防具
- ## 判断是否符合母版id
- actor.armors.each do |armor|
- if armor.base_id == @params[3]
- result = true
- break
- end
- end
- when 5 # 状态
- result = (actor.state?(@params[3]))
- end
- end
- when 5 # 敌方角色
- enemy = $game_troop.members[@params[1]]
- if enemy != nil
- case @params[2]
- when 0 # 出现
- result = (enemy.exist?)
- when 1 # 状态
- result = (enemy.state?(@params[3]))
- end
- end
- when 6 # 角色
- character = get_character(@params[1])
- if character != nil
- result = (character.direction == @params[2])
- end
- when 7 # 金钱
- if @params[2] == 0
- result = ($game_party.gold >= @params[1])
- else
- result = ($game_party.gold <= @params[1])
- end
- when 8 # 物品
- result = $game_party.has_item?($data_items[@params[1]])
- when 9 # 武器
- result = $game_party.has_weapon_by_base_id?($base_weapons[@params[1]], @params[2])
- when 10 # 防具
- result = $game_party.has_armor_by_base_id?($base_armors[@params[1]], @params[2])
- when 11 # 按钮
- result = Input.press?(@params[1])
- when 12 # 脚本
- result = eval(@params[1])
- when 13 # 交通工具
- result = ($game_player.vehicle_type == @params[1])
- end
- @branch[@indent] = result # 将判断结果放置在缓存中
- if @branch[@indent] == true
- @branch.delete(@indent)
- return true
- end
- return command_skip
- end
- #--------------------------------------------------------------------------
- # ● 计算装备操作的值
- # operand_type : 运算域类型 (0:常量 1:变量)
- # operand : 运算域 (数值为变量 ID)
- #--------------------------------------------------------------------------
- def opera_equip_value(operation, operand_type, operand)
- if operand_type == 0
- value = operand
- else
- value = $game_variables[operand]
- end
- return value
- end
- #--------------------------------------------------------------------------
- # ● 更改装备
- #--------------------------------------------------------------------------
- def command_319
- actor = $game_actors[@params[0]]
- if actor != nil
- actor.change_equip_by_id(@params[1], @params[2])
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 增减武器
- #--------------------------------------------------------------------------
- def get_weapon(id, n, *gift)
- $game_party.gain_reini($base_weapons[id], n, false, *gift)
- end
- #--------------------------------------------------------------------------
- # ● 增减防具
- #--------------------------------------------------------------------------
- def get_armor(id, n, *gift)
- $game_party.gain_reini($base_armors[id], n, false, *gift)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- def draw_item_name(item, x, y, enabled = true)
- if item != nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = text_color(item.text_color.to_i)
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x + 24, y, 172, WLH, item.name)
- end
- end
- end
- #==============================================================================
- # ■ Window_ShopBuy
- #==============================================================================
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @data = []
- for goods_item in @shop_goods
- case goods_item[0]
- when 0
- item = $data_items[goods_item[1]]
- when 1
- item = $base_weapons[goods_item[1]]
- when 2
- item = $base_armors[goods_item[1]]
- end
- if item != nil
- @data.push(item)
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #==============================================================================
- # ■ Window_ShopStatus
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 描绘角色现在装备的能力值变化
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_actor_parameter_change(actor, x, y)
- return if @item.is_a?(RPG::Item)
- enabled = actor.equippable?(@item, false)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x, y, 200, WLH, actor.name)
- if @item.is_a?(RPG::Weapon)
- item1 = weaker_weapon(actor)
- elsif actor.two_swords_style and @item.kind == 0
- item1 = nil
- else
- item1 = actor.equips[1 + @item.kind]
- end
- if enabled
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 == nil ? 0 : item1.atk
- atk2 = @item == nil ? 0 : @item.atk
- change = atk2 - atk1
- else
- def1 = item1 == nil ? 0 : item1.def
- def2 = @item == nil ? 0 : @item.def
- change = def2 - def1
- end
- self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
- end
- draw_item_name(item1, x, y + WLH, enabled)
- end
- end
- #==============================================================================
- # ■ Scene_File
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入文件用对象 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for actor in $game_party.members
- characters.push([actor.character_name, actor.character_index])
- end
- $game_system.save_count += 1
- $game_system.version_id = $data_system.version_id
- @last_bgm = RPG::BGM::last
- @last_bgs = RPG::BGS::last
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- Marshal.dump(@last_bgm, file)
- Marshal.dump(@last_bgs, file)
- Marshal.dump($game_system, file)
- Marshal.dump($game_message, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- Marshal.dump($data_weapons, file)
- Marshal.dump($data_armors, file)
- end
- #--------------------------------------------------------------------------
- # ● 读取存档数据
- # file : 读取文件用对象 (已经打开)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $data_weapons = Marshal.load(file)
- $data_armors = Marshal.load(file)
- if $game_system.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Shop
- #==============================================================================
- class Scene_Shop < Scene_Base
- #--------------------------------------------------------------------------
- # ● 确定输入个数
- #--------------------------------------------------------------------------
- def decide_number_input
- Sound.play_shop
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 购买
- $game_party.lose_gold(@number_window.number * @item.price)
- $game_party.gain_reini(@item, @number_window.number)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- $game_party.gain_gold(@number_window.number * (@item.price / 2))
- $game_party.lose_reini(@item, @number_window.number)
- @gold_window.refresh
- @sell_window.contents.clear
- @sell_window.set_item_sell(@itemcommand_window.commands[@command_index])
- @status_window.refresh
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- @itemcommand_window.visible = true
- end
- end
- end
- #==============================================================================
- # ■ Scene_Title
- #==============================================================================
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------
- # ● 载入数据库
- #--------------------------------------------------------------------------
- def load_database
- $data_actors = load_data("Data/Actors.rvdata")
- $data_classes = load_data("Data/Classes.rvdata")
- $data_skills = load_data("Data/Skills.rvdata")
- $data_items = load_data("Data/Items.rvdata")
- $base_weapons = load_data("Data/Weapons.rvdata")
- $base_armors = load_data("Data/Armors.rvdata")
- $data_enemies = load_data("Data/Enemies.rvdata")
- $data_troops = load_data("Data/Troops.rvdata")
- $data_states = load_data("Data/States.rvdata")
- $data_animations = load_data("Data/Animations.rvdata")
- $data_common_events = load_data("Data/CommonEvents.rvdata")
- $data_system = load_data("Data/System.rvdata")
- $data_areas = load_data("Data/Areas.rvdata")
- $data_weapons = [nil]
- $data_armors = [nil]
- end
- #--------------------------------------------------------------------------
- # ● 载入战斗测试用的数据库
- #--------------------------------------------------------------------------
- def load_bt_database
- $data_actors = load_data("Data/BT_Actors.rvdata")
- $data_classes = load_data("Data/BT_Classes.rvdata")
- $data_skills = load_data("Data/BT_Skills.rvdata")
- $data_items = load_data("Data/BT_Items.rvdata")
- $data_weapons = load_data("Data/BT_Weapons.rvdata")
- $data_armors = load_data("Data/BT_Armors.rvdata")
- $data_enemies = load_data("Data/BT_Enemies.rvdata")
- $data_troops = load_data("Data/BT_Troops.rvdata")
- $data_states = load_data("Data/BT_States.rvdata")
- $data_animations = load_data("Data/BT_Animations.rvdata")
- $data_common_events = load_data("Data/BT_CommonEvents.rvdata")
- $data_system = load_data("Data/BT_System.rvdata")
- $base_weapons = $data_weapons
- $base_armors = $data_armors
- end
- end
复制代码 |
|