赞 | 5 |
VIP | 71 |
好人卡 | 22 |
积分 | 6 |
经验 | 32145 |
最后登录 | 2013-8-9 |
在线时间 | 184 小时 |
Lv2.观梦者 天仙
- 梦石
- 0
- 星屑
- 620
- 在线时间
- 184 小时
- 注册时间
- 2008-4-15
- 帖子
- 5023
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
跟kissye君的不同,以熟练度升级
注释里添加:
[level up]、[lvup]、[升级]、[升級]
表示此技能能升级,并在窗口中显示等级和熟练度,不填的话无法升级
[熟练次数 N] 表示此技能需要使用N次才会升级, 不填默认为20
[最大等级 N] 表示此技能最大等级,不填默认为1
脚本更新:
* 2009/02/18
- BUG 修正:修改攻击技能不升级的BUG - class RPG::Skill < RPG::UsableItem
- # 判斷技能是否有等級
- def lvup?
- self.note.split(/[\r\n]+/).each { |line|
- return line =~ /\[(lvup|level up|升級|升级)\]/}
- return false
- end
- # 判斷技能熟練度次數
- def times_used_to_lvup
- self.note.split(/[\r\n]+/).each { |line|
- return $1.to_i if line =~ /\[(?:use_exp|熟練次數) (\d*)\]/}
- return 20
- end
- # 判斷技能所需熟練度
- def use_exp; return (100 / times_used_to_lvup); end
- # 獲取技能最大等級
- def maxlv
- self.note.split(/[\r\n]+/).each { |line|
- return $1.to_i if line =~ /\[(?:maxlv|最大等級|最大等级) (\d*)\]/}
- return 1
- end
- # 獲取等級值
- def get_value(lv, hash)
- if hash.include?(lv)
- return hash[lv]
- else
- ks = hash.keys.dup
- ks.sort!
- for i in 1..hash.size-1
- k0 = ks[i-1]
- k1 = ks[i]
- k2 = ks[i+1]
- if lv > k1 and lv < k2
- return hash[k1]
- elsif lv < k1
- return hash[k0]
- elsif lv > k2
- next
- end
- end
- end
- end
- end
- class Game_Temp
- alias skill_level_initialize initialize
- attr_accessor :skill_level
- def initialize
- skill_level_initialize
- @skill_level = 1
- end
- end
- class Game_Battler
- # 技能效果 + 熟練度提升
- alias skill_level_skill_effect skill_effect
- def skill_effect(user, skill)
- if skill_effective?(user, skill)
- exp = user.skill_exp[skill.id].to_i + skill.use_exp
- user.change_skill_exp(skill.id, exp)
- end
- skill_level_skill_effect(user, skill)
- end
- end
- class Game_Actor < Game_Battler
- attr_accessor :skill_level
- attr_accessor :skill_exp
- alias skill_level_initialize initialize
- # 可升級技能初始化
- def initialize(actor_id)
- skill_level_initialize(actor_id)
- @skill_level = {}
- @skill_exp = {}
- for i in self.class.learnings
- skill = $data_skills[i.skill_id]
- if skill.lvup?
- @skill_level[skill.id] ||= 1
- @skill_exp[skill.id] ||= 0
- end
- end
- end
- # 更改技能熟練度
- def change_skill_exp(id, exp)
- @skill_exp[id] = [[exp, 99999].min, 0].max
- while @skill_exp[id] >= 100
- skill_level_up(id)
- @skill_exp[id] = 0
- end
- end
- # 更改技能等級
- def skill_level_up(id, level=1)
- return unless skill_lvup?(id)
- @skill_level[id] = @skill_level[id].to_i+level
- # 顯示升級提示窗口
- @skill_lvup_window = Window_Base.new(0, (416-56)/2, 544,56)
- text="技能[#{$data_skills[id].name}]等級提升"
- @skill_lvup_window.contents.draw_text(0, 0, 512, Window_Base::WLH, text, 1)
- Graphics.wait(60) # 等待60禎
- @skill_lvup_window.dispose
- end
- # 角色技能是否能升级
- def skill_lvup?(id)
- return @skill_level[id] != $data_skills[id].maxlv
- return $data_skills[id].lvup?
- end
- end
- class Window_Base < Window
- alias skill_level_draw_item_name draw_item_name
- # 繪製技能名稱
- def draw_item_name(item, x, y, enabled = true)
- if item != nil and item.is_a?(RPG::Skill) and item.lvup?
- draw_skill_name_lvup(item, x, y, enabled)
- return
- end
- skill_level_draw_item_name(item, x, y, enabled)
- end
- # 繪製可升級技能名稱
- def draw_skill_name_lvup(item, x, y, enabled = true)
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- exp = @actor.skill_exp[item.id]
- level = @actor.skill_level[item.id]
- if @actor.skill_lvup?(item.id)
- self.contents.draw_text(x + 24, y, 172, WLH, item.name+" LV:#{level}"+"(#{exp}%)")
- else
- self.contents.draw_text(x + 24, y, 172, WLH, item.name+" LV:#{level}")
- end
- end
- end
- class Game_Actor < Game_Battler
- alias skill_level_skill_effective? skill_effective?
- def skill_effective?(user, skill)
- $game_temp.skill_level = user.skill_level[skill.id]
- skill_level_skill_effective?(user, skill)
- end
- end
- class Game_BattleAction
- alias skill_level_set_skill set_skill
- alias skill_level_skill skill
- def set_skill(skill_id)
- skill_level_set_skill(skill_id)
- $game_temp.skill_level = @battler.skill_level[skill_id]
- end
- def skill
- $game_temp.skill_level = @battler.skill_level[@skill_id]
- skill_level_skill
- end
- end
- class Window_Skill < Window_Selectable
- alias skill_level_skill skill
- def skill
- $game_temp.skill_level = @actor.skill_level[@data[self.index].id]
- skill_level_skill
- end
- end
复制代码 |
|