赞 | 17 |
VIP | 0 |
好人卡 | 0 |
积分 | 13 |
经验 | 18140 |
最后登录 | 2019-6-27 |
在线时间 | 354 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1308
- 在线时间
- 354 小时
- 注册时间
- 2009-9-14
- 帖子
- 328
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 CR~ 于 2014-12-18 16:32 编辑
我想改成不需要消耗物品。。。
还有个问题,假设强化的是铜剑,如果有个条件分歧或者脚本如果判定的是铜剑,强化之后就失效了。。。
如果能让这个装备的编号是1号,强化完了还是1号,条件分歧或者脚本的判定不会失效,,,
额,,,还有,这个强化脚本,如果强化失败的话掉三级,
如果装备强化的等级不足3级时,直接就没了。。。
我希望能改成强化1-6级失败的话不会掉级,7-9级失败的话掉到5级,10级失败的话装备毁坏。- # 简易装备强化
- module EquipUp
-
- # 强化第一级需要消耗金币:装备价格 * 20%
- # 强化第二级需要消耗金币:装备价格 * 50%
- # …… …… …… …… …… …… …… ……
- # 强化第十级需要消耗金币:装备价格 * 210%
- Gold = [20, 50, 70, 90, 110, 130, 150, 170, 190, 210]
-
- # 强化第一级的成功率为100%
- # 强化第二级的成功率为90%
- # …… …… …… …… …… …… …… ……
- # 强化第十级的成功率为10%
- URate = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10]
-
- # 强化第一级武器属性上浮1%
- # 强化第二级武器属性上浮2%
- # …… …… …… …… …… …… …… ……
- # 强化第十级武器属性上浮10%
- WRate = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-
- # 强化第一级防具属性上浮1%
- # 强化第二级防具属性上浮2%
- # …… …… …… …… …… …… …… ……
- # 强化第十级防具属性上浮10%
- ARate = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-
- # 强化消耗50号物品
- Item = 1
-
- # 最高强化等级
- MAX = 10
-
- end
- #==========================================================
- #脚本正文
- #==========================================================
- class Game_Temp
- attr_accessor :zzzzhash
- alias initialize_EquipUp_zzzzhash initialize
- def initialize
- initialize_EquipUp_zzzzhash
- @zzzzhash = {}
- end
- end
- module RPG
- class Weapon
- attr_accessor :zzlevel
- end
- class Armor
- attr_accessor :zzlevel
- end
- end
- #==============================================================================
- # ■ Scene_EquipUp_Status_Item
- #------------------------------------------------------------------------------
- # 强化画面显示浏览物品的窗口。
- #==============================================================================
- class Scene_EquipUp_Status_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 640-272, 480-64)
- @column_max = 1
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 1...$data_weapons.size
- if $game_party.weapon_number(i) > 0
- @data.push($data_weapons[i])
- end
- end
- for i in 1...$data_armors.size
- if $game_party.armor_number(i) > 0
- @data.push($data_armors[i])
- end
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- x = 4 + index % @column_max * (288 + 32)
- y = index / @column_max * 32
- bitmap = RPG::Cache.icon(item.icon_name)
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 300, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
- class Scene_EquipUp_Status < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(640-272, 64, 272, 480-64)
- self.contents = Bitmap.new(width - 32, height - 32)
- @rect = Rect.new(0, 0, 24, 24)
- end
- def str(s)
- return self.contents.text_size(s).width
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh(zz)
- self.contents.clear
- if zz.nil?
- return
- end
- # 名称and图标
- bitmap = RPG::Cache.icon(zz.icon_name)
- self.contents.blt(0, 0, bitmap, @rect)
- self.contents.draw_text(30, 0, str(zz.name), 22, zz.name)
- # 初始化
- if zz.zzlevel.nil?
- zz.zzlevel = 0
- if zz.is_a?(RPG::Weapon)
- $game_temp.zzzzhash[[zz.name, 0, "武器"]] = zz.id
- elsif zz.is_a?(RPG::Armor)
- $game_temp.zzzzhash[[zz.name, 0, "防具"]] = zz.id
- end
- end
- # 文字说明
- s = "强化等级:"+zz.zzlevel.to_s
- self.contents.draw_text(0, 32, str(s), 22, s)
- cy = 2
- if zz.is_a?(RPG::Weapon)
- if !EquipUp::WRate[zz.zzlevel].nil?
- s = "攻击力:"+zz.atk.to_s+" → "+Integer(zz.atk + zz.atk * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "攻击力:"+zz.atk.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- elsif zz.is_a?(RPG::Armor)
- if zz.eva > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- s = "回避:"+zz.eva.to_s+" → "+Integer(zz.eva + zz.eva * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- else
- s = "回避:"+zz.eva.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- end
- if zz.pdef > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "物理防御:"+zz.pdef.to_s+" → "+Integer(zz.pdef + zz.pdef * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "物理防御:"+zz.pdef.to_s+" → "+Integer(zz.pdef + zz.pdef * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "物理防御:"+zz.pdef.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- if zz.mdef > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "魔法防御:"+zz.mdef.to_s+" → "+Integer(zz.mdef + zz.mdef * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "魔法防御:"+zz.mdef.to_s+" → "+Integer(zz.mdef + zz.mdef * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "魔法防御:"+zz.mdef.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- if zz.str_plus > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "力量:"+zz.str_plus.to_s+" → "+Integer(zz.str_plus + zz.str_plus * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "力量:"+zz.str_plus.to_s+" → "+Integer(zz.str_plus + zz.str_plus * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "力量:"+zz.str_plus.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- if zz.dex_plus > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "灵巧:"+zz.dex_plus.to_s+" → "+Integer(zz.dex_plus + zz.dex_plus * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "灵巧:"+zz.dex_plus.to_s+" → "+Integer(zz.dex_plus + zz.dex_plus * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "灵巧:"+zz.dex_plus.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- if zz.agi_plus > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "速度:"+zz.agi_plus.to_s+" → "+Integer(zz.agi_plus + zz.agi_plus * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "速度:"+zz.agi_plus.to_s+" → "+Integer(zz.agi_plus + zz.agi_plus * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "速度:"+zz.agi_plus.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- if zz.int_plus > 0
- if !EquipUp::WRate[zz.zzlevel].nil?
- if !zz.is_a?(RPG::Armor)
- s = "魔力:"+zz.int_plus.to_s+" → "+Integer(zz.int_plus + zz.int_plus * (EquipUp::WRate[zz.zzlevel] / 100.0)).to_s
- else
- s = "魔力:"+zz.int_plus.to_s+" → "+Integer(zz.int_plus + zz.int_plus * (EquipUp::ARate[zz.zzlevel] / 100.0)).to_s
- end
- else
- s = "魔力:"+zz.int_plus.to_s
- end
- self.contents.draw_text(0, cy*32, str(s), 22, s)
- cy += 1
- end
- self.contents.draw_text(0, cy*32, str("价格:"+zz.price.to_s), 22, "价格:"+zz.price.to_s)
- cy += 1
- self.contents.draw_text(0, cy*32, str("现金:"+$game_party.gold.to_s), 22, "现金:"+$game_party.gold.to_s)
- cy += 1
- self.contents.draw_text(0, cy*32, str(
- "持有"+$data_items[EquipUp::Item].name+":"+$game_party.item_number(
- EquipUp::Item).to_s), 22, "持有"+$data_items[EquipUp::Item].name+":"+
- $game_party.item_number(EquipUp::Item).to_s)
- return if zz.zzlevel == EquipUp::MAX
- cy += 1
- self.contents.draw_text(0, cy*32, str("下一级将消耗:"), 22, "下一级将消耗:")
- cy += 1
- bitmap = RPG::Cache.icon($data_items[EquipUp::Item].icon_name)
- self.contents.blt(0, cy*32, bitmap, @rect)
- self.contents.draw_text(30, cy*32, str($data_items[EquipUp::Item].name + " × 1"), 22, $data_items[EquipUp::Item].name + " × 1")
- cy += 1
- self.contents.draw_text(0, cy*32, str("金币"+EquipUp::Gold[zz.zzlevel].to_s), 22, "金币"+EquipUp::Gold[zz.zzlevel].to_s)
-
-
-
- end
- end
- class Scene_EquipUp
- def main
- @help = Window_Help.new
- @status = Scene_EquipUp_Status.new
- @item = Scene_EquipUp_Status_Item.new
- @item.help_window = @help
- @status.refresh(@item.item)
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help.dispose
- @status.dispose
- @item.dispose
- end
- def update
- @help.update
- @status.update
- @item.update
- @status.refresh(@item.item)
-
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
-
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- if @item.item.nil?
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 初始化
- if @item.item.zzlevel == EquipUp::MAX
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- gold_num = Integer(EquipUp::Gold[@item.item.zzlevel] / 100.0 * @item.item.price)
- item_num = $game_party.item_number(EquipUp::Item)
- if $game_party.gold >= gold_num and item_num > 0
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 消耗
- $game_party.lose_gold(gold_num)
- $game_party.lose_item(EquipUp::Item, 1)
- # 概率
- if rand(100) > EquipUp::URate[@item.item.zzlevel]
- print "失败"
- zzlevel = [0, @item.item.zzlevel - 3].max
- #@item.item.zzlevel = [0, @item.item.zzlevel - 3].max
- if @item.item.is_a?(RPG::Weapon)
- $game_party.lose_weapon(@item.item.id, 1)
- if zzlevel != 0
- $game_party.gain_weapon($game_temp.zzzzhash[[@item.item.name.split(" ")[0], zzlevel, "武器"]], 1)
- end
- @item.refresh
- elsif @item.item.is_a?(RPG::Armor)
- $game_party.lose_armor(@item.item.id, 1)
- if zzlevel != 0
- $game_party.gain_armor($game_temp.zzzzhash[[@item.item.name.split(" ")[0], zzlevel, "防具"]], 1)
- end
- @item.refresh
- end
- return
- end
- # 制造新装备
- if @item.item.is_a?(RPG::Weapon)#武器
- newid = $game_temp.zzzzhash[[@item.item.name.split(" ")[0], @item.item.zzlevel + 1, "武器"]]
- if newid != nil
- print "OK!"
- $game_party.lose_weapon(@item.item.id, 1)
- $game_party.gain_weapon(newid, 1)
- @item.refresh
- return
- end
- zz = @item.item.clone
- zz.zzlevel = @item.item.zzlevel + 1
- zz.price += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.price) if zz.price > 0
- zz.atk += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.atk) if zz.atk > 0
- zz.mdef += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.mdef) if zz.mdef > 0
- zz.pdef += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.pdef) if zz.pdef > 0
- zz.str_plus += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.str_plus) if zz.str_plus > 0
- zz.dex_plus += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.dex_plus) if zz.dex_plus > 0
- zz.agi_plus += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.agi_plus) if zz.agi_plus > 0
- zz.int_plus += Integer(EquipUp::WRate[@item.item.zzlevel] / 100.0 * @item.item.int_plus) if zz.int_plus > 0
- if zz.name.include?("+")
- zz.name = zz.name.split("+")[0] + "+ #{zz.zzlevel}"
- else
- zz.name += " + 1"
- end
- zz.id = $data_weapons.size + 1
- $game_temp.zzzzhash[[@item.item.name.split(" ")[0], zz.zzlevel, "武器"]] = zz.id
- $data_weapons[zz.id] = zz
- for cl in $data_classes
- if cl.nil?
- next
- end
- if cl.weapon_set.include?(@item.item.id)
- cl.weapon_set.push(zz.id)
- end
- end
- $game_party.lose_weapon(@item.item.id, 1)
- $game_party.gain_weapon(zz.id, 1)
- @item.refresh
- print "OK!"
-
- elsif @item.item.is_a?(RPG::Armor)#防具
- newid = $game_temp.zzzzhash[[@item.item.name.split(" ")[0], @item.item.zzlevel + 1, "防具"]]
- if newid != nil
- print "OK!"
- $game_party.lose_armor(@item.item.id, 1)
- $game_party.gain_armor(newid, 1)
- @item.refresh
- return
- end
- zz = @item.item.clone
- zz.zzlevel = @item.item.zzlevel + 1
- zz.price += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.price) if zz.price > 0
- zz.eva += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.eva) if zz.eva > 0
- zz.mdef += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.mdef) if zz.mdef > 0
- zz.pdef += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.pdef) if zz.pdef > 0
- zz.str_plus += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.str_plus) if zz.str_plus > 0
- zz.dex_plus += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.dex_plus) if zz.dex_plus > 0
- zz.agi_plus += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.agi_plus) if zz.agi_plus > 0
- zz.int_plus += Integer(EquipUp::ARate[@item.item.zzlevel] / 100.0 * @item.item.int_plus) if zz.int_plus > 0
- if zz.name.include?("+")
- zz.name = zz.name.split("+")[0] + "+ #{zz.zzlevel}"
- else
- zz.name += " + 1"
- end
- zz.id = $data_armors.size + 1
- $game_temp.zzzzhash[[@item.item.name.split(" ")[0], zz.zzlevel, "防具"]] = zz.id
- $data_armors[zz.id] = zz
- for cl in $data_classes
- if cl.nil?
- next
- end
- if cl.armor_set.include?(@item.item.id)
- cl.armor_set.push(zz.id)
- end
- end
- $game_party.lose_armor(@item.item.id, 1)
- $game_party.gain_armor(zz.id, 1)
- @item.refresh
- print "OK!"
- end
- else
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
- end
- end
- end
- class Scene_Save < Scene_File
- alias write_save_data_zzzz_equip write_save_data
- def write_save_data(file)
- save_data($data_weapons, "Data/Weapons.rxdata")
- save_data($data_armors, "Data/Armors.rxdata")
- save_data($data_classes, "Data/Classes.rxdata")
- write_save_data_zzzz_equip(file)
- end
- end
复制代码 |
|