赞 | 0 |
VIP | 6 |
好人卡 | 0 |
积分 | 1 |
经验 | 3330 |
最后登录 | 2018-8-10 |
在线时间 | 203 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 203 小时
- 注册时间
- 2009-8-5
- 帖子
- 282
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
脚本如下:
#==============================================================================
# ■ 新约圣剑传说(Sword of mana)的升级系统。
#------------------------------------------------------------------------------
#自定义部分
#这脚本设计了很多方面的修改,虽说单独都不复杂,可是结合起来却有些难看懂了~
#所以说,并不适合小鸟们拿来学习哦@v@也就没刻意做人性化的处理.(其实是因为自己的算法很不行)
#召唤界面:$scene = Scene_Som.new(队伍中人物的位置,从0开始算起)
#和Window_Status的继承方法一样。
#给GA一股脑的添加了好多的变量...分歧也许变得容易些了。
#把下面的 UP = false就没有升级奖励的功能了。
#Plus:默认的windowskin真叫难看呀呀呀呀呀呀呀------------------>_<
#==============================================================================
module EclairSOM
#代号 #HP #SP #STR #DEX #AGI #INT #EVA #路线名 #增加总和(计算平衡用~)
L1 =[ 6 , 1 , 5 , 2 , 2 , 1 , 0 , "战士型"]#17
L2 =[ 5 , 2 , 3 , 3 , 2 , 2 , 0 , "骑士型"]#17
L3 =[ 3 , 5 , 1 , 2 , 1 , 5 , 0 , "法师型"]#17
L4 =[ 4 , 6 , 1 , 1 , 2 , 3 , 0 , "牧师型"]#17
L5 =[ 2 , 4 , 2 , 1 , 2 , 6 , 0 , "巫师型"]#17
L6 =[ 4 , 2 , 2 , 4 , 4 , 1 , 0 , "盗贼型"]#17
UP = true #是否使用升级奖励的功能
HELP = ["修炼肉搏能力,向战士型发展。",
"均衡提升战斗力,向骑士型发展。",
"修炼魔法能力,向法师型发展",
"以牧师为目标努力奋斗",
"大幅提升魔法攻击力,向巫师型发展",
"修炼敏捷身手,向盗贼型发展",
"随机提升能力"]
ALL = [L1,L2,L3,L4,L5,L6,"RANDOM"]#最后一个为“随机增加”判断的变量。
RANDOM = 20 #随机增加能力点数的总和
def level_up
#==============================================================================
#升级奖励部分的自定义
#@plus数组记录的是角色在每种类型上面修炼的次数。
#@plus[0]为“战士型”,@plus[1]为“骑士型”,以此类推。
#@get_up数组记录角色已经获得的称号,用来避免称号反复获得,if的时候记得用!做反向分歧这次获得的称号哦
#@rode,角色升级路线,这个是方便控制角色升级朝向的~~
#@ext是在这次进行奖励的时候要显示的内容,用"\n"来做分行。
#
#@maxhp_plus 角色HP增加量
#@maxsp_plus 角色SP增加量
#@str_plus 角色力量增加量
#@dex_plus 角色速度增加量
#@agi_plus 角色敏捷增加量
#@int_plus 角色智力增加量
#@eva_plus 角色闪避增加量(默认是没有的~~)
#==============================================================================
if @plus[0] == 5 and !@get_up.include?("新手战士") and @road = "没有"
@call = "新手战士"
@get_up.push(@call)
@road = "战士"
@maxhp_plus += 20
@str_plus += 10
@ext = "#{$data_system.words.hp} + 20\n#{$data_system.words.str} + 10"
end
if @plus[0] == 10 and !@get_up.include?("初级战士") and @road = "战士"
@call = "初级战士"
@get_up.push(@call)
@maxhp_plus += 25
@str_plus += 15
@ext = "#{$data_system.words.hp} + 25\n#{$data_system.words.str} + 15"
end
if @plus[1] == 5 and !@get_up.include?("见习骑士") and @road = "没有"
@call = "见习骑士"
@get_up.push(@call)
@road = "骑士"
@str_plus += 8
@dex_plus += 5
@agi_plus += 5
@ext = "#{$data_system.words.str} + 20\n#{$data_system.words.dex} + 5\n#{$data_system.words.agi} + 5"
end
if @plus[2] == 5 and !@get_up.include?("菜鸟法师") and @road = "没有"
@call = "菜鸟法师"
@get_up.push(@call)
@road = "法师"
@maxsp_plus += 15
@int_plus += 10
@ext = "#{$data_system.words.sp} + 15\n#{$data_system.words.int} + 10"
end
if @plus[3] == 5 and !@get_up.include?("见习修士") and @road = "没有"
@call = "见习修士"
@get_up.push(@call)
@road = "牧师"
@maxsp_plus += 25
@int_plus += 5
@ext = "#{$data_system.words.sp} + 25\n#{$data_system.words.int} + 5"
end
if @plus[4] == 5 and !@get_up.include?("见习巫师") and @road = "没有"
@call = "见习巫师"
@get_up.push(@call)
@road = "巫师"
@maxsp_plus += 10
@int_plus += 25
@ext = "#{$data_system.words.sp} + 10\n#{$data_system.words.int} + 25"
end
if @plus[5] == 5 and !@get_up.include?("小偷") and @road = "没有"
@call = "小偷"
@get_up.push(@call)
@road = "盗贼"
@maxhp_plus += 5
@dex_plus += 15
@agi_plus += 15
@ext = "#{$data_system.words.hp} + 5\n#{$data_system.words.dex} + 15\n#{$data_system.words.agi} + 15"
end
end
end
#==============================================================================
# ■ 自定义部分结束
#==============================================================================
class Scene_Som
#初始化
def initialize(actor_index = 0)
@actor_index = actor_index
end
#主处理
def main
@actor = $game_party.actors[@actor_index]
@main_window = Window_SomCommand.new(@actor_index)
@main_window.active = false if @actor.level_re == 0
@info_window = Window_Sominfo.new(@actor_index)
@info_window.add = EclairSOM::ALL[0]
@info_window.refresh
@help_window = Window_SomHelp.new
@help_window.set_text(EclairSOM::HELP[0])
@help_window.set_text("升级已经全部完成了") if @actor.level_re == 0
@up_window = Window_up.new(@actor_index)
@map = Spriteset_Map.new
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
@main_window.dispose
@info_window.dispose
@help_window.dispose
@up_window.dispose
@map.dispose
end
#刷新部分
def update
if @up_window.visible
update_up
return
end
@main_window.update
@info_window.update
@help_window.update
@up_window.update
@main_window.active = false if @actor.level_re == 0
@help_window.set_text("升级已经全部完成了") if @actor.level_re == 0
if (Input.repeat?(Input::UP) or Input.repeat?(Input::DOWN)) and @actor.level_re != 0
@info_window.add = EclairSOM::ALL[@main_window.index]
@info_window.refresh
@help_window.set_text(EclairSOM::HELP[@main_window.index])
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C) and @actor.level_re != 0 and @info_window.add != "RANDOM"
$game_system.se_play($data_system.decision_se)
@actor.maxhp += EclairSOM::ALL[@main_window.index][0]
@actor.maxsp += EclairSOM::ALL[@main_window.index][1]
@actor.str += EclairSOM::ALL[@main_window.index][2]
@actor.dex += EclairSOM::ALL[@main_window.index][3]
@actor.agi += EclairSOM::ALL[@main_window.index][4]
@actor.int += EclairSOM::ALL[@main_window.index][5]
@actor.eva += EclairSOM::ALL[@main_window.index][6]
@actor.level_re -= 1
@actor.plus[@main_window.index] += 1
@actor.up
@up_window.refresh
@info_window.refresh
@main_window.refresh
return
end
if Input.trigger?(Input::C) and @info_window.add == "RANDOM" and @actor.level_re != 0
$game_system.se_play($data_system.decision_se)
@point = EclairSOM::RANDOM
@actor.level_re -= 1
loop do
case rand(6)
when 0
@actor.maxhp += 1
when 1
@actor.maxsp += 1
when 2
@actor.str += 1
when 3
@actor.dex += 1
when 4
@actor.agi += 1
when 5
@actor.int += 1
end
@point -= 1
break if @point == 0
end
@actor.plus[@main_window.index] += 1
@actor.up
@up_window.refresh
@info_window.refresh
@main_window.refresh
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index %= $game_party.actors.size
$scene = Scene_Som.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Som.new(@actor_index)
return
end
end
def update_up
if Input.trigger?(Input::B) or Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@up_window.visible = false
return
end
end
end
#==============================================================================
# ■ Window_SomCommand
#------------------------------------------------------------------------------
# 命令选择行窗口。
#==============================================================================
class Window_SomCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# width : 窗口的宽
# commands : 命令字符串序列
#--------------------------------------------------------------------------
def initialize(actor = 0)
@actor = $game_party.actors[actor]
# 由命令的个数计算出窗口的高
super(20, 120,280,320)
@item_max = 7
@commands = [EclairSOM::L1[7],EclairSOM::L2[7],EclairSOM::L3[7],EclairSOM::L4[7],EclairSOM::L5[7],EclairSOM::L6[7],"随机型"]
self.contents = Bitmap.new(280 - 32, 320 - 32)
self.back_opacity = 160
self.index = 0
self.index = -1 if @actor.level_re == 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.index = -1 if @actor.level_re == 0
self.contents.clear
#描绘战斗图
pic = RPG::Cache.battler(@actor.battler_name,@actor.battler_hue)
self.contents.blt(0,20,pic,Rect.new(0,0,pic.width,pic.height))
#描绘已完成的升级
for i in 0...7
self.contents.draw_text(215,32 * i + 12,22,32,@actor.plus[i].to_s,1)
end
#描绘等级符号
self.contents.draw_text(20,192,22,32,"Lv")
self.contents.draw_text(20,242,22,32,"Lv")
self.contents.draw_text(48,217,22,32,"↓")
#描绘等级
self.contents.draw_text(80,192,22,32,(@actor.level).to_s,2)
if @actor.level_re == 0
self.contents.draw_text(80,242,22,32,(@actor.level).to_s,2)
else
self.contents.draw_text(80,242,22,32,(@actor.level + 1).to_s,2)
end
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(130, 32 * index + 12, self.contents.text_size(@commands[index]).width + 4, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# ● 项目无效化
# index : 项目编号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @index < 0
self.cursor_rect.empty
return
end
# 计算光标的宽
cursor_width = self.contents.text_size(@commands[index]).width + 4
# 计算光标坐标
x = 130 - 2
y = @index / @column_max * 32 - self.oy + 12
# 更新国标矩形
self.cursor_rect.set(x, y, cursor_width, 32)
end
end
#==============================================================================
# ■ Window_up
#------------------------------------------------------------------------------
# 获得奖励提示的窗口。
#==============================================================================
class Window_up < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor = $game_party.actors[actor_index]
super(145,90, 350, 300)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 210
self.z = 9999
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
return if @actor.ext == ""
self.contents.draw_text(20,15,99,32,"获得称号:")
self.contents.font.color = Color.new(255,255,0,255)
self.contents.draw_text(119,15,self.contents.width - 8,32,@actor.call)
self.contents.font.color = normal_color
draw_ext
self.visible = true
end
def draw_ext
x = 20
y = 40
while ((c = @actor.ext.slice!(/./m)) != nil)
if c == "\n"
y += 32
x = 20
next
end
if x >= 350 - 32 - 16
y += 32
x = 20
end
self.contents.draw_text(x,y,self.contents.text_size(c).width,32,c)
x += self.contents.text_size(c).width
end
end
end
#==============================================================================
# ■ Window_Sominfo
#------------------------------------------------------------------------------
# 显示能力变化的窗口。
#==============================================================================
class Window_Sominfo < Window_Base
attr_accessor :add
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(actor = 0)
super(330,120, 280,300)
@actor = $game_party.actors[actor]
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(24,12,66,32,$data_system.words.hp)
self.contents.draw_text(24,47,66,32,$data_system.words.sp)
self.contents.draw_text(24,82,132,32,$data_system.words.str)
self.contents.draw_text(24,117,132,32,$data_system.words.dex)
self.contents.draw_text(24,152,132,32,$data_system.words.agi)
self.contents.draw_text(24,187,132,32,$data_system.words.int)
self.contents.draw_text(24,222,132,32,"回避")
self.contents.draw_text(79,12,44,32,@actor.maxhp.to_s,1)
self.contents.draw_text(79,47,44,32,@actor.maxsp.to_s,1)
self.contents.draw_text(79,82,44,32,@actor.str.to_s,1)
self.contents.draw_text(79,117,44,32,@actor.dex.to_s,1)
self.contents.draw_text(79,152,44,32,@actor.agi.to_s,1)
self.contents.draw_text(79,187,44,32,@actor.int.to_s,1)
self.contents.draw_text(79,222,44,32,@actor.eva.to_s,1)
return if @actor.level_re == 0
if add != nil and add != "RANDOM"
self.contents.draw_text(140,12,22,32,"→")
self.contents.draw_text(140,47,22,32,"→")
self.contents.draw_text(140,82,22,32,"→")
self.contents.draw_text(140,117,22,32,"→")
self.contents.draw_text(140,152,22,32,"→")
self.contents.draw_text(140,187,22,32,"→")
self.contents.draw_text(140,222,22,32,"→")
self.contents.draw_text(181,12,44,32, (@actor.maxhp+ add[0]).to_s,1)
self.contents.draw_text(181,47,44,32, (@actor.maxsp+ add[1]).to_s,1)
self.contents.draw_text(181,82,44,32, (@actor.str + add[2]).to_s,1)
self.contents.draw_text(181,117,44,32,(@actor.dex + add[2]).to_s,1)
self.contents.draw_text(181,152,44,32,(@actor.agi + add[4]).to_s,1)
self.contents.draw_text(181,187,44,32,(@actor.int + add[5]).to_s,1)
self.contents.draw_text(181,222,44,32,(@actor.eva + add[6]).to_s,1)
end
if add == "RANDOM"
self.contents.draw_text(140,12,22,32,"→")
self.contents.draw_text(140,47,22,32,"→")
self.contents.draw_text(140,82,22,32,"→")
self.contents.draw_text(140,117,22,32,"→")
self.contents.draw_text(140,152,22,32,"→")
self.contents.draw_text(140,187,22,32,"→")
self.contents.draw_text(140,222,22,32,"→")
self.contents.draw_text(181,12,44,32,"??",1)
self.contents.draw_text(181,47,44,32,"??".to_s,1)
self.contents.draw_text(181,82,44,32,"??",1)
self.contents.draw_text(181,117,44,32,"??",1)
self.contents.draw_text(181,152,44,32,"??",1)
self.contents.draw_text(181,187,44,32,"??",1)
self.contents.draw_text(181,222,44,32,"??",1)
end
end
end
#==============================================================================
# ■ Window_SomHelp
#------------------------------------------------------------------------------
# 新的帮助窗口。
#==============================================================================
class Window_SomHelp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(20, 30, 590, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
# align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
#--------------------------------------------------------------------------
def set_text(text)
# 如果文本与上次的不同
if text != @text
# 再描绘文本
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32,text)
@text = text
end
self.visible = true
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
include EclairSOM
#--------------------------------------------------------------------------
# 内容
#--------------------------------------------------------------------------
attr_reader :level # 实际的等级
attr_accessor :level_re # 储存的等级
attr_accessor :plus # 角色做过的升级处理
attr_accessor :get_up # 已经得到的奖励
attr_accessor :call # 目前的称号(默认菜单里面没有)
attr_accessor :road # 修炼的路线
attr_accessor :ext # 获得奖励的文字
#算法: 实际等级 - 储存等级 = 完成等级
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
@actor_id = actor_id
@name = actor.name
@character_name = actor.character_name
@character_hue = actor.character_hue
@battler_name = actor.battler_name
@battler_hue = actor.battler_hue
@class_id = actor.class_id
@weapon_id = actor.weapon_id
@armor1_id = actor.armor1_id
@armor2_id = actor.armor2_id
@armor3_id = actor.armor3_id
@armor4_id = actor.armor4_id
@level = actor.initial_level
#--------------------------------------------------------------------------
# 内容
#--------------------------------------------------------------------------
@level_re = actor.initial_level - 1#算法:储存等级 = 实际等级 - 1
@plus = [0,0,0,0,0,0,0]
@get_up = []
@call = "初学者"
@road = "没有"
@ext = ""
#--------------------------------------------------------------------------
# 内容
#--------------------------------------------------------------------------
@exp_list = Array.new(101)
make_exp_list
@exp = @exp_list[@level]
@skills = []
@hp = maxhp
@sp = maxsp
@states = []
@states_turn = {}
@maxhp_plus = 0
@maxsp_plus = 0
@str_plus = 0
@dex_plus = 0
@agi_plus = 0
@int_plus = 0
# 学会特技
for i in 1..@level
for j in $data_classes[@class_id].learnings
if j.level == i
learn_skill(j.skill_id)
end
end
end
# 刷新自动状态
update_auto_state(nil, $data_armors[@armor1_id])
update_auto_state(nil, $data_armors[@armor2_id])
update_auto_state(nil, $data_armors[@armor3_id])
update_auto_state(nil, $data_armors[@armor4_id])
end
#--------------------------------------------------------------------------
# ● 计算 EXP
#--------------------------------------------------------------------------
def make_exp_list
actor = $data_actors[@actor_id]
@exp_list[1] = 0
pow_i = 2.4 + actor.exp_inflation / 100.0
for i in 2..100
if i > actor.final_level
@exp_list[i] = 0
else
n = actor.exp_basis * ((i + 3) ** pow_i) / (5 ** pow_i)
@exp_list[i] = @exp_list[i-1] + Integer(n)
end
end
end
#--------------------------------------------------------------------------
# ● 更改 EXP
# exp : 新的 EXP
#--------------------------------------------------------------------------
def exp=(exp)
@exp = [[exp, 9999999].min, 0].max
# 升级
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
@level += 1
@level_re += 1#储存等级 + 1 #eclair
# 学会特技
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
@level_re = [@level_re - 1,0].max#储存等级 - 1 #eclair
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#######################################eclair
#外部读取水平
def level
return @level - @level_re
end
#--------------------------------------------------------------------------
# ● 设置回避
# eva : 新的回避
#--------------------------------------------------------------------------
def eva=(eva)
@eva_plus += eva - self.eva
@eva_plus = [@eva_plus,100].min
end
#--------------------------------------------------------------------------
# ● 获取回避修正
#--------------------------------------------------------------------------
def eva
n = [[base_eva + @eva_plus,0].max,100].min
for i in @states
n += $data_states[i].eva
end
n = [[Integer(n), 0].max,100].min
return n
end
##########################################eclair
#升级奖励判断
def up
return if EclairSOM::UP == false
level_up
end
end
#==============================================================================
# ■ Game_Battler (分割定义 1)
#------------------------------------------------------------------------------
# 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
# 超级类来使用。
#==============================================================================
class Game_Battler
alias initialize_som initialize
def initialize
initialize_som
@eva_plus = 0
end
end
召唤界面代码:$scene = Scene_Som.new |
|