赞 | 50 |
VIP | 429 |
好人卡 | 14 |
积分 | 8 |
经验 | 146370 |
最后登录 | 2022-6-27 |
在线时间 | 3431 小时 |
Lv2.观梦者 会吐槽的画师
- 梦石
- 0
- 星屑
- 782
- 在线时间
- 3431 小时
- 注册时间
- 2011-6-10
- 帖子
- 6535
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 上贺茂润 于 2014-6-3 13:44 编辑
@丁凯乐 @美丽晨露 @铃仙·优昙华院·因幡 @弗雷德 @完全默认 @火烧兔子 @星尘泪 @王硕 @小九九 @正太君
这里是随机属性和详尽帮助的脚本 请正太小九九或者乐乐做一个饰品,增加暴击 命中 和 闪避 三项属性,有500糖相送哦~
#============================================================================== # 复杂装备系统之随机属性 by 沉影不器 # protosssonny修改版 #------------------------------------------------------------------------------ # 神宝 只要弄饰品的暴击 闪避 和命中就好了,其他武器 防具 头部 都不用,最好是在饰品的 #备注里写 暴击+N 然后就显示+N #============================================================================== # 参数设定 #============================================================================== module Game_Equip ## 最大附加属性数 GiftMax = 7 ## 附加属性影响价格基数 GiftPrice = 10 ## 极品爆率最低值和最高值(0到100) Equip_Chance = [10, 90] ## 附加属性各参数: ## name 添加到装备前的修饰词 ## max 该属性最大值 ## weight 权重(最大值的权重,用于计算价值,用于计算颜色也行) ## percent 是否按百分比计算 Gift = Struct.new(:name, :max, :weight, :percent) Gifts = [ # 攻击 Gift.new("", 60, 40, false), Gift.new("", 10, 40, true), # 防御 Gift.new("", 60, 40, false), Gift.new("", 10, 40, true), # 精神 Gift.new("", 60, 40, false), Gift.new("", 10, 40, true), # 敏捷 Gift.new("", 60, 40, false), Gift.new("", 10, 40, true), # hp Gift.new("", 800, 40, false), Gift.new("", 10, 40, true), # mp Gift.new("", 120, 40, false), Gift.new("", 10, 40, true), # 命中 Gift.new("", 12, 50,false), # 闪避 Gift.new("", 12, 50, false), # 暴击 Gift.new("", 10, 60, false), # 所有主要属性,最多+20% Gift.new("", 6, 50, true), Gift.new("", 25, 50, false), # 抗魔性 ###(待定) 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 = 30 when 5 result.text_color = 26 when 6 result.text_color = 20 when 7 result.text_color = 10 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 and @type != 16 if percent return $game_actors[actor_id].self_maxmp * @value / 100 else return @value end 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 [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.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#这只是武器 #如果二刀流解决不了就改武器的命中,星标 命中率最终 这是一个双重判断 miss和回避的判断 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 end return n end #-------------------------------------------------------------------------- # ● 获取基本 MaxMP #-------------------------------------------------------------------------- def base_maxmp n = actor.parameters[1, @level] for item in equips.compact do n += item.maxmp 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 = 50+(self.agi/15.0).round for e in equips.compact do n += e.hit end #★不摒弃装备命中 n = 100 if n > 100 return n end #-------------------------------------------------------------------------- # ● 获取回避率 #-------------------------------------------------------------------------- def eva n = 5+(self.agi/25.0).round for e in equips.compact do n += e.eva end n = 100 if n > 100 return n end #-------------------------------------------------------------------------- # ● 获取会心一击概率 #-------------------------------------------------------------------------- def cri n = 4+(self.agi/25.0).round n = 5+((self.agi/25.0)*1.1) if actor.critical_bonus for e in equips.compact do n += e.cri 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 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 [url=home.php?mod=space&uid=13302]@exp[/url] = @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]0...@weapon.size[/email] 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]0...@armor.size[/email] 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) <= [url=home.php?mod=space&uid=115736]@Chance[/url] 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) Marshal.dump($data_skills, 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) $data_skills = 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
#==============================================================================
# 复杂装备系统之随机属性 by 沉影不器
# protosssonny修改版
#------------------------------------------------------------------------------
# 神宝 只要弄饰品的暴击 闪避 和命中就好了,其他武器 防具 头部 都不用,最好是在饰品的
#备注里写 暴击+N 然后就显示+N
#==============================================================================
# 参数设定
#==============================================================================
module Game_Equip
## 最大附加属性数
GiftMax = 7
## 附加属性影响价格基数
GiftPrice = 10
## 极品爆率最低值和最高值(0到100)
Equip_Chance = [10, 90]
## 附加属性各参数:
## name 添加到装备前的修饰词
## max 该属性最大值
## weight 权重(最大值的权重,用于计算价值,用于计算颜色也行)
## percent 是否按百分比计算
Gift = Struct.new(:name, :max, :weight, :percent)
Gifts = [
# 攻击
Gift.new("", 60, 40, false),
Gift.new("", 10, 40, true),
# 防御
Gift.new("", 60, 40, false),
Gift.new("", 10, 40, true),
# 精神
Gift.new("", 60, 40, false),
Gift.new("", 10, 40, true),
# 敏捷
Gift.new("", 60, 40, false),
Gift.new("", 10, 40, true),
# hp
Gift.new("", 800, 40, false),
Gift.new("", 10, 40, true),
# mp
Gift.new("", 120, 40, false),
Gift.new("", 10, 40, true),
# 命中
Gift.new("", 12, 50,false),
# 闪避
Gift.new("", 12, 50, false),
# 暴击
Gift.new("", 10, 60, false),
# 所有主要属性,最多+20%
Gift.new("", 6, 50, true),
Gift.new("", 25, 50, false),
# 抗魔性 ###(待定)
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 = 30
when 5
result.text_color = 26
when 6
result.text_color = 20
when 7
result.text_color = 10
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 and @type != 16
if percent
return $game_actors[actor_id].self_maxmp * @value / 100
else
return @value
end
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
[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.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#这只是武器
#如果二刀流解决不了就改武器的命中,星标 命中率最终 这是一个双重判断 miss和回避的判断
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 end
return n
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxMP
#--------------------------------------------------------------------------
def base_maxmp
n = actor.parameters[1, @level]
for item in equips.compact do n += item.maxmp 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 = 50+(self.agi/15.0).round
for e in equips.compact do n += e.hit end #★不摒弃装备命中
n = 100 if n > 100
return n
end
#--------------------------------------------------------------------------
# ● 获取回避率
#--------------------------------------------------------------------------
def eva
n = 5+(self.agi/25.0).round
for e in equips.compact do n += e.eva end
n = 100 if n > 100
return n
end
#--------------------------------------------------------------------------
# ● 获取会心一击概率
#--------------------------------------------------------------------------
def cri
n = 4+(self.agi/25.0).round
n = 5+((self.agi/25.0)*1.1) if actor.critical_bonus
for e in equips.compact do n += e.cri 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 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
[url=home.php?mod=space&uid=13302]@exp[/url] = @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]0...@weapon.size[/email]
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]0...@armor.size[/email]
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) <= [url=home.php?mod=space&uid=115736]@Chance[/url] 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)
Marshal.dump($data_skills, 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)
$data_skills = 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
#============================================================================== # ■ Window_Help #------------------------------------------------------------------------------ # 原作:xuelong # 修正:水迭澜 # 移植:禾西 # protosssonny修改版 #============================================================================== class Window_Help < Window_Base #-------------------------------------------------------------------------- # ● 定義 #-------------------------------------------------------------------------- def set @phrase,@y= {}, 0 @scope, @parameter_type = [], [] #@name_size = 名字文字大小 #@size = 描述文字大小 #@word = 每行的描述文字數 @name_size = 18 @size = 15 @word = 10 # 不顯示的 屬性 與 狀態 ID @unshow_elements = [] @unshow_states = [] # 基本文字設定 @phrase[:price] = "售价" @phrase[:elements] = "攻击属性" @phrase[:states] = "附加状态" @phrase[:guard_elements] = "减半属性" @phrase[:guard_states] = "无效化状态" #------------------# # 物品效果語句 # #------------------# @phrase[:recover] = "恢复" @phrase[:hp] = "HP" @phrase[:mp] = "MP" @phrase[:plus_states] = "状态附加" @phrase[:minus_states] = "状态解除" @phrase[:speed] = "速度修正" @phrase[:consumable] = "消耗物品" @phrase[:base_damage] = "基本伤害" #------------------# # 特殊效果語句 # #------------------# @phrase[:special] = "附带属性" @phrase[:two_handed] = "双手武器" @phrase[:fast_attack] = "先发制人" @phrase[:dual_attack] = "连续攻击" @phrase[:critical_bonus] = "频繁暴击" @phrase[:prevent_critical] = "免疫暴击" @phrase[:half_mp_cost] = "耗魔减半" @phrase[:double_exp_gain] = "双倍经验" @phrase[:auto_hp_recover] = "自动恢复" @phrase[:physical_attack] = "物理攻击" @phrase[:damage_to_mp] = "魔法伤害" @phrase[:absorb_damage] = "伤害吸收" @phrase[:ignore_defense] = "无视防御" #------------------# # 技能描述語句 # #------------------# @phrase[:recovery] = "恢复力" @phrase[:mp_cost] = "消耗MP" @phrase[:hit] = "命中率" #------------------# # 效果範圍語句 # #------------------# @phrase[:scope] = "效果范围" @scope[0] = "无" @scope[1] = "敌人" @scope[2] = "敌全体" @scope[3] = "敌单体 连续" @scope[4] = "一至二人" @scope[5] = "二至四人" @scope[6] = "四至十人" @scope[7] = "我方单体" @scope[8] = "我方全体" @scope[9] = "我方单个死亡者" @scope[10] = "我方所有死亡者" @scope[11] = "自己" #------------------# # 效果範圍語句 # #------------------# @parameter_type[1] = "MaxHP" @parameter_type[2] = "MaxMP" @parameter_type[3] = $data_system.terms.atk @parameter_type[4] = $data_system.terms.def @parameter_type[5] = $data_system.terms.spi @parameter_type[6] = $data_system.terms.agi end #-------------------------------------------------------------------------- # ● 初始化對象 #-------------------------------------------------------------------------- def initialize super(240,0,608,WLH + 32) self.opacity = 200 self.z = 150 self.visible = false end #-------------------------------------------------------------------------- # ● 設置文本 # data : 窗口顯示的字符串/物品資料 # align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊) #-------------------------------------------------------------------------- def set_text(data, align=0) #------------------------------------------------------------------------ # ● 當資料爲文字時候 #------------------------------------------------------------------------ if data != @text or align != @align if data.is_a?(String) draw_string(data,align) end end return if data.is_a?(String) #------------------------------------------------------------------------ # ● 當沒有資料時候 #------------------------------------------------------------------------ if data.nil? self.visible=false else self.visible=true end #------------------------------------------------------------------------ # ● 當資料爲物品/技能時候 #------------------------------------------------------------------------ if data != nil && @data != data self.width = 210 self.height = 430 self.x=0 self.y=200 set draw_data(data) else return end end #-------------------------------------------------------------------------- # ● 更新帮助窗口 #-------------------------------------------------------------------------- def draw_string(data,align) self.width = 608 #修正寬度 self.height = WLH + 32 #修正高度 self.x = 240 #修正 x 坐標 self.y = 0 #修正 y 坐標 @text = data #記錄文本資料 @align = align #記錄對齊方式 @actor = nil #清空角色資料 self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil? self.contents.clear self.contents.font.color = normal_color self.contents.font.size = 20 self.contents.draw_text(4 , 0, self.width - 40, 28, data, align) self.visible = true end #-------------------------------------------------------------------------- # ● 更新帮助窗口 #-------------------------------------------------------------------------- def draw_data(data=@data) self.width = 186 #修正寬度 self.height = 430 #修正高度 self.x = 0 #修正 x 坐標 self.y = 150 #修正 y 坐標 @data = data #記錄 data 資料 case @data when RPG::Item set_item_text(@data) when RPG::Weapon, RPG::Armor set_equipment_text(@data) when RPG::Skill set_skill_text(@data) end end #-------------------------------------------------------------------------- # ● 修正窗口位置 #-------------------------------------------------------------------------- def set_pos(x,y,width,oy,index,column_max) cursor_width = width / column_max - 32 xx = index % column_max * (cursor_width + WLH) yy = index / column_max * WLH - oy self.x = xx + x + 140 self.y = yy + y + 35 if self.x + self.width > 608 self.x = 608 - self.width end if self.y + self.height > 480 self.y = 480 - self.height end end #------------------------------------------------------------------------ # ● 文字描繪 #------------------------------------------------------------------------ def draw_text(text, increase, move=0) @y += increase self.contents.font.size = @size @special_size = 0 if @special_size == nil @first_line = 0 if @first_line == nil if @special_size > 0 and not @data.is_a?(RPG::Item) if @y >= increase * @first_line case @special_size when 0 self.contents.font.color = normal_color when 1 self.contents.font.color = text_color(12) when 2 self.contents.font.color = text_color(29) when 3 self.contents.font.color = text_color(17) when 4 self.contents.font.color = text_color(30) when 5 self.contents.font.color = text_color(26) when 6 self.contents.font.color = text_color(20) when 7 self.contents.font.color = text_color(10) end end self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0) else self.contents.font.color = normal_color self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0) end end #-------------------------------------# # 子方法 #-------------------------------------# #-------------------------------------------------------------------------- # ● 裝備幫助窗口 #-------------------------------------------------------------------------- def set_equipment_text(equipment) #------------------------------------------------------------------------ # ● 取得基本質料 #------------------------------------------------------------------------ #----------------------------# # 取得屬性、狀態、說明之副本 # #----------------------------# element_set = equipment.element_set.clone state_set = equipment.state_set.clone description = equipment.description.clone phrase = @phrase #----------------------------# # 過濾不顯示的屬性與狀態描述 # #----------------------------# element_set -= @unshow_elements state_set -= @unshow_states #----------------# # 初始化數據設定 # #----------------# x, h, move = 0, 0, 0 #------------------# # 取得特殊效果數據 # #------------------# special = [] gifts = equipment.gifts gifts = [] if gifts.nil? s = [ "攻击 + [s]", "攻击 + [s]%", "防御 + [s]", "防御 + [s]%", "魔力 + [s]", "魔力 + [s]%", "速度 + [s]", "速度 + [s]%", "最大HP + [s]", "最大HP + [s]%", "最大MP + [s]", "最大MP + [s]%", "命中率 + [s]", "闪避率 + [s]", "暴击率 + [s]", "四项属性 + [s]%","四项属性 + [s]", "抗魔附加 + [s]" ] for g in gifts special << s[g.type].sub(/\[s\]/) {g.value} end #------------------------------------------------------------------------ # ● 確定背景圖片的高度 #------------------------------------------------------------------------ h += (description.size/3/@word) h += 1 if (description.size/3%@word) >= 0 now_h = h h += 1 #價格 h += 1 #装备等级 # h += 1 unless equipment.nodur or PA::USE_DUR == false#耐久度 h += 1 if equipment.sockets_num > 0 #孔数 h += 1 unless equipment.atk.zero? #攻擊力 h += 1 unless equipment.def.zero? #防禦力 h += 1 unless equipment.spi.zero? #精神力 h += 1 unless equipment.agi.zero? #敏捷力 h += element_set.size + 1 if element_set.size > 0 #屬性 h += state_set.size + 1 if state_set.size > 0 #狀態 h += special.size + 2 if special.size > 0 #特殊效果 if special.size > 0 case special.size when 1 @first_line = h-1 when 2 @first_line = h-2 when 3 @first_line = h-3 when 4 @first_line = h-4 when 5 @first_line = h-5 when 6 @first_line = h-6 end end @special_size = special.size #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ #h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * @size + @name_size + 36 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = equipment.name self.contents.font.size = @name_size if text.nil? self.visible = false else self.visible = true ###self.contents.draw_text(0, 0, text.size*7, @name_size, text, 0) #我加的,用case判断颜色 unless equipment.is_a?(RPG::Item) case gifts.size when 1 self.contents.font.color = text_color(12) when 2 self.contents.font.color = text_color(29) when 3 self.contents.font.color = text_color(17) when 4 self.contents.font.color = text_color(31) when 5 self.contents.font.color = text_color(26) when 6 self.contents.font.color = text_color(20) when 7 self.contents.font.color = text_color(10) end else self.contents.font.color = text_color(0) end self.contents.draw_text(0, 0, contents.width-4, @name_size, text) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 @y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = @size self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0) if words_judge(text) == true x += 1 else x += 0.5 end if x == @word or x == @word - 0.5 x = 0 @y += 1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ #bitmap = Cache.system("Iconset") #rect = Rect.new(equipment.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24) #self.contents.blt(0, y*size + 20, bitmap, rect, 255) #------------------------------------------------------------------------ # ● 價格描繪 #------------------------------------------------------------------------ unless equipment.price.zero? text = phrase[:price] + ":" + equipment.price.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 装备等级描繪 #------------------------------------------------------------------------ unless equipment.read_note('装备等级') == nil text = "角色等级要求:" + equipment.read_note('装备等级').to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 耐久度 #------------------------------------------------------------------------ if PA::USE_DUR == true unless equipment.nodur unless equipment.indesctructible if equipment.maxdur == nil text = "耐久度:#{equipment.dur} / #{equipment.read_note('耐久度')}" else text = "耐久度:#{equipment.dur} / #{equipment.maxdur}" end else text = "耐久度:无法破坏" end draw_text(text, 1, move) end end #------------------------------------------------------------------------ # ● 孔数 #------------------------------------------------------------------------ if equipment.sockets_num > 0 text = "剩余孔数:#{equipment.sockets_num}" draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 攻擊力 #------------------------------------------------------------------------ unless equipment.atk.zero? text = $data_system.terms.atk + ":" + equipment.base_atk.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 防禦力 #------------------------------------------------------------------------ unless equipment.def.zero? text = $data_system.terms.def + ":" + equipment.base_def.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 精神力 #------------------------------------------------------------------------ unless equipment.spi.zero? text = $data_system.terms.spi + ":" + equipment.base_spi.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 敏捷力 #------------------------------------------------------------------------ unless equipment.agi.zero? text = $data_system.terms.agi + ":" + equipment.base_agi.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 case equipment when RPG::Weapon text=phrase[:elements]+":" when RPG::Armor text=phrase[:guard_elements]+":" end draw_text(text, 1, move) element_set.each do |i| text = $data_system.elements[i] draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 狀態 #------------------------------------------------------------------------ if state_set.size > 0 case equipment when RPG::Weapon text=phrase[:states]+":" when RPG::Armor text=phrase[:guard_states]+":" end draw_text(text, 1, move) state_set.each do |i| text = $data_states[i].name draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 特殊效果 #------------------------------------------------------------------------ if special.size > 0 kind_text = ["","","",""] weapon_gifts = [0,1,4,5,12,14,15] armor0_gifts = [2,3,4,5,10,11,15,16] armor1_gifts = [2,3,8,9,15,16] armor2_gifts = [2,3,6,7,13,15,16] kind_text[0] = " 武器" if weapon_gifts.include?(equipment.gifts[0].type) kind_text[1] = " 盾牌" if armor0_gifts.include?(equipment.gifts[0].type) kind_text[2] = " 头盔" if armor1_gifts.include?(equipment.gifts[0].type) kind_text[3] = " 身体" if armor2_gifts.include?(equipment.gifts[0].type) if equipment.is_a?(RPG::Armor) and equipment.base_id == PA::CRYSTAL text = "可注入" + kind_text[0] + kind_text[1] + kind_text[2] + kind_text[3] draw_text(text, 1, move) special.each {|text| draw_text(text, 1, move + @size)} else text = phrase[:special]+":" draw_text(text, 1, move) special.each {|text| draw_text(text, 1, move + @size)} end end end #//////////////////////////////////////////////////////////////////////////// #-------------------------------------------------------------------------- # ● 物品幫助窗口 #-------------------------------------------------------------------------- def set_item_text(item) #----------------------------# # 取得屬性、狀態、說明之副本 # #----------------------------# description = item.description.clone element_set = item.element_set.clone plus_state_set = item.plus_state_set.clone minus_state_set = item.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化數據設定 x, h, move = 0, 0, 0 phrase = @phrase scope = @scope parameter_type = @parameter_type occasion = @occasion # 基本文字設定 #------------------# # 取得特殊效果數據 # #------------------# special = [] special << phrase[:physical_attack] if item.physical_attack #物理攻撃 special << phrase[:damage_to_mp] if item.damage_to_mp #MPにダメージ special << phrase[:absorb_damage] if item.absorb_damage #ダメージを吸収 special << phrase[:ignore_defense] if item.ignore_defense #防御力無視 #------------------------------------------------------------------------ # ● 確定背景圖片的高度 #------------------------------------------------------------------------ h += (description.size/3/@word) h += 1 if (description.size/3%@word) >= 0 now_h = h h += 2 unless scope[item.scope] == "无" #効果範囲 h += 1 unless item.price == 0 #價格 h += 1 if item.consumable #消耗品 h += 1 unless item.speed.zero? #速度補正値 h += 1 unless item.hp_recovery_rate==0 and item.hp_recovery==0 #HP 回復 h += 1 unless item.mp_recovery_rate==0 and item.mp_recovery==0 #MP 回復 h += 1 unless item.parameter_type.zero? #能力値 h += 1 unless item.base_damage.zero? #基本ダメージ h += element_set.size + 1 if element_set.size > 0 #屬性 h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態 h += minus_state_set.size + 2 if minus_state_set.size > 0 #解除狀態 h += special.size + 1 if special.size > 0 #特殊效果 #------------------------------------------------------------------------ # ● 圖片顯示保證高度 #------------------------------------------------------------------------ #h = 6 + now_h if (h - now_h) < 6 #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height = h * @size + @name_size + 36 #------------------------------------------------------------------------ # ● 生成背景 #------------------------------------------------------------------------ self.contents = Bitmap.new(self.width - 32, self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描繪 #------------------------------------------------------------------------ text = item.name self.contents.font.color = normal_color#顔色腳本 self.contents.font.size = @name_size if text.nil? self.visible = false else self.visible = true self.contents.draw_text(0,0, text.size*7, 20, text, 0) end #------------------------------------------------------------------------ # ● 說明描繪 #------------------------------------------------------------------------ x = 0 @y += 1 while ((text = description.slice!(/./m)) != nil) self.contents.font.color = normal_color self.contents.font.size = @size self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0) if words_judge(text) == true x+=1 else x+=0.5 end if x == @word or x == @word - 0.5 x = 0 @y += 1 end end #------------------------------------------------------------------------ # ● 圖標描繪 #------------------------------------------------------------------------ #bitmap = Cache.system("Iconset") #rect = Rect.new(item.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24) #self.contents.blt(0, y*size + 20, bitmap, rect, 255) #------------------------------------------------------------------------ # ● 效果範圍 #------------------------------------------------------------------------ unless scope[item.scope] == "无" text = phrase[:scope] +":" draw_text(text, 1, move) text = scope[item.scope] draw_text(text, 1, move + @size) end #------------------------------------------------------------------------ # ● 價格 #------------------------------------------------------------------------ unless item.price == 0 text = phrase[:price] + ":" + item.price.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 消耗品 #------------------------------------------------------------------------ if item.consumable text = phrase[:consumable] draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 速度補正値 #------------------------------------------------------------------------ unless item.speed.zero? text = phrase[:speed] draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● HP回復 #------------------------------------------------------------------------ unless item.hp_recovery_rate.zero? and item.hp_recovery.zero? if item.hp_recovery_rate > 0 and item.hp_recovery > 0 text = " + " else text = "" end unless item.hp_recovery_rate.zero? text = item.hp_recovery_rate.to_s + "%" + text end unless item.hp_recovery.zero? text += item.hp_recovery.to_s end text = phrase[:recover] +":" + text + phrase[:hp] draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● SP回復 #------------------------------------------------------------------------ unless item.mp_recovery_rate.zero? and item.mp_recovery.zero? if item.mp_recovery_rate > 0 and item.mp_recovery > 0 text = " + " else text = "" end unless item.mp_recovery_rate.zero? text = item.mp_recovery_rate.to_s + "%" + text end unless item.mp_recovery.zero? text += item.mp_recovery.to_s end text = phrase[:recover] +":" + text + phrase[:mp] draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 能力值增加 #------------------------------------------------------------------------ unless item.parameter_type.zero? text = parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 基本ダメージ #------------------------------------------------------------------------ unless item.base_damage.zero? #text = phrase[:base_damage] +":" + item.base_damage.to_s text = item.base_damage > 0 ? phrase[:base_damage] +":" + item.base_damage.to_s: phrase[:recovery] +":" + (-item.base_damage).to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 text = phrase[:elements]+":" draw_text(text, 1, move) element_set.each do |i| text = $data_system.elements[i] draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 添加狀態 #------------------------------------------------------------------------ unless plus_state_set.empty? text = phrase[:plus_states]+":" draw_text(text, 1, move) plus_state_set.each do |i| text = $data_states[i].name draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 解除狀態 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase[:minus_states]+":" draw_text(text, 1, move) minus_state_set.each do |i| text = $data_states[i].name draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 特殊效果 #------------------------------------------------------------------------ if special.size > 0 text = phrase[:special]+":" draw_text(text, 1, move) special.each {|text| draw_text(text, 1, move + @size)} end end #//////////////////////////////////////////////////////////////////////////// #-------------------------------------------------------------------------- # ● 技能帮助窗口 #-------------------------------------------------------------------------- def set_skill_text(skill) #----------------------------# # 取得屬性、狀態、說明之副本 # #----------------------------# description = skill.description.clone element_set = skill.element_set.clone plus_state_set = skill.plus_state_set.clone minus_state_set = skill.minus_state_set.clone # 過濾不顯示的描述 element_set -= @unshow_elements plus_state_set -= @unshow_states minus_state_set -= @unshow_states # 初始化設定 x ,h, move = 0, 0, 0 phrase = @phrase scope = @scope #------------------# # 取得特殊效果數據 # #------------------# special = [] special << phrase[:physical_attack] if skill.physical_attack #物理攻撃 special << phrase[:damage_to_mp] if skill.damage_to_mp #MPにダメージ special << phrase[:absorb_damage] if skill.absorb_damage #ダメージを吸収 special << phrase[:ignore_defense] if skill.ignore_defense #防御力無視 #------------------------------------------------------------------------ # ● 確定背景圖片的高度 #------------------------------------------------------------------------ h += (description.size/3/@word) h += 1 if (description.size/3%@word) >= 0 now_h = h h += 4 #効果範囲,消費MP,命中率 h += 1 unless skill.speed.zero? #速度補正値 h += 1 unless skill.base_damage.zero? #基本ダメージ h += element_set.size + 1 if element_set.size > 0 #屬性 h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態 h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態 h += special.size + 1 if special.size > 0 #特殊效果 @special_size = nil @first_line = nil #------------------------------------------------------------------------ # ● 換算高度 #------------------------------------------------------------------------ self.height=(h + 1) * @size + @name_size + 36 self.contents = Bitmap.new(self.width - 32,self.height - 32) self.contents.clear #------------------------------------------------------------------------ # ● 名字描述 #------------------------------------------------------------------------ text = skill.name self.contents.font.color = Color.new(255, 255, 128, 255) self.contents.font.size = @name_size if text!=nil self.visible = true self.contents.draw_text(0,0, text.size*7, @name_size, text, 0) else self.visible = false end #------------------------------------------------------------------------ # ● 說明描述 #------------------------------------------------------------------------ x = 0 @y += 1 text = description text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] } while ((text = description.slice!(/./m)) != nil) self.contents.font.color = Color.new(8, 200, 255, 255)#system_color self.contents.font.size = @size self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0) if words_judge(text) == true x+=1 else x+=0.5 end if x == @word or x == @word - 0.5 x = 0 @y += 1 end end #------------------------------------------------------------------------ # ● 攻擊範圍 #------------------------------------------------------------------------ self.contents.font.color = normal_color text = phrase[:scope] +":" draw_text(text, 1, move) text = scope[skill.scope] draw_text(text, 1, move + @size) #------------------------------------------------------------------------ # ● 基本ダメージ #------------------------------------------------------------------------ unless skill.base_damage .zero? text = skill.base_damage > 0 ? phrase[:base_damage] : phrase[:recovery] text += ":" + skill.base_damage.abs.to_s draw_text(text, 1, move) end #------------------------------------------------------------------------ # ● 消費SP描述 #------------------------------------------------------------------------ text = phrase[:mp_cost] +":"+ skill.mp_cost.to_s if skill.mp_cost == 0 and skill.base_damage .zero? #被动技能调用 text = phrase[:mp_cost] +":"+ "被动技能" end draw_text(text, 1, move) #------------------------------------------------------------------------ # ● 命中率描述 #------------------------------------------------------------------------ text = phrase[:hit] + ":" + skill.hit.to_s + "%" draw_text(text, 1, move) #------------------------------------------------------------------------ # ● 屬性 #------------------------------------------------------------------------ if element_set.size > 0 text = phrase[:elements]+":" draw_text(text, 1, move) element_set.each do |i| text = $data_system.elements[i] draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 添加狀態 #------------------------------------------------------------------------ unless plus_state_set.empty? text = phrase[:plus_states]+":" draw_text(text, 1, move) plus_state_set.each do |i| text = $data_states[i].name draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 解除狀態 #------------------------------------------------------------------------ unless minus_state_set.empty? text = phrase[:minus_states]+":" draw_text(text, 1, move) minus_state_set.each do |i| text = $data_states[i].name draw_text(text, 1, move + @size) end end #------------------------------------------------------------------------ # ● 特殊效果 #------------------------------------------------------------------------ if special.size > 0 text = phrase[:special]+":" draw_text(text, 1, move) special.each {|text| draw_text(text, 1, move + @size)} end end #------------------------------------------------------------------------ # ● 文字数字判定 #------------------------------------------------------------------------ def words_judge(word) case word when "0","1","2","3","4","5","6","7","8","9","%",".","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","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" return false end return true end end #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_Item < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- 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 #============================================================================== # ■ Window_Skill #------------------------------------------------------------------------------ # スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。 #============================================================================== class Window_Skill < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(skill) if skill != nil @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) else @help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见 end end end #============================================================================== # ■ Window_Equip #------------------------------------------------------------------------------ # 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。 #============================================================================== class Window_Equip < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) if item != nil @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) else @help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见 end end end #============================================================================== # ■ Window_ShopBuy #------------------------------------------------------------------------------ # ショップ画面で、購入できる商品の一覧を表示するウィンドウです。 #============================================================================== class Window_ShopBuy < Window_Selectable #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(item) if item != nil @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max) else @help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见 end end end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 原作:xuelong
# 修正:水迭澜
# 移植:禾西
# protosssonny修改版
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# ● 定義
#--------------------------------------------------------------------------
def set
@phrase,@y= {}, 0
@scope, @parameter_type = [], []
#@name_size = 名字文字大小
#@size = 描述文字大小
#@word = 每行的描述文字數
@name_size = 18
@size = 15
@word = 10
# 不顯示的 屬性 與 狀態 ID
@unshow_elements = []
@unshow_states = []
# 基本文字設定
@phrase[:price] = "售价"
@phrase[:elements] = "攻击属性"
@phrase[:states] = "附加状态"
@phrase[:guard_elements] = "减半属性"
@phrase[:guard_states] = "无效化状态"
#------------------#
# 物品效果語句 #
#------------------#
@phrase[:recover] = "恢复"
@phrase[:hp] = "HP"
@phrase[:mp] = "MP"
@phrase[:plus_states] = "状态附加"
@phrase[:minus_states] = "状态解除"
@phrase[:speed] = "速度修正"
@phrase[:consumable] = "消耗物品"
@phrase[:base_damage] = "基本伤害"
#------------------#
# 特殊效果語句 #
#------------------#
@phrase[:special] = "附带属性"
@phrase[:two_handed] = "双手武器"
@phrase[:fast_attack] = "先发制人"
@phrase[:dual_attack] = "连续攻击"
@phrase[:critical_bonus] = "频繁暴击"
@phrase[:prevent_critical] = "免疫暴击"
@phrase[:half_mp_cost] = "耗魔减半"
@phrase[:double_exp_gain] = "双倍经验"
@phrase[:auto_hp_recover] = "自动恢复"
@phrase[:physical_attack] = "物理攻击"
@phrase[:damage_to_mp] = "魔法伤害"
@phrase[:absorb_damage] = "伤害吸收"
@phrase[:ignore_defense] = "无视防御"
#------------------#
# 技能描述語句 #
#------------------#
@phrase[:recovery] = "恢复力"
@phrase[:mp_cost] = "消耗MP"
@phrase[:hit] = "命中率"
#------------------#
# 效果範圍語句 #
#------------------#
@phrase[:scope] = "效果范围"
@scope[0] = "无"
@scope[1] = "敌人"
@scope[2] = "敌全体"
@scope[3] = "敌单体 连续"
@scope[4] = "一至二人"
@scope[5] = "二至四人"
@scope[6] = "四至十人"
@scope[7] = "我方单体"
@scope[8] = "我方全体"
@scope[9] = "我方单个死亡者"
@scope[10] = "我方所有死亡者"
@scope[11] = "自己"
#------------------#
# 效果範圍語句 #
#------------------#
@parameter_type[1] = "MaxHP"
@parameter_type[2] = "MaxMP"
@parameter_type[3] = $data_system.terms.atk
@parameter_type[4] = $data_system.terms.def
@parameter_type[5] = $data_system.terms.spi
@parameter_type[6] = $data_system.terms.agi
end
#--------------------------------------------------------------------------
# ● 初始化對象
#--------------------------------------------------------------------------
def initialize
super(240,0,608,WLH + 32)
self.opacity = 200
self.z = 150
self.visible = false
end
#--------------------------------------------------------------------------
# ● 設置文本
# data : 窗口顯示的字符串/物品資料
# align : 對齊方式 (0..左對齊、1..中間對齊、2..右對齊)
#--------------------------------------------------------------------------
def set_text(data, align=0)
#------------------------------------------------------------------------
# ● 當資料爲文字時候
#------------------------------------------------------------------------
if data != @text or align != @align
if data.is_a?(String)
draw_string(data,align)
end
end
return if data.is_a?(String)
#------------------------------------------------------------------------
# ● 當沒有資料時候
#------------------------------------------------------------------------
if data.nil?
self.visible=false
else
self.visible=true
end
#------------------------------------------------------------------------
# ● 當資料爲物品/技能時候
#------------------------------------------------------------------------
if data != nil && @data != data
self.width = 210
self.height = 430
self.x=0
self.y=200
set
draw_data(data)
else
return
end
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_string(data,align)
self.width = 608 #修正寬度
self.height = WLH + 32 #修正高度
self.x = 240 #修正 x 坐標
self.y = 0 #修正 y 坐標
@text = data #記錄文本資料
@align = align #記錄對齊方式
@actor = nil #清空角色資料
self.contents = Bitmap.new(width - 32, height - 32) if self.contents.nil?
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.draw_text(4 , 0, self.width - 40, 28, data, align)
self.visible = true
end
#--------------------------------------------------------------------------
# ● 更新帮助窗口
#--------------------------------------------------------------------------
def draw_data(data=@data)
self.width = 186 #修正寬度
self.height = 430 #修正高度
self.x = 0 #修正 x 坐標
self.y = 150 #修正 y 坐標
@data = data #記錄 data 資料
case @data
when RPG::Item
set_item_text(@data)
when RPG::Weapon, RPG::Armor
set_equipment_text(@data)
when RPG::Skill
set_skill_text(@data)
end
end
#--------------------------------------------------------------------------
# ● 修正窗口位置
#--------------------------------------------------------------------------
def set_pos(x,y,width,oy,index,column_max)
cursor_width = width / column_max - 32
xx = index % column_max * (cursor_width + WLH)
yy = index / column_max * WLH - oy
self.x = xx + x + 140
self.y = yy + y + 35
if self.x + self.width > 608
self.x = 608 - self.width
end
if self.y + self.height > 480
self.y = 480 - self.height
end
end
#------------------------------------------------------------------------
# ● 文字描繪
#------------------------------------------------------------------------
def draw_text(text, increase, move=0)
@y += increase
self.contents.font.size = @size
@special_size = 0 if @special_size == nil
@first_line = 0 if @first_line == nil
if @special_size > 0 and not @data.is_a?(RPG::Item)
if @y >= increase * @first_line
case @special_size
when 0
self.contents.font.color = normal_color
when 1
self.contents.font.color = text_color(12)
when 2
self.contents.font.color = text_color(29)
when 3
self.contents.font.color = text_color(17)
when 4
self.contents.font.color = text_color(30)
when 5
self.contents.font.color = text_color(26)
when 6
self.contents.font.color = text_color(20)
when 7
self.contents.font.color = text_color(10)
end
end
self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
else
self.contents.font.color = normal_color
self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
end
end
#-------------------------------------#
# 子方法
#-------------------------------------#
#--------------------------------------------------------------------------
# ● 裝備幫助窗口
#--------------------------------------------------------------------------
def set_equipment_text(equipment)
#------------------------------------------------------------------------
# ● 取得基本質料
#------------------------------------------------------------------------
#----------------------------#
# 取得屬性、狀態、說明之副本 #
#----------------------------#
element_set = equipment.element_set.clone
state_set = equipment.state_set.clone
description = equipment.description.clone
phrase = @phrase
#----------------------------#
# 過濾不顯示的屬性與狀態描述 #
#----------------------------#
element_set -= @unshow_elements
state_set -= @unshow_states
#----------------#
# 初始化數據設定 #
#----------------#
x, h, move = 0, 0, 0
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
gifts = equipment.gifts
gifts = [] if gifts.nil?
s = [
"攻击 + [s]", "攻击 + [s]%",
"防御 + [s]", "防御 + [s]%",
"魔力 + [s]", "魔力 + [s]%",
"速度 + [s]", "速度 + [s]%",
"最大HP + [s]", "最大HP + [s]%",
"最大MP + [s]", "最大MP + [s]%",
"命中率 + [s]",
"闪避率 + [s]",
"暴击率 + [s]",
"四项属性 + [s]%","四项属性 + [s]",
"抗魔附加 + [s]"
]
for g in gifts
special << s[g.type].sub(/\[s\]/) {g.value}
end
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) >= 0
now_h = h
h += 1 #價格
h += 1 #装备等级
# h += 1 unless equipment.nodur or PA::USE_DUR == false#耐久度
h += 1 if equipment.sockets_num > 0 #孔数
h += 1 unless equipment.atk.zero? #攻擊力
h += 1 unless equipment.def.zero? #防禦力
h += 1 unless equipment.spi.zero? #精神力
h += 1 unless equipment.agi.zero? #敏捷力
h += element_set.size + 1 if element_set.size > 0 #屬性
h += state_set.size + 1 if state_set.size > 0 #狀態
h += special.size + 2 if special.size > 0 #特殊效果
if special.size > 0
case special.size
when 1
@first_line = h-1
when 2
@first_line = h-2
when 3
@first_line = h-3
when 4
@first_line = h-4
when 5
@first_line = h-5
when 6
@first_line = h-6
end
end
@special_size = special.size
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
#h = 6 + now_h if (h - now_h) < 6
#------------------------------------------------------------------------
# ● 換算高度
#------------------------------------------------------------------------
self.height = h * @size + @name_size + 36
#------------------------------------------------------------------------
# ● 生成背景
#------------------------------------------------------------------------
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.clear
#------------------------------------------------------------------------
# ● 名字描繪
#------------------------------------------------------------------------
text = equipment.name
self.contents.font.size = @name_size
if text.nil?
self.visible = false
else
self.visible = true
###self.contents.draw_text(0, 0, text.size*7, @name_size, text, 0)
#我加的,用case判断颜色
unless equipment.is_a?(RPG::Item)
case gifts.size
when 1
self.contents.font.color = text_color(12)
when 2
self.contents.font.color = text_color(29)
when 3
self.contents.font.color = text_color(17)
when 4
self.contents.font.color = text_color(31)
when 5
self.contents.font.color = text_color(26)
when 6
self.contents.font.color = text_color(20)
when 7
self.contents.font.color = text_color(10)
end
else
self.contents.font.color = text_color(0)
end
self.contents.draw_text(0, 0, contents.width-4, @name_size, text)
end
#------------------------------------------------------------------------
# ● 說明描繪
#------------------------------------------------------------------------
x = 0
@y += 1
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size = @size
self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
if words_judge(text) == true
x += 1
else
x += 0.5
end
if x == @word or x == @word - 0.5
x = 0
@y += 1
end
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(equipment.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 價格描繪
#------------------------------------------------------------------------
unless equipment.price.zero?
text = phrase[:price] + ":" + equipment.price.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 装备等级描繪
#------------------------------------------------------------------------
unless equipment.read_note('装备等级') == nil
text = "角色等级要求:" + equipment.read_note('装备等级').to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 耐久度
#------------------------------------------------------------------------
if PA::USE_DUR == true
unless equipment.nodur
unless equipment.indesctructible
if equipment.maxdur == nil
text = "耐久度:#{equipment.dur} / #{equipment.read_note('耐久度')}"
else
text = "耐久度:#{equipment.dur} / #{equipment.maxdur}"
end
else
text = "耐久度:无法破坏"
end
draw_text(text, 1, move)
end
end
#------------------------------------------------------------------------
# ● 孔数
#------------------------------------------------------------------------
if equipment.sockets_num > 0
text = "剩余孔数:#{equipment.sockets_num}"
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 攻擊力
#------------------------------------------------------------------------
unless equipment.atk.zero?
text = $data_system.terms.atk + ":" + equipment.base_atk.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 防禦力
#------------------------------------------------------------------------
unless equipment.def.zero?
text = $data_system.terms.def + ":" + equipment.base_def.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 精神力
#------------------------------------------------------------------------
unless equipment.spi.zero?
text = $data_system.terms.spi + ":" + equipment.base_spi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 敏捷力
#------------------------------------------------------------------------
unless equipment.agi.zero?
text = $data_system.terms.agi + ":" + equipment.base_agi.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:elements]+":"
when RPG::Armor
text=phrase[:guard_elements]+":"
end
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 狀態
#------------------------------------------------------------------------
if state_set.size > 0
case equipment
when RPG::Weapon
text=phrase[:states]+":"
when RPG::Armor
text=phrase[:guard_states]+":"
end
draw_text(text, 1, move)
state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
kind_text = ["","","",""]
weapon_gifts = [0,1,4,5,12,14,15]
armor0_gifts = [2,3,4,5,10,11,15,16]
armor1_gifts = [2,3,8,9,15,16]
armor2_gifts = [2,3,6,7,13,15,16]
kind_text[0] = " 武器" if weapon_gifts.include?(equipment.gifts[0].type)
kind_text[1] = " 盾牌" if armor0_gifts.include?(equipment.gifts[0].type)
kind_text[2] = " 头盔" if armor1_gifts.include?(equipment.gifts[0].type)
kind_text[3] = " 身体" if armor2_gifts.include?(equipment.gifts[0].type)
if equipment.is_a?(RPG::Armor) and equipment.base_id == PA::CRYSTAL
text = "可注入" + kind_text[0] + kind_text[1] + kind_text[2] + kind_text[3]
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
else
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
end
end
#////////////////////////////////////////////////////////////////////////////
#--------------------------------------------------------------------------
# ● 物品幫助窗口
#--------------------------------------------------------------------------
def set_item_text(item)
#----------------------------#
# 取得屬性、狀態、說明之副本 #
#----------------------------#
description = item.description.clone
element_set = item.element_set.clone
plus_state_set = item.plus_state_set.clone
minus_state_set = item.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @unshow_elements
plus_state_set -= @unshow_states
minus_state_set -= @unshow_states
# 初始化數據設定
x, h, move = 0, 0, 0
phrase = @phrase
scope = @scope
parameter_type = @parameter_type
occasion = @occasion
# 基本文字設定
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if item.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if item.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if item.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if item.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) >= 0
now_h = h
h += 2 unless scope[item.scope] == "无" #効果範囲
h += 1 unless item.price == 0 #價格
h += 1 if item.consumable #消耗品
h += 1 unless item.speed.zero? #速度補正値
h += 1 unless item.hp_recovery_rate==0 and item.hp_recovery==0 #HP 回復
h += 1 unless item.mp_recovery_rate==0 and item.mp_recovery==0 #MP 回復
h += 1 unless item.parameter_type.zero? #能力値
h += 1 unless item.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 2 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
#------------------------------------------------------------------------
# ● 圖片顯示保證高度
#------------------------------------------------------------------------
#h = 6 + now_h if (h - now_h) < 6
#------------------------------------------------------------------------
# ● 換算高度
#------------------------------------------------------------------------
self.height = h * @size + @name_size + 36
#------------------------------------------------------------------------
# ● 生成背景
#------------------------------------------------------------------------
self.contents = Bitmap.new(self.width - 32, self.height - 32)
self.contents.clear
#------------------------------------------------------------------------
# ● 名字描繪
#------------------------------------------------------------------------
text = item.name
self.contents.font.color = normal_color#顔色腳本
self.contents.font.size = @name_size
if text.nil?
self.visible = false
else
self.visible = true
self.contents.draw_text(0,0, text.size*7, 20, text, 0)
end
#------------------------------------------------------------------------
# ● 說明描繪
#------------------------------------------------------------------------
x = 0
@y += 1
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = normal_color
self.contents.font.size = @size
self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
if words_judge(text) == true
x+=1
else
x+=0.5
end
if x == @word or x == @word - 0.5
x = 0
@y += 1
end
end
#------------------------------------------------------------------------
# ● 圖標描繪
#------------------------------------------------------------------------
#bitmap = Cache.system("Iconset")
#rect = Rect.new(item.icon_index % 16 * 24, equipment.icon_index / 16 * 24, 24, 24)
#self.contents.blt(0, y*size + 20, bitmap, rect, 255)
#------------------------------------------------------------------------
# ● 效果範圍
#------------------------------------------------------------------------
unless scope[item.scope] == "无"
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[item.scope]
draw_text(text, 1, move + @size)
end
#------------------------------------------------------------------------
# ● 價格
#------------------------------------------------------------------------
unless item.price == 0
text = phrase[:price] + ":" + item.price.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 消耗品
#------------------------------------------------------------------------
if item.consumable
text = phrase[:consumable]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 速度補正値
#------------------------------------------------------------------------
unless item.speed.zero?
text = phrase[:speed]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● HP回復
#------------------------------------------------------------------------
unless item.hp_recovery_rate.zero? and item.hp_recovery.zero?
if item.hp_recovery_rate > 0 and item.hp_recovery > 0
text = " + "
else
text = ""
end
unless item.hp_recovery_rate.zero?
text = item.hp_recovery_rate.to_s + "%" + text
end
unless item.hp_recovery.zero?
text += item.hp_recovery.to_s
end
text = phrase[:recover] +":" + text + phrase[:hp]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● SP回復
#------------------------------------------------------------------------
unless item.mp_recovery_rate.zero? and item.mp_recovery.zero?
if item.mp_recovery_rate > 0 and item.mp_recovery > 0
text = " + "
else
text = ""
end
unless item.mp_recovery_rate.zero?
text = item.mp_recovery_rate.to_s + "%" + text
end
unless item.mp_recovery.zero?
text += item.mp_recovery.to_s
end
text = phrase[:recover] +":" + text + phrase[:mp]
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 能力值增加
#------------------------------------------------------------------------
unless item.parameter_type.zero?
text = parameter_type[item.parameter_type]+" +"+item.parameter_points.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless item.base_damage.zero?
#text = phrase[:base_damage] +":" + item.base_damage.to_s
text = item.base_damage > 0 ? phrase[:base_damage] +":" + item.base_damage.to_s: phrase[:recovery] +":" + (-item.base_damage).to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
end
#////////////////////////////////////////////////////////////////////////////
#--------------------------------------------------------------------------
# ● 技能帮助窗口
#--------------------------------------------------------------------------
def set_skill_text(skill)
#----------------------------#
# 取得屬性、狀態、說明之副本 #
#----------------------------#
description = skill.description.clone
element_set = skill.element_set.clone
plus_state_set = skill.plus_state_set.clone
minus_state_set = skill.minus_state_set.clone
# 過濾不顯示的描述
element_set -= @unshow_elements
plus_state_set -= @unshow_states
minus_state_set -= @unshow_states
# 初始化設定
x ,h, move = 0, 0, 0
phrase = @phrase
scope = @scope
#------------------#
# 取得特殊效果數據 #
#------------------#
special = []
special << phrase[:physical_attack] if skill.physical_attack #物理攻撃
special << phrase[:damage_to_mp] if skill.damage_to_mp #MPにダメージ
special << phrase[:absorb_damage] if skill.absorb_damage #ダメージを吸収
special << phrase[:ignore_defense] if skill.ignore_defense #防御力無視
#------------------------------------------------------------------------
# ● 確定背景圖片的高度
#------------------------------------------------------------------------
h += (description.size/3/@word)
h += 1 if (description.size/3%@word) >= 0
now_h = h
h += 4 #効果範囲,消費MP,命中率
h += 1 unless skill.speed.zero? #速度補正値
h += 1 unless skill.base_damage.zero? #基本ダメージ
h += element_set.size + 1 if element_set.size > 0 #屬性
h += plus_state_set.size + 1 if plus_state_set.size > 0 #附加狀態
h += minus_state_set.size + 1 if minus_state_set.size > 0 #解除狀態
h += special.size + 1 if special.size > 0 #特殊效果
@special_size = nil
@first_line = nil
#------------------------------------------------------------------------
# ● 換算高度
#------------------------------------------------------------------------
self.height=(h + 1) * @size + @name_size + 36
self.contents = Bitmap.new(self.width - 32,self.height - 32)
self.contents.clear
#------------------------------------------------------------------------
# ● 名字描述
#------------------------------------------------------------------------
text = skill.name
self.contents.font.color = Color.new(255, 255, 128, 255)
self.contents.font.size = @name_size
if text!=nil
self.visible = true
self.contents.draw_text(0,0, text.size*7, @name_size, text, 0)
else
self.visible = false
end
#------------------------------------------------------------------------
# ● 說明描述
#------------------------------------------------------------------------
x = 0
@y += 1
text = description
text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
while ((text = description.slice!(/./m)) != nil)
self.contents.font.color = Color.new(8, 200, 255, 255)#system_color
self.contents.font.size = @size
self.contents.draw_text(x*@size, @y*@size+5, @size, @size, text, 0)
if words_judge(text) == true
x+=1
else
x+=0.5
end
if x == @word or x == @word - 0.5
x = 0
@y += 1
end
end
#------------------------------------------------------------------------
# ● 攻擊範圍
#------------------------------------------------------------------------
self.contents.font.color = normal_color
text = phrase[:scope] +":"
draw_text(text, 1, move)
text = scope[skill.scope]
draw_text(text, 1, move + @size)
#------------------------------------------------------------------------
# ● 基本ダメージ
#------------------------------------------------------------------------
unless skill.base_damage .zero?
text = skill.base_damage > 0 ? phrase[:base_damage] : phrase[:recovery]
text += ":" + skill.base_damage.abs.to_s
draw_text(text, 1, move)
end
#------------------------------------------------------------------------
# ● 消費SP描述
#------------------------------------------------------------------------
text = phrase[:mp_cost] +":"+ skill.mp_cost.to_s
if skill.mp_cost == 0 and skill.base_damage .zero? #被动技能调用
text = phrase[:mp_cost] +":"+ "被动技能"
end
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 命中率描述
#------------------------------------------------------------------------
text = phrase[:hit] + ":" + skill.hit.to_s + "%"
draw_text(text, 1, move)
#------------------------------------------------------------------------
# ● 屬性
#------------------------------------------------------------------------
if element_set.size > 0
text = phrase[:elements]+":"
draw_text(text, 1, move)
element_set.each do |i|
text = $data_system.elements[i]
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 添加狀態
#------------------------------------------------------------------------
unless plus_state_set.empty?
text = phrase[:plus_states]+":"
draw_text(text, 1, move)
plus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 解除狀態
#------------------------------------------------------------------------
unless minus_state_set.empty?
text = phrase[:minus_states]+":"
draw_text(text, 1, move)
minus_state_set.each do |i|
text = $data_states[i].name
draw_text(text, 1, move + @size)
end
end
#------------------------------------------------------------------------
# ● 特殊效果
#------------------------------------------------------------------------
if special.size > 0
text = phrase[:special]+":"
draw_text(text, 1, move)
special.each {|text| draw_text(text, 1, move + @size)}
end
end
#------------------------------------------------------------------------
# ● 文字数字判定
#------------------------------------------------------------------------
def words_judge(word)
case word
when "0","1","2","3","4","5","6","7","8","9","%",".","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","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"
return false
end
return true
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面などで、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
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
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# スキル画面などで、使用できるスキルの一覧を表示するウィンドウです。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill)
if skill != nil
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
else
@help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见
end
end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
# 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item)
if item != nil
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
else
@help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见
end
end
end
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(item)
if item != nil
@help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
else
@help_window.x = 1000 #没有物品时,让帮助窗口出界而看不见
end
end
end
|
评分
-
查看全部评分
|