Files
wsmud/world/map/yz/leitai/biwu2.js
2026-05-26 16:41:20 +08:00

85 lines
3.1 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
this.inherits(ROOM);
this.name = "擂台"
this.desc = "你正站在一个白玉汉石砌成方圆数十丈的大擂台上面,擂台下面的观众声嘶力竭的呐喊助威,加油!加油!加油!加油!加油!加油!";
this.exits = { "down": "yz/leitai/ltx" };
this.max_item_count = 1;
this.no_save = true;
this.add_action("fight", null, function (me) { return me.notify("你正在比试。") });
this.add_action("kill", null, function (me) { return me.notify("你正在比试。") });
this.add_action("dazuo", null, function (me) { return me.notify("你正在比试。") });
this.add_action("liaoshang", null, function (me) { return me.notify("你正在比试。") });
this.add_action("relive", null, function (me) { return me.notify("你正在比试。") });
this.start_time = 0;
this.on_enter = function (me) {
if (!me.is_player) return;
me.die = challenge_over;
this.start_time = Date.now();
me.call_interval(x => {
me.send_message("\n<hic>挑战还有" + (10 - x) + "秒钟正式开始!</hic>", true);
},
1000,
10,
function () {
npc.do_kill(me);
}
);
}
this.on_heart_beat = function (dt) {
if (this.start_time) {
if (dt - this.start_time >= 300000) {
this.start_time = 0;
if (!this.items.length) {
return;
}
if (this.items.length == 1) {
var obj = this.items[0];
if (obj.is_player) {
obj.moveto(obj.query_temp("enter_room"), null, obj.name + "走了进来。", "endfight");
obj.notify("<yel>你挑战失败。</yel>");
} else {
this.items.length = 0;
obj.environment = null;
}
return;
}
var player = null;
for (var i = 0; i < this.items.length; i++) {
if (this.items[i].is_player) {
player = this.items[i];
} else {
this.items[i].environment = null;
}
}
if (player) {
player.moveto(player.query_temp("enter_room"), null, player.name + "走了进来。", "endfight");
player.notify("<yel>你挑战超时,自动离开擂台。</yel>");
}
this.items.length = 0;
}
}
}
function challenge_over(killer) {
if (this.environment.items.length != 2) {
return this.send("比武出现问题,请练习管理解决。");;
}
var p1 = this.environment.items[0];
var p2 = this.environment.items[1];
if (!p1.is_player||!p2.is_player) {
return this.send("比武出现问题,请练习管理解决。");;
}
this.die = USER.prototype.die;
killer.die = USER.prototype.die;
this.send_room("<hic>比武结束," + killer.name + "获得胜利5秒钟后将离开擂台。</hic>");
killer.send("<hig>恭喜你获得胜利,积分+1目前积分</hig>");
this.call_out(move_out, 5000);
}
function move_out() {
}
this.on_leave = function (me, dir) {
return me.notify_fail("你比试完才可以下擂台。");
}