Project1
标题:
ACE职业等级系统
[打印本页]
作者:
xmheart
时间:
2012-1-23 18:49
标题:
ACE职业等级系统
本帖最后由 xmheart 于 2012-1-23 18:59 编辑
新人第一次发帖,这个脚本是在日站找到的,然后加上自己渣一般的汉化能力重新弄了一下说明弄出来的,希望有什么问题提出来吧。(我是脚本盲= =)
原地址:
http://www.tekepon.net/fsm/modul ... d=2211&forum=12
#==============================================================================
# ■职业等级系统 for RGSS3 Ver1.02 by kure
#
# 功能: 1.把角色等级分成基本等级和职业等级.
# 2.可以根据角色职业等级自定义习得技能.
#==============================================================================
# 使用说明:
# ★设置职业等级经验值.
# 在数据库-敌人-备注里写入下面格式的内容
# <职业Exp 经验值> 如果不写则默认和通常经验值相同
# ★设置职业等级最大值.请不要设定在99级以上.
# MAX_JOBLV = 値
# ★基本等级の经验值曲线根据职业ID设置.
# 设置为0的时候.作为职业经验值曲线来使用
# 设置基本等级经验值曲线用附加一个替代职业来设置比较好
# ★设置角色固有技能.
# 这里可以设置角色根据基本等级习得技能
# ACTOR_SKILL[角色ID] = [[技能ID,习得等级],[技能ID,习得等级],…]
#==============================================================================
module KURE
module JobLvSystem
#--------------------------------------------------------------------------
# ● 基本设置(新增定义)
#--------------------------------------------------------------------------
# 初期设置(不能改变)
ACTOR_SKILL = []
# 最大职业等级
MAX_JOBLV = 99
# 设置基本等级经验值曲线
# 职业等级的经验值曲线为职业原来的经验值曲线来使用
# 因此,角色成长经验值曲线请用附加一个替代职业来设置
# USE_EXP_CURVE = [角色1,角色2,…]
USE_EXP_CURVE = [1,1,1,1,1,1,1,1,1,1]
# 角色固有技能
# ACTOR_SKILL[角色ID] = [[技能ID,习得等级],[技能ID,习得等级],…]
ACTOR_SKILL[4] = [[76,1],[77,1],[78,1]]
end
end
#==============================================================================
# ■ Vocab(追加定义)
#==============================================================================
module Vocab
ObtainJobExp = "获得了%s职业经验值!"
end
#==============================================================================
# ■ RPG::Enemy(追加定义)
#==============================================================================
class RPG::Enemy < RPG::BaseItem
#--------------------------------------------------------------------------
# ● 初期化(别名重定义)
#--------------------------------------------------------------------------
alias kure_jobLv_before_initialize initialize
def initialize
kure_jobLv_before_initialize
@jobexp = 0
end
#--------------------------------------------------------------------------
# ● 职业经验值定义(追加定义)
#--------------------------------------------------------------------------
def jobexp
if @note != ""
cheack_note = @note
cheack_note.match(/^<职业Exp\s?(\d+)>/)
if $1 == nil
return @exp
else
return jobexp = $1.to_i
end
else
return @exp
end
end
#--------------------------------------------------------------------------
# ● 职业经验值定义(重定义)
#--------------------------------------------------------------------------
def jobexp=(jobexp)
@jobexp = jobexp
end
end
#==============================================================================
# ■ Game_Enemy(追加定义)
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 职业经验值取得
#--------------------------------------------------------------------------
def jobexp
enemy.jobexp
end
end
#==============================================================================
# ■ Game_Troop(追加定义)
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 经验值合计计算
#--------------------------------------------------------------------------
def jobexp_total
dead_members.inject(0) {|r, enemy| r += enemy.jobexp }
end
end
#==============================================================================
# ■ BattleManager(重定义)
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● 获得经验值显示(重定义)
#--------------------------------------------------------------------------
def self.display_exp
if $game_troop.exp_total > 0
text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
$game_message.add('\.' + text)
end
if $game_troop.jobexp_total > 0
text2 = sprintf(Vocab::ObtainJobExp, $game_troop.jobexp_total)
$game_message.add('\.' + text2)
end
end
#--------------------------------------------------------------------------
# ● 经验值获得和等级上升显示(重定义)
#--------------------------------------------------------------------------
def self.gain_exp
$game_party.all_members.each do |actor|
actor.gain_exp($game_troop.exp_total,$game_troop.jobexp_total)
end
wait_for_message
end
end
#==============================================================================
# ■ Game_Actor(别名重定义)
#==============================================================================
class Game_Actor < Game_Battler
attr_reader :joblevel # 职业等级
#--------------------------------------------------------------------------
# ● 准备(别名重定义)
#--------------------------------------------------------------------------
alias kure_jobLv_before_setup setup
def setup(actor_id)
@joblevel = 1
@jobexp = {}
kure_jobLv_before_setup(actor_id)
init_jobexp
end
#--------------------------------------------------------------------------
# ▼ 指定等级上升必要累积经验值取得(重定义)
#--------------------------------------------------------------------------
def exp_for_level(level)
if @actor_id > 0
if KURE::JobLvSystem::USE_EXP_CURVE[@actor_id - 1] != 0
$data_classes[KURE::JobLvSystem::USE_EXP_CURVE[@actor_id - 1]].exp_for_level(level)
else
self.class.exp_for_level(level)
end
else
self.class.exp_for_level(level)
end
end
#--------------------------------------------------------------------------
# ● 指定职业等级上升必要累积经验值取得(追加定义)
#--------------------------------------------------------------------------
def jobexp_for_level(level)
self.class.exp_for_level(level)
end
#--------------------------------------------------------------------------
# ● 技能初期化(重定义)
#--------------------------------------------------------------------------
def init_skills
@skills = []
#处理职业等级1所掌握的技能
self.class.learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level <= @joblevel
end
#处理基本等级1所掌握的固有技能
if KURE::JobLvSystem::ACTOR_SKILL[@actor_id] != nil
for i in 0..KURE::JobLvSystem::ACTOR_SKILL[@actor_id].size - 1
if @level >= KURE::JobLvSystem::ACTOR_SKILL[@actor_id][i][1]
learn_skill(KURE::JobLvSystem::ACTOR_SKILL[@actor_id][i][0])
end
end
end
end
#--------------------------------------------------------------------------
# ● 职业经验值初期化(追加定义)
#--------------------------------------------------------------------------
def init_jobexp
@jobexp[@class_id] = current_joblevel_exp
end
#--------------------------------------------------------------------------
# ● 职业经验值取得(追加定义)
#--------------------------------------------------------------------------
def jobexp
@jobexp[@class_id]
end
#--------------------------------------------------------------------------
# ● 现在职业等级最低经验值取得(追加定义)
#--------------------------------------------------------------------------
def current_joblevel_exp
jobexp_for_level(@joblevel)
end
#--------------------------------------------------------------------------
# ● 下次等级经验值取得(追加定义)
#--------------------------------------------------------------------------
def next_joblevel_exp
jobexp_for_level(@joblevel + 1)
end
#--------------------------------------------------------------------------
# ● 最大职业等级(追加定义)
#--------------------------------------------------------------------------
def max_joblevel
KURE::JobLvSystem::MAX_JOBLV
end
#--------------------------------------------------------------------------
# ● 判定最大职业等级(追加定义)
#--------------------------------------------------------------------------
def max_joblevel?
@joblevel >= max_joblevel
end
#--------------------------------------------------------------------------
# ● 职业经验值变更(追加定义)
# show : 等级上升显示标记
#--------------------------------------------------------------------------
def change_jobexp(jobexp, show)
@jobexp[@class_id] = [jobexp, 0].max
last_level = @joblevel
last_skills = skills
joblevel_up while !max_joblevel? && self.jobexp >= next_joblevel_exp
joblevel_down while self.jobexp < current_joblevel_exp
display_joblevel_up(skills - last_skills) if show && @joblevel > last_level
refresh
end
#--------------------------------------------------------------------------
# ● 等级上升(重定义)
#--------------------------------------------------------------------------
def level_up
@level += 1
#检查是否存在固有技能目录
if KURE::JobLvSystem::ACTOR_SKILL[@actor_id] != nil
for i in 0..KURE::JobLvSystem::ACTOR_SKILL[@actor_id].size - 1
if @level == KURE::JobLvSystem::ACTOR_SKILL[@actor_id][i][1]
learn_skill(KURE::JobLvSystem::ACTOR_SKILL[@actor_id][i][0])
end
end
end
end
#--------------------------------------------------------------------------
# ● 职业等级上升(追加定义)
#--------------------------------------------------------------------------
def joblevel_up
@joblevel += 1
self.class.learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level == @joblevel
end
end
#--------------------------------------------------------------------------
# ● 职业等级下降(追加定义)
#--------------------------------------------------------------------------
def joblevel_down
@joblevel -= 1
end
#--------------------------------------------------------------------------
# ● 职业等级上升信息显示(追加定义)
# new_skills : 排列新习得技能
#--------------------------------------------------------------------------
def display_joblevel_up(new_skills)
$game_message.new_page
$game_message.add(sprintf(Vocab::LevelUp, @name, "职业等级", @joblevel))
new_skills.each do |skill|
$game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
end
end
#--------------------------------------------------------------------------
# ● 经验值获得(考虑经验获得率)(重定义)
#--------------------------------------------------------------------------
def gain_exp(exp,jobexp)
change_exp(self.exp + (exp * final_exp_rate).to_i, true)
change_jobexp(self.jobexp + (jobexp * final_exp_rate).to_i, true)
end
#--------------------------------------------------------------------------
# ● 职业变更(重定义)
# keep_exp : 继承经验值
#--------------------------------------------------------------------------
def change_class(class_id, keep_exp = true)
@exp[class_id] = exp if keep_exp
@class_id = class_id
change_exp(@exp[@class_id] || 0, false)
change_jobexp(@jobexp[@class_id] || 0, false)
self.class.learnings.each do |learning|
learn_skill(learning.skill_id) if learning.level == @joblevel
end
refresh
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 等级描绘
#--------------------------------------------------------------------------
alias kure_jobLv_before_draw_actor_level draw_actor_level
def draw_actor_level(actor, x, y)
kure_jobLv_before_draw_actor_level(actor, x, y)
draw_text(x + 56, y, 12, line_height, "/", 2)
draw_text(x + 68, y, 24, line_height, actor.joblevel, 2)
end
end
复制代码
无标题.png
(59.69 KB, 下载次数: 16)
下载附件
保存到相册
2012-1-23 18:57 上传
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1