=begin
# 宠物系统-无限生成宠物
# 作者:66RPG的tan12345
# 使用方法:
# 1.正常入队(指定ID:actor_id):
# $game_party.tan_add_actor(actor_id)
# 2.正常入队(初始化人物,建议少用)(指定ID:actor_id):
# $game_party.tan_add_actor(actor_id,false,true)
# 3.副本入队(将ID为actor_id的人物以副本的形式加入队伍,强制初始化):
# $game_party.tan_add_actor(actor_id,true)
# 4.正常离队(指定ID:actor_id):
# $game_party.tan_remove_actor(actor_id)
# 5.离队后删除副本(指定ID:actor_id,
# 该方法会将指定ID的人物清除掉,如果不能确定宠物是否副本生成的,请慎用):
# $game_party.tan_remove_actor(actor_id,true)
=end
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● 寻找空位
#--------------------------------------------------------------------------
def get_nil_actorid
for i in 1..$data_actors.size
return i if $data_actors[i] == nil
end
end
#--------------------------------------------------------------------------
# ● 无限生成专用的队员管理-入队
# a参数代表加入队伍的是否模版
# b参数代表是否需要初始化
# a为true时(加入的是模版)b也必须为true(初始化)
#--------------------------------------------------------------------------
def tan_add_actor(actor_id,a = false,b = false)
if a#加入的是模板
new_actor_id = get_nil_actorid
$data_actors[new_actor_id] = $data_actors[actor_id]
$game_actors[new_actor_id].setup(new_actor_id)
add_actor(new_actor_id)
else#正常加入
$game_actors[actor_id].setup(actor_id) if b
add_actor(actor_id)
end
end
#--------------------------------------------------------------------------
# ● 无限生成专用的队员管理-离队
# a参数代表是否需要清空离队人物(宠物)的数据
#--------------------------------------------------------------------------
def tan_remove_actor(actor_id,a = false)
if a#清除数据
remove_actor(actor_id)
$data_actors[actor_id] = nil
else#普通离队
remove_actor(actor_id)
end
end
end
#--------------------------------------------------------------------------
# ● 重写存档读档,保证新生成的数据存在。
#--------------------------------------------------------------------------
module DataManager
#--------------------------------------------------------------------------
# ● 生成存档内容
#--------------------------------------------------------------------------
def self.make_save_contents
contents = {}
contents[:system] = $game_system
contents[:timer] = $game_timer
contents[:message] = $game_message
contents[:switches] = $game_switches
contents[:variables] = $game_variables
contents[:self_switches] = $game_self_switches
contents[:actors] = $game_actors
contents[:party] = $game_party
contents[:troop] = $game_troop
contents[:map] = $game_map
contents[:player] = $game_player
contents[:weapons] = $data_weapons
contents[:armors] = $data_armors
###########################################
contents[:pactors] = $data_actors
###########################################
contents
end
#--------------------------------------------------------------------------
# ● 展开存档内容
#--------------------------------------------------------------------------
def self.extract_save_contents(contents)
$game_system = contents[:system]
$game_timer = contents[:timer]
$game_message = contents[:message]
$game_switches = contents[:switches]
$game_variables = contents[:variables]
$game_self_switches = contents[:self_switches]
$game_actors = contents[:actors]
$game_party = contents[:party]
$game_troop = contents[:troop]
$game_map = contents[:map]
$game_player = contents[:player]
$data_weapons = contents[:weapons]
$data_armors = contents[:armors]
###########################################
$data_actors = contents[:pactors]
###########################################
end
end