赞 4
VIP 0
好人卡 24
积分 0
经验 15951
最后登录 2016-1-17
在线时间 276 小时
Lv1.梦旅人
梦石 0
星屑 49
在线时间 276 小时
注册时间 2011-6-5
帖子 133
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 救世小树 于 2013-3-8 15:24 编辑
想给自己游戏弄个加点系统,但是VA找不到合适的, 白字卖萌
于是自己动手,查来查去,边查边写,有了这个不算完美的脚本。
写完之后想想来这里这么久了,一直在潜水, 白字卖萌
于是就鼓起勇气把这第一次自己完成的功能型脚本修改了一下,送给大家。
新版本正常向发布
新版正常向不再采用增长百分比 ,
就是普通的加法运算,也没有了蛋疼的每个角色设置成长率 ,
可以设定加点的种类,每种点对角色18 个属性的影响(加法),总之比这个版本更普适。
http://rpg.blue/thread-295517-1-1.html
首先要准备好大量的变量位置,因为每个角色要消耗7个变量位置,
储存属性点的变量编号是 x+角色id*7 ,
[x+角色id*7] ~ [x+角色id*7+6]号变量分别储存了
自由点; 体力点; 精神点;力量点; 魔力点; 韧性点; 灵活点。
体力精神影响HPMP上限和再生率,每个角色的影响程度可以在脚本一开始的数组里设置;
角色MHP=原MHP*(1+影响系数*角色体力点)
角色MMP=原MMP*(1+影响系数*角色精神点)
角色ATK=原ATK*(1+影响系数*角色力量点)
角色MAT=原MAT*(1+影响系数*角色魔力点)
这样设定纯粹是为了好玩【O(∩_∩)O~】
不过这样子计算时装备附加的HPMP物攻魔攻的效果也会被这样影响,
如果在数据库中把人物的基础物攻魔攻HPMP设定得比较低而且没有成长而单纯靠加点成长的话,那就装备附加上面四种属性的影响就比较强了。
至于其它属性的设置就全都是加法了。
通过加点可以影响的属性有:
MHP、HP再生、
MMP、MP再生、
物攻、
魔攻、
物防、魔防、
敏捷、物理魔法回避。
想要增加其它的属性也可以照着样子改,额,懂一点脚本的应该改起来不难。
--------------------------------------------------------------------------------------------------
第一次发脚本,可能有很多不好的地方,请多担待。
使用脚本将它放在该放的位置就行了,菜单中会多出加点的选项。
每个角色对应系数,洗点水的物品编号和一些文字可以自己在脚本开头设置。
白字卖萌
最后我怎么可能会告诉你这里顺便附带了一个升级回满血蓝的小功能【想必这个是大家都会的基础吧】
希望这脚本少出点bug。。。我自认为是写得挺认真的。。。
范例没有打包dll,请自行添加。
Project3.rar
(306.7 KB, 下载次数: 197)
修一个不算大的bug:洗点之后mp超过mmp;
150行左右:
def use_item(item)
super
if item.id == RESET_ITEM
reset(self.id)
self.hp = [self.hp,self.mhp].min
self.mp = [self.mp,self.mmp].min #加上这行。。。
end
end
这行白字是在卖萌?
以下脚本代码
#encoding:utf-8
#=============================================================================
#-----------------RMVA加点系统-v1.00---By:救世小树--------转载请注明出处-------
#=============================================================================
module Point_Tree
POINT_VARIABLE = 33
#储存属性点的变量编号是33+角色id*7,
#即40号变量为一号角色自由点;41号为体力点;42号为精神点;
#43号为力量点;44号为魔力点;45号为韧性点;46号为灵活点。
LEVEL_UP_POINT = 3
#每升一级属性点增加数
RESET_ITEM = 20 #洗点水编号
#每一种点的称呼
STR_BODY = "体力"
STR_MENTAL = "精神"
STR_STR = "力量"
STR_MAG = "魔力"
STR_HAR = "韧性"
STR_SPE = "灵活"
STR_ALL = [ STR_BODY,STR_MENTAL,STR_STR,STR_MAG,STR_HAR,STR_SPE]
#菜单项名称
ADDPOINT = "加点"
POINT_NAME = "属性点"
BODY_MHP = [ 0 ,
2.0 ,2.6 ,4.2 ,2.3 ,3.5 , 10 ,10 ,10 ,10 ,10 ]
#第一个0请无视,第二个2.0即1号角色对应的增加一点体力时MHP增加百分数
#即一号角色MHP=原MHP*(1+2.0*一号角色体力点)
BODY_HP = [ 0 ,
2 ,5 ,8 ,3 ,7 , 10 ,10 ,10 ,10 ,10 ]
#各角色每增加一点体力HP恢复率增加值(万分率)
MENTAL_MMP = [ 0 ,
4.4 ,3.9 ,2.6 ,4.2 ,3.5 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点精神MMP增加百分数
MENTAL_MP = [ 0 ,
12 ,10 ,7 ,9 ,7 , 10 ,10 ,10 ,10 ,10 ]
#各角色每增加一点精神MP恢复率增加值(万分率)
STR_ATK = [ 0 ,
1.0 ,1.6 ,3.7 ,1.2 ,3.0 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点力量物理攻击增加百分数
MAG_MAT = [ 0 ,
3.6 ,3.9 ,2.2 ,3.8 ,3.0 , 7 ,7 ,7 ,7 ,7 ]
#各角色每增加一点魔力魔法攻击增加百分数
HAR_DEF = [ 0 ,
0 ,2 ,5 ,2 ,4 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点韧性物理防御增加点数
HAR_MDF = [ 0 ,
7 ,5 ,5 ,6 ,4 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点韧性魔法防御增加点数
SPE_AGI = [ 0 ,
3 ,2 ,2 ,4 ,2 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点灵活敏捷增加点数
SPE_EVA = [ 0 ,
10 ,6 ,4 ,15 ,7 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点灵活物理魔法闪避增加点数(万分率)
def reset( actor_id)
for i in 1 ..6
$game_variables [ actor_id*7 + POINT_VARIABLE] +=$game_variables[ actor_id*7 + POINT_VARIABLE+i]
$game_variables [ actor_id*7 + POINT_VARIABLE+i] =0
end
end
def temp_all
return $temp_body +$temp_mental+$temp_str+$temp_mag+$temp_har+$temp_spe
end
end
$temp_body = 0
$temp_mental = 0
$temp_str = 0
$temp_mag = 0
$temp_har = 0
$temp_spe = 0
class Game_Actor < Game_Battler
include Point_Tree
alias level_up_tre level_up
def level_up
level_up_tre
@hp += mhp
@mp += mmp
$game_variables [ self .id* 7 + POINT_VARIABLE] += LEVEL_UP_POINT
end
def point_plus( param_id,extra_add = 0 )
case param_id
when 3
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+5 ] ) *HAR_DEF[ self .id ]
when 5
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+5 ] ) *HAR_MDF[ self .id ]
when 6
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_AGI[ self .id ]
end
return 0
end
def point_rate( param_id,extra_add=0 )
case param_id
when 0
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+1 ] ) *BODY_MHP[ self .id ] /100.0 )
when 1
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+2 ] ) *MENTAL_MMP[ self .id ] /100.0 )
when 2
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+3 ] ) *STR_ATK[ self .id ] /100.0 )
when 4
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+4 ] ) *MAG_MAT[ self .id ] /100.0 )
end
return 1
end
alias point_base_param param
def param( param_id,extra_add = 0 )
value = param_base( param_id) + param_plus( param_id) + point_plus( param_id,extra_add)
value *= param_rate( param_id) * point_rate( param_id,extra_add) * param_buff_rate( param_id)
[ [ value, param_max( param_id) ] .min , param_min( param_id) ] .max .to_i
end
def xparam( xparam_id,extra_add=0 )
xp = super ( xparam_id)
case xparam_id
when 1
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_EVA[ self .id ] /10000.0
when 4
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_EVA[ self .id ] /10000.0
when 7
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+1 ] ) *BODY_HP[ self .id ] /10000.0
when 8
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+2 ] ) *MENTAL_MP[ self .id ] /10000.0
end
return xp
end
def use_item( item)
super
if item.id == RESET_ITEM
reset( self .id )
self .hp = [ self .hp ,self .mhp ] .min
self .mp = [ self .mp ,self .mmp ] .min
end
end
end
class Window_Point_Command < Window_Command
include Point_Tree
#--------------------------------------------------------------------------
# ● 初始化指令选择位置(类方法)
#--------------------------------------------------------------------------
def self .init_command_position
@@last_command_symbol = nil
end
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize( actor)
[ url=home.php ?mod=space&uid=95897 ] @actor[ /url] = actor
super ( 0 ,0 )
select_last
end
def actor=( actor)
return if [ url=home.php ?mod=space&uid=95897 ] @actor[ /url] == actor
[ url=home.php ?mod=space&uid=95897 ] @actor[ /url] = actor
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
item_max
end
def get_actor_point( id)
s = $game_variables [ @actor.id* 7 +POINT_VARIABLE+id] .to_s
case id
when 1
return "(" +s+")+" +$temp_body.to_s
when 2
return "(" +s+")+" +$temp_mental.to_s
when 3
return "(" +s+")+" +$temp_str.to_s
when 4
return "(" +s+")+" +$temp_mag.to_s
when 5
return "(" +s+")+" +$temp_har.to_s
when 6
return "(" +s+")+" +$temp_spe.to_s
end
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command( STR_BODY + get_actor_point( 1 ) , :point_body ,add_enabled)
add_command( STR_MENTAL + get_actor_point( 2 ) , :point_mental ,add_enabled)
add_command( STR_STR + get_actor_point( 3 ) , :point_str ,add_enabled)
add_command( STR_MAG + get_actor_point( 4 ) , :point_mag ,add_enabled)
add_command( STR_HAR + get_actor_point( 5 ) , :point_har ,add_enabled)
add_command( STR_SPE + get_actor_point( 6 ) , :point_spe ,add_enabled)
add_command( "确认" , :point_ok )
add_command( "取消" , :point_cancle )
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
#--------------------------------------------------------------------------
# ● 返回最后一个选项的位置
#--------------------------------------------------------------------------
def select_last
select_symbol( @@last_command_symbol)
end
def add_enabled
temp_all < $game_variables [ @actor.id* 7 + POINT_VARIABLE]
end
def update_help
@help_window .set_text ( self .index +1 ) if @help_window
end
end
#帮助窗口
class Window_Point_Help < Window_Base
include Point_Tree
def initialize( )
super ( 0 , 216 , 160 , 200 )
end
def set_text( id)
contents.clear
text = ""
case id
when 1
text = STR_BODY + "影响:\n \\ } " + Vocab::param( 0 ) +"\n (百分之)\n 回合HP再生\n (万分之)"
when 2
text = STR_MENTAL + "影响:\n \\ } " + Vocab::param( 1 ) +"\n (百分之)\n 回合MP再生\n (万分之)"
when 3
text = STR_STR + "影响:\n \\ } " + Vocab::param( 2 ) +"\n (百分之)"
when 4
text = STR_MAG + "影响:\n \\ } " + Vocab::param( 4 ) +"\n (百分之)"
when 5
text = STR_HAR + "影响:\n \\ } " + Vocab::param( 3 ) +"\n " +Vocab::param( 5 )
when 6
text = STR_SPE + "影响:\n \\ } " + Vocab::param( 6 ) +"\n 双回避\n (万分之)"
when 7
text = "\\ }确认此次加点分配"
when 8
text = "\\ }取消此次加点分配"
end
draw_text_ex( 8 , 8 , text)
end
end
#角色状态窗口
class Window_Point_Actor < Window_Base
include Point_Tree
def initialize( actor)
super ( 160 , 0 , Graphics.width - 160 , Graphics.height )
@actor = actor
refresh
end
def actor=( actor)
return if @actor == actor
@actor = actor
refresh
end
def refresh
contents.clear
draw_actor_name( @actor, 2 , 0 )
draw_actor_level( @actor, 102 , line_height * 1 )
draw_actor_class( @actor, 140 , 0 )
draw_actor_face( @actor, 2 , line_height * 1 )
draw_actor_point( 100 ,line_height*2 )
draw_actor_param_point( 8 ,line_height * 5 )
end
def draw_actor_point( x,y)
draw_text( x,y,200 ,line_height," 未分配" +POINT_NAME + ":" + $game_variables [ @actor.id* 7 + POINT_VARIABLE] .to_s )
draw_text( x,y+line_height,200 ,line_height,"此次分配" +POINT_NAME + ":" + temp_all.to_s )
end
def draw_actor_param_point( x,y)
11 .times { |i| actor_param_to_s( x,y,i) }
end
def actor_param_to_s( x,y,param_id)
s1 = ""
s2 = ""
s3 = ""
s4 = ""
case param_id
when 0
s1 = Vocab::param( 0 )
s2 = @actor .param ( 0 ) .to_s
s3 = @actor .param ( 0 ,$temp_body) .to_s
s4 = "成长" + BODY_MHP[ @actor.id ] .to_s
when 1
s1 = Vocab::param( 1 )
s2 = @actor .param ( 1 ) .to_s
s3 = @actor .param ( 1 ,$temp_mental) .to_s
s4 = "成长" + MENTAL_MMP[ @actor.id ] .to_s
when 2
s1 = Vocab::param( 2 )
s2 = @actor .param ( 2 ) .to_s
s3 = @actor .param ( 2 ,$temp_str) .to_s
s4 = "成长" + STR_ATK[ @actor.id ] .to_s
when 3
s1 = Vocab::param( 3 )
s2 = @actor .param ( 3 ) .to_s
s3 = @actor .param ( 3 ,$temp_har) .to_s
s4 = "成长" + HAR_DEF[ @actor.id ] .to_s
when 4
s1 = Vocab::param( 4 )
s2 = @actor .param ( 4 ) .to_s
s3 = @actor .param ( 4 ,$temp_mag) .to_s
s4 = "成长" + MAG_MAT[ @actor.id ] .to_s
when 5
s1 = Vocab::param( 5 )
s2 = @actor .param ( 5 ) .to_s
s3 = @actor .param ( 5 ,$temp_har) .to_s
s4 = "成长" + HAR_MDF[ @actor.id ] .to_s
when 6
s1 = Vocab::param( 6 )
s2 = @actor .param ( 6 ) .to_s
s3 = @actor .param ( 6 ,$temp_spe) .to_s
s4 = "成长" + SPE_AGI[ @actor.id ] .to_s
when 7
s1 = "物理闪避"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 1 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 1 ,$temp_spe) *100 )
s4 = "成长" + SPE_EVA[ @actor.id ] .to_s
when 8
s1 = "魔法闪避"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 4 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 4 ,$temp_spe) *100 )
s4 = "成长" + SPE_EVA[ @actor.id ] .to_s
when 9
s1 = "HP恢复"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 7 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 7 ,$temp_body) *100 )
s4 = "成长" + BODY_HP[ @actor.id ] .to_s
when 10
s1 = "MP恢复"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 8 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 8 ,$temp_mental) *100 )
s4 = "成长" + MENTAL_MP[ @actor.id ] .to_s
end
change_color( system_color)
draw_text( x,y+line_height*param_id,100 ,line_height,s1)
change_color( normal_color)
s2+= " →"
draw_text( x+82 ,y+line_height*param_id,120 ,line_height,s2,2 )
change_color( system_color)
draw_text( x+150 ,y+line_height*param_id,100 ,line_height,s3,2 )
change_color( normal_color)
contents.font .size = 16
draw_text( x+266 ,y+line_height*param_id,100 ,line_height,s4)
contents.font .size = 24
end
end
class Scene_Point < Scene_Base
include Point_Tree
def start
super
create_background
@actor = $game_party .menu_actor
create_command_window
create_status_window
create_help_window
end
def terminate
super
dispose_background
end
def create_background
@background_sprite = Sprite.new
@background_sprite .bitmap = SceneManager.background_bitmap
@background_sprite .color .set ( 16 , 16 , 16 , 128 )
end
def dispose_background
@background_sprite .dispose
end
def create_command_window
@command_window = Window_Point_Command.new ( @actor)
@command_window .set_handler ( :cancel , method( :return_scene ) )
@command_window .set_handler ( :pagedown , method( :next_actor ) )
@command_window .set_handler ( :pageup , method( :prev_actor ) )
@command_window .set_handler ( :point_body , method( :add_body ) )
@command_window .set_handler ( :point_mental ,method( :add_mental ) )
@command_window .set_handler ( :point_str , method( :add_str ) )
@command_window .set_handler ( :point_mag , method( :add_mag ) )
@command_window .set_handler ( :point_har , method( :add_har ) )
@command_window .set_handler ( :point_spe , method( :add_spe ) )
@command_window .set_handler ( :point_ok , method( :add_ok ) )
@command_window .set_handler ( :point_cancle ,method( :add_cancle ) )
end
def return_scene
add_cancle
SceneManager.return
end
def create_status_window
@status_window = Window_Point_Actor.new ( @actor)
end
def create_help_window
@help_window = Window_Point_Help.new
@help_window .viewport = @viewport
@command_window .help_window = @help_window
@command_window .activate
end
def add_body
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE] #or $game_variables[@actor.id*7 + POINT_VARIABLE] == 0
@command_window .activate
return
end
$temp_body += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_mental
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_mental += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_str
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_str += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_mag
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_mag += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_har
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_har += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_spe
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_spe += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_ok
$game_variables [ @actor.id* 7 + POINT_VARIABLE+1 ] += $temp_body
$game_variables [ @actor.id* 7 + POINT_VARIABLE+2 ] += $temp_mental
$game_variables [ @actor.id* 7 + POINT_VARIABLE+3 ] += $temp_str
$game_variables [ @actor.id* 7 + POINT_VARIABLE+4 ] += $temp_mag
$game_variables [ @actor.id* 7 + POINT_VARIABLE+5 ] += $temp_har
$game_variables [ @actor.id* 7 + POINT_VARIABLE+6 ] += $temp_spe
$game_variables [ @actor.id* 7 + POINT_VARIABLE] -= temp_all
add_cancle
end
def add_cancle
$temp_body = 0
$temp_mental = 0
$temp_str = 0
$temp_mag = 0
$temp_har = 0
$temp_spe = 0
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def next_actor
@actor = $game_party .menu_actor_next
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换到上一个角色
#--------------------------------------------------------------------------
def prev_actor
@actor = $game_party .menu_actor_prev
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@status_window .actor = @actor
@command_window .actor = @actor
@command_window .activate
end
end
class Window_MenuCommand < Window_Command
alias add_original_commands_old add_original_commands
def add_original_commands
add_original_commands_old
add_command( Point_Tree::ADDPOINT , :addpoint )
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_old create_command_window
def create_command_window
create_command_window_old
@command_window .set_handler ( :addpoint ,method( :add_point ) )
end
def add_point
@status_window .select_last
@status_window .activate
@status_window .set_handler ( :ok , method( :on_ok ) )
@status_window .set_handler ( :cancel , method( :on_personal_cancel ) )
end
def on_ok
SceneManager.call ( Scene_Point)
Window_Point_Command::init_command_position
end
end
class Window_Status < Window_Selectable
include Point_Tree
alias draw_parameters_old draw_parameters
def draw_parameters( x, y)
draw_parameters_old( x,y)
draw_point( x,y)
end
def draw_point( x,y)
for i in 0 ..5
change_color( system_color)
draw_text( x+100 , y+ line_height * i, 80 , line_height, STR_ALL[ i] )
change_color( normal_color)
draw_text( x+180 , y+ line_height * i, 36 , line_height,$game_variables[ @actor.id* 7 +POINT_VARIABLE+i+1 ] , 2 )
end
end
end
class Window_Base < Window
def draw_actor_param( actor, x, y, param_id)
change_color( system_color)
draw_text( x-30 , y, 80 , line_height, Vocab::param( param_id) )
change_color( normal_color)
draw_text( x+ 50 , y, 36 , line_height, actor.param ( param_id) , 2 )
end
end
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == Point_Tree::RESET_ITEM
return true
end
user.usable ?( item) && item_effects_valid?
end
end
#encoding:utf-8
#=============================================================================
#-----------------RMVA加点系统-v1.00---By:救世小树--------转载请注明出处-------
#=============================================================================
module Point_Tree
POINT_VARIABLE = 33
#储存属性点的变量编号是33+角色id*7,
#即40号变量为一号角色自由点;41号为体力点;42号为精神点;
#43号为力量点;44号为魔力点;45号为韧性点;46号为灵活点。
LEVEL_UP_POINT = 3
#每升一级属性点增加数
RESET_ITEM = 20 #洗点水编号
#每一种点的称呼
STR_BODY = "体力"
STR_MENTAL = "精神"
STR_STR = "力量"
STR_MAG = "魔力"
STR_HAR = "韧性"
STR_SPE = "灵活"
STR_ALL = [ STR_BODY,STR_MENTAL,STR_STR,STR_MAG,STR_HAR,STR_SPE]
#菜单项名称
ADDPOINT = "加点"
POINT_NAME = "属性点"
BODY_MHP = [ 0 ,
2.0 ,2.6 ,4.2 ,2.3 ,3.5 , 10 ,10 ,10 ,10 ,10 ]
#第一个0请无视,第二个2.0即1号角色对应的增加一点体力时MHP增加百分数
#即一号角色MHP=原MHP*(1+2.0*一号角色体力点)
BODY_HP = [ 0 ,
2 ,5 ,8 ,3 ,7 , 10 ,10 ,10 ,10 ,10 ]
#各角色每增加一点体力HP恢复率增加值(万分率)
MENTAL_MMP = [ 0 ,
4.4 ,3.9 ,2.6 ,4.2 ,3.5 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点精神MMP增加百分数
MENTAL_MP = [ 0 ,
12 ,10 ,7 ,9 ,7 , 10 ,10 ,10 ,10 ,10 ]
#各角色每增加一点精神MP恢复率增加值(万分率)
STR_ATK = [ 0 ,
1.0 ,1.6 ,3.7 ,1.2 ,3.0 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点力量物理攻击增加百分数
MAG_MAT = [ 0 ,
3.6 ,3.9 ,2.2 ,3.8 ,3.0 , 7 ,7 ,7 ,7 ,7 ]
#各角色每增加一点魔力魔法攻击增加百分数
HAR_DEF = [ 0 ,
0 ,2 ,5 ,2 ,4 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点韧性物理防御增加点数
HAR_MDF = [ 0 ,
7 ,5 ,5 ,6 ,4 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点韧性魔法防御增加点数
SPE_AGI = [ 0 ,
3 ,2 ,2 ,4 ,2 , 3 ,3 ,3 ,3 ,3 ]
#各角色每增加一点灵活敏捷增加点数
SPE_EVA = [ 0 ,
10 ,6 ,4 ,15 ,7 , 2 ,2 ,2 ,2 ,2 ]
#各角色每增加一点灵活物理魔法闪避增加点数(万分率)
def reset( actor_id)
for i in 1 ..6
$game_variables [ actor_id*7 + POINT_VARIABLE] +=$game_variables[ actor_id*7 + POINT_VARIABLE+i]
$game_variables [ actor_id*7 + POINT_VARIABLE+i] =0
end
end
def temp_all
return $temp_body +$temp_mental+$temp_str+$temp_mag+$temp_har+$temp_spe
end
end
$temp_body = 0
$temp_mental = 0
$temp_str = 0
$temp_mag = 0
$temp_har = 0
$temp_spe = 0
class Game_Actor < Game_Battler
include Point_Tree
alias level_up_tre level_up
def level_up
level_up_tre
@hp += mhp
@mp += mmp
$game_variables [ self .id* 7 + POINT_VARIABLE] += LEVEL_UP_POINT
end
def point_plus( param_id,extra_add = 0 )
case param_id
when 3
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+5 ] ) *HAR_DEF[ self .id ]
when 5
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+5 ] ) *HAR_MDF[ self .id ]
when 6
return ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_AGI[ self .id ]
end
return 0
end
def point_rate( param_id,extra_add=0 )
case param_id
when 0
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+1 ] ) *BODY_MHP[ self .id ] /100.0 )
when 1
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+2 ] ) *MENTAL_MMP[ self .id ] /100.0 )
when 2
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+3 ] ) *STR_ATK[ self .id ] /100.0 )
when 4
return 1 +( ( extra_add+$game_variables[ self .id* 7 +POINT_VARIABLE+4 ] ) *MAG_MAT[ self .id ] /100.0 )
end
return 1
end
alias point_base_param param
def param( param_id,extra_add = 0 )
value = param_base( param_id) + param_plus( param_id) + point_plus( param_id,extra_add)
value *= param_rate( param_id) * point_rate( param_id,extra_add) * param_buff_rate( param_id)
[ [ value, param_max( param_id) ] .min , param_min( param_id) ] .max .to_i
end
def xparam( xparam_id,extra_add=0 )
xp = super ( xparam_id)
case xparam_id
when 1
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_EVA[ self .id ] /10000.0
when 4
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+6 ] ) *SPE_EVA[ self .id ] /10000.0
when 7
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+1 ] ) *BODY_HP[ self .id ] /10000.0
when 8
return xp + ( extra_add+$game_variables[ self .id* 7 + POINT_VARIABLE+2 ] ) *MENTAL_MP[ self .id ] /10000.0
end
return xp
end
def use_item( item)
super
if item.id == RESET_ITEM
reset( self .id )
self .hp = [ self .hp ,self .mhp ] .min
self .mp = [ self .mp ,self .mmp ] .min
end
end
end
class Window_Point_Command < Window_Command
include Point_Tree
#--------------------------------------------------------------------------
# ● 初始化指令选择位置(类方法)
#--------------------------------------------------------------------------
def self .init_command_position
@@last_command_symbol = nil
end
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize( actor)
[ url=home.php ?mod=space&uid=95897 ] @actor[ /url] = actor
super ( 0 ,0 )
select_last
end
def actor=( actor)
return if [ url=home.php ?mod=space&uid=95897 ] @actor[ /url] == actor
[ url=home.php ?mod=space&uid=95897 ] @actor[ /url] = actor
refresh
end
#--------------------------------------------------------------------------
# ● 获取窗口的宽度
#--------------------------------------------------------------------------
def window_width
return 160
end
#--------------------------------------------------------------------------
# ● 获取显示行数
#--------------------------------------------------------------------------
def visible_line_number
item_max
end
def get_actor_point( id)
s = $game_variables [ @actor.id* 7 +POINT_VARIABLE+id] .to_s
case id
when 1
return "(" +s+")+" +$temp_body.to_s
when 2
return "(" +s+")+" +$temp_mental.to_s
when 3
return "(" +s+")+" +$temp_str.to_s
when 4
return "(" +s+")+" +$temp_mag.to_s
when 5
return "(" +s+")+" +$temp_har.to_s
when 6
return "(" +s+")+" +$temp_spe.to_s
end
end
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
add_command( STR_BODY + get_actor_point( 1 ) , :point_body ,add_enabled)
add_command( STR_MENTAL + get_actor_point( 2 ) , :point_mental ,add_enabled)
add_command( STR_STR + get_actor_point( 3 ) , :point_str ,add_enabled)
add_command( STR_MAG + get_actor_point( 4 ) , :point_mag ,add_enabled)
add_command( STR_HAR + get_actor_point( 5 ) , :point_har ,add_enabled)
add_command( STR_SPE + get_actor_point( 6 ) , :point_spe ,add_enabled)
add_command( "确认" , :point_ok )
add_command( "取消" , :point_cancle )
end
#--------------------------------------------------------------------------
# ● 按下确定键时的处理
#--------------------------------------------------------------------------
def process_ok
@@last_command_symbol = current_symbol
super
end
#--------------------------------------------------------------------------
# ● 返回最后一个选项的位置
#--------------------------------------------------------------------------
def select_last
select_symbol( @@last_command_symbol)
end
def add_enabled
temp_all < $game_variables [ @actor.id* 7 + POINT_VARIABLE]
end
def update_help
@help_window .set_text ( self .index +1 ) if @help_window
end
end
#帮助窗口
class Window_Point_Help < Window_Base
include Point_Tree
def initialize( )
super ( 0 , 216 , 160 , 200 )
end
def set_text( id)
contents.clear
text = ""
case id
when 1
text = STR_BODY + "影响:\n \\ } " + Vocab::param( 0 ) +"\n (百分之)\n 回合HP再生\n (万分之)"
when 2
text = STR_MENTAL + "影响:\n \\ } " + Vocab::param( 1 ) +"\n (百分之)\n 回合MP再生\n (万分之)"
when 3
text = STR_STR + "影响:\n \\ } " + Vocab::param( 2 ) +"\n (百分之)"
when 4
text = STR_MAG + "影响:\n \\ } " + Vocab::param( 4 ) +"\n (百分之)"
when 5
text = STR_HAR + "影响:\n \\ } " + Vocab::param( 3 ) +"\n " +Vocab::param( 5 )
when 6
text = STR_SPE + "影响:\n \\ } " + Vocab::param( 6 ) +"\n 双回避\n (万分之)"
when 7
text = "\\ }确认此次加点分配"
when 8
text = "\\ }取消此次加点分配"
end
draw_text_ex( 8 , 8 , text)
end
end
#角色状态窗口
class Window_Point_Actor < Window_Base
include Point_Tree
def initialize( actor)
super ( 160 , 0 , Graphics.width - 160 , Graphics.height )
@actor = actor
refresh
end
def actor=( actor)
return if @actor == actor
@actor = actor
refresh
end
def refresh
contents.clear
draw_actor_name( @actor, 2 , 0 )
draw_actor_level( @actor, 102 , line_height * 1 )
draw_actor_class( @actor, 140 , 0 )
draw_actor_face( @actor, 2 , line_height * 1 )
draw_actor_point( 100 ,line_height*2 )
draw_actor_param_point( 8 ,line_height * 5 )
end
def draw_actor_point( x,y)
draw_text( x,y,200 ,line_height," 未分配" +POINT_NAME + ":" + $game_variables [ @actor.id* 7 + POINT_VARIABLE] .to_s )
draw_text( x,y+line_height,200 ,line_height,"此次分配" +POINT_NAME + ":" + temp_all.to_s )
end
def draw_actor_param_point( x,y)
11 .times { |i| actor_param_to_s( x,y,i) }
end
def actor_param_to_s( x,y,param_id)
s1 = ""
s2 = ""
s3 = ""
s4 = ""
case param_id
when 0
s1 = Vocab::param( 0 )
s2 = @actor .param ( 0 ) .to_s
s3 = @actor .param ( 0 ,$temp_body) .to_s
s4 = "成长" + BODY_MHP[ @actor.id ] .to_s
when 1
s1 = Vocab::param( 1 )
s2 = @actor .param ( 1 ) .to_s
s3 = @actor .param ( 1 ,$temp_mental) .to_s
s4 = "成长" + MENTAL_MMP[ @actor.id ] .to_s
when 2
s1 = Vocab::param( 2 )
s2 = @actor .param ( 2 ) .to_s
s3 = @actor .param ( 2 ,$temp_str) .to_s
s4 = "成长" + STR_ATK[ @actor.id ] .to_s
when 3
s1 = Vocab::param( 3 )
s2 = @actor .param ( 3 ) .to_s
s3 = @actor .param ( 3 ,$temp_har) .to_s
s4 = "成长" + HAR_DEF[ @actor.id ] .to_s
when 4
s1 = Vocab::param( 4 )
s2 = @actor .param ( 4 ) .to_s
s3 = @actor .param ( 4 ,$temp_mag) .to_s
s4 = "成长" + MAG_MAT[ @actor.id ] .to_s
when 5
s1 = Vocab::param( 5 )
s2 = @actor .param ( 5 ) .to_s
s3 = @actor .param ( 5 ,$temp_har) .to_s
s4 = "成长" + HAR_MDF[ @actor.id ] .to_s
when 6
s1 = Vocab::param( 6 )
s2 = @actor .param ( 6 ) .to_s
s3 = @actor .param ( 6 ,$temp_spe) .to_s
s4 = "成长" + SPE_AGI[ @actor.id ] .to_s
when 7
s1 = "物理闪避"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 1 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 1 ,$temp_spe) *100 )
s4 = "成长" + SPE_EVA[ @actor.id ] .to_s
when 8
s1 = "魔法闪避"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 4 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 4 ,$temp_spe) *100 )
s4 = "成长" + SPE_EVA[ @actor.id ] .to_s
when 9
s1 = "HP恢复"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 7 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 7 ,$temp_body) *100 )
s4 = "成长" + BODY_HP[ @actor.id ] .to_s
when 10
s1 = "MP恢复"
s2 = sprintf ( "%02.1f%%" ,@actor.xparam ( 8 ) *100 )
s3 = sprintf ( "%02.1f%%" ,@actor.xparam ( 8 ,$temp_mental) *100 )
s4 = "成长" + MENTAL_MP[ @actor.id ] .to_s
end
change_color( system_color)
draw_text( x,y+line_height*param_id,100 ,line_height,s1)
change_color( normal_color)
s2+= " →"
draw_text( x+82 ,y+line_height*param_id,120 ,line_height,s2,2 )
change_color( system_color)
draw_text( x+150 ,y+line_height*param_id,100 ,line_height,s3,2 )
change_color( normal_color)
contents.font .size = 16
draw_text( x+266 ,y+line_height*param_id,100 ,line_height,s4)
contents.font .size = 24
end
end
class Scene_Point < Scene_Base
include Point_Tree
def start
super
create_background
@actor = $game_party .menu_actor
create_command_window
create_status_window
create_help_window
end
def terminate
super
dispose_background
end
def create_background
@background_sprite = Sprite.new
@background_sprite .bitmap = SceneManager.background_bitmap
@background_sprite .color .set ( 16 , 16 , 16 , 128 )
end
def dispose_background
@background_sprite .dispose
end
def create_command_window
@command_window = Window_Point_Command.new ( @actor)
@command_window .set_handler ( :cancel , method( :return_scene ) )
@command_window .set_handler ( :pagedown , method( :next_actor ) )
@command_window .set_handler ( :pageup , method( :prev_actor ) )
@command_window .set_handler ( :point_body , method( :add_body ) )
@command_window .set_handler ( :point_mental ,method( :add_mental ) )
@command_window .set_handler ( :point_str , method( :add_str ) )
@command_window .set_handler ( :point_mag , method( :add_mag ) )
@command_window .set_handler ( :point_har , method( :add_har ) )
@command_window .set_handler ( :point_spe , method( :add_spe ) )
@command_window .set_handler ( :point_ok , method( :add_ok ) )
@command_window .set_handler ( :point_cancle ,method( :add_cancle ) )
end
def return_scene
add_cancle
SceneManager.return
end
def create_status_window
@status_window = Window_Point_Actor.new ( @actor)
end
def create_help_window
@help_window = Window_Point_Help.new
@help_window .viewport = @viewport
@command_window .help_window = @help_window
@command_window .activate
end
def add_body
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE] #or $game_variables[@actor.id*7 + POINT_VARIABLE] == 0
@command_window .activate
return
end
$temp_body += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_mental
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_mental += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_str
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_str += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_mag
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_mag += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_har
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_har += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_spe
if temp_all >= $game_variables [ @actor.id* 7 + POINT_VARIABLE]
@command_window .activate
return
end
$temp_spe += 1
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def add_ok
$game_variables [ @actor.id* 7 + POINT_VARIABLE+1 ] += $temp_body
$game_variables [ @actor.id* 7 + POINT_VARIABLE+2 ] += $temp_mental
$game_variables [ @actor.id* 7 + POINT_VARIABLE+3 ] += $temp_str
$game_variables [ @actor.id* 7 + POINT_VARIABLE+4 ] += $temp_mag
$game_variables [ @actor.id* 7 + POINT_VARIABLE+5 ] += $temp_har
$game_variables [ @actor.id* 7 + POINT_VARIABLE+6 ] += $temp_spe
$game_variables [ @actor.id* 7 + POINT_VARIABLE] -= temp_all
add_cancle
end
def add_cancle
$temp_body = 0
$temp_mental = 0
$temp_str = 0
$temp_mag = 0
$temp_har = 0
$temp_spe = 0
@status_window .refresh
@command_window .refresh
@command_window .activate
end
def next_actor
@actor = $game_party .menu_actor_next
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换到上一个角色
#--------------------------------------------------------------------------
def prev_actor
@actor = $game_party .menu_actor_prev
on_actor_change
end
#--------------------------------------------------------------------------
# ● 切换角色
#--------------------------------------------------------------------------
def on_actor_change
@status_window .actor = @actor
@command_window .actor = @actor
@command_window .activate
end
end
class Window_MenuCommand < Window_Command
alias add_original_commands_old add_original_commands
def add_original_commands
add_original_commands_old
add_command( Point_Tree::ADDPOINT , :addpoint )
end
end
class Scene_Menu < Scene_MenuBase
alias create_command_window_old create_command_window
def create_command_window
create_command_window_old
@command_window .set_handler ( :addpoint ,method( :add_point ) )
end
def add_point
@status_window .select_last
@status_window .activate
@status_window .set_handler ( :ok , method( :on_ok ) )
@status_window .set_handler ( :cancel , method( :on_personal_cancel ) )
end
def on_ok
SceneManager.call ( Scene_Point)
Window_Point_Command::init_command_position
end
end
class Window_Status < Window_Selectable
include Point_Tree
alias draw_parameters_old draw_parameters
def draw_parameters( x, y)
draw_parameters_old( x,y)
draw_point( x,y)
end
def draw_point( x,y)
for i in 0 ..5
change_color( system_color)
draw_text( x+100 , y+ line_height * i, 80 , line_height, STR_ALL[ i] )
change_color( normal_color)
draw_text( x+180 , y+ line_height * i, 36 , line_height,$game_variables[ @actor.id* 7 +POINT_VARIABLE+i+1 ] , 2 )
end
end
end
class Window_Base < Window
def draw_actor_param( actor, x, y, param_id)
change_color( system_color)
draw_text( x-30 , y, 80 , line_height, Vocab::param( param_id) )
change_color( normal_color)
draw_text( x+ 50 , y, 36 , line_height, actor.param ( param_id) , 2 )
end
end
class Scene_ItemBase < Scene_MenuBase
def item_usable?
if item.id == Point_Tree::RESET_ITEM
return true
end
user.usable ?( item) && item_effects_valid?
end
end
白字卖萌
感谢支持
评分
查看全部评分