Project1
标题:
一个关于脚本的问题
[打印本页]
作者:
han462160636
时间:
2013-8-21 19:27
标题:
一个关于脚本的问题
=begin
#==============================================================================
# ■ 天赋加点系统
#------------------------------------------------------------------------------
# By 轮回者
#==============================================================================
#==============================================================================
#一些介绍:
#==============================================================================
转职后天赋加点还原
降级减退点,没点减最后加的那个天赋
加天赋的时候有限制:除了某些天赋单独的限制以外,你在这一类加的天赋的总点数必
须不小于(所选天赋的行数 * 5 - 5)
Part1是数据库,即需要使用者设定的部分,分3小块。
Part2是处理部分,全部新建。
Part3是所有修改原定义的处理部分,可搜索“=修改=”。
想扩充天赋效果种类的请搜索"扩充",可找到一个需要注意的地方。
调用方法:$scene = Scene_Genius.new
想设定天赋效果的请搜索"天赋效果000"
差不多就这些。
================================================================================
#一些废话:
#==============================================================================
虽然这个脚本略做修改可以做技能树,但带有的数据库应用的范围不是很大,因为想做魔
兽那类游戏的人大概不多,所以天赋的效果都没设,也因此,关于天赋效果的问题尚不清
楚,只对各项功能做了些测试,有些BUG已经修正。
数据库是直接从新浪的一个老版的天赋模拟器上弄下来的,转成了RGSS可用的格式,有些
没用的东西没删,嗯,由于某些原因……
感觉上这个脚本还有很大扩充余地,不过最近脑袋比较木,扩充就麻烦各位自己动手了。
想改脚本的可以看"Scripts_拆分版",嗯,舒服一点。
脚本17号就做完了,不过测试今天才做,感觉没有太大问题,所以就发了。
有错误的话请联系我(最好是PM),谢了!
轮回者
2006.9.19
================================================================================
=end
#====================================Part1======================================
=begin
技能介绍、要求的数据库
增加方法:
$talents[职业ID][天赋ID] = ["名称",类型ID, "类型", 纵列, 横行, "图标",Coords(不知道是干什么的-_-b)
详细资料, 介绍, 信息(按级别不同), 需求]
可对照Main下面的'RGSS化数据库'。
注意!!
不同职业不可有相同的天赋ID!!
"名称"中'@'以后的部分会自动屏蔽!
纵列, 横行不是具体坐标值!
'介绍'中只可插入一个'@',脚本会将'@'替换为本级天赋的'信息'!
图标在本脚本中未应用,若需使用,图标在"Graphics\WOW\"中。
=end
$talents = [nil,[],[],[],[],[],[],[],[],[]]
$talents[1][1] = [ "九阴真经[第一层]", 1, "九阴真经", 1, 1, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第一层,需消耗1修为点,习得可增长50气血50内力.",[], []]
$talents[1][2] = [ "九阴真经[第二层]", 1, "九阴真经", 1, 2, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第二层,需消耗2修为点,习得可增长60气血60内力.",[], []]
$talents[1][3] = [ "九阴真经[第三层]", 1, "九阴真经", 2, 3, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第三层,需消耗3修为点,习得可增长70气血70内力.",[], []]
$talents[1][4] = [ "九阴真经[第四层]", 1, "九阴真经", 3, 3, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第四层,需消耗1修为点,习得可增长80气血80内力.",[], []]
$talents[1][5] = [ "九阴真经[第五层]", 1, "九阴真经", 4, 3, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第五层,需消耗1修为点,习得可增长100气血100内力.",[], []]
$talents[1][6] = [ "九阴真经[第六层]", 1, "九阴真经", 4, 2, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第六层,需消耗1修为点,习得可增长150气血150内力.",[], []]
$talents[1][7] = [ "九阴真经[第七层]", 1, "九阴真经", 6, 2, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第七层,需消耗2修为点,习得可增长200气血200内力,并且会习得九阴白骨爪.",[], []]
$talents[1][8] = [ "九阴真经[第八层]", 1, "九阴真经", 6, 4, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第八层,需消耗1修为点,习得可增长300气血300内力.",[], []]
$talents[1][9] = [ "九阴真经[第九层]", 1, "九阴真经", 7, 3, "Ability_GhoulFrenzy_sm.png", nil, nil, "九阴真经第九层,需消耗3修为点,习得可增长500气血500内力.",[], []]
#$talents[职业ID][天赋ID][9][天赋等级] = [耗费技能点, "描述", nil, ""]
$talents[1][1][9][0] = [1, "", nil, ""]
$talents[1][2][9][0] = [1, "", nil, ""]
$talents[1][2][9][1] = [2, "", nil, ""]
$talents[1][3][9][0] = [1, "", nil, ""]
$talents[1][3][9][1] = [2, "", nil, ""]
$talents[1][3][9][2] = [3, "", nil, ""]
$talents[1][4][9][0] = [1, "", nil, ""]
$talents[1][4][9][1] = [2, "", nil, ""]
$talents[1][4][9][2] = [3, "", nil, ""]
$talents[1][5][9][0] = [1, "", nil, ""]
$talents[1][5][9][1] = [2, "", nil, ""]
$talents[1][5][9][2] = [3, "", nil, ""]
$talents[1][6][9][0] = [1, "", nil, ""]
$talents[1][6][9][1] = [2, "", nil, ""]
$talents[1][6][9][2] = [3, "", nil, ""]
$talents[1][7][9][0] = [1, "", nil, ""]
$talents[1][7][9][1] = [2, "", nil, ""]
$talents[1][7][9][2] = [3, "", nil, ""]
$talents[1][8][9][0] = [1, "", nil, ""]
$talents[1][8][9][1] = [2, "", nil, ""]
$talents[1][8][9][2] = [3, "", nil, ""]
$talents[1][9][9][0] = [1, "", nil, ""]
#天赋等级与效果和技能点的耗费$talents[职业ID][9][天赋等级] = [耗费技能点, "效果", nil, ""]
$talents[1][7][9][0] = [1, "", nil, ""]
$talents[1][7][9][1] = [2, "", nil, ""]
$talents[1][8][9][0] = [1, "", nil, ""]
$talents[1][8][9][0] = [1, "", nil, ""]
$talents[1][9][9][0] = [1, "", nil, ""]
$talents[1][9][9][0] = [1, "", nil, ""]
$talents[1][9][9][1] = [2, "", nil, ""]
#天赋等级与效果和技能点的耗费$talents[天赋ID][9][天赋等级] = [耗费技能点, "效果", nil, ""]
#天赋等级与效果和技能点的耗费$talents[职业ID][9][天赋等级] = [耗费技能点, "效果", nil, ""]
#$talents[职业ID][天赋ID][9][天赋等级] = [耗费技能点, "描述", nil, ""]
#save_data($talents, "Talents.rxdata")
#===============================================================================
=begin
天赋效果000
格式:
作用于人物:
$talents_2[天赋的ID] = [0]
$talents_2[天赋的ID][天赋等级] = [MAXHP百分比,MAXSP百分比,力量百分比,灵巧百分比,速度百分比,魔力百分比,物防百分比,魔方百分比,回避百分比,攻击力百分比, 命中率百分比,
MAXHP增加值,MAXSP增加值,力量增加值,灵巧增加值,速度增加值,魔力增加值,物防增加值,魔方增加值,回避增加值, 攻击力增加值, 命中率增加值]
或:
$talents_2[天赋的ID] = [0]
$talents_2[天赋的ID][天赋等级] = []
$talents_2[天赋的ID][天赋等级][效果序号] = 你要的效果
序号:
0:MAXHP百分比
1:MAXSP百分比
2:力量百分比
3:灵巧百分比
4:速度百分比
5:魔力百分比
6:物防百分比
7:魔防百分比
8:回避百分比
9:攻击力百分比
10:命中率百分比
11:MAXHP增加值
12:MAXSP增加值
13:力量增加值
14:灵巧增加值
15:速度增加值
16:魔力增加值
17:物防增加值
18:魔防增加值
19:回避增加值
20:攻击力增加值
21:命中率增加值
如:
41号技能作用于自身
$talents_2[41] = [0]
41号等级为1时
格式
$talents_2[41][1] = []
自身MAXHP * 1.2
$talents_2[41][1][0] = 120
自身MAXSP * 1.4
$talents_2[41][1][1] = 140
自身命中率 + 5%
$talents_2[41][1][21] = 5
41号等级为1时
格式
$talents_2[41][2] = []
自身MAXHP * 1.4
$talents_2[41][2][0] = 140
自身MAXSP * 1.6
$talents_2[41][2][1] = 160
自身命中率 + 10%
$talents_2[41][2][21] = 10
-------------------------------------------------------------
作用于技能
$talents_2[天赋的ID] = [1]
$talents_2[天赋的ID][天赋等级] = [学会的技能ID,作用的技能ID,消费SP百分比,威力百分比,命中率百分比,消费SP减少值,威力增加值,命中率增加值]
或
$talents_2[天赋的ID] = [1]
$talents_2[天赋的ID][天赋等级] = []
$talents_2[天赋的ID][天赋等级][效果序号] = 你要的效果
序号:
0:学会的技能ID
1:作用的技能ID #注意:这一项统领下面6项!不可缺少!!!!!
2:消费SP百分比
3:威力百分比
4:命中率百分比
5:消费SP减少值
6:威力增加值
7:命中率增加值
不需要的项设为nil,也可不设
请按需要自行追加
=end
#-------------不可删--------------
$talents_2 = []
for i in 0..999
$talents_2[i] = [nil]
end
#---------------------------------
#-------------测试档--------------
$talents_2[373] = [1]
$talents_2[373][1] = []
$talents_2[373][1][0] = 4
$talents_2[373][2] = []
$talents_2[373][2][1] = 4
for i in 2..4
$talents_2[373][2][i] = 200
end
$talents_2[373][3] = []
$talents_2[373][3][1] = 4
for i in 2..4
$talents_2[373][3][i + 3] = 200
end
#---------------------------------
#===============================================================================
#天赋窗口的底图,将直接对应到'Graphics\WOW2'下
#注意!职业不可变,暂不支持变更职业!
#格式:$backgenius[] = ["","",""]
$backgenius = {}
#德鲁伊
$backgenius[1] = ["jiuyinzhenjing","talent_druidferalcombat_r1","talent_druidrestoration_r1"]
#猎人
$backgenius[2] = ["talent_hunterbeastmastery_r1","talent_huntermarksmanship_r1","talent_huntersurvival_r1"]
#法师
$backgenius[3] = ["talent_magearcane_r1","talent_magefrost_r1","talent_magefire_r1"]
#圣骑士
$backgenius[4] = ["talent_paladinholy_r1","talent_paladinprotection_r1","talent_paladinretribution_r1"]
#牧师
$backgenius[5] = ["talent_priestdiscipline_r1","talent_priestholy_r1","talent_priestshadow_r1"]
#盗贼
$backgenius[6] = ["talent_rogueassassination_r1","talent_roguecombat_r1","talent_roguesubtlety_r1"]
#萨满
$backgenius[7] = ["talent_shamanelementalcombat_r1","talent_shamanenhancement_r1","talent_shamanrestoration_r1"]
#术士
$backgenius[8] = ["talent_warlockaffliction_r1","talent_warlockdemonology_r1","talent_warlockdestruction_r1"]
#战士
$backgenius[9] = ["talent_warriorarms_r1", "talent_warriorfury_r1", "talent_warriorprotection_r1"]
#====================================Part2======================================
#==============================================================================
# ■ Genius_Restart
#------------------------------------------------------------------------------
# 洗点
#==============================================================================
class Genius_Restart
def initialize(actor_a)
actor_b = []
if actor_a == "all"
for actor in $game_party.actors
actor_b.push(actor)
end
else
actor_b.push(actor_a)
end
for actor in actor_b
$Genius_rs_x[actor.id] += 1
$Genius_Point[actor.id][0] = $Genius_Point[actor.id][1]
$Genius_Point_note_1[actor.id] = {}
$Genius_Point_note_2[actor.id] = {}
$talents_3[actor.id] = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
$talents_4[actor.id] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
$talents_5[actor.id] = []
$talents_6[actor.id] = []
for i_X in 1..$data_skills.size - 1
$talents_5[actor.id][i_X] = [100,100,100]
$talents_6[actor.id][i_X] = [0,0,0]
end
$Genius_Point_note_3[actor.id] = [0,0,0]
end
end
end
#==============================================================================
# ■ Game_Genius
#------------------------------------------------------------------------------
# 天赋加点 效果处理
#==============================================================================
#Game_Genius.new(actor)
class Game_Genius
#attr_accessor :g
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize(actor)
#防错
if actor != nil
#初始化技能效果
$talents_3[actor.id] = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
$talents_4[actor.id] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
$talents_5[actor.id] = []
$talents_6[actor.id] = []
for i_X in 1..$data_skills.size - 1
$talents_5[actor.id][i_X] = [100,100,100]
$talents_6[actor.id][i_X] = [0,0,0]
end
if $Genius_Point_note_1[actor.id] != nil
for g in $Genius_Point_note_1[actor.id]
#获取天赋等级
if g[1] >0
#获取天赋ID
i_a = $talents[actor.class_id].index(g[0])
#获取天赋效果
i = $talents_2[i_a]
case i[0]
when 0
#扩充天赋效果请注意"a"
if i[g[1]] != nil
for a in 0..10
if i[g[1]][a] != nil
if $talents_3[actor.id][a] == nil
$talents_3[actor.id][a] = 100
end
$talents_3[actor.id][a] *= i[g[1]][a]
$talents_3[actor.id][a] /= 100
end
if i[g[1]][a + 11] != nil
if $talents_4[actor.id][a] == nil
$talents_4[actor.id][a] = 0
end
$talents_4[actor.id][a] += i[g[1]][a + 11]
end
end
end
when 1
#学会技能判断
if i[g[1]][0] != nil
skill_id = i[g[1]][0]
if !actor.skill_learn?(skill_id)
actor.learn_skill(skill_id)
end
end
skill_id_2 = i[g[1]][1]
#扩充天赋效果请注意"a"
if skill_id_2 != nil
for a in 0..2
if i[g[1]][a + 2] != nil
if $talents_5[actor.id][skill_id_2][a] == nil
$talents_5[actor.id][skill_id_2][a] = 100
end
$talents_5[actor.id][skill_id_2][a] *= i[g[1]][a + 2]
$talents_5[actor.id][skill_id_2][a] /= 100
end
if i[g[1]][a + 5] != nil
if $talents_6[actor.id][skill_id_2][a] == nil
$talents_6[actor.id][skill_id_2][a] = 0
end
$talents_6[actor.id][skill_id_2][a] += i[g[1]][a + 5]
end
end
end
else
next
end
end
end
end
end
end
end
#==============================================================================
# ■ Window_Selectable_Genius
#------------------------------------------------------------------------------
# W_Genius的父类。
#==============================================================================
class Window_Selectable_Genius < Window_Base
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_reader :x_index # 光标位置x(不是具体坐标值)
attr_reader :y_index # 光标位置y(不是具体坐标值)
attr_reader :help_window # 帮助窗口
#--------------------------------------------------------------------------
# ● 初始画对像
# x : 窗口的 X 坐标
# y : 窗口的 Y 坐标
# width : 窗口的宽
# height : 窗口的高
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@x_index = 1
@y_index = 1
@x_index_max = 4
@y_index_max = 7
@x0 = 35
@y0 = 5
@cursor_width = 50
@cursor_height = 50
@cursor_width_2 = 66
@cursor_height_2 = 63
@item_max = 1
@column_max = 1
@index = -1
end
#--------------------------------------------------------------------------
# ● 设置光标的位置
# x_index : 新的光标位置的X值
#--------------------------------------------------------------------------
def x_index=(x_index)
@x_index = x_index
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 设置光标的位置
# y_index : 新的光标位置的Y值
#--------------------------------------------------------------------------
def y_index=(y_index)
@y_index = y_index
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
#--------------------------------------------------------------------------
# ● 更新光标举行
#--------------------------------------------------------------------------
def update_cursor_rect
# 光标位置不满 0 的情况下
if @x_index < 0 or @y_index < 0
self.cursor_rect.empty
return
end
x = @x0 + (@x_index - 1) * @cursor_width_2
y = @y0 + (@y_index - 1) * @cursor_height_2
# 更新国标矩形
self.cursor_rect.set(x, y, @cursor_width, @cursor_height)
end
#--------------------------------------------------------------------------
# ● 帮助窗口的设置
# help_window : 新的帮助窗口
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 可以移动光标的情况下
if self.active
# 方向键下被按下的情况下
if Input.repeat?(Input::DOWN)
if @y_index_max > @y_index
# 光标向下移动
$game_system.se_play($data_system.cursor_se)
@y_index += 1
end
end
# 方向键上被按下的情况下
if Input.repeat?(Input::UP)
if @y_index > 1
# 光标向上移动
$game_system.se_play($data_system.cursor_se)
@y_index -= 1
end
end
# 方向键右被按下的情况下
if Input.repeat?(Input::RIGHT)
if @x_index < @x_index_max
# 光标向右移动
$game_system.se_play($data_system.cursor_se)
@x_index += 1
end
end
# 方向键左被按下的情况下
if Input.repeat?(Input::LEFT)
if @x_index > 1
# 光标向左移动
$game_system.se_play($data_system.cursor_se)
@x_index -= 1
end
end
end
# 刷新帮助文本 (update_help 定义了继承目标)
if self.active and @help_window != nil
update_help
end
# 刷新光标矩形
update_cursor_rect
end
end
#==============================================================================
# ■ Window_Genius
#------------------------------------------------------------------------------
# 天赋加点 窗口
#==============================================================================
class Window_Genius < Window_Selectable_Genius
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
#p [@a,@b,@c]
self.contents.clear
j = $talents[$scene.actor.class_id]
for i in j
if i != nil
if $Genius_Point_note_1[$scene.actor.id][i] == nil
$Genius_Point_note_1[$scene.actor.id][i] = 0
end
if i[1] == ($scene.list_window.index + 1)
text = $Genius_Point_note_1[$scene.actor.id][i]
x = 35 + 38 + (i[4] - 1) * 66
y = 5 + 35 + (i[3] - 1) * 63
if text == i[9].size
self.contents.font.color = text_color(0)
else
self.contents.font.color = text_color(3)
end
if i[10].size != 0
g_r = $Genius_Point_note_1[$scene.actor.id][$talents[$scene.actor.class_id][i[10][0]]]
if i[10][1] > g_r
self.contents.font.color = text_color(2)
end
end
if $Genius_Point_note_3[$scene.actor.id][i[1] - 1] < (i[3] - 1) * 3
self.contents.font.color = text_color(2)
end
text = text.to_s
self.contents.draw_text(x, y, 20, 20,text)
end
end
end
end
end
#==============================================================================
# ■ Window_Genius_Base
#------------------------------------------------------------------------------
# 天赋加点 窗口 背景
# 应该改为Window_Genius_Back,懒得改了
#==============================================================================
class Window_Genius_Base < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(296,0,344,480)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh_db(filename)
self.contents.clear
bitmap = Bitmap.new("Graphics/武功系统2/#{filename}")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt( 0, 0, bitmap, src_rect)
end
end
#==============================================================================
# ■ Window_Genius_Info
#------------------------------------------------------------------------------
# 天赋加点 天赋介绍
#==============================================================================
class Window_Genius_Info < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(y, h)
super(0, y, 296, h)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_info(g)
self.contents.clear
if g != nil
x = 0
y = 0
text_a = g[0].to_s
text_b = text_a.split(/@/)[0]
self.contents.draw_text(x, y, 255, 32, text_b,1)
text_c = text_a.split(/@/)[1]
if g[8] == nil
text_d = ""
text_e = ""
else
text_d = g[8].split(/@/)[0] != nil ? g[8].split(/@/)[0] : ""
text_e = g[8].split(/@/)[1] != nil ? g[8].split(/@/)[1] : ""
end
k = $Genius_Point_note_1[$scene.actor.id][g]
if k > 0
k -= 1
else
k = 0
end
text_f = g[9][k][3] != "" ? g[9][k][3] : g[9][k][1]
text_y = text_d.to_s + text_f.to_s + text_e.to_s
text_x = [""]
while ((c = text_y.slice!(/./m)) != nil)
text_x[text_x.length - 1] += c.to_s
if text_x[text_x.length - 1].size >= 36
self.contents.draw_text(x, y + 64 + text_x.length * 32, 264 * text_x[text_x.length - 1].size / 36, 32, text_x[text_x.length - 1],0)
text_x[text_x.length] = ""
end
end
self.contents.draw_text(x, y + 64 + text_x.length * 32, 264 * text_x[text_x.length - 1].size / 36, 32, text_x[text_x.length - 1],0)
end
end
end
#==============================================================================
# ■ Window_Genius_Info_Back
#------------------------------------------------------------------------------
# 天赋加点 天赋介绍
#==============================================================================
class Window_Genius_Info_Back < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(y, h)
super(0, y, 296, h)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
end
#--------------------------------------------------------------------------
# ● 刷新角色战斗图
#--------------------------------------------------------------------------
def update_actor(a)
b = RPG::Cache.battler(a.battler_name, a.battler_hue)
src_rect = Rect.new(0, 0, b.width, b.height)
self.contents.blt((self.contents.width - b.width)/2, (self.contents.height - b.height)/2, b, src_rect, 100)
end
end
#==============================================================================
# ■ Window_Actor
#------------------------------------------------------------------------------
# 天赋加点左上第二个
#==============================================================================
class Window_Actor < Window_Base
attr_accessor :actor
attr_accessor :actor_old
attr_accessor :point_old
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize(h, actor)
@actor = actor
super(140,0,156,h)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if @actor_old != @actor or $Genius_Point[@actor.id][0] != @point_old
@actor_old = @actor
@point_old = $Genius_Point[@actor.id][0]
self.contents.clear
x = 0
y = 0
self.contents.draw_text(x+10, y, 120, 30, @actor.name)
y += 30
self.contents.draw_text(x+10, y, 140, 30, "修为点")
y += 30
text = "点数:" + $Genius_Point[@actor.id][0].to_s + "点"
self.contents.draw_text(x+10, y, 80, 30, text)
end
end
end
#==============================================================================
# ■ Scene_Genius
#------------------------------------------------------------------------------
# 天赋加点 画面
#==============================================================================
class Scene_Genius
attr_accessor :list_window
attr_accessor :content_window
attr_accessor :actor
attr_accessor :genius_on_elect
#--------------------------------------------------------------------------
# actor_index :角色编号
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
# p $Genius_Point[$game_party.actors[actor_index].id]
@actor_index = actor_index
@genius_on_elect = nil
end
#------------------------------------------------------------
# 主循环
#------------------------------------------------------------
def main
@actor = $game_party.actors[@actor_index]
command = self.command_set
#选择窗口
@list_window = Window_Command.new(140,command)
@list_window.active = true
#信息窗口
@info_window = Window_Genius_Info.new(@list_window.height, 480 - @list_window.height)
@info_window.back_opacity = 0
@info_window_back = Window_Genius_Info_Back.new(@list_window.height, 480 - @list_window.height)
@info_window_back.update_actor(@actor)
@info_window_back.z = @info_window.z - 100
#前景窗口
@content_window = Window_Genius.new(296,0,344,480)
@content_window.active = false
@content_window.cursor_rect.empty
@content_window.x_index = -1
@content_window.y_index = -1
@content_window.refresh
#@content_window.help_window = @help_window
#背景窗口
@content_window_base = Window_Genius_Base.new
@content_window_base.z = @content_window.z - 100
@content_window_base.refresh_db($backgenius[@actor.class_id][0])
#角色窗口
@actor_window = Window_Actor.new(@list_window.height, @actor)
# 执行过渡(格式,不用管)
Graphics.transition
# 主循环(格式,不用管)
loop do
# 刷新游戏画面(格式,不用管)
Graphics.update
# 刷新键盘按键的情报(格式,不用管)
Input.update
# 刷新内容
update
# 如果画面被切换的话就中断循环(格式,不用管)
if $scene != self
break
end
end
# 过渡(格式,不用管)
Graphics.freeze
# 释放内存
@list_window.dispose
@content_window.dispose
@content_window_base.dispose
@actor_window.dispose
@info_window.dispose
@info_window_back.dispose
# @help_window.dispose
end
#------------------------------------------
# 天赋类别选项
#------------------------------------------
def command_set
case @actor.class_id
when 1
return ["九阴真经","易筋经", "降龙十八掌"]
end
end
#---------------
# 刷新
#---------------
def update
# 光标控制功能
@list_window.update
@content_window.update
@actor_window.refresh
# 指令窗口激活的情况下: 调用 update_list
if @list_window.active
update_list
return
end
# 指令窗口激活的情况下: 调用 update_content
if @content_window.active
update_content
return
end
end
#-------------------------------------------
# 刷新画面 (指令窗口激活的情况下)
#-------------------------------------------
def update_list
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
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_Genius.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_Genius.new(@actor_index)
return
end
if Input.trigger?(Input::DOWN) or Input.trigger?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@actor_genius_class = @list_window.index
@content_window_base.refresh_db($backgenius[@actor.class_id][@actor_genius_class])
@content_window.refresh
return
end
# 如果按下C的时候
if Input.trigger?(Input::C)
# 播放“嘟”的一声
$game_system.se_play($data_system.decision_se)
@list_window.active = false
@content_window.active = true
@content_window.x_index = 1
@content_window.y_index = 1
# 完毕
return
end
end
#-------------------------------------------
# 刷新画面 (天赋窗口激活的情况下)
#-------------------------------------------
def update_content
genius_elect
@info_window.update_info(@genius_on_elect)
# 如果按下ESC的时候
if Input.trigger?(Input::B)
# 播放“嘟”的一声
$game_system.se_play($data_system.cancel_se)
#返回选择窗口
@list_window.active = true
@content_window.active = false
@content_window.x_index = -1
@content_window.y_index = -1
# 完毕
return
end
# 如果按下C的时候
if Input.trigger?(Input::C)
if genius_up?
#效果应用
Game_Genius.new(@actor)
# 播放“嘟”的一声
$game_system.se_play($data_system.decision_se)
@info_window.update_info(@genius_on_elect)
@content_window.refresh
else
# 播放“嘟”的一声
$game_system.se_play($data_system.cancel_se)
end
# 完毕
return
end
end
#-------------------------------------------
# 天赋增加
#-------------------------------------------
def genius_up?
g = @genius_on_elect
if g == nil
return false
end
if $Genius_Point_note_1[@actor.id][g] == nil
$Genius_Point_note_1[@actor.id][g] = 10
end
if $Genius_Point[@actor.id][0] < 1
return false
end
if $Genius_Point_note_3[@actor.id][g[1] - 1] < (g[3] - 1) * 3
return false
end
if $Genius_Point_note_1[@actor.id][g] == g[9].size
return false
end
if g[10][0] != nil
g_r = $Genius_Point_note_1[@actor.id][$talents[@actor.class_id][g[10][0]]]
if g_r == nil
return false
end
if g_r < g[10][1]
return false
end
end
$Genius_Point_note_1[@actor.id][g] += 1
$Genius_Point_note_2[@actor.id][$Genius_Point_note_2[@actor.id].length] = $talents[@actor.class_id].index(g)
$Genius_Point_note_3[@actor.id][g[1] - 1] += 1
# p $Genius_Point_note_3[@actor.id][g[1] - 1]
# p $talents[@actor.class_id].index(g)
$Genius_Point[@actor.id][0] -= 1
end
#-------------------------------------------
# 光标选中的天赋
#-------------------------------------------
def genius_elect
j = $talents[@actor.class_id]
s_k = false
for i in j
if i != nil
if i[1] == (@list_window.index + 1)
x = i[4] == @content_window.x_index
y = i[3] == @content_window.y_index
if x and y
@genius_on_elect = i
s_k = true
break
end
end
end
end
if !s_k
@genius_on_elect = nil
end
end
end
#====================================Part3======================================
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# 7处修改
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 获取命中率
#--------------------------------------------------------------------------
def hit
n = 100
for i in @states
n *= $data_states[i].hit_rate / 100.0
end
#====================修改========================
n *= $talents_3[self.id][10] / 100
n += $talents_4[self.id][10]
#================================================
return Integer(n)
end
#--------------------------------------------------------------------------
# ● 可以使用特技的判定
# skill_id : 特技 ID
#--------------------------------------------------------------------------
def skill_can_use?(skill_id)
# SP 不足的情况下不能使用
#====================修改========================
sp_cost = $data_skills[skill_id].sp_cost * $talents_5[self.id][skill_id][0] / 100
sp_cost -= $talents_6[self.id][skill_id][0]
if sp_cost > self.sp
return false
end
#================================================
# 战斗不能的情况下不能使用
if dead?
return false
end
# 沉默状态的情况下、物理特技以外的特技不能使用
if $data_skills[skill_id].atk_f == 0 and self.restriction == 1
return false
end
# 获取可以使用的时机
occasion = $data_skills[skill_id].occasion
# 战斗中的情况下
if $game_temp.in_battle
# [平时] 或者是 [战斗中] 可以使用
return (occasion == 0 or occasion == 1)
# 不是战斗中的情况下
else
# [平时] 或者是 [菜单中] 可以使用
return (occasion == 0 or occasion == 2)
end
end
#--------------------------------------------------------------------------
# ● 应用特技效果
# user : 特技的使用者 (battler)
# skill : 特技
#--------------------------------------------------------------------------
def skill_effect(user, skill)
#=======================修改==============================
if user.is_a?(Game_Actor)
skill_power = skill.power * $talents_5[user.id][skill.id][1] / 100
skill_power += $talents_6[user.id][skill.id][1]
skill_hit = skill.hit * $talents_5[user.id][skill.id][20] / 100
skill_hit += $talents_6[user.id][skill.id][2]
else
skill_power = skill.power
skill_hit = skill.hit
end
#=========================================================
# 清除会心一击标志
self.critical = false
# 特技的效果范围是 HP 1 以上的己方、自己的 HP 为 0、
# 或者特技的效果范围是 HP 0 的己方、自己的 HP 为 1 以上的情况下
if ((skill.scope == 3 or skill.scope == 4) and self.hp == 0) or
((skill.scope == 5 or skill.scope == 6) and self.hp >= 1)
# 过程结束
return false
end
# 清除有效标志
effective = false
# 公共事件 ID 是有效的情况下,设置为有效标志
effective |= skill.common_event_id > 0
# 第一命中判定
#========================修改=============================
hit = skill_hit
#=========================================================
if skill.atk_f > 0
hit *= user.hit / 100
end
hit_result = (rand(100) < hit)
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
# 命中的情况下
if hit_result == true
# 计算威力
#=====================修改================================
power = skill_power + user.atk * skill.atk_f / 100
#=========================================================
if power > 0
power -= self.pdef * skill.pdef_f / 200
power -= self.mdef * skill.mdef_f / 200
power = [power, 0].max
end
# 计算倍率
rate = 20
rate += (user.str * skill.str_f / 100)
rate += (user.dex * skill.dex_f / 100)
rate += (user.agi * skill.agi_f / 100)
rate += (user.int * skill.int_f / 100)
# 计算基本伤害
self.damage = power * rate / 20
# 属性修正
self.damage *= elements_correct(skill.element_set)
self.damage /= 100
# 伤害符号正确的情况下
if self.damage > 0
# 防御修正
if self.guarding?
self.damage /= 2
end
end
# 分散
if skill.variance > 0 and self.damage.abs > 0
amp = [self.damage.abs * skill.variance / 100, 1].max
self.damage += rand(amp+1) + rand(amp+1) - amp
end
# 第二命中判定
eva = 8 * self.agi / user.dex + self.eva
hit = self.damage < 0 ? 100 : 100 - eva * skill.eva_f / 100
hit = self.cant_evade? ? 100 : hit
hit_result = (rand(100) < hit)
# 不确定的特技的情况下设置为有效标志
effective |= hit < 100
end
# 命中的情况下
if hit_result == true
# 威力 0 以外的物理攻击的情况下
#======================修改===============================
if skill_power != 0 and skill.atk_f > 0
#=========================================================
# 状态冲击解除
remove_states_shock
# 设置有效标志
effective = true
end
# HP 的伤害减法运算
last_hp = self.hp
self.hp -= self.damage
effective |= self.hp != last_hp
# 状态变化
@state_changed = false
effective |= states_plus(skill.plus_state_set)
effective |= states_minus(skill.minus_state_set)
# 威力为 0 的场合
#======================修改===============================
if skill_power == 0
#=========================================================
# 伤害设置为空的字串
self.damage = ""
# 状态没有变化的情况下
unless @state_changed
# 伤害设置为 "Miss"
self.damage = "Miss"
end
end
# Miss 的情况下
else
# 伤害设置为 "Miss"
self.damage = "Miss"
end
# 不在战斗中的情况下
unless $game_temp.in_battle
# 伤害设置为 nil
self.damage = nil
end
# 过程结束
return effective
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 6处修改
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def setup(actor_id)
actor = $data_actors[actor_id]
#===============修改=========================================
Genius_Restart.new(actor)
$Genius_rs_x[actor.id] = 0
#===============修改=========================================
@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
#===============修改=========================================
if @level > 9 and @level <61
$Genius_Point[self.id][0] = @level - 9
$Genius_Point[self.id][1] = @level - 9
elsif @level > 60
$Genius_Point[self.id][0] = 51
$Genius_Point[self.id][1] = 51
else
$Genius_Point[self.id][0] = 0
$Genius_Point[self.id][1] = 0
end
#============================================================
@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
#==================================修改===========================================
#--------------------------------------------------------------------------
# ● 获取 MaxHP
#--------------------------------------------------------------------------
def maxhp
n = [[base_maxhp + @maxhp_plus, 1].max, 9999].min
for i in @states
n *= $data_states[i].maxhp_rate / 100.0
end
n = [[Integer(n), 1].max, 9999].min
return n
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxHP
#--------------------------------------------------------------------------
def base_maxhp
n = $data_actors[@actor_id].parameters[0, @level]
n *= $talents_3[self.id][0] / 100
n += $talents_4[self.id][0]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本 MaxSP
#--------------------------------------------------------------------------
def base_maxsp
n = $data_actors[@actor_id].parameters[1, @level]
n *= $talents_3[self.id][1] / 100
n += $talents_4[self.id][1]
return n
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
n *= $talents_3[self.id][2] / 100
n += $talents_4[self.id][2]
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
n *= $talents_3[self.id][3] / 100
n += $talents_4[self.id][3]
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
n *= $talents_3[self.id][4] / 100
n += $talents_4[self.id][4]
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
n *= $talents_3[self.id][5] / 100
n += $talents_4[self.id][5]
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本攻击力
#--------------------------------------------------------------------------
def base_atk
weapon = $data_weapons[@weapon_id]
atk = weapon != nil ? weapon.atk : 0
return (atk) * $talents_3[self.id][9] + $talents_4[self.id][9]
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
return (pdef1 + pdef2 + pdef3 + pdef4 + pdef5) * $talents_3[self.id][6] / 100 + $talents_4[self.id][6]
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
return (mdef1 + mdef2 + mdef3 + mdef4 + mdef5) * $talents_3[self.id][7] / 100 + $talents_4[self.id][7]
end
#--------------------------------------------------------------------------
# ● 获取基本回避修正
#--------------------------------------------------------------------------
def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
return (eva1 + eva2 + eva3 + eva4) * $talents_3[self.id][8] / 100 + $talents_4[self.id][8]
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 += 0.3
#===============修改=========================================
if @level > 9 and @level <61
$Genius_Point[self.id][0] += 1
$Genius_Point[self.id][1] = @level - 9
end
#============================================================
# 学会特技
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
#===============修改=========================================
$Genius_Point[self.id][1] = @level - 8
if level > 8 and level <60
if $Genius_Point[self.id][0] < 1
i_n = $Genius_Point_note_2[self.id].length - 1
for i in 0..i_n
if $Genius_Point_note_2[self.id].length == $Genius_Point[self.id][1]
break
end
j = $Genius_Point_note_2[self.id].length - 11
g = $Genius_Point_note_2[self.id][j]
#p j
#p g
#p self
$Genius_Point_note_1[self.id][$talents[self.class_id][g]] -= 1
$Genius_Point_note_3[self.id][$talents[self.class_id][g][1] - 1] -= 1
$Genius_Point_note_2[self.id].delete(j)
end
Game_Genius.new(self)
else
$Genius_Point[self.id][0] -= 1
end
end
#============================================================
end
# 修正当前的 HP 与 SP 超过最大值
@hp = [@hp, self.maxhp].min
@sp = [@sp, self.maxsp].min
end
#--------------------------------------------------------------------------
# ● 更改职业 ID
# class_id : 新的职业 ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
#===============修改=========================================
#初始化天赋
Genius_Restart.new(self)
#============================================================
# 避开无法装备的物品
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
end
end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 1处修改
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 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)
#===================修改=========================
sp_cost = skill.sp_cost * $talents_5[@actor.id][skill.id][0] / 100
sp_cost -= $talents_6[@actor.id][skill.id][0]
self.contents.draw_text(x + 232, y, 48, 32, sp_cost.to_s, 2)
#================================================
end
end
#==============================================================================
# ■ Scene_Title
#------------------------------------------------------------------------------
# 两处修改
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# ● 命令 : 新游戏
#--------------------------------------------------------------------------
def command_new_game
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 停止 BGM
Audio.bgm_stop
# 重置测量游戏时间用的画面计数器
Graphics.frame_count = 0
# 生成各种游戏对像
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
#=================================修改=========================================
#初始化天赋剩余点数
$Genius_Point = []
$Genius_rs_x = []
$talents_3 = {}
$talents_4 = {}
$talents_5 = {}
$talents_6 = {}
$Genius_Point_note_1 = []
$Genius_Point_note_2 = []
$Genius_Point_note_3 = []
for actor in $data_actors
$Genius_Point[actor.id] = [0,0]
$talents_3[actor.id] = [100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100]
$talents_4[actor.id] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
$talents_5[actor.id] = []
$talents_6[actor.id] = []
for i_X in 1..$data_skills.size - 1
$talents_5[actor.id][i_X] = [100,100,100]
$talents_6[actor.id][i_X] = [0,0,0]
end
$Genius_rs_x[actor.id] = 0
$Genius_Point_note_1[actor.id] = {}
$Genius_Point_note_2[actor.id] = {}
$Genius_Point_note_3[actor.id] = [0,0,0]
end
#==============================================================================
# 设置初期同伴位置
$game_party.setup_starting_members
# 设置初期位置的地图
$game_map.setup($data_system.start_map_id)
# 主角向初期位置移动
$game_player.moveto($data_system.start_x, $data_system.start_y)
# 刷新主角
$game_player.refresh
# 执行地图设置的 BGM 与 BGS 的自动切换
$game_map.autoplay
# 刷新地图 (执行并行事件)
$game_map.update
# 切换地图画面
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# ● 战斗测试
#--------------------------------------------------------------------------
def battle_test
# 载入数据库 (战斗测试用)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# 重置测量游戏时间用的画面计数器
Graphics.frame_count = 0
# 生成各种游戏对像
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
#=================================修改=========================================
#初始化天赋剩余点数
$Genius_Point = []
$Genius_rs_x = []
$Genius_Point_note_1 = []
$Genius_Point_note_2 = []
$Genius_Point_note_3 = []
for actor in $data_actors
$Genius_Point[actor.id] = [0,0]
$Genius_rs_x[actor.id] = 0
$Genius_Point_note_1[actor.id] = {}
$Genius_Point_note_2[actor.id] = {}
$Genius_Point_note_3[actor.id] = [0,0,0]
end
#==============================================================================
# 设置战斗测试用同伴
$game_party.setup_battle_test_members
# 设置队伍 ID、可以逃走标志、战斗背景
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# 演奏战斗开始 BGM
$game_system.se_play($data_system.battle_start_se)
# 演奏战斗 BGM
$game_system.bgm_play($game_system.battle_bgm)
# 切换到战斗画面
$scene = Scene_Battle.new
end
end
#==============================================================================
# ■ Scene_Skill
#------------------------------------------------------------------------------
# 两处修改
#==============================================================================
class Scene_Skill
#--------------------------------------------------------------------------
# ● 刷新画面 (特技窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_skill
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(1)
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技窗口现在选择的特技的数据
@skill = @skill_window.skill
# 不能使用的情况下
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 效果范围是我方的情况下
if @skill.scope >= 3
# 激活目标窗口
@skill_window.active = false
@target_window.x = (@skill_window.index + 1) % 2 * 304
@target_window.visible = true
@target_window.active = true
# 设置效果范围 (单体/全体) 的对应光标位置
if @skill.scope == 4 || @skill.scope == 6
@target_window.index = -1
elsif @skill.scope == 7
@target_window.index = @actor_index - 10
else
@target_window.index = 0
end
# 效果在我方以外的情况下
else
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
#====================修改========================
# 消耗 SP
sp_cost = @skill.sp_cost * $talents_5[@actor.id][@skill.id][0] / 100
sp_cost -= $talents_6[@actor.id][@skill.id][0]
@actor.sp -= sp_cost
#================================================
# 再生成各窗口的内容
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
return
end
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的特技画面
$scene = Scene_Skill.new(@actor_index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的特技画面
$scene = Scene_Skill.new(@actor_index)
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (目标窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_target
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 删除目标窗口
@skill_window.active = true
@target_window.visible = false
@target_window.active = false
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 因为 SP 不足而无法使用的情况下
unless @actor.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 目标是全体的情况下
if @target_window.index == -1
# 对同伴全体应用特技使用效果
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# 目标是使用者的情况下
if @target_window.index <= -2
# 对目标角色应用特技的使用效果
target = $game_party.actors[@target_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# 目标是单体的情况下
if @target_window.index >= 0
# 对目标角色应用特技的使用效果
target = $game_party.actors[@target_window.index]
used = target.skill_effect(@actor, @skill)
end
# 使用特技的情况下
if used
# 演奏特技使用时的 SE
$game_system.se_play(@skill.menu_se)
#====================修改========================
# 消耗 SP
sp_cost = @skill.sp_cost * $talents_5[@actor.id][@skill.id][0] / 100
sp_cost -= $talents_6[@actor.id][@skill.id][0]
@actor.sp -= sp_cost
#================================================
# 再生成各窗口内容
@status_window.refresh
@skill_window.refresh
@target_window.refresh
# 全灭的情况下
if $game_party.all_dead?
# 切换到游戏结束画面
$scene = Scene_Gameover.new
return
end
# 公共事件 ID 有效的情况下
if @skill.common_event_id > 0
# 预约调用公共事件
$game_temp.common_event_id = @skill.common_event_id
# 切换到地图画面
$scene = Scene_Map.new
return
end
end
# 无法使用特技的情况下
unless used
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# ■ Scene_Save
#------------------------------------------------------------------------------
# 一处修改
#==============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# ● 写入存档数据
# file : 写入用文件对像 (已经打开)
#--------------------------------------------------------------------------
def write_save_data(file)
# 生成描绘存档文件用的角色图形
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# 写入描绘存档文件用的角色数据
Marshal.dump(characters, file)
# 写入测量游戏时间用画面计数
Marshal.dump(Graphics.frame_count, file)
# 增加 1 次存档次数
$game_system.save_count += 1
# 保存魔法编号
# (将编辑器保存的值以随机值替换)
$game_system.magic_number = $data_system.magic_number
# 写入各种游戏对像
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
#=================================修改=========================================
Marshal.dump($Genius_Point, file)
Marshal.dump($Genius_rs_x, file)
Marshal.dump($talents_3, file)
Marshal.dump($talents_4, file)
Marshal.dump($talents_5, file)
Marshal.dump($talents_6, file)
#==============================================================================
end
end
#==============================================================================
# ■ Scene_Load
#------------------------------------------------------------------------------
# 一处修改
#==============================================================================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ● 读取存档数据
# file : 读取用文件对像 (已经打开)
#--------------------------------------------------------------------------
def read_save_data(file)
# 读取描绘存档文件用的角色数据
characters = Marshal.load(file)
# 读取测量游戏时间用画面计数
Graphics.frame_count = Marshal.load(file)
# 读取各种游戏对像
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
#=================================修改=========================================
$Genius_Point = Marshal.load(file)
$Genius_rs_x = Marshal.load(file)
$talents_3 = Marshal.load(file)
$talents_4 = Marshal.load(file)
$talents_5 = Marshal.load(file)
$talents_6 = Marshal.load(file)
#==============================================================================
# 魔法编号与保存时有差异的情况下
# (加入编辑器的编辑过的数据)
if $game_system.magic_number != $data_system.magic_number
# 重新装载地图
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# 刷新同伴成员
$game_party.refresh
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 一处修改
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 生成特技行动结果
#--------------------------------------------------------------------------
def make_skill_action_result
# 获取特技
@skill = $data_skills[@active_battler.current_action.skill_id]
# 如果不是强制行动
unless @active_battler.current_action.forcing
# 因为 SP 耗尽而无法使用的情况下
unless @active_battler.skill_can_use?(@skill.id)
# 清除强制行动对像的战斗者
$game_temp.forcing_battler = nil
# 移至步骤 1
@phase4_step = 1
return
end
end
#====================修改========================
# 消耗 SP
if
sp_cost = @skill.sp_cost * $talents_5[@active_battler.id][@skill.id][0] / 100
sp_cost -= $talents_6[@active_battler.id][@skill.id][0]
else
end
#================================================
# 刷新状态窗口
@status_window.refresh
# 在帮助窗口显示特技名
@help_window.set_text(@skill.name, 1)
# 设置动画 ID
@animation1_id = @skill.animation1_id
@animation2_id = @skill.animation2_id
# 设置公共事件 ID
@common_event_id = @skill.common_event_id
# 设置对像侧战斗者
set_target_battlers(@skill.scope)
# 应用特技效果
for target in @target_battlers
target.skill_effect(@active_battler, @skill)
end
end
end
复制代码
这是天赋加点系统
调用是$scene = Scene_Genius.new
请问怎样改一下调用的脚本? 换成别的
作者:
紫英晓狼1130
时间:
2013-8-21 19:30
换成别的脚本吗?LZ写一个新的定义就行了…
作者:
han462160636
时间:
2013-8-21 19:34
紫英晓狼1130 发表于 2013-8-21 19:30
换成别的脚本吗?LZ写一个新的定义就行了…
不是。。原来的调用方法是$scene = Scene_Genius.new
我想改一下 调用方法 请问可以实现吗
我不太懂脚本
作者:
han462160636
时间:
2013-8-21 19:58
@satgo1546
这个脚本有职业区分 我想把职业去掉 可是不太会。。 我想做金庸类的游戏 要学习的心法太多了
因此我想到多弄几个这种脚本 有多少种武功就添加多少个这种脚本 前提是每个脚本调用不同 做好了之后然后使用某物品如九阴真经秘籍 就可以切换到九阴真经武功修炼界面
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1