赞 | 651 |
VIP | 62 |
好人卡 | 144 |
积分 | 329 |
经验 | 110435 |
最后登录 | 2024-7-10 |
在线时间 | 5096 小时 |
Lv5.捕梦者
- 梦石
- 0
- 星屑
- 32930
- 在线时间
- 5096 小时
- 注册时间
- 2012-11-19
- 帖子
- 4877

|
- #==============================================================================
- module XdRs
- #--------------------------------------------------------------------------
- # 升级物品限制。格式: 职业ID => 物品ID 。未写入这个记录的职业,将不受限制。
- Item_data = {
- 1 => 13,
- 2 => 14,
- 3 => 15,
- 4 => 16,
- 5 => 17,
- 6 => 18,
- 7 => 19,
- 8 => 20
- }
- #--------------------------------------------------------------------------
- # 升级需要对应物品个数的算式, level: 角色等级 。
- Equation = "level * 2"
-
- #--------------------------------------------------------------------------
- # 升级所需物品的显示用语。
- Status_word = "升级需要物品:"
-
- #--------------------------------------------------------------------------
- # 在 角色状态界面 的显示位置。
- Point = {:x=>260, :y=>0}
-
- #--------------------------------------------------------------------------
- def self.is_limit_item?(item_id)
- return Item_data.values.include?(item_id)
- end
- #--------------------------------------------------------------------------
- def self.need_item?(actor)
- return Item_data.keys.include?(actor.class_id) &&
- $data_items[Item_data[actor.class_id]]
- end
- #--------------------------------------------------------------------------
- def self.quantity_required(actor)
- level = actor.level
- return eval Equation
- end
- #--------------------------------------------------------------------------
- def self.deduct_test(actor)
- return true if !self.need_item?(actor.class_id)
- item_id = Item_data[actor.class_id]
- number = self.quantity_required(actor)
- result = $game_party.item_number(item_id) >= number
- result && $game_party.lose_item(item_id, number)
- return result
- end
- end
- #==============================================================================
- class Game_Actor
- #--------------------------------------------------------------------------
- def exp=(exp)
- @exp = [[exp, 9999999].min, 0].max
- # 升级
- while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0 &&
- XdRs.deduct_test(self)
- @level += 1
- # 学会特技
- for j in $data_classes[@class_id].learnings
- if j.level == @level
- learn_skill(j.skill_id)
- end
- end
- end
- # 降级
- while @exp < @exp_list[@level]
- @level -= 1
- end
- # 修正当前的 HP 与 SP 超过最大值
- @hp = [@hp, self.maxhp].min
- @sp = [@sp, self.maxsp].min
- end
- end
- #==============================================================================
- class Game_Party
- #--------------------------------------------------------------------------
- def refresh_level_limit
- @actors.each{|a| a.exp += 0 }
- end
- #--------------------------------------------------------------------------
- alias xr_level_limit_gain_item gain_item
- def gain_item(item_id, n)
- xr_level_limit_gain_item(item_id, n)
- n > 0 && XdRs.is_limit_item?(item_id) && refresh_level_limit
- end
- end
- #==============================================================================
- class Window_Status
- #--------------------------------------------------------------------------
- alias xr_level_limit_refresh refresh
- def refresh
- xr_level_limit_refresh
- XdRs.need_item?(@actor) && draw_limit_item
- end
- #--------------------------------------------------------------------------
- def draw_limit_item
- x = XdRs::Point[:x]
- y = XdRs::Point[:y]
- word = XdRs::Status_word
- item = $data_items[XdRs::Item_data[@actor.class_id]]
- need_num = XdRs.quantity_required(@actor)
- now_num = $game_party.item_number(item.id)
- text = "#{now_num}/#{need_num}"
- cw = contents.text_size(word).width
- tw = contents.text_size(text).width
- iw = contents.text_size(item.name).width
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, cw, 32, word)
- draw_item_name(item, x+cw, y)
- color_index = now_num >= need_num ? 3 : 2
- self.contents.font.color = text_color(color_index)
- self.contents.draw_text(x+44+cw+iw, y, tw, 32, text)
- end
- end
- #==============================================================================
复制代码 |
|