赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 7 |
经验 | 5305 |
最后登录 | 2024-6-15 |
在线时间 | 218 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 686
- 在线时间
- 218 小时
- 注册时间
- 2016-5-10
- 帖子
- 99
|
3楼
楼主 |
发表于 2016-5-18 18:27:47
|
只看该作者
- =begin
- ==============================================================================
- MESS 1.00 (全称:Make Equips Stornger System)
- -----------------------------------------------------------------------------
- 装备强化系统 1.00 by 804173948
- ==============================================================================
- 与其他大部分强化系统的区别:
-
- (并没有针对某些强化系统、不过按自己的喜好选择吧)
-
- 1.增加属性方面
- 大部分强化系统强化装备时增加的属性都是用特定公式计算的,
- 这个可直接在数据库里面自己设定好每一个属性,不用被公式束缚、
- 另外还有一个好处是,因为是数据库里面的装备,
- 所以打怪也可以直接在数据库里设定掉落这些被强化的装备
-
- 2.强化成功率和所需金钱方面
- 很多强化系统都是固定的一个值或几个值,
- 本脚本可以直接在数据库里设定、不同装备强化成功率以及所需金钱都不同
-
- 3.所需物品方面
- 本强化系统可以用多个物品强化一个装备,
- 强化每一个装备所需的物品都可以自行设定,
- (打个比方、比如说要强化一个红宝石做的项链、自然要用[红宝石]来强化它;
- 但是一个绿宝石做的项链、却用[红宝石]来强化、就会觉得很怪、所以本人觉得
- 强化每一个装备所需的物品都可以自行设定 更合理)
-
- 4.物品槽
- (个人感觉更像合成系统之类的、、、)
-
- 使用说明:
-
- 装备:
-
- 1.使装备能够强化:
- 在备注上加上 [Strongable 强化后的ID]
-
- 如:一个武器在备注加上[Strongable 100]
- 强化成功后就获得一个 第100号武器
-
- 2.强化成功率:
- 在备注上加上 [Rate 成功率]
- 成功率是0~100之间
-
- 3.强化所需金钱:
- 在备注上加上 [Gold 数值]
-
- 4.强化所需物品:
- 在备注上加上 [item n 物品[n]ID]
- n 代表所需的第 n 个物品
-
- 如:一个武器需要 第10号物品2个,30号物品一个
- 就在备注上加上 [item 1 10]
- [item 2 10]
- [item 3 30]
- 详细的就直接看范例的数据库里吧、
-
- 物品:
-
- 1.能够增加成功率:
- 在备注上加上 [RateUP 成功率]
- 成功率最好是0~100之间
- 注意、所谓成功率不是直接加在装备成功率上
- 、、比如说、强化一个成功几率为 60% 的装备、使用能够提升 20% 成功率的物品
- 成功率不是变为 80,而是 72 ,72 = 60*(1+20%)
-
- 2.能够防止装备随坏:
- 在备注上加上 [Prevent]
-
- 界面:
-
- 1.物品装备栏:
- 位于左方,选取物品和装备进行强化
- 2.物品信息栏:
- 中间最大的那个,显示装备物品信息和强化信息
- 3.所需物品提示:
- 中下方,显示强化某装备必须品
- 4.物品槽:
- 右下角,选定准备进行强化的物品
-
- ※5.提示框(最最重要的又是最最最容易被人忽略的):
- 左上方,提示你接下来要做什么、、、
-
- ※注意事项:
-
- 1.此脚本要与“装备帮助增强”脚本共用
- (“装备帮助增强”脚本我改动了、具体行数是 123 行到 133 行,
- 请复制到你的工程同一位置中)
-
- 2.不知道、、、
-
- BUG、冲突:
-
- 暂无- -、
-
- 友情提示:
- 最好把窗口分辨率调到最大、、、
-
-
- =end
- module MESS
- # 能够强化的标志
- CanAugmentFlag = "Strongable"
- # 强化成功的几率
- SuccessfulAugmentRate = "Rate"
- # 强化所需物品
- UseItemForAugment = "Item"
- # 强化所需金钱
- MoneyForAugment = "Gold"
- # 增加强化成功率的物品(0~100)
- CanRateUP = "RateUP"
- # 强化失败能避免原装备损坏的标志
- PreventLost = "Prevent"
- # 强化所需物品最大值
- MaxItemUse = 5
- end
- class Scene_MESS < Scene_ItemBase
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_text_help_window
- create_item_status_window
- create_item_window
- create_augment_setting_window
- create_item_slot_window
- end
- #--------------------------------------------------------------------------
- # ● 生成文字提示窗口
- #--------------------------------------------------------------------------
- def create_text_help_window
- @text_help_window = Window_Help.new(1)
- @text_help_window.width = 256
- @text_help_window.set_text("选择装备进行强化")
- end
- #--------------------------------------------------------------------------
- # ● 生成物品窗口
- #--------------------------------------------------------------------------
- def create_item_window
- wy = @text_help_window.y + @text_help_window.height
- ww = @text_help_window.width
- wh = Graphics.height - wy
- @item_window = Window_EquipList.new(0, wy, ww, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @item_status_window
- @item_window.set_handler(:ok , method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- end
- #--------------------------------------------------------------------------
- # ● 生成物品状态窗口
- #--------------------------------------------------------------------------
- def create_item_status_window
- wx = @text_help_window.width
- wy = 0
- ww = Graphics.width - wx
- wh = Graphics.height / 3 * 2
- @item_status_window = Window_EquipStatus2.new(wx, wy, ww, wh)
- @item_status_window.viewport = @viewport
- end
- #--------------------------------------------------------------------------
- # ● 生成强化设定窗口(中下窗口)
- #--------------------------------------------------------------------------
- def create_augment_setting_window
- wx = @text_help_window.width
- wy = @item_status_window.height
- ww = (Graphics.width - wx)/2
- wh = Graphics.height - wy
- @augment_setting_window = Window_AugmentSet.new(wx, wy, ww, wh)
- @augment_setting_window.viewport = @viewport
- @item_status_window.relation_window = @augment_setting_window
- end
- #--------------------------------------------------------------------------
- # ● 生成物品槽
- #--------------------------------------------------------------------------
- def create_item_slot_window
- wx = @augment_setting_window.x + @augment_setting_window.width
- wy = @augment_setting_window.y
- ww = Graphics.width - wx
- wh = Graphics.height - wy
- @slot_window = Window_ItemSlot.new(wx, wy, ww, wh)
- @slot_window.viewport = @viewport
- @slot_window.help_window = @item_status_window
- @slot_window.set_handler(:ok , method(:on_slot_ok))
- @slot_window.set_handler(:cancel, method(:on_slot_cancel))
- @item_window.index = 0
- @item_window.activate
- end
- #--------------------------------------------------------------------------
- # ● 生成警示窗口
- #--------------------------------------------------------------------------
- def create_warn_window
- ww = Graphics.width / 4 * 3
- wx = (Graphics.width - ww) / 2
- wy = 80
- @warn_window = Window_Help.new(1)
- @warn_window.x = wx
- @warn_window.y = wy
- @warn_window.width = ww
- @warn_window.viewport = @viewport
- @warn_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 物品“确定”
- #--------------------------------------------------------------------------
- def on_item_ok
- if @item_window.item
- if @item_window.itemtype == :equip
- @item_window.equip = @item_status_window.equip
- @text_help_window.set_text("选择物品进行强化")
- @item_window.itemtype = :item
- @item_window.refresh
- @item_window.index = 0
- @item_window.activate
- elsif @item_window.itemtype == :item
- @text_help_window.set_text("选择物品槽放置物品")
- @slot_window.index = 0 if @slot_window.index < 0
- @slot_window.activate
- end
- else
- on_item_change
- end
- end
- #--------------------------------------------------------------------------
- # ● 物品“取消”
- #--------------------------------------------------------------------------
- def on_item_cancel(augmenting = false)
- if @item_window.itemtype == :item
- if @slot_window.data != [] && augmenting == false
- MESS::MaxItemUse.times {|i| $game_party.gain_item(@slot_window.data[i],1) if @slot_window.data[i]}
- MESS::MaxItemUse.times {|i| @slot_window.remove_item(i)}
- end
- @item_window.equip = nil
- @text_help_window.set_text("选择装备进行强化")
- @item_window.itemtype = :equip
- @item_window.refresh
- @item_window.index = 0
- @item_status_window.clear(true) if augmenting
- @item_window.activate
- elsif @item_window.itemtype == :equip
- SceneManager.return
- end
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“确定”
- #--------------------------------------------------------------------------
- def on_slot_ok
- if @slot_window.item != :augment
- if @item_window.windowstatus == :owner
- @text_help_window.set_text("选择物品进行强化")
- @augment_setting_window.set_item(@item_status_window.equip)
- item = @item_window.item
- if item.porveup > 0
- rate = @item_status_window.basic_rate.to_f
- rate *= item.porveup/100.0
- rate *= 10
- rate.round
- rate /= 10.0
- @item_status_window.rate = @item_status_window.rate + rate
- end
- item = @slot_window.item
- if item
- if item.porveup > 0
- rate = @item_status_window.basic_rate.to_f
- rate *= item.porveup/100.0
- rate *= 10
- rate.round
- rate /= 10.0
- @item_status_window.rate = @item_status_window.rate - rate
- end
- end
- $game_party.lose_item(@item_window.item,1)
- $game_party.gain_item(@slot_window.item,1) if @slot_window.item
- @slot_window.set_item(@item_window.item,@slot_window.index)
- @item_status_window.refresh_aug_status
- @item_window.refresh
- @item_window.activate
- elsif @item_window.windowstatus == :given
- item = @slot_window.item
- if item
- if item.porveup > 0
- rate = @item_status_window.basic_rate.to_f
- rate *= item.porveup/100.0
- rate *= 10
- rate.round
- rate /= 10.0
- @item_status_window.rate = @item_status_window.rate - rate
- end
- $game_party.gain_item(item,1)
- @slot_window.remove_item(@slot_window.index)
- end
- @item_status_window.refresh_aug_status
- @item_window.refresh
- @slot_window.activate
- end
- else
- @text_help_window.set_text("正在进行强化")
- augment
- end
- end
- #--------------------------------------------------------------------------
- # ● 装备栏“取消”
- #--------------------------------------------------------------------------
- def on_slot_cancel
- if @item_window.windowstatus == :owner
- @text_help_window.set_text("选择物品进行强化")
- @item_window.refresh
- @item_window.activate
- elsif @item_window.windowstatus == :given
- on_slot_change
- end
- end
-
- def augment
- create_warn_window
- equip = @item_status_window.equip
- if equip
- rate = @item_status_window.rate
- gold = @item_status_window.gold
- item = @slot_window.data.select {|item| item != :augment && item }
- needitem = []
- MESS::MaxItemUse.times {|i| needitem.push($data_items[equip.strongitem(i+1)]) if equip.strongitem(i+1) > 0}
- # 检查必需品
- needcount = 0
- for i in 0 ... needitem.size
- if item.include?(needitem[i])
- needcount += 1
- for a in 0 ... item.size
- if item[a] == needitem[i]
- item.delete_at(a)
- break
- end
- end
- end
- end
- #~ needitem.size.times{|i| item.delete(needitem[i]) if item.include?(needitem[i])}
- if needcount >= needitem.size
- if $game_party.gold >= gold
- $game_party.lose_gold(gold)
- $game_party.lose_item(equip,1)
- rand = rand(100)
- if rand <= rate
- new_item = nil
- if equip.is_a?(RPG::Weapon)
- new_item = $data_weapons[equip.strongto]
- elsif equip.is_a?(RPG::Armor)
- new_item = $data_armors[equip.strongto]
- end
- $game_party.gain_item(new_item,1)
- BattleManager.play_battle_end_me
- @warn_window.show
- @warn_window.set_text("恭喜,装备升到了" + new_item.name + "!")
- Graphics.wait(60)
- @warn_window.hide
- @slot_window.clear
- @slot_window.refresh
- on_slot_cancel
- on_item_cancel(true)
- else
- prevent = false
- for i in 0 ... item.size
- if item[i].prevent?
- prevent = true
- break
- end
- end
- if !prevent
- $data_system.gameover_me.play
- @warn_window.show
- @warn_window.set_text("很遗憾,强化失败,装备消失")
- Graphics.wait(60)
- @warn_window.hide
- @slot_window.clear
- @slot_window.refresh
- on_slot_cancel
- on_item_cancel(true)
- else
- $game_party.gain_item(equip,1)
- $data_system.gameover_me.play
- @warn_window.show
- @warn_window.set_text("强化失败,使用特殊道具,装备保存")
- Graphics.wait(60)
- @warn_window.hide
- @slot_window.clear
- @slot_window.refresh
- on_slot_cancel
- on_item_cancel(true)
- end
- end
- else
- Sound.play_buzzer
- @warn_window.show
- @warn_window.set_text("没有足够金钱")
- Graphics.wait(30)
- @warn_window.hide
- on_slot_cancel
- end
- else
- Sound.play_buzzer
- @warn_window.show
- @warn_window.set_text("没有足够物品")
- Graphics.wait(30)
- @warn_window.hide
- on_slot_cancel
- end
- else
- Sound.play_buzzer
- @warn_window.show
- @warn_window.set_text("没有选定装备")
- Graphics.wait(30)
- @warn_window.hide
- on_slot_cancel
- end
- end
-
- def on_item_change
- @text_help_window.set_text("移除物品槽物品")
- @item_window.windowstatus = :given
- @slot_window.refresh
- @slot_window.activate
- end
-
- def on_slot_change
- @text_help_window.set_text("选择物品进行强化")
- @item_window.windowstatus = :owner
- @slot_window.index = 0
- @item_window.refresh
- @item_window.activate
- end
- #--------------------------------------------------------------------------
- # ● 播放使用物品声效
- #--------------------------------------------------------------------------
- def play_se_for_item
- Sound.play_use_item
- end
- #--------------------------------------------------------------------------
- # ● 使用物品
- #--------------------------------------------------------------------------
- def use_item
- super
- @item_window.redraw_current_item
- end
- end
- class Window_EquipList < Window_ItemList
- attr_accessor :equip
- attr_accessor :itemtype
- attr_accessor :windowstatus
- def initialize(x, y, width, height)
- super
- @data = []
- @equip = nil
- @itemtype = :equip
- @windowstatus = :owner
- refresh
- end
- def col_max
- return 1
- end
- def can_use?(id)
- for i in 1 .. MESS::MaxItemUse
- return true if @equip.strongitem(i) == id
- end
- return false
- end
- def include?(item,times = 0)
- if item
- case @itemtype
- when :equip
- if !item.is_a?(RPG::Item)
- item.strongto > 0
- else
- false
- end
- when :item
- if item.is_a?(RPG::Item)
- if times == 0
- can_use?(item.id)
- elsif times == 1
- item.prevent? || item.porveup > 0
- end
- else
- false
- end
- else
- false
- end
- else
- true
- end
- end
- def enable?(item)
- return true
- end
- def make_item_list
- @data = []
- case @itemtype
- when :equip
- @data = $game_party.all_items.select {|item| include?(item) }
- when :item
- 2.times {|i| @data += $game_party.all_items.select{|item| include?(item,i) } }
- end
- @data.push(nil) if include?(nil)
- 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_number(rect, item)
- elsif index == @data.size - 1 && !item
- rect = item_rect(index)
- draw_text(rect.x, rect.y, self.width-(rect.x+update_padding)*2, line_height, "光标移到物品槽",1)
- end
- end
- def update_help
- @help_window.set_item(item)
- end
- end
- class Window_EquipStatus2 < Window_Base
- attr_reader :equip
- attr_accessor :relation_window
- attr_accessor :rate
- attr_accessor :gold
- def initialize(x,y,w,h)
- super(x,y,w,h)
- @equip = nil
- @relation_window = nil
- @rate = 0.0
- @gold = 0
- end
- def basic_rate
- return @equip ? @equip.strongrate : nil
- end
- def item_rate
- return basic_rate ? (@rate - basic_rate).to_i : nil
- end
- def basic_gold
- return @equip ? @equip.strongmoney : nil
- end
- def draw_augment_status(x,y,width)
- if @equip
- contents.font.size -= 6
- contents.font.color = Color.new(128,255,128)
- rate = [@rate,100].min
- rate *= 10
- rate.round
- rate /= 10.0
- draw_text(x,y,width,line_height,"当前成功率 "+rate.to_s+" ( "+item_rate.to_s+" )")
- contents.font.color = Color.new(255,255,128)
- draw_text(x,y+line_height,width,line_height,Vocab::currency_unit+" 消耗 "+basic_gold.to_s)
- contents.font.size += 6
- contents.font.color = Color.new(255,255,255)
- end
- end
-
- def can_use?(id)
- for i in 1 .. MESS::MaxItemUse
- return true if @equip.strongitem(i) == id
- end
- return false
- end
- def clear(equip_nil = false)
- contents.clear
- @equip = nil if equip_nil
- end
- def draw_old_equip(x,y,width,item)
- change_color(system_color)
- draw_text(x, y, width,line_height,"原装备:")
- contents.font.color = Color.new(237, 71, 71)
- rect = Rect.new(x,y+line_height+4,width,24)
- draw_item_name(item, rect.x, rect.y)
- help = "\\c[27]" + Equipplus.getequiphelp(item)
- contents.font.size -= 7
- draw_text_ex(x,y+line_height+4+24+4,help,256,40,false)
- contents.font.size += 7
- change_color(normal_color)
- end
- def draw_new_equip(x,y,width,item)
- change_color(system_color)
- draw_text(x, y, width,line_height,"新装备:")
- contents.font.color = Color.new(238, 79,142)
- rect = Rect.new(x,y+line_height+4,width,24)
- draw_item_name(item, rect.x, rect.y)
- help = "\\c[29]" + Equipplus.getequiphelp(item)
- contents.font.size -= 7
- draw_text_ex(x,y+line_height+4+24+4,help,256,40,false)
- contents.font.size += 7
- end
- def draw_item_effect(x,y,width,item)
- change_color(system_color)
- draw_text(x, y, width,line_height,"道具效果:")
- rect = Rect.new(x,y+line_height+4,width,24)
- draw_item_name(item, rect.x, rect.y)
- help = make_item_help(item)
- contents.font.size -= 4
- draw_text_ex(x,y+line_height+4+24+4,help,256,40,false)
- contents.font.size += 4
- change_color(normal_color)
- end
- def make_item_help(item)
- help = ""
- if item.porveup > 0
- help += "\\c[24]增加成功率:"+item.porveup.to_s+"% \n"
- end
- if item.prevent?
- help += "\\c[13]防止装备损坏 \n"
- end
- if can_use?(item.id)
- help += "\\c[2]必需品 \n"
- end
- return help
- end
- def set_item(item)
- contents.clear
- new_item = nil
- if item.is_a?(RPG::EquipItem)
- @equip = item
- @rate = basic_rate
- @gold = basic_gold
- set_relation_window
- draw_old_equip(4,0,(self.width-(4+update_padding)*2)/2,item)
- elsif item.is_a?(RPG::Item)
- draw_item_effect(4,0,(self.width-(4+update_padding)*2)/2,item)
- refresh_aug_status if @rate > 0.0 && @gold > 0
- end
- if @equip.is_a?(RPG::Weapon)
- new_item = $data_weapons[@equip.strongto]
- elsif @equip.is_a?(RPG::Armor)
- new_item = $data_armors[@equip.strongto]
- end
- draw_new_equip(8+(self.width-(4+update_padding)*2)/2,0,(self.width-(4+update_padding)*2)/2,new_item) if new_item
- end
- def set_relation_window
- @relation_window.set_item(@equip) if @relation_window
- end
- def refresh_aug_status
- contents.clear_rect(4,self.height - line_height*3,(self.width-(3+update_padding)*2)/2,line_height*2)
- draw_augment_status(4,self.height - line_height*3,(self.width-(3+update_padding)*2)/2)
- end
- end
- class Window_AugmentSet < Window_Base
- def initialize(x,y,w,h)
- super(x,y,w,h)
- @equip = nil
- end
- def draw_equip_need(x,y,width,item)
- useable = []
- change_color(system_color)
- contents.font.size -= 2
- draw_text(x,y,width,line_height,"必需品")
- change_color(normal_color)
- for i in 1 .. MESS::MaxItemUse
- if @equip.strongitem(i) > 0
- useable.push($data_items[@equip.strongitem(i)])
- draw_item_name(useable[i-1], x, y+i*(line_height+2))
- end
- end
- contents.font.size += 2
- end
- def set_item(item)
- contents.clear
- if item
- @equip = item
- draw_equip_need(4,0,(self.width-(4+update_padding)*2)/2,item)
- end
- end
- end
- class Window_ItemSlot < Window_Selectable
- attr_reader :data
- def initialize(x, y, width,height)
- super(x, y, width, height)
- @data = []
- refresh
- end
- def clear
- @data = []
- end
- def item_max
- return MESS::MaxItemUse + 1
- end
- def item
- @data && index >= 0 ? @data[index] : nil
- end
- def set_item(item,id)
- @data[id] = item
- refresh
- end
- def remove_item(index)
- @data[index] = nil
- refresh
- end
- def draw_item(index)
- if index < MESS::MaxItemUse
- contents.font.size -= 2
- rect = item_rect_for_text(index)
- change_color(system_color, enable?(index))
- draw_text(rect.x, rect.y, 50, line_height, slot_name(index))
- draw_item_name(@data[index], rect.x + 50, rect.y, enable?(index)) if @data[index]
- change_color(normal_color)
- contents.font.size += 2
- elsif index == MESS::MaxItemUse
- rect = item_rect_for_text(index)
- draw_text(rect.x, rect.y, self.width-(rect.x+update_padding)*2, line_height, "强化装备",1)
- @data[index] = :augment
- end
- end
- def slot_name(index)
- return "材料 "+(index+1).to_s
- end
- def enable?(index)
- return true
- end
- def update_help
- super
- @help_window.set_item(item) if @help_window
- end
- end
复制代码- #encoding:utf-8
- #==============================================================================
- # ■ 装备说明增强 By wyongcan
- #==============================================================================
- module Equipplus
- 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 => "经验获得加成"}
- @队伍能力 ={
- 0 => "遇敌几率减半",
- 1 => "随机遇敌无效",
- 2 => "敌人偷袭无效",
- 3 => "先制攻击几率上升",
- 4 => "获得金钱数量双倍",
- 5 => "物品掉落几率双倍"}
- def self.equiphelpready
- @状态 = {}
- @武器类型 = {}
- @防具类型 = {}
- @属性 = {}
- $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_int.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"}
- # ======== 改动部分 ========
- if equip.strongto > 0
- strong = nil
- if equip.is_a?(RPG::Weapon)
- strong = $data_weapons[equip.strongto]
- elsif equip.is_a?(RPG::Armor)
- strong = $data_armors[equip.strongto]
- end
- help += "可强化到 " + strong.name + "\n"
- end
- # ======== 改动部分 ========
- 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_Help2 < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对象
- #--------------------------------------------------------------------------
- def initialize(line_number = 0)
- super(0, 0, 210, 0)
- self.z = 150
- contents.font.size = 14
- hide
- end
- #--------------------------------------------------------------------------
- # ● 设置内容
- #--------------------------------------------------------------------------
- def set_text(text)
- @text = text
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 清除
- #--------------------------------------------------------------------------
- def clear
- set_text("")
- end
- #--------------------------------------------------------------------------
- # ● 更新帮助位置
- #--------------------------------------------------------------------------
- def uppos(index,rect,window)
- self.height = fitting_height2(Equipplus.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?(RPG::EquipItem) || item.is_a?(RPG::Item)
- @xtext += Equipplus.getequiphelp(item) if item.is_a?(RPG::EquipItem)
- @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
- Equipplus.equiphelpready
- 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
- 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_MenuBase < Scene_Base
- def create_help_window
- @help_window = Window_Help2.new
- @help_window.viewport = @viewport
- end
- end
- class Scene_Battle < Scene_Base
- def create_help_window
- @help_window = Window_Help2.new
- @help_window.visible = false
- end
- end
复制代码 |
|