赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 557 |
最后登录 | 2012-7-12 |
在线时间 | 59 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 59 小时
- 注册时间
- 2012-4-9
- 帖子
- 24
|
=begin
--------------------------------------------------------------------------------
打坐系统v1.03[修正] By 凌冰
仿文曲星游戏“黄金英雄传说”
基于特技熟练度升级和RTAB版血槽制作
不可缺少以上两个脚本。
设置:
需要打坐的技能勾上“打坐”这个属性
附带功能:
在技能说明里设置
“生命+”aaa和“生命增”bbb
则生命 = 原生命 + aaa + bbb * 技能等级
技力、攻击、防御、魔御、回避、力量、敏捷、速度、魔力的设置与此类似
这个脚本还不够完善,先写成这样吧!
召唤界面
$scene = Scene_Training.new
--------------------------------------------------------------------------------
更新说明
在“在这里设置”下进行相关设置
$BASE[id] = i
则技能id为id的技能打坐中等级无法超过技能id为i的技能
就像“黄金英雄传说”里高阶的武功等级不能超过基本的武功等级
$LEARN_SKILL[id] = [[lv1,i1],[lv2,i2]]
则技能id为id的技能在lv1时习得i2,lv2时习得i2
=end
#---------------------------基本设置-------------------------------------------
$打坐最高等级 = 100 #打坐技能不会超过这个等级,即使控制等级限制的变量〉100
$打坐相关属性 = "魔力" #设置为空则增长率不变
$基本增长率 = 1 #每次增加的数值
$增长频率 = 10 #若设为10则每十分之一秒增加的数值为
#$基本增长率 *( $打坐相关属性 / 100 + 1 )
#PS:对此,我越来越觉得这个脚本诡异了,不好理解,orz
#---------------------------AVG设置(虽然自己也感觉基本没什么用处)------------
$AVG = false
$AVG图片 = "background"
#---------------------------初始化(不要改这里好吗?)-------------------------
$BASE = []
$LEARN_SKILL = []
$LEVEL_LIMIT = []
#---------------------------基础技能设置-----------------------------------------
$BASE[3] = 2
$BASE[4] = 2
$BASE[5] = 2
$BASE[6] = 2
$BASE[7] = 2#编号为3,4,5,6,7的技能等级不能超过编号为2的技能的等级
#---------------------------领悟技能设置---------------------------------------
$LEARN_SKILL[3] = [[100,13]]#3号技能10级时学会12号技能
$LEARN_SKILL[4] = [[100,13]]
$LEARN_SKILL[5] = [[100,13]]
$LEARN_SKILL[6] = [[100,13]]
$LEARN_SKILL[7] = [[100,13]]
$LEARN_SKILL[1] = [[25,12]]
#---------------------------技能等级限制---------------------------------------
$LEVEL_LIMIT[2] = [[1,102]]
$LEVEL_LIMIT[3] = [[1,103]]
$LEVEL_LIMIT[4] = [[1,104]]
$LEVEL_LIMIT[5] = [[1,105]]
$LEVEL_LIMIT[6] = [[1,106]]
$LEVEL_LIMIT[7] = [[1,107]]
$LEVEL_LIMIT[8] = [[1,108]]
$LEVEL_LIMIT[9] = [[1,109]]
$LEVEL_LIMIT[10] = [[1,110]]
$LEVEL_LIMIT[11] = [[1,111]]#角色ID,变量号
#------------------------------------------------------------------------------
#==============================================================================
#绘制打坐条
#==============================================================================
class Window_Base < Window
def draw_actor_skill_exp(actor, skill, x = 0, y = -5,width = 600)
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(0, y+25, 120, 32, "打坐中...")
actor.skill_level[skill.id] = 0 if actor.skill_level[skill.id] == nil
name_level = skill.name + "(Lv" + actor.skill_level[skill.id].to_s + ")"
self.contents.font.color = Color.new(128, 255, 255, 255)
self.contents.draw_text(240, y+25, 204, 32, name_level, 0)
self.contents.font.color = normal_color
count = actor.skill_count[skill.id].to_i
self.contents.draw_text(480, y+25, 48, 32, count.to_s, 2)
self.contents.draw_text(480 + 48, y+25, 12, 32, "/", 1)
self.contents.draw_text(480 + 60, y+25, 48, 32, actor.skill_use[skill.id].to_s)
if actor.skill_use[skill.id] != 0
rate = actor.skill_count[skill.id].to_f / actor.skill_use[skill.id].to_f
else
rate = 0
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 95
height = 15
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(255, 255, 192, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
if actor.skill_use[skill.id] != 0
hp=(width + plus_width)*actor.skill_count[skill.id]*rate_width/100/actor.skill_use[skill.id]
else
hp = 0
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
end
end
#==============================================================================
#绘制打坐条
#==============================================================================
#==============================================================================
#追加定义
#==============================================================================
class Game_Actor
include Skill_updata
attr_accessor :skill_count
alias skill_updata_eci setup
def setup(actor_id)
skill_updata_eci(actor_id)
@skill_count = []
for id in 1...$data_skills.size
@skill_count[id] = 0
end
end
end
module RPG
class Skill
def kind
return 1 if element_set.include?(get_train_id)
return 0
end
def get_train_id
if @train_id == nil
result = nil
for i in 1 ... $data_system.elements.size
if $data_system.elements == "打坐"
result = i
break
end
end
@train_id = result == nil ? 0 : result
end
return @train_id
end
end
end
#==============================================================================
#追加定义
#==============================================================================
#==============================================================================
#等级限制修正
#==============================================================================
class Game_Actor
def make_skill_list(skill_id)
interval = S_INTER[skill_id]
up_interval = ( (interval != nil and interval[@actor_id] != nil) ? interval[@actor_id] : UPDATA_INTERVAL)
slope = S_SLOPE[skill_id]
up_slope = ( (slope != nil and slope[@actor_id] != nil) ? slope[@actor_id] : UPDATA_SLOP )
limit = S_LEVEL[skill_id]
limit_lv = ( (limit != nil and limit[@actor_id] != nil) ? limit[@actor_id] : LEVEL_LIMIT )
limit_lv = $打坐最高等级 if $data_skills[skill_id].kind == 1
list = []
list[0] = 0
for lv in 1...limit_lv+1
exp = 0
case SKILL_PATTERN
when 0
exp = up_interval * lv
when 2
exp = list[lv-1] + up_slope * lv + up_interval
when 1
exp = list[lv-1] + up_interval * lv
end
list[lv] = exp.truncate
end
return list
end
def skill_update_main(actor, skill)
actor.skill_use[skill.id] += 1
limit = S_LEVEL[skill.id]
s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
s_limit = $打坐最高等级 if $data_skills[skill.id].kind == 1
if s_limit == false or actor.skill_level[skill.id] < s_limit
interval = actor.skill_list[skill.id]
if actor.skill_use[skill.id] == interval[actor.skill_level[skill.id]+1]
actor.skill_level[skill.id] += 1
actor.skill_up = true
if SKILL_MIGHT_UP
might = S_MIGHT[skill.id]
might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
actor.skill_power[skill.id] += skill.power * might_rate / 100
actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
end
if SP_COST_DOWN
cost = S_COST[skill.id]
cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
if actor.skill_sp_cost[skill.id] < 0
actor.skill_sp_cost[skill.id] = 0
end
end
if SKILL_HIT_UP
hit = S_HIT[skill.id]
hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
if actor.skill_hit[skill.id] > 100
actor.skill_hit[skill.id] = 100
end
end
for state in skill.plus_state_set
actor.state_holdturn[state] += 1
end
end
end
end
end
class Interpreter
def set_skill_level(actor_id, skill_id, level)
actor = $game_actors[actor_id]
skill = $data_skills[skill_id]
limit = S_LEVEL[skill_id]
s_limit = ( (limit != nil and limit[actor.id] != nil) ? limit[actor.id] : LEVEL_LIMIT)
s_limit = $打坐最高等级 if $data_skills[skill_id].kind == 1
if level > s_limit or level < 0
return
end
actor.skill_level[skill.id] = level
use_list = actor.skill_list[skill.id]
actor.skill_use[skill.id] = use_list[level]
if SKILL_MIGHT_UP
actor.skill_power[skill.id] = skill.power
might = S_MIGHT[skill.id]
might_rate = ((might != nil and might[actor.id] != nil) ? might[actor.id] : MIGHT_RATE)
for i in 0...level
actor.skill_power[skill.id] += skill.power * might_rate / 100
actor.skill_power[skill.id] = actor.skill_power[skill.id].truncate
end
end
if SP_COST_DOWN
actor.skill_sp_cost[skill.id] = skill.sp_cost
cost = S_COST[skill.id]
cost_rate = ((cost != nil and cost[actor.id] != nil) ? cost[actor.id] : COST_RATE)
for i in 0...level
actor.skill_sp_cost[skill.id] -= skill.sp_cost * cost_rate / 100
actor.skill_sp_cost[skill.id] = actor.skill_sp_cost[skill.id].truncate
end
if actor.skill_sp_cost[skill.id] < 0
actor.skill_sp_cost[skill.id] = 0
end
end
if SKILL_HIT_UP
actor.skill_hit[skill.id] = skill.hit
hit = S_HIT[skill.id]
hit_rate = ((hit != nil and hit[actor.id] != nil) ? hit[actor.id] : HIT_RATE)
for i in 0...level
actor.skill_hit[skill.id] += skill.hit * hit_rate / 100
actor.skill_hit[skill.id] = actor.skill_hit[skill.id].truncate
end
if actor.skill_hit[skill.id] > 100
actor.skill_hit[skill.id] = 100
end
end
for state in skill.plus_state_set
actor.state_holdturn[state] += 1
end
end
end
#==============================================================================
#等级限制修正
#==============================================================================
#==============================================================================
#定义增加属性
#==============================================================================
module RPG
class Skill
def mxh_plus
string = $data_system.words.hp+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def mxh_rate
string = $data_system.words.hp+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def mxs_plus
string = $data_system.words.sp+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def mxs_rate
string = $data_system.words.sp+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def atk_plus
string = $data_system.words.atk+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def atk_rate
string = $data_system.words.atk+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def pdef_plus
string = $data_system.words.pdef+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def pdef_rate
string = $data_system.words.pdef+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def mdef_plus
string = $data_system.words.mdef+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def mdef_rate
string = $data_system.words.mdef+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def eva_plus
return 0 if @description.split(/回避+/)[1] == nil
return @description.split(/回避+/)[1].to_i
end
def eva_rate
return 0 if @description.split(/回避增/)[1] == nil
return @description.split(/回避增/)[1].to_i
end
def str_plus
string = $data_system.words.str+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def str_rate
string = $data_system.words.str+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def dex_plus
string = $data_system.words.dex+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def dex_rate
string = $data_system.words.dex+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def agi_plus
string = $data_system.words.agi+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def agi_rate
string = $data_system.words.agi+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def int_plus
string = $data_system.words.int+"+"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
def int_rate
string = $data_system.words.int+"增"
return 0 if @description.split(string)[1] == nil
return @description.split(string)[1].to_i
end
end
end
#==============================================================================
#定义增加属性
#==============================================================================
#==============================================================================
#属性追加
#==============================================================================
class Game_Actor < Game_Battler
alias base_maxhp_train base_maxhp
def base_maxhp
n = base_maxhp_train
for i in skills
skill = $data_skills
n += skill.mxh_plus + skill.mxh_rate * skill_level
end
return n
end
alias base_maxsp_train base_maxsp
def base_maxsp
n = base_maxsp_train
for i in skills
skill = $data_skills
n += skill.mxs_plus + skill.mxs_rate * skill_level
end
return n
end
alias base_atk_train base_atk
def base_atk
n = base_atk_train
for i in skills
skill = $data_skills
n += skill.atk_plus + skill.atk_rate * skill_level
end
return n
end
alias base_pdef_train base_pdef
def base_pdef
n = base_pdef_train
for i in skills
skill = $data_skills
n += skill.pdef_plus + skill.pdef_rate * skill_level
end
return n
end
alias base_mdef_train base_mdef
def base_mdef
n = base_mdef_train
for i in skills
skill = $data_skills
n += skill.mdef_plus + skill.mdef_rate * skill_level
end
return n
end
alias base_eva_train base_eva
def base_eva
n = base_eva_train
for i in skills
skill = $data_skills
n += skill.eva_plus + skill.eva_rate * skill_level
end
return n
end
alias base_str_train base_str
def base_str
n = base_str_train
for i in skills
skill = $data_skills
n += skill.str_plus + skill.str_rate * skill_level
end
return n
end
alias base_dex_train base_dex
def base_dex
n = base_dex_train
for i in skills
skill = $data_skills
n += skill.dex_plus + skill.dex_rate * skill_level
end
return n
end
alias base_agi_train base_agi
def base_agi
n = base_agi_train
for i in skills
skill = $data_skills
n += skill.agi_plus + skill.agi_rate * skill_level
end
return n
end
alias base_int_train base_int
def base_int
n = base_int_train
for i in skills
skill = $data_skills
n += skill.int_plus + skill.int_rate * skill_level
end
return n
end
end
#==============================================================================
#属性追加
#==============================================================================
#==============================================================================
#绘制选择技能窗口
#==============================================================================
class Window_Skill_Eci < Window_Selectable
include Skill_updata
def initialize(actor)
super(336, 0, 640-336, 480)
@actor = actor
refresh
self.index = 0
end
def skill
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in [email protected]
skill = $data_skills[@actor.skills]
if skill != nil
@data.push(skill)
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)
skill = @data[index]
if skill.kind == 1
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.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, 204, 32, skill.name, 0)
@actor.skill_level[skill.id] = 0 if @actor.skill_level[skill.id] == nil
limit = $打坐最高等级
level_limit = $LEVEL_LIMIT[skill.id]
if level_limit != nil
for i in 0...level_limit.size
lv_limit = level_limit
if @actor.id == lv_limit[0]
limit = $game_variables[lv_limit[1]]
limit = $打坐最高等级 if limit > $打坐最高等级
end
end
end
if skill.kind != 1
limit = LEVEL_LIMIT
end
name_level = skill.name + "(Lv" + @actor.skill_level[skill.id].to_s+"/" +limit.to_s+ ")"
#name_level = skill.name + "(Lv" + @actor.skill_level[skill.id].to_s + ")"
self.contents.draw_text(x + 28, y, 204, 32, name_level, 0)
end
end
#==============================================================================
#绘制选择技能窗口
#==============================================================================
#==============================================================================
#绘制打坐窗口
#==============================================================================
class Window_Train < Window_Base
def initialize(actor_id ,skill_id)
@actor_id = actor_id
@skill_id = skill_id
super(0, 0, 640, 80)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 160
end
def update
actor = $game_actors[@actor_id]
skill = $data_skills[@skill_id]
draw_actor_skill_exp(actor, skill)
end
end
#==============================================================================
#绘制打坐窗口
#==============================================================================
#==============================================================================
#描绘打坐场景
#==============================================================================
class Scene_Training
def initialize
@update_train = false
end
def main
if $AVG
@spriteset = Sprite.new#eci
@spriteset.bitmap = Bitmap.new("Graphics/Pictures/"+$AVG图片)#eci
else
@spriteset = Spriteset_Map.new
end
@target_window = Window_Target.new
@target_window.index = 0
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@target_window.dispose
@spriteset.dispose
end
def update
if @update_train
update_train
elsif @target_window.active
update_target
else
update_training
end
end
def update_target
@target_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
#@target_window.dispose
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
@actor = $game_party.actors[@target_window.index]
@skill_window = Window_Skill_Eci.new(@actor)
@skill_window.index = 0
@target_window.active = false
@update_train = true
end
end
def update_train
@skill_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@skill_window.visible = false
@target_window.active = true
@update_train = false
return
end
if Input.trigger?(Input::C)
@actor_id = @actor.id
@skill_id = @skill_window.skill.id
unless $data_skills[@skill_id].kind == 1
$game_system.se_play($data_system.buzzer_se)
return
end
@skill_window.visible = false
@target_window.visible = false
@window = Window_Train.new(@actor_id, @skill_id)
@update_train = false
@skill_window.dispose
end
end
def update_training
@actor_id = @actor.id
@skill_id = @skill_window.skill.id
base_id = $BASE[@skill_id]
limit = $打坐最高等级
level_limit = $LEVEL_LIMIT[@skill_id]
if level_limit != nil
for i in 0...level_limit.size
lv_limit = level_limit
if @actor_id == lv_limit[0]
limit = $game_variables[lv_limit[1]]
limit = $打坐最高等级 if limit > $打坐最高等级
end
end
#==============================================================================
#某个非最优算法的遗迹
#==============================================================================
=begin
if level_limit[1] != nil
for i in 1...level_limit.size
lv_limit = level_limit
if value < lv_limit[0]
limit = lv_limit[1]
break
end
end
end
=end
#==============================================================================
#某个非最优算法的遗迹
#==============================================================================
end
if (base_id != nil and @actor.skill_level[@skill_id] < @actor.skill_level[base_id]) or base_id == nil
rate = Graphics.frame_rate/$增长频率
if (Graphics.frame_count%rate.to_i) == 0 and @actor.skill_level[@skill_id] < limit
case $打坐相关属性
when "力量"
a = @actor.str/100+1
when "敏捷"
a = @actor.dex/100+1
when "速度"
a = @actor.agi/100+1
when "魔力"
a = @actor.int/100+1
else
a = 1
end
@actor.skill_count[@skill_id] += $基本增长率*a
end
end
if @actor.skill_count[@skill_id] >= @actor.skill_use[@skill_id]
@actor.skill_count[@skill_id] = 0
@actor.skill_update_main(@actor, @skill_window.skill)
learn_sk = $LEARN_SKILL[@skill_id]
if learn_sk != nil
for i in 0...learn_sk.size
le_sk = learn_sk
if @actor.skill_level[@skill_id] >= le_sk[0]
@actor.learn_skill(le_sk[1])
end
end
end
end
@window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
@window.dispose
end
end
end
#==============================================================================
#描绘打坐场景
#==============================================================================
#==============================================================================
#无效化打坐技能的默认升级方式
#==============================================================================
class Game_Battler
def get_train_id
if @train_id == nil
result = nil
for i in 1 ... $data_system.elements.size
if $data_system.elements == "打坐"
result = i
break
end
end
@train_id = result == nil ? 0 : result
end
return @train_id
end
alias skill_update_main_train skill_update_main
def skill_update_main(actor, skill)
if !skill.element_set.include?(get_train_id)
skill_update_main_train(actor, skill)
end
end
alias skill_use_recount_train skill_use_recount
def skill_use_recount(actor, skill)
if !skill.element_set.include?(get_train_id)
skill_use_recount_train(actor, skill)
end
end
end
#==============================================================================
#无效化打坐技能的默认升级方式
#==============================================================================
=begin
#==============================================================================
#貌似这个是等级限制修正的更优算法!
#==============================================================================
module Skill_updata
def get_train_id
if @train_id == nil
result = nil
for i in 1 ... $data_system.elements.size
if $data_system.elements == "打坐"
result = i
break
end
end
@train_id = result == nil ? 0 : result
end
return @train_id
end
def skill_lv
for i in 1...$data_skills.size
skill = $data_skills
if skill.element_set.include?(get_train_id)
S_LEVEL = []
for j in 1...$data_actors.size
S_LEVEL.push(j=>$打坐最高等级)
end
end
end
end
end
class Scene_Title
include Skill_updata
alias train_main main
def main
train_main
skill_lv
end
end
=end
|
|