赞 | 0 |
VIP | 16 |
好人卡 | 0 |
积分 | 1 |
经验 | 12245 |
最后登录 | 2023-5-31 |
在线时间 | 275 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 70
- 在线时间
- 275 小时
- 注册时间
- 2008-10-22
- 帖子
- 205
|
能不能把沉影不器前辈的耐久度脚本和新的帮助窗口整合一下(主要是修复界面)
顺便问一句,武器攻击力随机和耐久度脚本能否整合?
贴上脚本- #==============================================================================
- # 装备耐久度
- # by 沉影不器
- #==============================================================================
- #主要更改:
- #
- # ① 角色的每件装备都是原数据库的克隆品,使每件装备都有唯一id
- # ② 角色物品窗口中所有装备单独一格
- # ③ 更改了商店中对装备的买卖方式,跳过输入数量,只能一件一件买卖
- # ④ 战斗中,打人消耗武器耐久度(非物理攻击的技能不消耗),被打消耗防具耐久度,有一定机率
- # ⑤ 装备耐久度降为 0 时即是装备损坏,装备能力消失,可修复
- # ⑥ 损坏的装备将在地图上显示
- # ⑦ 装备卖出价格随耐久度打折
- #------------------------------------------------------------------------------
- #使用说明
- #
- # ① 武器耐久度在[数据库-武器]一栏的武器名称后输入,格式为"武器名,耐久度最大值"
- # 例如"铜剑,12"表示铜剑最大耐久度为12
- # 防具设定同上
- # ② 脚本第31行设定原数据库武器最大id
- # 例如:默认数据库里最后一个武器是密斯利尔杖,id是32
- # ③ 脚本第32行设定原数据库防具最大id,同上
- # ●注意! 以上两个常量为必设,须根据您自己的数据库更改,否则出错
- # ④ 脚本第33行设定最大耐久度
- # 脚本第34行设定修复装备时的音效
- # ⑤ 角色初期装备最好没有重复id的装备,比如默认数据库中几个人物都用了铜盾(id:1)
- # 这将使几个人物的该铜盾共享一个耐久度
- # ⑥ 使用$scene = Scene_Dur_Equip.new调出修复装备画面
- #==============================================================================
- module DUR
- DATA_WEAPON_SIZE = 32 # 原数据库武器最大id
- DATA_ARMOR_SIZE = 32 # 原数据库防具最大id
- DUR_SET_MAX = 2000 # 最大耐久度
- REP_SE = "055-Right01" # 修复装备时的音效文件名
- end
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += (weapon != nil ) ? weapon.str_plus : 0
- n += (armor1 != nil ) ? armor1.str_plus : 0
- n += (armor2 != nil ) ? armor2.str_plus : 0
- n += (armor3 != nil ) ? armor3.str_plus : 0
- n += (armor4 != nil ) ? armor4.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- def base_dex
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += (weapon != nil ) ? weapon.dex_plus : 0
- n += (armor1 != nil ) ? armor1.dex_plus : 0
- n += (armor2 != nil ) ? armor2.dex_plus : 0
- n += (armor3 != nil ) ? armor3.dex_plus : 0
- n += (armor4 != nil ) ? armor4.dex_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- def base_agi
- n = $data_actors[@actor_id].parameters[4, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += (weapon != nil ) ? weapon.agi_plus : 0
- n += (armor1 != nil ) ? armor1.agi_plus : 0
- n += (armor2 != nil ) ? armor2.agi_plus : 0
- n += (armor3 != nil ) ? armor3.agi_plus : 0
- n += (armor4 != nil ) ? armor4.agi_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- def base_int
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- n += (weapon != nil ) ? weapon.int_plus : 0
- n += (armor1 != nil ) ? armor1.int_plus : 0
- n += (armor2 != nil ) ? armor2.int_plus : 0
- n += (armor3 != nil ) ? armor3.int_plus : 0
- n += (armor4 != nil ) ? armor4.int_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- def base_atk
- weapon = $data_weapons[@weapon_id]
- return (weapon != nil ) ? weapon.atk : 0
- end
- #--------------------------------------------------------------------------
- def base_pdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- pdef1 = (weapon != nil ) ? weapon.pdef : 0
- pdef2 = (armor1 != nil ) ? armor1.pdef : 0
- pdef3 = (armor2 != nil ) ? armor2.pdef : 0
- pdef4 = (armor3 != nil ) ? armor3.pdef : 0
- pdef5 = (armor4 != nil ) ? armor4.pdef : 0
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
- end
- #--------------------------------------------------------------------------
- def base_mdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- mdef1 = (weapon != nil ) ? weapon.mdef : 0
- mdef2 = (armor1 != nil ) ? armor1.mdef : 0
- mdef3 = (armor2 != nil ) ? armor2.mdef : 0
- mdef4 = (armor3 != nil ) ? armor3.mdef : 0
- mdef5 = (armor4 != nil ) ? armor4.mdef : 0
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
- end
- #--------------------------------------------------------------------------
- def base_eva
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- eva1 = (armor1 != nil ) ? armor1.eva : 0
- eva2 = (armor2 != nil ) ? armor2.eva : 0
- eva3 = (armor3 != nil ) ? armor3.eva : 0
- eva4 = (armor4 != nil ) ? armor4.eva : 0
- return eva1 + eva2 + eva3 + eva4
- end
- end
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- attr_accessor :weapons
- attr_accessor :armors
- #--------------------------------------------------------------------------
- def weapon_number(weapon_id)
- return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
- end
- #--------------------------------------------------------------------------
- # 以下修改于<<武器攻击力波动>>(灼眼的夏娜)
- def gain_weapon(weapon_id, n)
- if weapon_id > 0
- if n > 0 # 增加武器的情况
- n = 1
- # 装备栏中使用的武器不处理~
- if $scene.is_a?(Scene_Equip)
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- else
- new_weapon = $data_weapons[weapon_id].clone
- new_weapon.dur_set = $data_weapons[weapon_id].dur_set
- new_weapon.dur = $data_weapons[weapon_id].dur_set
- new_weapon.id = $data_weapons.size
- #数据库扩容
- $data_weapons.push(new_weapon)
- # 职业可装备武器数组更新~
- for i in 1...$data_classes.size
- if $data_classes[i].weapon_set.include?(weapon_id)
- $data_classes[i].weapon_set.push(new_weapon.id)
- end
- end
- # 增加武器~
- @weapons[new_weapon.id] = [[weapon_number(new_weapon.id) + n, 0].max, 99].min
- end
- else # n < 0 减少武器的情况(未定的情况: n = 0)
- n = -1
- # 装备栏中卸下的武器不处理~
- if $scene.is_a?(Scene_Equip)
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- else
- lose_name = $data_weapons[weapon_id].name
- dur_min = DUR::DUR_SET_MAX
- for i in DUR::DATA_WEAPON_SIZE+1...$data_weapons.size
- # 重新确定weapon_id,必定在原武器数据库之外
- # 减少同名武器中耐久度最低的
- if $data_weapons[i].name == lose_name and $data_weapons[i].dur < dur_min
- weapon_id = i
- end
- end
- # 已不存在的不做操作
- if weapon_number(weapon_id) <= 0
- return
- end
- # 减少武器
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- # 删除行囊拥有的武器id,后id补进
- @weapons.delete(weapon_id)
- weapon_keys = @weapons.keys.sort!
- for i in weapon_keys
- if i > weapon_id
- @weapons[i-1] = @weapons[i]
- @weapons.delete(i)
- end
- end
- # 更改角色使用中的武器id
- for i in [email protected]
- if @actors[i].weapon_id != nil and @actors[i].weapon_id > weapon_id
- @actors[i].weapon_id -= 1
- end
- end
- if weapon_id > DUR::DATA_WEAPON_SIZE
- # 删除数据库武器id,后补进
- for i in weapon_id+1...$data_weapons.size
- $data_weapons[i].id -= 1
- end
- $data_weapons.delete_at(weapon_id)
- # 职业可装备武器数组更新
- for i in 1...$data_classes.size
- if $data_classes[i].weapon_set.include?(weapon_id)
- $data_classes[i].weapon_set.delete(weapon_id)
- end
- for j in $data_classes[i].weapon_set
- if j > weapon_id
- $data_classes[i].weapon_set.delete(j)
- j -= 1
- $data_classes[i].weapon_set.push(j)
- end
- end
- end
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- def gain_armor(armor_id, n)
- if armor_id > 0
- if n > 0 # 增加防具的情况
- n = 1
- # 装备栏中使用的防具不处理~
- if $scene.is_a?(Scene_Equip)
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- else
- new_armor = $data_armors[armor_id].clone
- new_armor.dur_set = $data_armors[armor_id].dur_set
- new_armor.dur = $data_armors[armor_id].dur_set
- new_armor.id = $data_armors.size
- #数据库扩容
- $data_armors.push(new_armor)
- # 职业可装备防具数组更新~
- for i in 1...$data_classes.size
- if $data_classes[i].armor_set.include?(armor_id)
- $data_classes[i].armor_set.push(new_armor.id)
- end
- end
- # 增加防具
- @armors[new_armor.id] = [[armor_number(new_armor.id) + n, 0].max, 99].min
- end
- else # n < 0 减少防具的情况(未定的情况: n = 0)
- n = -1
- # 装备栏中卸下的防具不处理
- if $scene.is_a?(Scene_Equip)
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- else
- lose_name = $data_armors[armor_id].name
- dur_min = DUR::DUR_SET_MAX
- for i in DUR::DATA_ARMOR_SIZE+1...$data_armors.size
- # 重新确定armor_id,必定在原防具数据库之外
- # 减少同名防具中耐久度最低的
- if $data_armors[i].name == lose_name and $data_armors[i].dur < dur_min
- armor_id = i
- end
- end
- # 已不存在的不做操作
- if armor_number(armor_id) <= 0
- return
- end
- # 减少防具
- @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
- # 删除行囊拥有的防具id,后id补进
- @weapons.delete(armor_id)
- armor_keys = @armors.keys.sort!
- for i in armor_keys
- if i > armor_id
- @armors[i-1] = @armors[i]
- @armors.delete(i)
- end
- end
- # 更改角色使用中的防具id
- for i in [email protected]
- if @actors[i].armor1_id != nil and @actors[i].armor1_id > armor_id
- @actors[i].armor1_id -= 1
- end
- if @actors[i].armor2_id != nil and @actors[i].armor2_id > armor_id
- @actors[i].armor2_id -= 1
- end
- if @actors[i].armor3_id != nil and @actors[i].armor3_id > armor_id
- @actors[i].armor3_id -= 1
- end
- if @actors[i].armor4_id != nil and @actors[i].armor4_id > armor_id
- @actors[i].armor4_id -= 1
- end
- end
- if armor_id > DUR::DATA_ARMOR_SIZE
- # 删除数据库防具id,后补进
- for i in armor_id+1...$data_armors.size
- $data_armors[i].id -= 1
- end
- $data_armors.delete_at(armor_id)
- # 职业可装备防具数组更新
- for i in 1...$data_classes.size
- if $data_classes[i].armor_set.include?(armor_id)
- $data_classes[i].armor_set.delete(armor_id)
- end
- for j in $data_classes[i].armor_set
- if j > armor_id
- $data_classes[i].armor_set.delete(j)
- j -= 1
- $data_classes[i].armor_set.push(j)
- end
- end
- end
- end
- end
- end
- end
- end
- end
- # ===========================================================================
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- def update_help
- description = ""
- if self.item != nil
- description = self.item.description
- if !self.item.is_a? RPG::Item
- dur_set = item.dur_set
- dur = item.dur
- description = description + " 耐久度: #{dur}/#{dur_set}"
- end
- end
- @help_window.set_text(description)
- end
- end
- # ===========================================================================
- class Window_EquipItem < Window_Selectable
- #--------------------------------------------------------------------------
- def update_help
- description = ""
- if self.item != nil
- description = self.item.description
- dur_set = item.dur_set
- dur = item.dur
- description = description + " 耐久度: #{dur}/#{dur_set}"
- end
- @help_window.set_text(description)
- end
- end
- class Scene_Title
- #--------------------------------------------------------------------------
- alias main_add_dur main
- def main
- main_add_dur
- # 战斗测试的情况下
- if $BTEST
- battle_test
- return
- end
- $data_weapons = load_data("Data/Weapons.rxdata")
- $data_armors = load_data("Data/Armors.rxdata")
- # 初始化耐久度
- for i in 1...$data_weapons.size
- $data_weapons[i].dur = $data_weapons[i].dur_set
- end
- for i in 1...$data_armors.size
- $data_armors[i].dur = $data_armors[i].dur_set
- end
- end
- end
- #==============================================================================
- class Scene_Shop
- #--------------------------------------------------------------------------
- def update_buy
- @status_window.item = @buy_window.item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- # 窗口状态转向初期模式
- @command_window.active = true
- @dummy_window.visible = true
- @buy_window.active = false
- @buy_window.visible = false
- @status_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @buy_window.item
- if @item == nil or @item.price > $game_party.gold
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- if number == 99
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- max = @item.price == 0 ? 99 : $game_party.gold / @item.price
- max = [max, 99 - number].min
- if @item.is_a? RPG::Item # 除物品外直接买进1件
- @buy_window.active = false
- @buy_window.visible = false
- @number_window.set(@item, max, @item.price)
- @number_window.active = true
- @number_window.visible = true
- else
- update_number
- end
- end
- end
- #--------------------------------------------------------------------------
- def update_sell
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @command_window.active = true
- @dummy_window.visible = true
- @sell_window.active = false
- @sell_window.visible = false
- @status_window.item = nil
- @help_window.set_text("")
- return
- end
- if Input.trigger?(Input::C)
- @item = @sell_window.item
- @status_window.item = @item
- if @item == nil or @item.price == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- max = number
- if @item.is_a? RPG::Item # 除物品外直接卖出1件
- @sell_window.active = false
- @sell_window.visible = false
- @number_window.set(@item, max, @item.price / 2)
- @number_window.active = true
- @number_window.visible = true
- @status_window.visible = true
- else
- update_number
- end
- end
- end
- #--------------------------------------------------------------------------
- def update_number
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 购买
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.shop_se)
- @number_window.active = false
- @number_window.visible = false
- case @command_window.index
- when 0 # 购买
- $game_party.lose_gold(@number_window.number * @item.price)
- case @item
- when RPG::Item
- $game_party.gain_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.gain_weapon(@item.id, @number_window.number)
- when RPG::Armor
- $game_party.gain_armor(@item.id, @number_window.number)
- end
- @gold_window.refresh
- @buy_window.refresh
- @status_window.refresh
- @buy_window.active = true
- @buy_window.visible = true
- when 1 # 卖出
- $game_party.gain_gold(@number_window.number * rep_cost(@item) / 2)
- case @item
- when RPG::Item
- $game_party.lose_item(@item.id, @number_window.number)
- when RPG::Weapon
- $game_party.lose_weapon(@item.id, @number_window.number)
- when RPG::Armor
- $game_party.lose_armor(@item.id, @number_window.number)
- end
- @gold_window.refresh
- @sell_window.refresh
- @status_window.refresh
- @sell_window.active = true
- @sell_window.visible = true
- @status_window.visible = false
- end
- return
- end
- end
- end
- #==============================================================================
- class Game_Battler
- #--------------------------------------------------------------------------
- def attack_effect(attacker)
- self.critical = false
- hit_result = (rand(100) < attacker.hit)
- if hit_result == true
- atk = [attacker.atk - self.pdef / 2, 0].max
- self.damage = atk * (20 + attacker.str) / 20
- self.damage *= elements_correct(attacker.element_set)
- self.damage /= 100
- if self.damage > 0
- if rand(100) < 4 * attacker.dex / self.agi
- self.damage *= 2
- self.critical = true
- end
- if self.guarding?
- self.damage /= 2
- end
- end
- if self.damage.abs > 0
- amp = [self.damage.abs * 15 / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
- eva = 8 * self.agi / attacker.dex + self.eva
- hit = self.damage < 0 ? 100 : 100 - eva
- hit = self.cant_evade? ? 100 : hit
- hit_result = (rand(100) < hit)
- end
- if hit_result == true
- remove_states_shock
- self.hp -= self.damage
- @state_changed = false
- states_plus(attacker.plus_state_set)
- states_minus(attacker.minus_state_set)
- else
- self.damage = "Miss"
- self.critical = false
- end
- # 耐久度判断
- if hit_result == true
- if self.is_a?(Game_Actor) # 如果挨打的是角色,减防具耐久度
- armor_kind = 1 + rand(4)
- case armor_kind
- when 1
- if self.armor1_id != nil and self.armor1_id > 0
- if rand(2) == 0 and $data_armors[self.armor1_id].dur >= 0
- $data_armors[self.armor1_id].dur -= 1
- end
- end
- when 2
- if self.armor2_id != nil and self.armor2_id > 0
- if rand(2) == 0 and $data_armors[self.armor2_id].dur >= 0
- $data_armors[self.armor2_id].dur -= 1
- end
- end
- when 3
- if self.armor3_id != nil and self.armor3_id > 0
- if rand(2) == 0 and $data_armors[self.armor3_id].dur >= 0
- $data_armors[self.armor3_id].dur -= 1
- end
- end
- when 4
- if self.armor4_id != nil and self.armor4_id > 0
- if rand(2) == 0 and $data_armors[self.armor4_id].dur >= 0
- $data_armors[self.armor4_id].dur -= 1
- end
- end
- end
- else # 角色打人,减武器耐久度
- if attacker.weapon_id != nil and attacker.weapon_id > 0
- if rand(8) == 0 and $data_weapons[attacker.weapon_id].dur > 0
- $data_weapons[attacker.weapon_id].dur -= 1
- end
- end
- end
- end
- # 过程结束
- return true
- end
- #--------------------------------------------------------------------------
- def skill_effect(user, skill)
- self.critical = false
- if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
- ((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
- return false
- end
- effective = false
- effective |= skill.common_event_id > 0
- hit = skill.hit
- if skill.atk_f > 0
- hit *= user.hit / 100
- end
- hit_result = (rand(100) < hit)
- effective |= hit < 100
- if hit_result == true
- power = skill.power + user.atk * skill.atk_f / 100
- if power > 0
- power -= self.pdef * skill.pdef_f / 200
- power -= self.mdef * skill.mdef_f / 200
- power = [power, 0].max
- end
- rate = 20
- rate += (user.str * skill.str_f / 100)
- rate += (user.dex * skill.dex_f / 100)
- rate += (user.agi * skill.agi_f / 100)
- rate += (user.int * skill.int_f / 100)
- self.damage = power * rate / 20
- self.damage *= elements_correct(skill.element_set)
- self.damage /= 100
- if self.damage > 0
- if self.guarding?
- self.damage /= 2
- end
- end
- if skill.variance > 0 and self.damage.abs > 0
- amp = [self.damage.abs * skill.variance / 100, 1].max
- self.damage += rand(amp+1) + rand(amp+1) - amp
- end
- eva = 8 * self.agi / user.dex + self.eva
- hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
- hit = self.cant_evade? ? 100 : hit
- hit_result = (rand(100) < hit)
- effective |= hit < 100
- end
- if hit_result == true
- if skill.power != 0 and skill.atk_f > 0
- remove_states_shock
- effective = true
- end
- last_hp = self.hp
- self.hp -= self.damage
- effective |= self.hp != last_hp
- @state_changed = false
- effective |= states_plus(skill.plus_state_set)
- effective |= states_minus(skill.minus_state_set)
- if skill.power == 0
- self.damage = ""
- unless @state_changed
- self.damage = "Miss"
- end
- end
- else
- self.damage = "Miss"
- end
- unless $game_temp.in_battle
- self.damage = nil
- end
- # 耐久度判断
- if hit_result == true
- if self.is_a?(Game_Actor) # 如果挨打的是角色,减防具耐久度
- armor_kind = 1 + rand(4)
- case armor_kind
- when 1
- if self.armor1_id != nil and self.armor1_id > 0
- if rand(2) == 0 and $data_armors[self.armor1_id].dur > 0
- $data_armors[self.armor1_id].dur -= 1
- end
- end
- when 2
- if self.armor2_id != nil and self.armor2_id >= 0
- if rand(2) == 0 and $data_armors[self.armor2_id].dur >= 0
- $data_armors[self.armor2_id].dur -= 1
- end
- end
- when 3
- if self.armor3_id != nil and self.armor3_id > 0
- if rand(2) == 0 and $data_armors[self.armor3_id].dur >= 0
- $data_armors[self.armor3_id].dur -= 1
- end
- end
- when 4
- if self.armor4_id != nil and self.armor4_id > 0
- if rand(2) == 0 and $data_armors[self.armor4_id].dur >= 0
- $data_armors[self.armor4_id].dur -= 1
- end
- end
- end
- else # 角色打人,减武器耐久度
- if user.weapon_id != nil and user.weapon_id > 0
- if rand(8) == 0 and $data_weapons[user.weapon_id].dur >= 0
- if skill.atk_f == 0 # 非物理技能不损武器耐久度
- $data_weapons[user.weapon_id].dur -= 1
- end
- end
- end
- end
- end
- # 过程结束
- return effective
- end
- end
- #==============================================================================
- class Window_Dur < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(0,0,320,480)
- self.opacity = 0
- self.contents = Bitmap.new(width - 32, height - 32)
- @text_dur_old = [0]
- @text_dur = []
- refresh
- end
- #--------------------------------------------------------------------------
- def draw_text_dur(index,y)
- text = @text_dur[index]
- tx = 0
- ty = index * 24 + y
- self.contents.font.color = normal_color
- self.contents.draw_text(tx, ty, 320-32, 24, text)
- end
- #--------------------------------------------------------------------------
- def refresh
- # 节省内存
- if @text_dur_old == @text_dur
- return
- end
- @text_dur.clear
- # 取得空耐久度的装备名
- for i in $game_party.actors
- if $data_weapons[i.weapon_id] != nil and $data_weapons[i.weapon_id].dur == 0
- @text_dur.push(i.name + "-" + $data_weapons[i.weapon_id].name)
- end
- if $data_armors[i.armor1_id] != nil and $data_armors[i.armor1_id].dur == 0
- @text_dur.push(i.name + "-" + $data_armors[i.armor1_id].name)
- end
- if $data_armors[i.armor2_id] != nil and $data_armors[i.armor2_id].dur == 0
- @text_dur.push(i.name + "-" + $data_armors[i.armor2_id].name)
- end
- if $data_armors[i.armor3_id] != nil and $data_armors[i.armor3_id].dur == 0
- @text_dur.push(i.name + "-" + $data_armors[i.armor3_id].name)
- end
- if $data_armors[i.armor4_id] != nil and $data_armors[i.armor4_id].dur == 0
- @text_dur.push(i.name + "-" + $data_armors[i.armor4_id].name)
- end
- end
- @text_dur_old = @text_dur
- y = 448 - @text_dur.size * 24
- self.contents.clear
- self.contents.font.size = 14
- if @text_dur != []
- self.contents.font.color = Color.new(255, 0, 0) # 红色显示
- self.contents.draw_text(0, y - 24, 320 - 32, 24, "装备损坏:")
- end
- for i in 0... @text_dur.size
- draw_text_dur(i,y)
- end
- self.contents.font.size = Font.default_size
- end
- end
- #==============================================================================
- class Window_Dur_Equip < Window_Selectable
- #--------------------------------------------------------------------------
- def initialize
- super(0, 128, 640, 352)
- @column_max = 2
- 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
- @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
- #--------------------------------------------------------------------------
- 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
- # 有没钱修复 是否需要修复
- if $game_party.gold > rep_cost(item) and rep_cost(item) != 0
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
- self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
- end
- #--------------------------------------------------------------------------
- def update_help
- description = ""
- if self.item != nil
- description = self.item.description
- if !self.item.is_a? RPG::Item
- dur_set = item.dur_set
- dur = item.dur
- description = description + " 耐久度: #{dur}/#{dur_set}"
- end
- end
- @help_window.set_text(description)
- end
- end
- #==============================================================================
- class Window_RepMes < Window_Base
- #--------------------------------------------------------------------------
- def initialize
- super(0, 64, 480, 64)
- self.contents = Bitmap.new(width - 32, height - 32)
- end
- #--------------------------------------------------------------------------
- def set(rep_cost)
- if rep_cost != @rep_cost
- # 再描绘文本
- self.contents.clear
- self.contents.font.color = normal_color
- if rep_cost == 0
- self.contents.draw_text(4, 0, self.width - 40, 32, "无需修复!")
- else
- text = "修复费用:#{rep_cost}"
- cx = contents.text_size(text).width
- self.contents.draw_text(4, 0, self.width - 40, 32, text)
- self.contents.font.color = system_color
- self.contents.draw_text(8 + cx, 0, self.width - 40, 32, $data_system.words.gold)
- end
- @rep_cost = rep_cost
- end
- self.visible = true
- end
- end
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- def main
- @spriteset = Spriteset_Map.new
- @message_window = Window_Message.new
- @dur_window = Window_Dur.new
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @spriteset.dispose
- @message_window.dispose
- @dur_window.dispose
- if $scene.is_a?(Scene_Title)
- Graphics.transition
- Graphics.freeze
- end
- end
- #--------------------------------------------------------------------------
- def update
- loop do
- $game_map.update
- $game_system.map_interpreter.update
- $game_player.update
- $game_system.update
- $game_screen.update
- unless $game_temp.player_transferring
- break
- end
- transfer_player
- if $game_temp.transition_processing
- break
- end
- end
- @spriteset.update
- @message_window.update
- @dur_window.update
- if $game_temp.gameover
- $scene = Scene_Gameover.new
- return
- end
- if $game_temp.to_title
- $scene = Scene_Title.new
- return
- end
- if $game_temp.transition_processing
- $game_temp.transition_processing = false
- if $game_temp.transition_name == ""
- Graphics.transition(20)
- else
- Graphics.transition(40, "Graphics/Transitions/" +
- $game_temp.transition_name)
- end
- end
- if $game_temp.message_window_showing
- return
- end
- if $game_player.encounter_count == 0 and $game_map.encounter_list != []
- unless $game_system.map_interpreter.running? or
- $game_system.encounter_disabled
- n = rand($game_map.encounter_list.size)
- troop_id = $game_map.encounter_list[n]
- if $data_troops[troop_id] != nil
- $game_temp.battle_calling = true
- $game_temp.battle_troop_id = troop_id
- $game_temp.battle_can_escape = true
- $game_temp.battle_can_lose = false
- $game_temp.battle_proc = nil
- end
- end
- end
- if Input.trigger?(Input::B)
- unless $game_system.map_interpreter.running? or
- $game_system.menu_disabled
- $game_temp.menu_calling = true
- $game_temp.menu_beep = true
- end
- end
- if $DEBUG and Input.press?(Input::F9)
- $game_temp.debug_calling = true
- end
- unless $game_player.moving?
- if $game_temp.battle_calling
- call_battle
- elsif $game_temp.shop_calling
- call_shop
- elsif $game_temp.name_calling
- call_name
- elsif $game_temp.menu_calling
- call_menu
- elsif $game_temp.save_calling
- call_save
- elsif $game_temp.debug_calling
- call_debug
- end
- end
- end
- end
- #==============================================================================
- class Scene_Dur_Equip
- #--------------------------------------------------------------------------
- def main
- @help_window = Window_Help.new
- @item_window = Window_Dur_Equip.new
- @gold_window = Window_Gold.new
- @gold_window.x = 480
- @gold_window.y = 64
- @repmes_window = Window_RepMes.new
- @item_window.help_window = @help_window
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- # 装备过渡
- Graphics.freeze
- @help_window.dispose
- @item_window.dispose
- @gold_window.dispose
- @repmes_window.dispose
- end
- #--------------------------------------------------------------------------
- def update
- @help_window.update
- @item_window.update
- @gold_window.update
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- # 切换到地图
- $scene = Scene_Map.new
- return
- end
- # 获取装备
- @item = @item_window.item
- # 为空时
- if @item == nil
- return
- end
- @rep_cost = rep_cost(@item)
- @repmes_window.set(@rep_cost)
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 不能使用的情况下
- if $game_party.gold < @rep_cost or @rep_cost == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 音效
- Audio.se_play("Audio/SE/#{DUR::REP_SE}", 100, 100)
- # 修复
- if @item.is_a?(RPG::Weapon)
- $data_weapons[@item.id].dur = $data_weapons[@item.id].dur_set
- else
- $data_armors[@item.id].dur = $data_armors[@item.id].dur_set
- end
- $game_party.gain_gold(-@rep_cost)
- @item_window.refresh
- @gold_window.refresh
- return
- end
- end
- end
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- def write_save_data(file)
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- Marshal.dump(characters, file)
- Marshal.dump(Graphics.frame_count, file)
- $game_system.save_count += 1
- $game_system.magic_number = $data_system.magic_number
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- Marshal.dump($data_weapons, file)
- Marshal.dump($data_armors, file)
- Marshal.dump($data_classes, file)
- end
- end
- #==============================================================================
- def rep_cost(item)
- if item.is_a?(RPG::Item)
- item.price
- else
- rep_cost = item.dur == 0 ? item.price : item.price * (item.dur_set-item.dur)/item.dur_set
- end
- end
- #==============================================================================
- module RPG
- class Weapon
- attr_accessor :dur_set
- attr_accessor :dur
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def dur_set
- dur_set = @name.split(/,/)[1]
- return dur_set != nil ? dur_set.to_i : 0
- end
- end
- class Armor
- attr_accessor :dur_set
- attr_accessor :dur
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def dur_set
- dur_set = @name.split(/,/)[1]
- return dur_set != nil ? dur_set.to_i : 0
- end
- end
- end
复制代码- #==============================================================================
- # ■ Window_Help
- #------------------------------------------------------------------------------
- # 特技及物品的说明、角色的状态显示的窗口。
- # 若要更改属性,请搜索element_set={1=>"火",2=>"冰",3=>"光",4=>"暗"} 改成对应属性即可
- #==============================================================================
- UNSHOW_STATE=[1,2,3,4,5]#记录不显示的状态数组
- UNSHOW_ELEMENT=[1,2,3,4,5]#记录不显示的属性数组
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(150,200, 180, 480)
- self.opacity = 150
- self.z = 150
- self.visible = false
- self.contents = Bitmap.new(width - 32, height - 32)
- description=""
- @item=nil
- @armor=nil
- @weapon=nil
- end
- #--------------------------------------------------------------------------
- # ● 设置文本
- # text : 窗口显示的字符串
- # align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
- #--------------------------------------------------------------------------
- def set_text(data, align=nil)
- # 如果文本和对齐方式的至少一方与上次的不同
- if align != nil
- # 再描绘窗口和文本
- self.width = 640
- self.height = 64
- self.x=0
- self.y=0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.color = normal_color
- self.contents.font.size = 20
- self.contents.draw_text(4, 0, self.width - 48, 32, data, align)
- self.visible = true
- return
- end
- if data == nil
- self.visible = false
- @data = nil
- end
- if data != nil && @data != data
- @data=data
- self.visible = true
- self.width = 180
- self.height = 200
- self.x=180
- self.y=430
- self.contents = Bitmap.new(width - 32, height - 32)
- case @data
- when RPG::Item
- set_item_text(@data)
- when RPG::Weapon
- set_weapon_text(@data)
- when RPG::Armor
- set_armor_text(@data)
- when RPG::Skill
- set_skill_text(@data)
- end
- else
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 设置敌人
- # enemy : 要显示名字和状态的敌人
- #--------------------------------------------------------------------------
- def set_enemy(enemy)
- text = enemy.name
- state_text = make_battler_state_text(enemy, 0, false)
- if state_text != ""
- text += " " + state_text
- end
- set_text(text, 1)
- @data=nil
- end
- #--------------------------------------------------------------------------
- # ● 设置角色
- # actor : 要显示状态的角色
- #--------------------------------------------------------------------------
- def set_actor(actor)
- if actor != @actor
- self.width = 640
- self.height = 64
- self.x=0
- self.y=0
- self.contents = Bitmap.new(width - 32, height - 32)
- self.contents.clear
- self.contents.font.size=20
- self.contents.font.color = normal_color
- draw_actor_name(actor, 4, 0)
- draw_actor_state(actor, 140, 0)
- draw_actor_hp(actor, 284, 0)
- draw_actor_sp(actor, 460, 0)
- @actor = actor
- @text = nil
- self.visible = true
- end
- end
- #--------------------------------------------------------------------------
- # ● 校正帮助窗口位置
- #--------------------------------------------------------------------------
- def set_pos(x,y,width,oy,index,column_max)
- #光标坐标
- cursor_width = width / column_max - 32
- xx = index % column_max * (cursor_width + 32)
- yy = index / column_max * 32 - oy
- self.x=xx+x+150
- self.y=yy+y+30
- if self.x+self.width>640
- self.x=640-self.width
- end
- if self.y+self.height>480
- self.y=480-self.height
- end
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 物品帮助窗口
- #--------------------------------------------------------------------------
- def set_item_text(item)
- @item=item
- description=""
- [email protected]
- x=0
- y=0
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @item.element_set.clone
- plus_state_set = @item.plus_state_set.clone
- minus_state_set = @item.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=3 #空行,效果范围,价格
- if @item.recover_hp_rate!=0 #HP 回复率。
- height+=1
- end
- if @item.recover_hp!=0 #HP 回复量。
- height+=1
- end
- if @item.recover_sp_rate!=0 #SP 回复率。
- height+=1
- end
- if @item.recover_sp!=0 #SP 回复量。
- height+=1
- end
- if @item.parameter_type!=0 #增加能力值
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- [email protected]
- self.contents.font.color =text_color(3)
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @item.name.size*7, 20, text, 0)
- else
- self.visible = false
- end
- x=0
- y+=1
- text=description
- #描绘描叙
- while ((text = description.slice!(/./m)) != nil)
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
- x+=1
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
- #效果范围
- scope = {0=>"特殊物品",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
- text="范围:"+scope[@item.scope]
- x=0
- y+=2 #空一行
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- #价格
- x=0
- y+=1
- text="价格:"[email protected]_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
-
- #HP 回复率
- if @item.recover_hp_rate!=0
- x=0
- y+=1
- text="回复气血:"[email protected]_hp_rate.to_s+"%"
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #HP回复量
- if @item.recover_hp!=0
- x=0
- y+=1
- text="回复气血:"[email protected]_hp.to_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #SP 回复率
- if @item.recover_sp_rate!=0
- x=0
- y+=1
- text="回复魔法:"[email protected]_sp_rate.to_s+"%"
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #SP 回复量
- if @item.recover_sp!=0
- x=0
- y+=1
- text="回复魔法:"[email protected]_sp.to_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #增加能力值
- if @item.parameter_type!=0
- parameter_type={1=>"最大气血",2=>"最大魔法",3=>$data_system.words.str,4=>$data_system.words.dex,5=>$data_system.words.agi,6=>$data_system.words.int}
- x=0
- y+=1
- if @item.parameter_points>0
- text="增加:"+parameter_type[@item.parameter_type]+" +"[email protected]_points.to_s
- else
- text="减少:"+parameter_type[@item.parameter_type][email protected]_points.to_s
- end
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
-
- #物品属性
- if element_set.empty?!=true #属性。为属性 ID 的数组
- text="属性:"
- for i in 0...element_set.size
- text+=$data_system.elements[element_set[i]]+" "
- end
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #附加状态
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- text="附加状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...plus_state_set.size
- y+=1
- text=$data_states[plus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- #解除状态
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- text="解除状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...minus_state_set.size
- y+=1
- text=$data_states[minus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 武器帮助窗口
- #--------------------------------------------------------------------------
-
- def set_weapon_text(weapon)
- @weapon=weapon
- description=""
- [email protected]
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @weapon.element_set.clone
- plus_state_set = @weapon.plus_state_set.clone
- minus_state_set = @weapon.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
-
-
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=4 #2个空行,攻击,价格
- if @weapon.pdef!=0 #物理防御
- height+=1
- end
- if @weapon.mdef!=0 #魔法防御
- height+=1
- end
- if @weapon.str_plus!=0 #力量
- height+=1
- end
- if @weapon.dex_plus!=0#体质
- height+=1
- end
- if @weapon.agi_plus!=0#敏捷
- height+=1
- end
- if @weapon.int_plus!=0 #智力
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- [email protected]
- self.contents.font.color = text_color(1)#颜色脚本
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @weapon.name.size*7, 20, text, 0)
- else
- self.visible = false
- end
- x=0
- y+=1
- text=description
- #描绘描叙
- while ((text = description.slice!(/./m)) != nil)
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
- x+=1
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
-
- #攻击
- x=0
- y+=2 #空行
- text="攻击:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- #价格
- x=0
- y+=1
- text="价格:"[email protected]_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- #耐久度
- dur_set = @weapon.dur_set
- dur = @weapon.dur
- text = "耐久度: #{dur}"
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x-1, y*15+20, text.size*6, 14, text, 0)
-
- if @weapon.pdef!=0 #物理防御
- x=0
- y+=1
- text="物理防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @weapon.mdef!=0 #魔法防御
- x=0
- y+=1
- text="魔法防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #武器属性
- if element_set.empty? != true #属性。为属性 ID 的数组
- text="属性:"
- for i in 0...element_set.size
- text+=$data_system.elements[element_set[i]]+" "
- end
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #附加状态
- if plus_state_set.empty? != true #附加状态。为状态 ID 的数组
- text="附加状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...plus_state_set.size
- y+=1
- text=$data_states[plus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- #解除状态
- if minus_state_set.empty? != true #解除状态。为状态 ID 的数组
- text="解除状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...minus_state_set.size
- y+=1
- text=$data_states[minus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- y+=1 #空行
- if @weapon.str_plus!=0 #力量
- x=0
- y+=1
- if @weapon.str_plus > 0
- text=$data_system.words.str+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.str+" - "+str_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @weapon.dex_plus!=0#体质
- x=0
- y+=1
- if @weapon.dex_plus > 0
- text=$data_system.words.dex+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.dex+" - "+dex_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @weapon.agi_plus!=0#敏捷
- x=0
- y+=1
- if @weapon.agi_plus > 0
- text=$data_system.words.agi+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.agi+" - "+agi_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @weapon.int_plus!=0 #智力
- x=0
- y+=1
- if @weapon.int_plus > 0
- text=$data_system.words.int+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.int+" - "+int_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
-
-
-
- end
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 防具帮助窗口
- #--------------------------------------------------------------------------
- def set_armor_text(armor)
- @armor=armor
- description=""
- [email protected]
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @armor.guard_element_set.clone
- guard_state_set = @armor.guard_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- guard_state_set -= UNSHOW_STATE
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10 !=0
- height+=1
- end
- height+=2 #2个空行,价格
- if @armor.pdef !=0 #物理防御
- height+=1
- end
- if @armor.mdef !=0 #魔法防御
- height+=1
- end
- if @armor.str_plus !=0 #力量
- height+=1
- end
- if @armor.dex_plus !=0#体质
- height+=1
- end
- if @armor.agi_plus !=0#敏捷
- height+=1
- end
- if @armor.int_plus !=0 #智力
- height+=1
- end
- if element_set.empty? != true #属性防御。为属性 ID 的数组
- height+=1
- end
- if guard_state_set.empty? != true #状态防御。为状态 ID 的数组
- height+=guard_state_set.size
- end
- self.height=height*16+70
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- [email protected]
- self.contents.font.color = text_color(1)#颜色脚本
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @armor.name.size*7, 20, text, 0)
- else
- self.visible = false
- end
- x=0
- y+=1
- text=description
- #描绘描叙
- while ((text = description.slice!(/./m)) != nil)
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
- x+=1
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
-
-
- #价格
- x=0
- y+=2#空行
- text="价格:"[email protected]_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- #耐久度
- dur_set = @weapon.dur_set
- dur = @weapon.dur
- text = "耐久度: #{dur}"
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x-1, y*15+35, text.size*6, 14, text, 0)
-
- if @armor.pdef!=0 #物理防御
- text="物理防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- end
- if @armor.mdef!=0 #魔法防御
- text="魔法防御:"[email protected]_s
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- x=0
- y+=1
- end
- #属性防御
- if element_set.empty? !=true #属性。为属性 ID 的数组
- text="属性防御:"
- for i in 0...element_set.size
- text+=$data_system.elements[element_set[i]]+" "
- end
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #状态防御
- if guard_state_set.empty?!=true #附加状态。为状态 ID 的数组
- text="状态防御:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...guard_state_set.size
- y+=1
- text=$data_states[guard_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
-
- # y+=1 #空行
- if @armor.str_plus!=0 #力量
- x=0
- y+=1
- if @armor.str_plus > 0
- text=$data_system.words.str+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.str+" - "+str_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.dex_plus!=0#体质
- x=0
- y+=1
- if @armor.dex_plus > 0
- text=$data_system.words.dex+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.dex+" - "+dex_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.agi_plus!=0#敏捷
- x=0
- y+=1
- if @armor.agi_plus > 0
- text=$data_system.words.agi+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.agi+" - "+agi_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- if @armor.int_plus!=0 #智力
- x=0
- y+=1
- if @armor.int_plus > 0
- text=$data_system.words.int+" + "[email protected]_plus.to_s
- else
- [email protected]_plus
- text=$data_system.words.int+" - "+int_minus.to_s
- end
- self.contents.font.color = text_color(6)#颜色脚本
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- end
- class Window_Help < Window_Base
- #--------------------------------------------------------------------------
- # ● 技能帮助窗口
- #--------------------------------------------------------------------------
- def set_skill_text(skill)
- @skill=skill
- description=""
- [email protected]
- # 取得屬性、附加狀態、解除狀態之副本
- element_set = @skill.element_set.clone
- plus_state_set = @skill.plus_state_set.clone
- minus_state_set = @skill.minus_state_set.clone
- # 過濾不顯示的描述
- element_set -= UNSHOW_ELEMENT
- plus_state_set -= UNSHOW_STATE
- minus_state_set -= UNSHOW_STATE
- x=0
- y=0
- height=1 #依要显示的内容确定高
- #由描叙确定高
- height+=description.size/3/10
- if description.size%10!=0
- height+=1
- end
- height+=4 #空行,效果范围,消费SP,命中率
- if @skill.power!=0 #威力,威力为0,则可能为状态魔法
- height+=1
- end
- if element_set.empty?!=true #属性。为属性 ID 的数组
- height+=1
- end
- if plus_state_set.empty?!=true #附加状态。为状态 ID 的数组
- height+=plus_state_set.size
- end
- if minus_state_set.empty?!=true #解除状态。为状态 ID 的数组
- height+=minus_state_set.size
- end
- self.height=height*15+40+15
- self.contents = Bitmap.new(self.width - 32,self.height - 32)
- self.contents.clear
- #描绘名字
- [email protected]
- self.contents.font.color =text_color(6)
- self.contents.font.size=18
- if text!=nil
- self.visible = true
- self.contents.draw_text(0,0, @skill.name.size*7, 20, text, 0)
- else
- self.visible = false
- end
- x=0
- y+=1
- text=description
- #描绘描叙
- while ((text = description.slice!(/./m)) != nil)
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x*15, y*15+5, 14, 14, text, 0)
- x+=1
- text
- if x==10#每行10个字
- x=0
- y+=1
- end
- end
- #由特技属性确定高
- #效果范围
-
- scope = {0=>"特殊技能",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
- text="范围:"+scope[@skill.scope]
- x=0
- y+=2 #空一行
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
-
- #威力
- if @skill.power!=0
- x=0
- y+=1
- [email protected] > 0 ? @skill.power : -1* @skill.power
- text="威力:"+c.to_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #描绘消费SP
- x=0
- y+=1
- text="消耗SP:"[email protected]_cost.to_s
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- #命中率
- x=0
- y+=1
- text="命中率:"[email protected]_s+"%"
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- #攻击属性
-
- if element_set.empty? != true #属性。为属性 ID 的数组
- text="属性:"
- for i in 0...element_set.size
- text+=$data_system.elements[element_set[i]]+" "
- end
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- #附加状态
- if plus_state_set.empty? != true #附加状态。为状态 ID 的数组
- text="附加状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...plus_state_set.size
- y+=1
- text=$data_states[plus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- #解除状态
- if minus_state_set.empty? != true #解除状态。为状态 ID 的数组
- text="解除状态:"
- x=0
- y+=1
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- y-=1
- x+=text.size*5
- for i in 0...minus_state_set.size
- y+=1
- text=$data_states[minus_state_set[i]].name
- self.contents.font.color = normal_color
- self.contents.font.size=14
- self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
- end
- end
- end
- end
- class Window_Item < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- # @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- @help_window.set_text(skill)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_EquipRight < Window_Selectable
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_EquipItem < Window_Selectable
- def update_help
- # @help_window.set_text(self.item == nil ? "" : self.item.description)
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_ShopBuy < Window_Selectable
- def update_help
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
- class Window_ShopSell < Window_Selectable
- def update_help
- @help_window.set_text(item)
- #校正帮助窗口位置
- @help_window.set_pos(self.x,self.y,self.width,self.oy,self.index,@column_max)
- end
- end
复制代码- class Game_Party
-
- def gain_weapon(weapon_id, n)
- if weapon_id > 0
- # 装备栏中卸下的武器和物品栏里卸下的武器不进行随机处理~
- if $scene.is_a?(Scene_Equip)or$scene.is_a?(Scene_Item)
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- else
- # 随机浮动范围~
- add_atk = rand(50)-25
- if add_atk == 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
- else
- now = 0
- # 判断数据库中是否已经有 相同属性的武器~
- for i in weapon_id...$data_weapons.size
- if $data_weapons[i].atk == $data_weapons[weapon_id].atk+add_atk and
- ($data_weapons[i].name.split('+')[0] == $data_weapons[weapon_id].name or $data_weapons[i].name.split('-')[0] == $data_weapons[weapon_id].name)
- now = i
- break
- end end
- if now == 0
- # 无相同属性时则 重新生成~
- new_weapon = $data_weapons[weapon_id].clone
- new_weapon.id = $data_weapons.size
- if add_atk<0
- new_weapon.name = $data_weapons[weapon_id].name+" 破烂"
- if add_atk<10
- new_weapon.name = $data_weapons[weapon_id].name+" 粗糙"
- end
- else
- if add_atk<10
- new_weapon.name = $data_weapons[weapon_id].name+" 精良"
- else
- new_weapon.name = $data_weapons[weapon_id].name+" 极品"
- end
- end
- new_weapon.atk = $data_weapons[weapon_id].atk+add_atk
- $data_weapons.push(new_weapon)
- # 职业可装备武器数组更新~
- for i in 1...$data_classes.size
- if $data_classes[i].weapon_set.include?(weapon_id)
- $data_classes[i].weapon_set.push(new_weapon.id)
- end
- end
- # 增加武器~
- @weapons[new_weapon.id] = [[weapon_number(new_weapon.id) + n, 0].max, 99].min
- else
- # 有相同属性则直接 增加武器~
- @weapons[now] = [[weapon_number(now) + n, 0].max, 99].min
- end
- end
- end
- end
- end
-
- def lose_weapon(weapon_id, n)
- if weapon_id > 0
- @weapons[weapon_id] = [[weapon_number(weapon_id) - n, 0].max, 99].min
- end
- end
-
- end
复制代码 |
|