| 赞 | 3 |
| VIP | |
| 好人卡 | |
| 积分 | 2 |
| 经验 | |
| 最后登录 | 2018-5-25 |
| 在线时间 | 248 小时 |
- 梦石
- 0
- 星屑
- 199
- 在线时间
- 248 小时
- 注册时间
- 2012-4-29
- 回帖
- 313
|
楼主 |
发表于 2013-10-31 17:06:57
|
显示全部楼层
本帖最后由 76213585 于 2013-10-31 20:12 编辑
tan12345 发表于 2013-10-31 13:26 
把2个脚本分别贴出来吧,你这样问我很难说……
只是装备颜色描绘不兼容了 这是全部的脚本 麻烦帮我调一下
还有这里的字能否改成别的颜色么!
如果很麻烦的话就算了 !!
- #encoding:utf-8
- #==============================================================================
- # ■ LBQ's Equip Randomization Script - Beta
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- # ■ Version History
- #------------------------------------------------------------------------------
- # - 10/21/2013 Started
- # - 10/25/2013 Beta Version Finished
- # - 10/26/2013 Patch 1 Finished
- # - 10/26/2013 Finished Refoging and Enchanting
- #==============================================================================
- # ■ Compatibility
- #------------------------------------------------------------------------------
- # - Because this almost rewrite the item system so do not expect any compati-
- # bility
- # - Only Works in RPG Maker VX Ace
- #==============================================================================
- # ■ Manual
- #------------------------------------------------------------------------------
- # - Use these in event scripts
- # -- gain_enchanted_armor(id,[possible_effects])
- # - This can give you a randomnized armor
- # -- gain_enchanted_weapon(id,[possible_effects])
- #==============================================================================
- $imported ||= {}
- $imported[:lbq_equip_randomnization] = 'beta'
- module LBQ_Delegate
- def delegate_item
- self.object
- end
-
-
- def can_delegate?(id)
- if self.object.respond_to? id
- return true
- end
-
- return false
-
- end
-
-
-
-
- def method_missing(id,*args,&block)
- return nil if is_nil?
- return '' unless object
- if can_delegate?(id)
- delegate_item.send(id,*args,&block)
- else
- super
- end
-
- end
-
- end
- class Unique_Equip < Game_BaseItem
-
- attr_accessor :pos
- def initialize
- super
- @pos = 0
- end
-
- def etype_id
- return self.object.etype_id
- end
-
-
-
- def empty?
- return true unless @class
- return false
- end
-
-
- def icon_index
- return 0 if is_nil?
- return self.object.icon_index
- end
-
-
- def params
- return_value = Marshal.load(Marshal.dump(self.object.params))
-
-
- prefix_objects.each do |o|
- o.params.each_with_index do |v,i|
- return_value[i] += v
- end
- end
-
-
- return_value.each_with_index do |v,i|
- return_value[i]*=@param_randomness[i]
- return_value[i] = return_value[i].to_i
- end
-
-
-
-
-
- return [] if is_nil?
- return return_value
- end
-
-
- def price
- return 0 if is_nil?
- return object.price
- end
-
- end
- class Unique_Item < Game_BaseItem
- include LBQ_Delegate
- attr_accessor :pos
- def initialize
- super
- @pos = 0
- end
-
- def itype_id
- return self.object.itype_id
- end
-
-
- def battle_ok?
- return true
- end
-
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 初始化装备
- # equips : 初期装备的数组
- #--------------------------------------------------------------------------
- def init_equips(equips)
- @equips = Array.new(equip_slots.size) { Unique_Equip.new }
- equips.each_with_index do |item_id, i|
- etype_id = index_to_etype_id(i)
- slot_id = empty_slot(etype_id)
- @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
- end
- refresh
- end
-
- def change_equip(slot_id, item)
- return unless trade_item_with_party(item, @equips[slot_id])
- return if item && equip_slots[slot_id] != item.etype_id
- if item.nil?
- @equips[slot_id] = Unique_Equip.new
- else
- @equips[slot_id] = item
- end
- refresh
- end
-
-
- def trade_item_with_party(new_item, old_item)
- $game_party.gain_item(old_item, 1)
- $game_party.lose_item(new_item, 1)
- return true
- end
- end
- class Game_Party
- attr_reader :items,:weapons,:armors
-
- def items
- @items = @items.select{|i| !i.is_nil?}
- @items = @items.compact
- return @items
- end
-
- alias lbq_ue_init_items init_all_items
- def init_all_items
- lbq_ue_init_items
- @items = []
- @weapons = []
- @armors = []
- end
-
- alias lbq_ue_gain_item gain_item
- def gain_item(item, amount, include_equip = false)
- if item.class == RPG::Weapon
- amount.times do
- new_one = Unique_Equip.new
- new_one.object = item
- @weapons << new_one
- end
- elsif item.class == RPG::Armor
- amount.times do
- new_one = Unique_Equip.new
- new_one.object = item
- @armors << new_one
- end
- elsif item.class == Unique_Equip && item.is_armor?
- if amount == 1
- @armors.push item
- else
- @armors.delete(item)
- end
- elsif item.class == Unique_Equip && item.is_weapon?
- if amount == 1
- @weapons.push item
- else
- @weapons.delete(item)
- end
- elsif item.class == Unique_Item
- puts amount
- if amount ==1
- @items.push item
- else
- @items.each do |i|
-
- if i.name == item.name
- @items.delete(i)
- break
- end
- end
-
- end
-
- else
- amount.times do
- new_one = Unique_Item.new
- new_one.object = item
- @items << new_one
- end
- end # if
- sort_all
- end
-
-
-
-
- def sort(x)
- #x.sort! { |a, b| a.item_id <=> b.item_id }
- x.each_with_index do |item,i|
- x.delete(item) unless i.class
- item.pos = i
- end
- end
-
- def sort_all
- sort_weapon
- sort_armor
- sort_item
- end
-
-
- def sort_weapon
- sort(@weapons)
- end
-
-
- def sort_armor
- sort(@armors)
- end
-
- def sort_item
- sort(@items)
- end
-
-
- #--------------------------------------------------------------------------
- # ● 消耗物品
- # 减少 1 个持有数。
- #--------------------------------------------------------------------------
- def consume_item(item)
- lose_item(item, 1) if item.is_a?(Unique_Item) && item.consumable
- end
-
- end
- class Game_Battler < Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● 技能/使用物品
- # 对使用目标使用完毕后,应用对于使用目标以外的效果。
- #--------------------------------------------------------------------------
- def use_item(item)
- pay_skill_cost(item) if item.is_a?(RPG::Skill)
- consume_item(item) if item.is_a?(Unique_Item)
- item.effects.each {|effect| item_global_effect_apply(effect) }
- end
- end
- class Game_Action
- #--------------------------------------------------------------------------
- # ● 设置物品
- #--------------------------------------------------------------------------
- def set_item(item_id)
- new_one = $data_items[item_id]
- @item = Unique_Item.new
- @item.object = new_one
- self
- end
- end
- #==============================================================================
- # ■ Game_BaseItem
- #------------------------------------------------------------------------------
- # 管理技能、物品、武器、护甲的统一类。会根据自己的所属类别而管理不同的数据。
- #==============================================================================
- class Game_BaseItem
-
-
- attr_reader :item_id
-
-
- def id
- return nil if is_nil?
- return object.id
- end
- end
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 查询列表中是否含有此物品
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(Unique_Item) &&! item.is_nil?
- when :weapon
- item.is_a?(Unique_Equip) && item.object.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(Unique_Equip) && item.object.is_a?(RPG::Armor)
- when :key_item
- false
- else
- false
- end
- end
-
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item)) unless item.is_nil? || item.object.nil?
- end
- end
-
- end
- class Window_EquipItem < Window_ItemList
- #--------------------------------------------------------------------------
- # ● 查询使用列表中是否含有此物品
- #--------------------------------------------------------------------------
- alias lbq_ue_we_include? include?
- def include?(item)
-
- return true if item == nil
- return false unless item.is_a?(Unique_Equip)
- return lbq_ue_we_include?(item.object)
- end
- end
- class Game_BattlerBase
- #--------------------------------------------------------------------------
- # ● 判定技能/使用物品是否可用
- #--------------------------------------------------------------------------
- def usable?(item)
- if item
- puts item.name.to_s + " -- " + item.class.inspect if item.name
- end
-
- #puts skill_conditions_met?(item) if item.is_a?(RPG::Sk
- return skill_conditions_met?(item) if item.is_a?(RPG::Skill)
- puts "Item Conditions Met? #{item_conditions_met?(item) if item.is_a?(Unique_Item)}"
- return item_conditions_met?(item) if item.is_a?(Unique_Item)
- return false
- end
- end
- class Game_Party
- def has_item?(item, include_equip = false)
- puts "Has Item Check Class: #{item.class}"
- return false if item.name.nil?
- puts "The Item has a Name"
-
- #puts "Items Array: #{items.collect{|i|i.name}}"
- puts "This Item: #{item}"
-
-
-
- result = false
- @items.each do |i|
- puts "Comparing: #{i.name} vs #{item.name}"
- if i.name == item.name
-
- result = true
- end
- end
-
-
- puts "Found this Item in the item array" if result
- puts "Does not have it in the item array" unless result
-
- return result if result
-
- return true if @items.include?(item) || @armors.include?(item) || @weapons.include?(item)
- return include_equip ? members_equip_include?(item) : false
- end
-
- end
- class Game_Action
- #--------------------------------------------------------------------------
- # ● 获取物品实例
- #--------------------------------------------------------------------------
- def item
- puts @item.is_a?(Unique_Item)
- return @item if @item.is_a?(Unique_Item)
- return @item.object
- end
- end
- class Window_ItemList
- #--------------------------------------------------------------------------
- # ● 查询此物品是否可用
- #--------------------------------------------------------------------------
- def enable?(item)
- return false unless item
- $game_party.usable?(item)
- end
- end
- module ADE
- class << self
- def get_all_prefix(mode = :weapon)
- db = $data_weapons if mode == :weapon
- db = $data_armors if mode == :armor
- db = $data_items if mode == :items
- objects = db.select do |w|
- if w
- w.note.include? "<PREFIX>"
- else
- false
- end
-
- end
-
- return objects.collect{|o| o.id}
- end
- end
- end
- class Unique_Equip
- include LBQ_Delegate
- attr_accessor :prefixes
- alias lbq_unique_equip_prefix_init initialize
- def initialize
- lbq_unique_equip_prefix_init
- # PREFIX - All Integers
- @prefixes = []
- @prefix_features = {}
- @param_randomness = Array.new(8,1.0)
- @price_randomness = 1.0
- regenerate_prefix_features
- end
-
- def generate_price_randomness
- @price_randomness = the_rand_num
- end
-
-
- def generate_param_randomness
- @param_randomness = @param_randomness.map{|v| the_rand_num}
- end
-
- def the_rand_num
- num = rand(40) + 80
- return num/100.0
- end
-
- def enchant(id)
- @prefixes.push(id)
- regenerate_prefix_feature_about id
- puts "Prefixes: #{@prefix_features[id]}"
- end
-
- def price
- return 0 if is_nil?
- value = object.price
- self.prefix_objects.each do |o|
- value+=o.price
- end
-
- value*=@price_randomness
- return value.to_i
-
- end
-
-
-
- def regenerate_prefix_features
- self.prefix_objects.each_with_index do |o,i|
- regenerate_prefix_feature_about(i)
- end
- end
-
-
-
- def regenerate_prefix_feature_about(id)
- feature_arrays = []
- object_thing = $data_weapons[id]
- object_thing = $data_armors[id] if is_armor?
-
-
-
- object_thing.features.each do |f|
- clone_f = Marshal.load(Marshal.dump(f))
-
- multi = (rand(40).to_f + 80.0)/100.0
- multi = multi.round(2)
- clone_f.value = clone_f.value*multi
- clone_f.value = clone_f.value.round(2)
- feature_arrays << clone_f
- end
- @prefix_features[id] = feature_arrays
- end
-
-
- def prefix_objects
- @prefixes.collect {|p| db[p]}
- end
-
-
- def db
- is_weapon? ? $data_weapons : $data_armors
- end
-
-
-
-
- def name
- return nil if is_nil?
- return '' unless object.respond_to? :name
- return add_suffix(self.object.name)
- end
-
- def add_suffix(str)
-
- s = ''
-
- @prefixes.each do |p|
- name = db[p].name
- s+=name
- end
-
- s = s + "的" unless s.empty?
- str = s + str
- return str
- end
-
-
- def features
- return @prefix_features.values.inject([]){|b,r| b+=r}
- return weapon_features if is_weapon?
- return armor_features if is_armor?
- return []
- end
-
- def weapon_features
- return_value = []
- @prefixes.each do |x|
- return_value += $data_weapons[x].features
- end
- return return_value
- end
-
- def armor_features
- return_value = []
- @prefixes.each do |x|
- return_value += $data_armors[x].features
- end
- return return_value
- end
-
-
-
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 获取装备实例的数组
- #--------------------------------------------------------------------------
- def equips
- new_value = @equips.collect do |item|
- item.object
- end
- return new_value
- end
-
- #--------------------------------------------------------------------------
- # ● 以数组方式获取拥有特性所有实例
- #--------------------------------------------------------------------------
- def feature_objects
- super + [actor] + [self.class] + equips.compact + @equips
- end
-
-
- #--------------------------------------------------------------------------
- # ● 获取武器实例的数组
- #--------------------------------------------------------------------------
- def weapons
- @equips.select {|item| item.is_weapon? }.collect{|i| i.object}
- end
- #--------------------------------------------------------------------------
- # ● 获取护甲实例的数组
- #--------------------------------------------------------------------------
- def armors
- @equips.select {|item| item.is_armor? }.collect{|i| i.object}
- end
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 获取装备实例的数组
- #--------------------------------------------------------------------------
- def drawn_equips
- @equips.collect{|e| e}
- end
- end
- class Window_EquipSlot
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- return unless @actor
- rect = item_rect_for_text(index)
- change_color(system_color, enable?(index))
- draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
- draw_item_name(@actor.drawn_equips[index], rect.x + 92, rect.y, enable?(index))
- end
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 强制更换装备
- # slot_id : 装备栏 ID
- # item : 武器/护甲(为 nil 时装备解除)
- #--------------------------------------------------------------------------
- def force_change_equip(slot_id, item)
- if item.nil?
- @equips[slot_id] = Unique_Equip.new
- else
- @equips[slot_id] = item
- end
- release_unequippable_items(false)
- refresh
- end
- end
- class Game_Party
- def gain_enchanted_weapon(*args)
- item_id = args[0]
- new_one = Unique_Equip.new
- new_one.object = $data_weapons[item_id]
- if args.length == 1
- #~ case rand(10)
- #~ when 0..4
- #~ gp = [prefixes.sample]
- #~ when 5..7
- #~ gp = [prefixes.sample,prefixes.sample]
- #~ gp = gp.uniq
- #~ else
- #~ gp = []
- #~ end
- gp = Prefix_Gen.generate_prefix(:weapon)
- else
- gp = args[1]
- end
- gp.each do |p|
- new_one.enchant(p)
- end
-
- new_one.generate_param_randomness
- new_one.generate_price_randomness
- @weapons << new_one
- end
-
- def prefixes
- return ADE.get_all_prefix
- end
-
-
- def armor_prefixes
- return ADE.get_all_prefix(:armor)
- end
-
-
- def gain_enchanted_armor(*args)
- item_id = args[0]
- new_one = Unique_Equip.new
- new_one.object = $data_armors[item_id]
- if args.length == 1
- #~ case rand(10)
- #~ when 0..4
- #~ gp = [armor_prefixes.sample]
- #~ when 5..7
- #~ gp = [armor_prefixes.sample,armor_prefixes.sample]
- #~ gp = gp.uniq
- #~ else
- #~ gp = []
- #~ end
- gp = Prefix_Gen.generate_prefix(:armor)
- else
- gp = args[1]
- end
- gp.each do |p|
- new_one.enchant(p)
- end
- new_one.generate_param_randomness
- new_one.generate_price_randomness
- @armors << new_one
- end
-
- end
- class Unique_Item
- attr_reader :prefixes
-
- alias lbq_ui_uni_i_init initialize
- def initialize
- lbq_ui_uni_i_init
- @prefixes = []
- @prefix_effects = {}
- create_all_effects
- end
-
-
- def name
- return nil if is_nil?
- begin
- object.name
- rescue
- return ''
- end
-
- $game_party.items
- ori_name = object.name
- new_name = prefix_objects.inject('') do |o,n|
- o+=n.name
- end
-
- connect_string = ''
- connect_string = '的' unless new_name.empty?
-
- final_name = new_name + connect_string + ori_name
-
- return final_name
- end
-
-
- def prefix_objects
- @prefixes.collect{|p| $data_items[p]}
- end
-
-
-
- def enchant(x)
- @prefixes << x
- create_single_effect(x)
- end
-
-
- def create_all_effects
- @prefixes.each do |p|
- create_single_effect(p)
- end
-
- end
-
-
- def create_single_effect(id)
- clone_e = Marshal.load(Marshal.dump($data_items[id].effects))
- clone_e.each do |e|
- if e
- e.value1*=the_rand_num
- e.value2*=the_rand_num
- end
-
- end
-
- @prefix_effects[id] = clone_e
- end
-
- def the_rand_num
- num = rand(40) + 80
- return num/100.0
- end
-
-
-
- def effects
- return @prefix_effects.values.inject(object.effects) do |o,n|
- o += n
- end
- end
-
- end
- class Game_Party
- def item_prefixes
- ADE.get_all_prefix(:items)
- end
-
- def gain_enchanted_item(*args)
- item_id = args[0]
- new_one = Unique_Item.new
- new_one.object = $data_items[item_id]
- if args.length == 1
- case rand(10)
- when 0..4
- gp = [item_prefixes.sample]
- when 5..7
- gp = [item_prefixes.sample,item_prefixes.sample]
- gp = gp.uniq
- else
- gp = []
- end
- else
- gp = args[1]
- end
-
- gp = []
-
- puts "This thing's GP is #{gp}"
- gp.each do |p|
- new_one.enchant(p)
- end
-
- @items << new_one
- end
-
- end
- class Game_Interpreter
- def gain_enchanted_item(*args)
- $game_party.gain_enchanted_item(*args)
- end
-
- def gain_enchanted_armor(*args)
- $game_party.gain_enchanted_armor(*args)
- end
-
- def gain_enchanted_weapon(*args)
- $game_party.gain_enchanted_weapon(*args)
- end
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 获取普通能力的附加值
- #--------------------------------------------------------------------------
- def param_plus(param_id)
- @equips.select{|e| e.name!=nil}.inject(super) do |r, item|
- r += item.params[param_id]
- end
- end
-
-
- end
- class Window_Base
- #--------------------------------------------------------------------------
- # ● 绘制物品名称
- # enabled : 有效的标志。false 的时候使用半透明效果绘制
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true, width = 250)
- return unless item
- draw_icon(item.icon_index, x, y, enabled)
- change_color(normal_color, enabled)
- draw_text(x + 24, y, width, line_height, item.name)
- end
- end
复制代码
第二个 - #encoding:utf-8
- #==============================================================================
- # ■ Equip Help by wyongcan - LBQ Equip Randomnization Special Version
- #------------------------------------------------------------------------------
- # 修改了说明窗口,增强了装备的说明 作者:wyongcan 发布于66RPG 转载请注明
- #==============================================================================
- module Help
- CODE ={
- 11 => "属性抗性",
- 12 => "弱化抗性",
- 13 => "状态抗性",
- 14 => "状态免疫",
- 21 => "普通能力",
- 22 => "添加能力",
- 23 => "特殊能力",
- 31 => "攻击附带属性",
- 32 => "攻击附带状态",
- 33 => "修正攻击速度",
- 34 => "添加攻击次数",
- 41 => "添加技能类型",
- 42 => "禁用技能类型",
- 43 => "添加技能",
- 44 => "禁用技能",
- 51 => "可装备武器类型",
- 52 => "可装备护甲类型",
- 53 => "固定装备",
- 54 => "禁用装备",
- 55 => "装备风格",
- 61 => "添加行动次数",
- 62 => "特殊标志",
- 63 => "消失效果",
- 64 => "队伍能力"}
- #特殊标志
- FLAG ={
- 0 => "自动战斗",
- 1 => "擅长防御",
- 2 => "保护弱者",
- 3 => "特技专注"}
- #普通能力
- PARAM ={
- 0 => "最大HP",
- 1 => "最大MP",
- 2 => "物理攻击",
- 3 => "物理防御",
- 4 => "魔法攻击",
- 5 => "魔法防御",
- 6 => "敏 捷 值",
- 7 => "幸 运 值"}
- #添加能力
- XPARAM ={
- 0 => "物理命中几率:",
- 1 => "物理闪避几率:",
- 2 => "必杀几率:",
- 3 => "必杀闪避几率:",
- 4 => "魔法闪避几率:",
- 5 => "魔法反射几率:",
- 6 => "物理反击几率:",
- 7 => "体力值再生速度:",
- 8 => "魔力值再生速度:",
- 9 => "特技值再生速度:"}
- #特殊能力
- SPARAM ={
- 0 => "受到攻击的几率",
- 1 => "防御效果比率",
- 2 => "恢复效果比率",
- 3 => "药理知识",
- 4 => "MP消费率",
- 5 => "TP消耗率",
- 6 => "物理伤害加成",
- 7 => "魔法伤害加成",
- 8 => "地形伤害加成",
- 9 => "经验获得加成"}
- #~ #效果范围
- #~ SCOPE ={
- #~ 0 => "特殊",
- #~ 1 => "单个敌人",
- #~ 2 => "全体敌人" ,
- #~ 3 => "一个随机敌人",
- #~ 4 => "两个随机敌人",
- #~ 5 => "三个随机敌人",
- #~ 6 => "四个随机敌人",
- #~ 7 => "单个队友",
- #~ 8 => "全体队友",
- #~ 9 => "单个队友(无法战斗)",
- #~ 10 => "全体队友(无法战斗)",
- #~ 11 => "使用者"}
- @队伍能力 ={
- 0 => "遇敌几率减半",
- 1 => "随机遇敌无效",
- 2 => "敌人偷袭无效",
- 3 => "先制攻击几率上升",
- 4 => "获得金钱数量双倍",
- 5 => "物品掉落几率双倍"}
- def self.ready
- @状态 = {}
- @武器类型 = {}
- @防具类型 = {}
- @属性 = {}
- $data_states.each{|x| @状态[x.id] = x.name if x != nil}
- elements = $data_system.elements
- weapon_types = $data_system.weapon_types
- armor_types = $data_system.armor_types
- elements.each_with_index{|x,y| @属性[y] = x if x != ""}
- weapon_types.each_with_index{|x,y| @武器类型[y] = x if x != ""}
- armor_types.each_with_index{|x,y| @防具类型[y] = x if x != ""}
- end
- def self.getequiphelp(equip)
- help = ""
- param = []
- equip.params.each_with_index{|x,y| param.push([PARAM[y],x])}
- param = param.select{|x| x[1] != 0}
- param.each{|x| help += x[0] + ":" + x[1].to_s + "\n"}
- features = equip.features
- features.select{|x| x.code == 55}.each{|x| help += CODE[x.code] + ":双持武器" + "\n"}
- features.select{|x| x.code == 11}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "*" + x.value.to_s + "\n"}
- features.select{|x| x.code == 12}.each{|x| help += CODE[x.code] + ":" + PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
- features.select{|x| x.code == 13}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "*" + x.value.to_s + "\n"}
- features.select{|x| x.code == 14}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "\n"}
- features.select{|x| x.code == 31}.each{|x| help += CODE[x.code] + ":" + @属性[x.data_id] + "\n"}
- features.select{|x| x.code == 32}.each{|x| help += CODE[x.code] + ":" + @状态[x.data_id] + "+" + x.value.to_s + "\n"}
- features.select{|x| x.code == 33}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
- features.select{|x| x.code == 34}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
- features.select{|x| x.code == 41}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"}
- features.select{|x| x.code == 42}.each{|x| help += CODE[x.code] + ":" + (x.data_id == 1 ? "特技" : "魔法") + "\n"}
- features.select{|x| x.code == 43}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"}
- features.select{|x| x.code == 44}.each{|x| help += CODE[x.code] + ":" + $data_skills[x.data_id].name + "\n"}
- features.select{|x| x.code == 51}.each{|x| help += CODE[x.code] + ":" + @武器类型[x.data_id] + "\n"}
- features.select{|x| x.code == 52}.each{|x| help += CODE[x.code] + ":" + @防具类型[x.data_id] + "\n"}
- features.select{|x| x.code == 61}.each{|x| help += CODE[x.code] + ":" + x.value.to_s + "\n"}
- features.select{|x| x.code == 62}.each{|x| help += CODE[x.code] + ":" + FLAG[x.data_id] + "\n"}
- features.select{|x| x.code == 64}.each{|x| help += CODE[x.code] + ":" + @队伍能力[x.data_id] + "\n"}
- featuresparam = []
- featuresparam.push features.select{|x| x.code == 21}
- featuresparam.push features.select{|x| x.code == 22}
- featuresparam.push features.select{|x| x.code == 23}
- featuresparam[0].each{|x| help += PARAM[x.data_id] + "*" + x.value.to_s + "\n"}
- featuresparam[1].each{|x| help += XPARAM[x.data_id] + x.value.to_s + "\n"}
- featuresparam[2].each{|x| help += SPARAM[x.data_id] + "*" + x.value.to_s + "\n"}
- help
- end
- def self.getline(text,maxtext)
- xtext = []
- line = 0
- text.each_line{|x| xtext.push x.sub(/\n/){}}
- xtext.each{|x| x.size % maxtext != 0 ? line += x.size / maxtext + 1 : line += x.size / maxtext}
- line
- end
- end
- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 显示特技和物品等的说明、以及角色状态的窗口
- #==============================================================================
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(line_number = 0)
- super(0, 0, 210, fitting_height(line_number))
- self.z = 150
- contents.font.size = 10
- hide
- end
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- if text != @text
- @text = text
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助位置
- #--------------------------------------------------------------------------
- def uppos(index,rect,window)
- self.height = fitting_height2(Help.getline(@xtext,13))
- create_contents
- contents.font.size = 14
- rect.x -= window.ox
- rect.y -= window.oy
- ax = rect.x + rect.width + 10
- ax = rect.x - self.width + 10 if ax + self.width > window.width + 10
- ax += window.x
- ax = 0 if ax < 0
- ay = rect.y + rect.height
- ay = rect.y - self.height if ay + self.height > window.height
- ay += window.y
- ay = 0 if ay < 0
- self.x = ax
- self.y = ay
- set_text(@xtext)
- show
- end
- #--------------------------------------------------------------------------
- # ● 设置物品
- # item : 技能、物品等
- #--------------------------------------------------------------------------
- def set_item(item)
- if item == nil
- set_text("")
- return
- end
- @xtext = ""
- @xtext = "名称:" + item.name + "\n"
- @xtext += "介绍:" + item.description + "\n"
- @xtext += "价格:" + item.price.to_s + "\n" if item.is_a?(Unique_Equip) || item.is_a?(Unique_Item)
- @xtext += Help.getequiphelp(item) if item.is_a?(Unique_Equip)
- @xtext = @xtext[0,@text.size - 2] if @xtext[@xtext.size - 2,2] == "\n"
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- hide if @text == ""
- draw_text_ex(4, 0, @text,width,40,false)
- end
- end
- class Window_Base < Window
- #--------------------------------------------------------------------------
- # ● 计算窗口显示指定行数时的应用高度2*************************
- #--------------------------------------------------------------------------
- def fitting_height2(line_number)
- line_number * contents.font.size + standard_padding * 2
- end
- #~ draw_text_ex的增强,使其可以自动换行 原作者:叶子 修改:wyongcan
- #--------------------------------------------------------------------------
- # ● 绘制带有控制符的文本内容
- # 如果传递了width参数的话,会自动换行
- #--------------------------------------------------------------------------
- def draw_text_ex(x, y, text, width = nil,textwidth = nil,normalfont = true)
- reset_font_settings if normalfont == true
- text = convert_escape_characters(text)
- pos = {:x => x, :y => y, :new_x => x, :height => calc_line_height(text)}
- if width != nil
- pos[:height] = contents.font.size
- pos[:width] = width
- pos[:textwidth] = textwidth
- end
- process_character(text.slice!(0, 1), text, pos) until text.empty?
- end
- #--------------------------------------------------------------------------
- # ● 文字的处理
- # c : 文字
- # text : 绘制处理中的字符串缓存(字符串可能会被修改)
- # pos : 绘制位置 {:x, :y, :new_x, :height}
- #--------------------------------------------------------------------------
- def process_character(c, text, pos)
- case c
- when "\r" # 回车
- return
- when "\n" # 换行
- process_new_line(text, pos)
- when "\f" # 翻页
- process_new_page(text, pos)
- when "\e" # 控制符
- process_escape_character(obtain_escape_code(text), text, pos)
- else # 普通文字
- pos[:textwidth] == nil ? text_width = text_size(c).width : text_width = pos[:textwidth]
- if pos[:width] != nil && pos[:x] - pos[:new_x] + text_width > pos[:width]
- process_new_line(text, pos)
- end
- process_normal_character(c, pos)
- end
- end
- end
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
- end
- end
- class Window_SkillList < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item)
- @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil
- end
- end
- class Window_ShopBuy < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item) if @help_window
- @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
- @status_window.item = item if @status_window
- end
- end
- class Window_EquipSlot < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 更新帮助内容
- #--------------------------------------------------------------------------
- def update_help
- super
- @help_window.set_item(item) if @help_window
- @help_window.uppos(index,item_rect(index),self) if index != -1 && item != nil && @help_window
- @status_window.set_temp_actor(nil) if @status_window
- end
- end
- class Scene_Shop < Scene_MenuBase
- alias on_sell_ok_old on_sell_ok
- def on_sell_ok
- on_sell_ok_old
- @help_window.hide
- end
- alias on_buy_ok_old on_buy_ok
- def on_buy_ok
- on_buy_ok_old
- @help_window.hide
- end
- alias on_number_ok_old on_number_ok
- def on_number_ok
- on_number_ok_old
- @help_window.refresh
- @help_window.show
- end
- alias on_number_cancel_old on_number_cancel
- def on_number_cancel
- on_number_cancel_old
- @help_window.refresh
- @help_window.show
- end
- end
- class Scene_Title < Scene_Base
- alias start_old start
- def start
- start_old
- Help.ready
- end
- end
- class Window_Base < Window
- alias old_process_new_line process_new_line
- def process_new_line(text, pos)
- old_process_new_line(text, pos)
- pos[:height] = contents.font.size if pos[:width] != nil
- end
- end
- class Scene_ItemBase < Scene_MenuBase
- alias old_on_actor_cancel on_actor_cancel
- def on_actor_cancel
- old_on_actor_cancel
- @help_window.refresh
- end
- alias old_on_actor_ok on_actor_ok
- def on_actor_ok
- old_on_actor_ok
- @help_window.refresh
- end
- end
复制代码
第三个 - #encoding:utf-8
- #==============================================================================
- # ■ Equip Randomnization - Quality Color based on PS0
- #------------------------------------------------------------------------------
- # Author: 仲秋启明(PS0颜色绘制), LBQ
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- class RPG::EquipItem
- def good_quality?
- return !self.note.include?("<BAD>")
- end
-
- def great_quality?
- return self.note.include?("<GREAT>")
- end
-
- end
- module Quality
- def quality
- value = 1
- self.prefix_objects.each do |p|
- if p.good_quality?
- value += 1
- else
- value -= 1
- end
- value += 1 if p.great_quality?
- end
-
- return value
- end
- end
- class Unique_Equip
- include Quality
- end
- #==============================================================================
- # [PS0]物品颜色描绘
- # Window_Base_Itemcolor
- #------------------------------------------------------------------------------
- # 在物品、技能选项中显示物品品质并显示品质框和修改物品名颜色。
- #==============================================================================
- # [更新记录]
- # - 2012.01.03 By 仲秋启明
- # * 修改为VA定义
- # - 2011.12.27 By 仲秋启明
- # * 移植至RGSS3,遵循PS0协议;
- # * 优化数据库备注中设定方法
- # - 2011.08.22 By 冰舞蝶恋
- # * 蓝本(实用·极简 -- 按品质,给物品描绘色彩边框)
- # - 2010.08.06 By 仲秋启明
- # * 蓝本(物品颜色描绘脚本(完整无冲突版))
- #------------------------------------------------------------------------------
- # [使用方法]
- # - 替换原Window_Base中的draw_item_name定义或复制到Main之前
- #==============================================================================
- $_PS0 = {} if $_PS0 == nil
- $_PS0["Window_Base_Itemcolor"] = 20111227
- #==============================================================================
- # [PS0] 通用配置模块
- #==============================================================================
- module PS0
- module Window_Base_Itemcolor
- Color0 = Color.new(137, 137, 137)
- Color1 = Color.new(255, 255, 255) # 一般品质的色彩(白,1)
- Color2 = Color.new(128, 255, 128) # 平庸品质的色彩(绿,2)
- Color3 = Color.new(128, 128, 255) # 精良品质的色彩(蓝,3)
- Color4 = Color.new(255, 0, 255) # 卓越品质的色彩(紫,4)
- Color5 = Color.new(255, 128, 128) # 神秘品质的色彩(红,5)
- Color6 = Color.new(255, 128, 0) # 传说品质的色彩(橙,6)
- Color7 = Color.new(255, 255, 128) # 特殊品质的色彩(黄,7)
- end
- end
- #==============================================================================
- # ■ Window_Base
- #==============================================================================
- class Window_Base < Window
- def draw_item_name(item, x, y, enabled = true, width = 172)
- if item != nil
- n = item.note
-
- c = 1
- c = item.quality if item.respond_to? :quality
- if c <= 0
- color = PS0::Window_Base_Itemcolor::Color0
- elsif c == 1
- color = PS0::Window_Base_Itemcolor::Color1
- elsif c == 2
- color = PS0::Window_Base_Itemcolor::Color2
- elsif c == 3
- color = PS0::Window_Base_Itemcolor::Color3
- elsif c == 4
- color = PS0::Window_Base_Itemcolor::Color4
- elsif c == 5
- color = PS0::Window_Base_Itemcolor::Color5
- elsif c == 6
- color = PS0::Window_Base_Itemcolor::Color6
- elsif c == 7
- color = PS0::Window_Base_Itemcolor::Color7
- else
- color = Color.new(0, 0, 0, 0)
- end
- draw_icon(item.icon_index, x, y, enabled)
- change_color(color, enabled)
- draw_text(x + 24, y, width, line_height, item.name)
- end
- end
- end
- #==============================================================================
- # [PS0] End of Script
- #==============================================================================
复制代码
第四个 - #encoding:utf-8
- #==============================================================================
- # ■ Gain Enchanted Item after Battle - beta plugin
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- class << BattleManager
- #--------------------------------------------------------------------------
- # ● 显示获得的物品
- #--------------------------------------------------------------------------
- def gain_drop_items
- $game_troop.make_drop_items.each do |item|
- puts "The Class of the Item: #{item.class}"
- if item.is_a? RPG::Weapon
- $game_party.gain_enchanted_weapon(item.id)
- new_item = $game_party.weapons.last
- elsif item.is_a? RPG::Armor
- $game_party.gain_enchanted_armor(item.id)
- new_item = $game_party.armors.last
- else
- $game_party.gain_item(item, 1)
- new_item = $game_party.items.last
- end
- $game_message.add(sprintf(Vocab::ObtainItem, new_item.name))
- end
- wait_for_message
- end
- end
复制代码
第5个 - #encoding:utf-8
- #==============================================================================
- # ■ Prefix Generator - Beta : Generate the prefix according to f(x)=log2(x)
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- module Prefix_Gen
- class << self
- def generate_prefix(type)
- num = function
- if num>=3
- num -=1
- num = 3 if num>3
- end
-
- dic = ADE.get_all_prefix(type)
- return_value = Array.new(num,0)
- return_value.map! do |v|
- dic.sample
- end
- return_value = return_value.uniq
- return return_value
- end
-
-
- def function
- return (-Math.log(rand,2)).round
- end
- end
- end
复制代码
第6个- #encoding:utf-8
- #==============================================================================
- # ■ LBQ's Equip Randomnization Patch 1 - The Gate to Beta 2
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- class Window_ShopStatus
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_possession(4, 0)
- draw_equip_info(4, line_height * 2) if @item.is_a?(Unique_Equip)
- end
- end
- class Game_Party
- alias lbq_patch_1_item_number item_number
- def item_number(item)
- if item.class == RPG::Weapon or item.class == RPG::Armor or item.class == RPG::Item
- (@armors + @items + @weapons).select do |i|
- if i.object
- i.object.name == item.name
- else
- false
- end
-
- end.length
- else
- return lbq_patch_1_item_number(item)
- end
- end
- end
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 判定物品是否可以装备
- #--------------------------------------------------------------------------
- alias lbq_patch_1_unique_engine_equippable? equippable?
- def equippable?(item)
- return lbq_patch_1_unique_engine_equippable?(item.object) if item.is_a?(Unique_Equip)
- lbq_patch_1_unique_engine_equippable?(item)
- end
- end
- class Unique_Equip
- def performance
- return 0 if is_nil?
- return performance_objects.inject(0) do |o,n|
- o+=n.performance
- end
-
- end
-
- def performance_objects
- return [object] + prefix_objects
- end
-
-
- end
- class Game_Actor
- def true_equips
- return @equips
- end
-
- end
- class Window_EquipSlot
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return nil unless @actor
- if @actor.true_equips[index]
- if @actor.true_equips[index].name
- return @actor.true_equips[index]
- else
- return nil
- end
- end
- end
- end
复制代码- #encoding:utf-8
- #==============================================================================
- # ■ Reforging - LBQ Equip Randmnization plugin
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- # SceneManager.call Scene_Reforge
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- class Unique_Equip
- def type
- return :weapon if is_weapon?
- return :armor if is_armor?
- return nil if is_nil?
- raise
- end
- end
- module Reforge
- def shallow_reforge
- self.generate_param_randomness
- self.regenerate_prefix_features
- end
-
-
- def deep_reforge
- gp = Prefix_Gen.generate_prefix(self.type)
- @prefixes = []
- @prefix_features = {}
- gp.each do |p|
- self.enchant(p)
- end
- self.generate_price_randomness
- end
- alias reforge deep_reforge
- end
- class Unique_Equip
- include Reforge
-
- def reforge_price
- return self.price*2
- end
-
-
- def shallow_price
- return self.price/10
- end
-
- end
- class Reforge_ItemWindow < Window_ItemList
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_party.all_items.select {|item| item.is_a? Unique_Equip }
- @data.push(nil) if include?(nil)
- end
-
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
-
-
- def draw_item_reforge_price(rect,item)
- str = "#{item.reforge_price}"
- draw_text(rect, str, 2)
- end
-
-
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item),350)
- draw_item_reforge_price(rect, item)
- end
- end
-
- def enable?(item)
- enable = false
- enable = true if $game_party.gold>item.reforge_price
- return enable
- end
-
- end
- class Scene_Reforge < Scene_MenuBase
- def start
- super
- create_gold_window
- create_reforge_window
- create_info_window
- create_background
- end
-
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = Graphics.height - @gold_window.height
- @gold_window.refresh
- end
-
-
- def create_info_window
- a = 0
- b = @reforge_window.height
- c = @reforge_window.width - @gold_window.width
- d = @gold_window.height
- @info_window = Window_Base.new(a,b,c,d)
- refresh_info_window
- end
-
-
- def refresh_info_window
- @info_window.contents.clear
- return unless @reforge_window.item
- @info_window.draw_item_name(@reforge_window.item,0,0)
- str = " 评价:#{@reforge_window.item.performance}"
- @info_window.draw_text(0,0,@info_window.contents.width,@info_window.contents.height,str,2)
- end
-
-
- def create_reforge_window
-
- @help_window = Window_Help.new
- w = Graphics.width
- h = Graphics.height - @gold_window.height
- @reforge_window = Reforge_ItemWindow.new(0,0,w,h)
- @reforge_window.make_item_list
- @reforge_window.activate
- @reforge_window.select(0)
- @reforge_window.refresh
- @reforge_window.help_window = @help_window
- end
-
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- draw_all_items
- end
-
-
- def update
- super
- if Input.press?(:DOWN) || Input.press?(:UP)
- refresh_info_window
- end
-
- if Input.trigger?(:B)
- Sound.play_cancel
- SceneManager.return
- end
-
- if Input.trigger?(:C) && @reforge_window.item
- if @reforge_window.item.reforge_price <= $game_party.gold
- $game_party.gain_gold([email]-@reforge_window.item.reforge_price[/email])
- Sound.play_reflection
- @reforge_window.item.reforge
- @reforge_window.refresh
-
- @help_window.dispose
- @help_window = Window_Help.new
- @reforge_window.help_window = @help_window
- @help_window.refresh
- @gold_window.refresh
-
- refresh_info_window
- end
- end
- end
-
- end
复制代码
- #encoding:utf-8
- #==============================================================================
- # ■ Enchanter - LBQ Equip Randomnization Plugin
- #------------------------------------------------------------------------------
- # Author: LBQ lbq.mist.so
- #==============================================================================
- # SceneManager.call Scene_Enchanter
- #==============================================================================
- unless $imported[:lbq_equip_randomnization]
- msgbox "Require LBQ Equip Randomnization Script"
- exit
- end
- class Unique_Equip
- def remove_enchant(id)
- @prefixes.delete id
- @prefix_features.delete id
- end
- end
- class Game_Temp
- DEFAULT_ENCHANTS = {
- :weapon => [63,64,65,66],
- :armor => [62,64,68],
- }
- attr_accessor :ava_enchants
- def ava_enchants
- @ava_enchants || DEFAULT_ENCHANTS
- end
-
- end
- class Enchant_ItemWindow < Window_ItemList
- attr_accessor :add_window
- attr_accessor :remove_window
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- @data = $game_party.all_items.select {|item| item.is_a? Unique_Equip }
- @data.push(nil) if include?(nil)
- end
-
- #--------------------------------------------------------------------------
- # ● 获取列数
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
-
- #--------------------------------------------------------------------------
- # ● 处理光标的移动
- #--------------------------------------------------------------------------
- def process_cursor_move
- last_index = @index
- super
- refresh_my_windows if @index != last_index
- end
-
-
- def refresh_my_windows
- return unless self.item
- @add_window.enchant_item = self.item
- @remove_window.enchant_item = self.item
- @add_window.db = $data_weapons if self.item.is_weapon?
- @add_window.db = $data_armors if self.item.is_armor?
- raise unless @add_window.db
- @add_window.refresh
- @remove_window.refresh
- end
-
-
- #--------------------------------------------------------------------------
- # ● 绘制项目
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- end
- end
-
- def enable?(item)
- return true
- end
-
- end
- class Window_PrefixWindow < Window_ItemList
- attr_accessor :db
- attr_accessor :prefixes
- def initialize(prefix)
- super(0,0,Graphics.width,Graphics.height)
- yield self if block_given?
- @prefixes = $game_temp.ava_enchants
- @prefixes = prefix if prefix
- end
-
- def prefixes=(array)
- @prefixes = array
- refresh
- end
-
- def draw_item(index)
- item = @data[index]
- if item
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- draw_item_price(rect, item)
- end
- end
-
-
- #--------------------------------------------------------------------------
- # ● 绘制物品个数
- #--------------------------------------------------------------------------
- def draw_item_price(rect, item)
- draw_text(rect,"#{get_price(item)}", 2)
- end
-
-
- def get_price(item)
- 0
- end
-
-
- def enable?(item)
- return get_price(item) <= $game_party.gold
- end
-
- # From PS0
- def draw_item_name(item, x, y, enabled = true, width = 172)
- if item != nil
- n = item.note
-
- c = 1
- c = item.quality if item.respond_to? :quality
- if c <= 0
- color = PS0::Window_Base_Itemcolor::Color0
- elsif c == 1
- color = PS0::Window_Base_Itemcolor::Color1
- elsif c == 2
- color = PS0::Window_Base_Itemcolor::Color2
- elsif c == 3
- color = PS0::Window_Base_Itemcolor::Color3
- elsif c == 4
- color = PS0::Window_Base_Itemcolor::Color4
- elsif c == 5
- color = PS0::Window_Base_Itemcolor::Color5
- elsif c == 6
- color = PS0::Window_Base_Itemcolor::Color6
- elsif c == 7
- color = PS0::Window_Base_Itemcolor::Color7
- else
- color = Color.new(0, 0, 0, 0)
- end
- change_color(color, enabled)
- draw_text(x, y, width, line_height, item.name)
- end
- end
-
- end
- class Enchant_InfoWindow < Window_Base
- def initialize(*args)
- super(*args)
- end
-
- def item=(x)
- @item = item
- refresh
- end
-
- def display(x)
- self.contents.clear
- draw_text_ex(0,0,x)
- end
-
- end
- class Prefix_AddWindow < Window_PrefixWindow
- attr_accessor :enchant_item
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- return unless @db
- @data = @prefixes[db==$data_weapons ? :weapon : :armor].collect{|p| @db[p]}
- @data.push(nil) if include?(nil)
- end
-
- def get_price(item)
- price = 0
- price += @enchant_item.price unless @enchant_item
-
- if item.good_quality?
- price+= (@enchant_item.price/5) * (@enchant_item.prefix_objects.length + 1)
- else
- price = @enchant_item.price/10 * (@enchant_item.prefix_objects.length + 1)
- end
-
- price+=item.price
-
- if price<=40
- price += 40
- end
-
- return price
- end
-
-
- def enable?(item)
- return false if @enchant_item.prefixes.include?(item.id)
- super
- end
-
- end
- class Prefix_RemoveWindow < Window_PrefixWindow
- attr_accessor :enchant_item
- #--------------------------------------------------------------------------
- # ● 生成物品列表
- #--------------------------------------------------------------------------
- def make_item_list
- return unless @enchant_item
- @data = @enchant_item.prefix_objects
- @data.push(nil) if include?(nil)
- end
-
-
-
- def get_price(item)
- price = 0
- if item.good_quality?
- price = @enchant_item.price/20
- else
- price = @enchant_item.price/5
- end
- return price
- end
-
-
- end
- class Scene_Enchanter < Scene_MenuBase
- def start
- super
- create_all_windows
- activate_select_window
- @select_window.select(0)
- deal_with_enchant_item
- @add_window.refresh
- @remove_window.refresh
- remove_all_bug_cursors
- end
-
-
- def create_all_windows
- create_gold_window
- create_remove_window
- create_add_window
- create_select_window
- @select_window.add_window = @add_window
- @select_window.remove_window = @remove_window
- create_info_window
- end
-
-
- def create_select_window
- a = 0
- b = 0
- c = Graphics.width/2
- d = Graphics.height - @gold_window.height
- @select_window = Enchant_ItemWindow.new(a,b,c,d)
-
- end
-
- def create_remove_window
- a = Graphics.width/2
- b = 0
- c = Graphics.width/2
- d = (Graphics.height - @gold_window.height)/2
- @remove_window = Prefix_RemoveWindow.new(nil) do |w|
- w.x = a
- w.y = b
- w.width = c
- w.height = d
- end
- end
-
- def create_add_window
- a = Graphics.width/2
- b = @remove_window.height
- c = Graphics.width/2
- d = (Graphics.height - @gold_window.height)/2
- @add_window = Prefix_AddWindow.new(nil) do |w|
- w.x = a
- w.y = b
- w.width = c
- w.height = d
- end
- end
-
-
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = Graphics.height - @gold_window.height
- @gold_window.refresh
- end
-
- def create_info_window
- a = 0
- b = @select_window.height
- c = Graphics.width - @gold_window.width
- d = @gold_window.height
- @info_window = Enchant_InfoWindow.new(a,b,c,d)
- end
-
-
-
- def update
- super
- if Input.trigger?(:B)
- Sound.play_cancel
- if @select_window.active
- SceneManager.return
- else
- activate_select_window
- end
- end
-
- return unless @select_window.item
-
- if Input.trigger?(:X) && @select_window.active
- if @select_window.item.prefixes.length>=3
- Sound.play_buzzer
- @info_window.display "Too many prefixes!"
- return
- end
- Sound.play_ok
- activate_add_window
- elsif Input.trigger?(:Z) && @select_window.active
- Sound.play_ok
- activate_remove_window
- elsif Input.trigger?(:C) && (@add_window.active || @remove_window.active)
- if @add_window.active
- do_add_prefix
- else
- do_remove_prefix
- end
- Sound.play_magic_evasion
- end
- end
-
- def do_add_prefix
- return unless @add_window.item
- @select_window.item.enchant(@add_window.item.id)
- $game_party.gain_gold([email]-@add_window.get_price[/email](@select_window.item))
- @gold_window.refresh
-
- @add_window.enchant_item = @select_window.item
- activate_select_window
- end
-
-
- def do_remove_prefix
- return unless @remove_window.item
- @select_window.item.remove_enchant(@remove_window.item.id)
- $game_party.gain_gold([email]-@remove_window.get_price[/email](@select_window.item))
- @gold_window.refresh
- activate_select_window
- end
-
-
-
- def activate_select_window
- disactivate_all_windows
- deal_with_all_activate(@select_window)
-
- @info_window.display "A - Add Enchants; D - Remove Enchants"
- end
-
-
- def deal_with_enchant_item
- return unless @select_window.item
- @add_window.enchant_item = @select_window.item
- @remove_window.enchant_item = @select_window.item
- @add_window.db = $data_weapons if @select_window.item.is_weapon?
- @add_window.db = $data_armors if @select_window.item.is_armor?
- end
-
-
-
- def activate_add_window
- @add_window.enchant_item = @select_window.item
- @add_window.db = $data_weapons if @select_window.item.is_weapon?
- @add_window.db = $data_armors if @select_window.item.is_armor?
- disactivate_all_windows
- deal_with_all_activate(@add_window)
- @info_window.display "Press Space to Confirm Adding"
- end
-
-
- def deal_with_all_activate(target)
- raise unless target.respond_to?(:make_item_list)
- target.activate
- target.select(0) unless target == @select_window
- target.refresh
- end
-
-
- def activate_remove_window
- @remove_window.enchant_item = @select_window.item
- disactivate_all_windows
- deal_with_all_activate(@remove_window)
- @info_window.display "Press Space to Confirm Removing"
- end
-
- def remove_all_bug_cursors
- end
-
-
- def disactivate_all_windows
- @select_window.active, @add_window.active, @remove_window.active = false,false,false
- @add_window.select(-1)
- @remove_window.select(-1)
- @remove_window.contents.clear
- @add_window.select(-1)
- @add_window.contents.clear
-
- @select_window.refresh_my_windows if @select_window.item
- end
-
- end
复制代码 |
-
装备颜色无法描绘
-
需要改颜色的地方
|