Project1
标题: 用了随机脚本 盾的位置变成了衣服了..那帮忙改下.. [打印本页]
作者: 344143370 时间: 2012-5-4 20:06
标题: 用了随机脚本 盾的位置变成了衣服了..那帮忙改下..
本帖最后由 344143370 于 2012-5-5 08:41 编辑
用了随机脚本 盾的位置变成了衣服了.怎么装备都是衣服.谁帮忙改下..- #==============================================================================
- # 复杂装备系统之随机属性 by 沉影不器
- #------------------------------------------------------------------------------
- # 说明: 让装备类似暗黑那样附加随机属性,目前有17种属性元素可供组合,允许按
- # 能力百分比加成.
- #
- # 附加属性的名称允许多个(按能力从小大到排列),用英文逗号隔开,自动按
- # 附加能力大小选择词缀
- #
- # 极品爆率不影响物品掉落机率,而是指掉落的物品带附加属性的机率
- #
- # 获得随机属性装备的方法:
- # 事件脚本中输入 get_weapon(母版武器id, 数量, 附加属性1, 附加属性2...)
- # 或者直接指定附加属性数 get_weapon(母版武器id, 数量, 附加属性数)
- # 将随机生成指定附加属性数的装备
- # 获得防具方法是 get_armor() 参数含义同上
- #
- # 获得普通装备的方法:
- # 事件脚本中输入 get_weapon(母版武器id, 数量)
- # 获得防具方法是 get_armor() 参数含义同上
- #==============================================================================
- # 参数设定
- #==============================================================================
- module Game_Equip
- ## 最大附加属性数
- GiftMax = 6
- ## 附加属性影响价格基数
- GiftPrice = 10
- ## 极品爆率最低值和最高值(0到100)
- Equip_Chance = [94, 95]
-
- ## 附加属性各参数:
- ## name 添加到装备前的修饰词
- ## max 该属性最大值
- ## weight 权重(最大值的权重,用于计算价值,用于计算颜色也行)
- ## percent 是否按百分比计算
- Gift = Struct.new(:name, :max, :weight, :percent)
- Gifts = [
- # 攻击
- Gift.new("锐利,伤害,霸道", 50, 25, false),
- Gift.new("残忍,残酷,凶残", 50, 40, true),
- # 防御
- Gift.new("厚重,守卫,守护", 50, 10, false),
- Gift.new("结实,防卫,防护", 50, 20, true),
- # 精神
- Gift.new("光荣", 50, 15, false),
- Gift.new("祝福", 50, 25, true),
- # 敏捷
- Gift.new("敏捷", 50, 20, false),
- Gift.new("灵巧", 50, 30, true),
- # hp
- Gift.new("落英", 80, 20, false),
- Gift.new("武士", 15, 20, true),
- # mp
- Gift.new("神灵", 80, 15, false),
- Gift.new("圣者", 15, 15, true),
- # 命中
- Gift.new("精确", 10, 10,false),
- # 闪避
- Gift.new("幻影", 10, 10, false),
- # 暴击
- Gift.new("暴击", 10, 10, false),
- # 经验
- Gift.new("贪婪", 20, 10, true),
- # 极品爆率 ###(待定)
- Gift.new("幸运", 50, 10, false)
- ]
- 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
- ## 附加属性为空或指定为(0)时,直接返回母版
- return self.result(result) if gifts.nil? or gifts == 0
- ## 指定附加属性数量时
- if gifts.is_a? Integer
- ## 控制数量
- num = [gifts, GiftMax].min
- gifts = []
- ## 随机生成指定数量的附加属性
- rd = different_rand(Gifts.size-1, num)
- 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
- for gift in gifts
- name += gift.name
- price += gift.weight * GiftPrice
- end
- ## 设定名称
- result.name = name + '的' + result.name
- ## 设定价格
- result.price += price.round
- ## 设定颜色
- result.text_color = gifts.size
- return self.result(result)
- end
- #--------------------------------------------------------------------------
- # ● 返回结果
- # item: 物品
- #--------------------------------------------------------------------------
- def self.result(item)
- case item
- when RPG::Item
-
- when RPG::Weapon
- item.base_id = item.id
- item.id = $data_weapons.size
- $data_weapons << item
- when RPG::Armor
- item.base_id = item.id
- 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]
- when 1
- item = $base_armors[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
- @value = linear_rand(max) + 1
- 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 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 atk
- n = @atk
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.atk(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 防御力(合)
- #------------------------------------------------------------------------
- def def
- n = @def
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.def(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 魔力(合)
- #------------------------------------------------------------------------
- def spi
- n = @spi
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.spi(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 敏捷(合)
- #------------------------------------------------------------------------
- def agi
- n = @agi
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.agi(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 最大hp(合)
- #------------------------------------------------------------------------
- def maxhp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.maxhp(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 最大mp(合)
- #------------------------------------------------------------------------
- def maxmp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.maxmp(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 命中率(合)
- #------------------------------------------------------------------------
- def hit
- n = @hit
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.hit end
- return n
- end
- #------------------------------------------------------------------------
- # 闪避率(合)
- #------------------------------------------------------------------------
- def eva
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.eva end
- return n
- end
- #------------------------------------------------------------------------
- # 暴击率(合)
- #------------------------------------------------------------------------
- def cri
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.cri 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 atk
- n = @atk
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.atk(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 防御力(合)
- #------------------------------------------------------------------------
- def def
- n = @def
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.def(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 魔力(合)
- #------------------------------------------------------------------------
- def spi
- n = @spi
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.spi(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 敏捷(合)
- #------------------------------------------------------------------------
- def agi
- n = @agi
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.agi(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 最大hp(合)
- #------------------------------------------------------------------------
- def maxhp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.maxhp(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 最大mp(合)
- #------------------------------------------------------------------------
- def maxmp
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.maxmp(actor_id) end
- return n
- end
- #------------------------------------------------------------------------
- # 命中率(合)
- #------------------------------------------------------------------------
- def hit
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.hit end
- return n
- end
- #------------------------------------------------------------------------
- # 闪避率(合)
- #------------------------------------------------------------------------
- def eva
- n = @eva
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.eva end
- return n
- end
- #------------------------------------------------------------------------
- # 暴击率(合)
- #------------------------------------------------------------------------
- def cri
- n = 0
- @gifts = [] if @gifts.nil?
- for g in @gifts.compact do n += g.cri 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 = 95
- for e in equips.compact do n += e.hit end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取回避率
- #--------------------------------------------------------------------------
- def eva
- n = 5
- for e in equips.compact do n += e.eva end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取会心一击概率
- #--------------------------------------------------------------------------
- def cri
- n = 4
- n += 4 if actor.critical_bonus
- for e in equips.compact do n += e.cri end
- return n
- end
- #--------------------------------------------------------------------------
- # ● 获取更多经验值
- #--------------------------------------------------------------------------
- def exp_added
- exp = 1
- 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(@exp + 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
- @level = actor.initial_level
- @exp_list = Array.new(101)
- make_exp_list
- @exp = @exp_list[@level]
- @skills = []
- for i in self.class.learnings
- learn_skill(i.skill_id) if i.level <= @level
- end
- clear_extra_values
- recover_all
- ## 生成新装备id
- reset_equip_id
- end
- #--------------------------------------------------------------------------
- # ● 装备重设
- #--------------------------------------------------------------------------
- def reset_equip_id
- @weapon_id = Game_Equip.reini_id(@weapon_id, 0)
- @armor1_id = Game_Equip.reini_id(@armor1_id, two_hands_legal? ? 0 : 1)
- @armor2_id = Game_Equip.reini_id(@armor2_id, 1)
- @armor3_id = Game_Equip.reini_id(@armor3_id, 1)
- @armor4_id = Game_Equip.reini_id(@armor4_id, 1)
- end
- #--------------------------------------------------------------------------
- # ● 判断是否可以装备
- # item : 物品
- # base : 是否读取母版数据
- #--------------------------------------------------------------------------
- def equippable?(item, base = true)
- return true if item == nil
- 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 : 物品
- # include_equip : 包括装备品
- #--------------------------------------------------------------------------
- def has_item_by_base_id?(item, include_equip = false)
- for i in items
- return true if i.base_id == item.id
- end
- if include_equip
- for actor in members
- for e in actor.equips
- return true if e.base_id == item.id
- end
- end
- end
- return false
- 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, 99].min
- when RPG::Weapon
- for i in 0...n
- w = Game_Equip.reini(item, *gift)
- @weapons[w.id] = 1
- end
- when RPG::Armor
- for i in 0...n
- a = Game_Equip.reini(item, *gift)
- @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, 99].min
- when RPG::Weapon
- @weapons[item.id] = [[number - n, 0].max, 99].min
- when RPG::Armor
- @armors[item.id] = [[number - n, 0].max, 99].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_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 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
- item = reini_chance($base_weapons[di.weapon_id], $game_party.equip_chance)
- drop_items.push(item)
- elsif di.kind == 3
- item = reini_chance($base_armors[di.armor_id], $game_party.equip_chance)
- drop_items.push(item)
- end
- end
- end
- return drop_items
- end
- #--------------------------------------------------------------------------
- # ● 处理极品爆率
- #--------------------------------------------------------------------------
- def reini_chance(item, chance)
- @item = item
- @chance = [chance/100.0, Game_Equip::Equip_Chance[1]/100.0].min
- @gifts = []
- loop do
- if rand(0) < @chance and @gifts.size < Game_Equip::GiftMax
- @gifts << Game_Gift.new
- @chance /= 2
- else
- return Game_Equip.reini(@item, @gifts)
- end
- 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|
- next if weapon.nil?
- if weapon.base_id == @params[3]
- result = true
- break
- end
- end
- when 4 # 防具
- ## 判断是否符合母版id
- actor.armors.each do |armor|
- next if armor.nil?
- 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_item_by_base_id?($base_weapons[@params[1]], @params[2])
- when 10 # 防具
- result = $game_party.has_item_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_127
- value = operate_value(@params[1], @params[2], @params[3])
- if @params[1] == 0
- $game_party.gain_reini($base_weapons[@params[0]], value.abs, @params[4])
- else
- $game_party.lose_reini($base_weapons[@params[0]], value.abs, @params[4])
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ● 增减防具
- #--------------------------------------------------------------------------
- def command_128
- value = operate_value(@params[1], @params[2], @params[3])
- if @params[1] == 0
- $game_party.gain_reini($base_armors[@params[0]], value.abs, @params[4])
- else
- $game_party.lose_reini($base_armors[@params[0]], value.abs, @params[4])
- end
- return true
- 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 = $data_weapons[goods_item[1]]
- when 2
- item = $data_armors[goods_item[1]]
- end
- if item != nil
- @data.push(item)
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #==============================================================================
- # ■ Window_ShopStatus
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 描绘角色现在装备的能力值变化
- # actor : 角色
- # x : 描画目标 X 坐标
- # y : 描画目标 Y 坐标
- #--------------------------------------------------------------------------
- def draw_actor_parameter_change(actor, x, y)
- return if @item.is_a?(RPG::Item)
- enabled = actor.equippable?(@item, false)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x, y, 200, WLH, actor.name)
- if @item.is_a?(RPG::Weapon)
- item1 = weaker_weapon(actor)
- elsif actor.two_swords_style and @item.kind == 0
- item1 = nil
- else
- item1 = actor.equips[1 + @item.kind]
- end
- if enabled
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 == nil ? 0 : item1.atk
- atk2 = @item == nil ? 0 : @item.atk
- change = atk2 - atk1
- else
- def1 = item1 == nil ? 0 : item1.def
- def2 = @item == nil ? 0 : @item.def
- change = def2 - def1
- end
- self.contents.draw_text(x, y, 200, WLH, sprintf("%+d", change), 2)
- end
- draw_item_name(item1, x, y + WLH, enabled)
- end
- end
- #==============================================================================
- # ■ Scene_File
- #==============================================================================
- class Scene_File < Scene_Base
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入文件用对象 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for actor in $game_party.members
- characters.push([actor.character_name, actor.character_index])
- end
- $game_system.save_count += 1
- $game_system.version_id = $data_system.version_id
- @last_bgm = RPG::BGM::last
- @last_bgs = RPG::BGS::last
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- Marshal.dump(@last_bgm, file)
- Marshal.dump(@last_bgs, file)
- Marshal.dump($game_system, file)
- Marshal.dump($game_message, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- Marshal.dump($data_weapons, file)
- Marshal.dump($data_armors, file)
- end
- #--------------------------------------------------------------------------
- # ● 读取存档数据
- # file : 读取文件用对象 (已经打开)
- #--------------------------------------------------------------------------
- def read_save_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = Marshal.load(file)
- $game_actors = Marshal.load(file)
- $game_party = Marshal.load(file)
- $game_troop = Marshal.load(file)
- $game_map = Marshal.load(file)
- $game_player = Marshal.load(file)
- $data_weapons = Marshal.load(file)
- $data_armors = Marshal.load(file)
- if $game_system.version_id != $data_system.version_id
- $game_map.setup($game_map.map_id)
- $game_player.center($game_player.x, $game_player.y)
- end
- end
- end
- #==============================================================================
- # ■ Scene_Shop
- #==============================================================================
- class Scene_Shop < Scene_Base
- #--------------------------------------------------------------------------
- # ● 确定输入个数
- #--------------------------------------------------------------------------
- def decide_number_input
- Sound.play_shop
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 购买
- $game_party.lose_gold(@number_window.number * @item.price)
- $game_party.gain_reini(@item, @number_window.number)
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- $game_party.gain_gold(@number_window.number * (@item.price / 2))
- $game_party.lose_reini(@item, @number_window.number)
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- 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
- # 修正:水迭澜
- # 移植:禾西
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 定義
- #--------------------------------------------------------------------------
- def set
- @phrase,@y= {}, 0
- @scope, @parameter_type = [], []
- =begin
- @name_size = 名字文字大小
- @size = 描述文字大小
- @word = 每行的描述文字數
- =end
- @name_size = 18
- @size = 14
- @word = 11
-
- # 不顯示的 屬性 與 狀態 ID
- @unshow_elements = [17, 18]
- @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] = "消費MP半分"
- @phrase[:double_exp_gain] = "取得経験値2倍"
- @phrase[:auto_hp_recover] = "HP自動回復"
- @phrase[:physical_attack] = "物理攻撃"
- @phrase[:damage_to_mp] = "MP傷害"
- @phrase[:absorb_damage] = "傷害吸収"
- @phrase[:ignore_defense] = "防御力無視"
- #------------------#
- # 技能描述語句 #
- #------------------#
- @phrase[:recovery] = "回復力"
- @phrase[:mp_cost] = "消耗SP"
- @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(0, 0, 544, 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 = 544 #修正寬度
- self.height = WLH + 32 #修正高度
- self.x=0 #修正 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, 32, 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>544
- self.x=544-self.width
- end
- if self.y+self.height>416
- self.y=416-self.height
- end
- end
- #------------------------------------------------------------------------
- # ● 文字描繪
- #------------------------------------------------------------------------
- def draw_text(text, increase, move=0)
- @y += increase
- self.contents.font.color = normal_color
- self.contents.font.size = @size
- self.contents.draw_text(0+move, @y*@size+5, text.size*6, @size, text, 0)
- 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]%"
- ]
- 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 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 #特殊效果
-
- #------------------------------------------------------------------------
- # ● 圖片顯示保證高度
- #------------------------------------------------------------------------
- #h = 6 + now_h if (h - now_h) < 6
- #------------------------------------------------------------------------
- # ● 換算高度
- #------------------------------------------------------------------------
- self.height = h * @size + @name_size + 32
- #------------------------------------------------------------------------
- # ● 生成背景
- #------------------------------------------------------------------------
- self.contents = Bitmap.new(self.width - 32, self.height - 32)
- self.contents.clear
- #------------------------------------------------------------------------
- # ● 名字描繪
- #------------------------------------------------------------------------
- text = equipment.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, @name_size, text, 0)
- 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)
- x+=1
- if x == @word
- 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.atk.zero?
- text = $data_system.terms.atk + ":" + equipment.atk.to_s
- draw_text(text, 1, move)
- end
- #------------------------------------------------------------------------
- # ● 防禦力
- #------------------------------------------------------------------------
- unless equipment.def.zero?
- text = $data_system.terms.def + ":" + equipment.def.to_s
- draw_text(text, 1, move)
- end
- #------------------------------------------------------------------------
- # ● 精神力
- #------------------------------------------------------------------------
- unless equipment.spi.zero?
- text = $data_system.terms.spi + ":" + equipment.spi.to_s
- draw_text(text, 1, move)
- end
- #------------------------------------------------------------------------
- # ● 敏捷力
- #------------------------------------------------------------------------
- unless equipment.agi.zero?
- text = $data_system.terms.agi + ":" + equipment.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
- text = phrase[:special]+":"
- draw_text(text, 1, move)
- special.each {|text| draw_text(text, 1, move + @size)}
- 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 #効果範囲,價格
- 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 + 1 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 + 32
- #------------------------------------------------------------------------
- # ● 生成背景
- #------------------------------------------------------------------------
- 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)
- x+=1
- if x == @word
- 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)
- #------------------------------------------------------------------------
- # ● 效果範圍
- #------------------------------------------------------------------------
- text = phrase[:scope] +":"
- draw_text(text, 1, move)
- text = scope[item.scope]
- draw_text(text, 1, move + @size)
- #------------------------------------------------------------------------
- # ● 價格
- #------------------------------------------------------------------------
- text = phrase[:price] + item.price.to_s
- draw_text(text, 1, move)
- #------------------------------------------------------------------------
- # ● 消耗品
- #------------------------------------------------------------------------
- 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] +":" + phrase[:hp] + text
- 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] +":" + phrase[:mp] + text
- 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
- 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 #特殊效果
- #------------------------------------------------------------------------
- # ● 換算高度
- #------------------------------------------------------------------------
- self.height=h * @size + @name_size + 32
- 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
- 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)
- x+=1
- if x==@word
- x = 0
- @y += 1
- end
- end
-
- #------------------------------------------------------------------------
- # ● 攻擊範圍
- #------------------------------------------------------------------------
- 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
- 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
- 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)
- #修正窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- #==============================================================================
- # ■ Window_Equip
- #------------------------------------------------------------------------------
- # 装備画面で、アクターが現在装備しているアイテムを表示するウィンドウです。
- #==============================================================================
- class Window_Equip < 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_ShopBuy
- #------------------------------------------------------------------------------
- # ショップ画面で、購入できる商品の一覧を表示するウィンドウです。
- #==============================================================================
- class Window_ShopBuy < 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
复制代码