// laechan 2024/10/25
// boss房兼控制房
inherit ROOM;
void create()
{
::create();
seteuid(getuid(this_object()));
set("light",1);
set("short",YEL"Ψ"HIY"零落的王墓─最深處的房間"NOR+YEL"Ψ"NOR);
set("long",@LONG
LONG
);
set("pre_clean",1);
}
static mixed replicas;
static object times_check,frieren,spiegel; // ,laechan
int random_sort(objetc ob1,object ob2)
{
return -1+random(3);
}
// 任何人進入第二張及第三張地圖時皆呼叫
int times_check(string names,string files,mixed tmps)
{
int t=time(),s;
object replica;
string str;
if(!times_check)
if(catch(times_check=find_object_or_load("/open/cmds/times_check")))
return 1;
// 配置芙莉蓮
if(!frieren && !query("frieren"))
{
frieren=clone_object(__DIR__"mob/frieren1");
frieren->move(__DIR__"352");
set("frieren",t);
}
// 配置水鏡的惡魔
if(!spiegel && !query("spiegel"))
{
spiegel=clone_object(__DIR__"mob/spiegel1");
spiegel->move(this_object());
set("spiegel",t);
}
if(!replicas)
replicas=({});
replicas-=({0});
s=sizeof(replicas);
// 複製體不在時,初始化
// if(s<5)
if(s<1 && sizeof(users())>30)
{
mixed usr=({});
object replica,ppl;
int i;
foreach(ppl in users())
if(ppl)
if(environment(ppl) && interactive(ppl) &&
ppl->query("pri_guild"))
if(count_damage(ppl)>9999999)
usr+=({ppl});
usr=sort_array|(usr,(: random_sort :));
replicas-=({0});
s=0;
while(sizeof(replicas)<5 && s<30)
{
ppl=usr[s];
s++;
i=0;
foreach(replica in replicas)
if(replica)
if(replica->id(ppl->query("name")))
i=1;
// 已經有這個複製體時就跳過
if(i>0) continue;
if(catch(replica=clone_object(__DIR__"replica"))) return 1;
replica->set("pri_guild",ppl->query("pri_guild"));
replica->set("level",ppl->query("level"));
replica->set("gender",ppl->query("gender"));
replica->set("race",ppl->query("race"));
replica->set("chi_name",ppl->query("chi_name"));
replica->add("id",({str+"'s replica","replica"}));
replica->set("short",replica->query("chi_name")+HIP"的複製體"HIW+
"(capitalize(str)+"'s replica)"NOR);
replica->set("long","/adm/daemons/look_d"->living_description(ppl));
replica->move(this_object());
replicas+=({replica});
// 複製體隨機配置到區域
replica->move(__DIR__+(101+random(353-101)));
}
}
// call times_check 定時判斷
// 不寫入 times_check 週期判斷,純粹使用它的週期呼叫
// 輔助判斷則是玩家進入第二層及第三層的 call times_check
times_check->set_temp_times_check(names,files,tmps,30);
return 1;
}