赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 1810 |
最后登录 | 2012-7-18 |
在线时间 | 18 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 18 小时
- 注册时间
- 2009-7-25
- 帖子
- 411
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 flzt5354 于 2009-8-29 11:31 编辑
范例下载
原来呢,就是法宝1和法宝2是通用的
我要使得它不通用
请说明改怎么改- #==============================================================================
- # ■ Window_EquipRight
- #------------------------------------------------------------------------------
- # 装备画面、显示角色现在装备的物品的窗口。
- #==============================================================================
- class Window_EquipRight_New < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(160, 48, 240, 352)
- self.windowskin = RPG::Cache.windowskin("../system/menu/windowskins/palskin")
- self.opacity = 180
- self.contents = Bitmap.new(width - 32, height - 32)
- @actor = actor
- refresh
- self.index = 0
- end
- #--------------------------------------------------------------------------
- # ● 获取物品
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @data = []
- @data.push($data_weapons[@actor.weapon_id])
- @data.push($data_armors[@actor.armor1_id])
- @data.push($data_armors[@actor.armor2_id])
- @data.push($data_armors[@actor.armor3_id])
- @data.push($data_armors[@actor.armor4_id])
- @data.push($data_armors[@actor.armor5_id])
- @data.push($data_armors[@actor.armor6_id])
- @data.push($data_armors[@actor.armor7_id])
- @item_max = @data.size
- self.contents.font.color = system_color
- self.contents.font.size = 20
- self.contents.draw_text(4, 0, 92, 32, $data_system.words.weapon)
- self.contents.draw_text(4, 40 * 1, 92, 32, $data_system.words.armor1)
- self.contents.draw_text(4, 40 * 2, 92, 32, $data_system.words.armor2)
- self.contents.draw_text(4, 40 * 3, 92, 32, $data_system.words.armor3)
- self.contents.draw_text(4, 40 * 4, 92, 32, $data_system.words.armor4)
- self.contents.draw_text(4, 40 * 5, 92, 32, "鞋")
- self.contents.draw_text(4, 40 * 6, 92, 32, "法宝1")
- self.contents.draw_text(4, 40 * 7, 92, 32, "法宝2")
- draw_item_name(@data[0], 64, 40 * 0, 18)
- draw_item_name(@data[1], 64, 40 * 1, 18)
- draw_item_name(@data[2], 64, 40 * 2, 18)
- draw_item_name(@data[3], 64, 40 * 3, 18)
- draw_item_name(@data[4], 64, 40 * 4, 18)
- draw_item_name(@data[5], 64, 40 * 5, 18)
- draw_item_name(@data[6], 64, 40 * 6, 18)
- draw_item_name(@data[7], 64, 40 * 7, 18)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- #--------------------------------------------------------------------------
- # ● 更新光标举行
- #--------------------------------------------------------------------------
- def update_cursor_rect
- # 光标位置不满 0 的情况下
- if @index < 0
- self.cursor_rect.empty
- return
- end
- # 获取当前的行
- row = @index / @column_max
- # 当前行被显示开头行前面的情况下
- if row < self.top_row
- # 从当前行向开头行滚动
- self.top_row = row
- end
- # 当前行被显示末尾行之后的情况下
- if row > self.top_row + (self.page_row_max - 1)
- # 从当前行向末尾滚动
- self.top_row = row - (self.page_row_max - 1)
- end
- # 计算光标的宽
- cursor_width = self.width / @column_max - 32
- # 计算光标坐标
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 40 - self.oy
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 40)
- end
- end
复制代码- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 防具类追加
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- module RPG
- class Armor
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def kind
- kind = @name.split(/,/)[1]
- return kind != nil ? kind.to_i : @kind
- end
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # Game_Actor添加新的防具ID,并对相关方法修正
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- class Game_Actor < Game_Battler
- attr_reader :armor5_id # 手套 ID
- attr_reader :armor6_id # 鞋 ID
- attr_reader :armor7_id # 法宝2 ID
- #--------------------------------------------------------------------------
- # ● 设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- alias old_setup setup
- def setup(actor_id)
- old_setup(actor_id)
- @armor5_id = 0
- @armor6_id = 0
- @armor7_id = 0
- update_auto_state(nil, $data_armors[@armor5_id])
- update_auto_state(nil, $data_armors[@armor6_id])
- update_auto_state(nil, $data_armors[@armor7_id])
- end
- #--------------------------------------------------------------------------
- # ● 取得属性修正值
- # element_id : 属性 ID
- #--------------------------------------------------------------------------
- def element_rate(element_id)
- # 获取对应属性有效度的数值
- table = [0,200,150,100,50,0,-100]
- result = table[$data_classes[@class_id].element_ranks[element_id]]
- # 防具能防御本属性的情况下效果减半
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
- armor = $data_armors[i]
- if armor != nil and armor.guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 状态能防御本属性的情况下效果减半
- for i in @states
- if $data_states[i].guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 过程结束
- return result
- end
- #--------------------------------------------------------------------------
- # ● 判定防御属性
- # state_id : 属性 ID
- #--------------------------------------------------------------------------
- def state_guard?(state_id)
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
- armor = $data_armors[i]
- if armor != nil
- if armor.guard_state_set.include?(state_id)
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 获取基本力量
- #--------------------------------------------------------------------------
- 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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- n += armor5 != nil ? armor5.str_plus : 0
- n += armor6 != nil ? armor6.str_plus : 0
- n += armor7 != nil ? armor7.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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- n += armor5 != nil ? armor5.dex_plus : 0
- n += armor6 != nil ? armor6.dex_plus : 0
- n += armor7 != nil ? armor7.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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- n += armor5 != nil ? armor5.agi_plus : 0
- n += armor6 != nil ? armor6.agi_plus : 0
- n += armor7 != nil ? armor7.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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- n += armor5 != nil ? armor5.int_plus : 0
- n += armor6 != nil ? armor6.int_plus : 0
- n += armor7 != nil ? armor7.int_plus : 0
- return [[n, 1].max, 999].min
- 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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- pdef6 = armor5 != nil ? armor5.pdef : 0
- pdef7 = armor6 != nil ? armor6.pdef : 0
- pdef8 = armor7 != nil ? armor7.pdef : 0
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + pdef8
- 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]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- mdef6 = armor5 != nil ? armor5.mdef : 0
- mdef7 = armor6 != nil ? armor6.mdef : 0
- mdef8 = armor7 != nil ? armor7.mdef : 0
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + mdef8
- end
- #--------------------------------------------------------------------------
- # ● 获取基本回避修正
- #--------------------------------------------------------------------------
- def base_eva
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_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
- eva5 = armor5 != nil ? armor5.eva : 0
- eva6 = armor6 != nil ? armor6.eva : 0
- eva7 = armor7 != nil ? armor7.eva : 0
- return eva1 + eva2 + eva3 + eva4 + eva5 + eva6 + eva7
- end
- #--------------------------------------------------------------------------
- # ● 变更装备
- # equip_type : 装备类型
- # id : 武器 or 防具 ID (0 为解除装备)
- #--------------------------------------------------------------------------
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- end
- when 1 # 盾
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- end
- when 2 # 头
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- end
- when 3 # 身体
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- end
- when 4 # 手套
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- end
- when 5 # 鞋
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor5_id], $data_armors[id])
- $game_party.gain_armor(@armor5_id, 1)
- @armor5_id = id
- $game_party.lose_armor(id, 1)
- end
- when 6 # 法宝1
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor6_id], $data_armors[id])
- $game_party.gain_armor(@armor6_id, 1)
- @armor6_id = id
- $game_party.lose_armor(id, 1)
- end
- when 7 # 法宝2
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor7_id], $data_armors[id])
- $game_party.gain_armor(@armor7_id, 1)
- @armor7_id = id
- $game_party.lose_armor(id, 1)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更改职业 ID
- # class_id : 新的职业 ID
- #--------------------------------------------------------------------------
- def class_id=(class_id)
- if $data_classes[class_id] != nil
- @class_id = class_id
- # 避开无法装备的物品
- unless equippable?($data_weapons[@weapon_id])
- equip(0, 0)
- end
- unless equippable?($data_armors[@armor1_id])
- equip(1, 0)
- end
- unless equippable?($data_armors[@armor2_id])
- equip(2, 0)
- end
- unless equippable?($data_armors[@armor3_id])
- equip(3, 0)
- end
- unless equippable?($data_armors[@armor4_id])
- equip(4, 0)
- end
- unless equippable?($data_armors[@armor5_id])
- equip(5, 0)
- end
- unless equippable?($data_armors[@armor6_id])
- equip(6, 0)
- end
- unless equippable?($data_armors[@armor7_id])
- equip(7, 0)
- end
- end
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 商店购买窗口美化,增加对新装备位置的描述
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- # ■ Window_ShopStatus
- #------------------------------------------------------------------------------
- # 商店画面、显示物品所持数与角色装备的窗口。
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item == nil
- 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
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 200, 32, "所持数")
- self.contents.font.color = normal_color
- self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
- if @item.is_a?(RPG::Item)
- return
- end
- # 添加装备品信息
- for i in 0...$game_party.actors.size
- # 获取角色
- actor = $game_party.actors[i]
- # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
- if actor.equippable?(@item)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- # 描绘角色名字
- self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
- # 获取当前的装备品
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- elsif @item.kind == 3
- item1 = $data_armors[actor.armor4_id]
- elsif @item.kind == 4
- item1 = $data_armors[actor.armor5_id]
- elsif @item.kind == 5
- item1 = $data_armors[actor.armor6_id]
- else
- item1 = $data_armors[actor.armor7_id]
- end
- # 可以装备的情况
- if actor.equippable?(@item)
- # 武器的情况
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- change = atk2 - atk1
- end
- # 防具的情况
- if @item.is_a?(RPG::Armor)
- pdef1 = item1 != nil ? item1.pdef : 0
- mdef1 = item1 != nil ? item1.mdef : 0
- pdef2 = @item != nil ? @item.pdef : 0
- mdef2 = @item != nil ? @item.mdef : 0
- change = pdef2 - pdef1 + mdef2 - mdef1
- end
- # 描绘能力值变化
- self.contents.draw_text(124, 64 + 64 * i, 112, 32,
- sprintf("%+d", change), 2)
- end
- # 描绘物品
- if item1 != nil
- x = 4
- y = 64 + 64 * i + 32
- bitmap = RPG::Cache.icon(item1.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, item1.name)
- end
- end
- end
- end
复制代码 |
|