Commit d34786cd authored by nanahira's avatar nanahira

add 2018.7 death rule

parent a054e678
......@@ -20,6 +20,7 @@
* 0 正常加时赛规则
* 1 YGOCore战队联盟第十二届联赛使用规则
* 2 正常加时赛规则 + 1胜规则
* 3 2018年7月适用的OCG/TCG加时赛规则
### 不支持功能
* 在线聊天室
......
......@@ -96,6 +96,7 @@
"cannot_to_observer": "Spectating is not allowed in a matchup.",
"death_cancel": "Over-match has been canceled from this game.",
"death_start": "Over-time match has begun, player with higher LP will win the single game after 4 turns.",
"death_start_phase": "Over-time match has begun, player with higher LP will win the single game after each phase ends.",
"death_start_siding": "Extra time match starts, player with higher LP will win the single game after 4 turns.",
"death_start_quick": "Extra time match starts, you are getting into sudden-death match next round. The Duel continues until the first change in LP happens.",
"death_start_final": "You are getting into sudden-death match, the Duel continues until the first change in LP happens.",
......@@ -362,13 +363,14 @@
"cannot_to_observer": "匹配模式中决斗者不允许观战。",
"death_cancel": "已取消本房间的加时赛状态。",
"death_start": "加时赛开始,从本回合开始计算4回合,基本分高的玩家获得本次决斗的胜利。",
"death_start_phase": "加时赛开始,在阶段结束时,基本分高的玩家获得本次决斗的胜利。",
"death_start_siding": "加时赛开始,下次决斗的第4回合结束时,基本分高的玩家决斗胜利。",
"death_start_quick": "加时赛开始,下次决斗将进入猝死赛,基本分发生变动的回合结束时将决出胜负。",
"death_start_final": "本次决斗将进入猝死赛,基本分发生变动的回合结束时,基本分高的玩家将获得本次决斗的胜利。",
"death_start_extra": "本次决斗为额外决斗,第4回合结束时,基本分高的玩家获得本次决斗的胜利。",
"death_remain_part1": "本次决斗将在",
"death_remain_part2": "回合后结束,基本分高的玩家将获得本次决斗的胜利。",
"death_remain_final": "若本回合基本分发生变动,在该回合结束时决斗即告结束,生命值多的玩家获得本场决斗的胜利。",
"death_remain_final": "若本回合基本分发生变动,在该回合结束时决斗即告结束,基本分高的玩家获得本场决斗的胜利。",
"death_finish_part1": "加时赛决斗结束,恭喜 ",
"death_finish_part2": " 获得本次决斗的胜利。",
"death2_finish_part1": "加时赛结束,恭喜 ",
......
......@@ -1405,7 +1405,7 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
if ygopro.constants.MSG[msg] == 'NEW_TURN'
if client.pos == 0
room.turn = room.turn + 1
if room.death
if room.death and room.death != -2
if room.turn >= room.death
oppo_pos = if room.hostinfo.mode == 2 then 2 else 1
if room.dueling_players[0].lp != room.dueling_players[oppo_pos].lp and room.turn > 1
......@@ -1427,6 +1427,20 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
client.surrend_confirm = false
ygopro.stoc_send_chat(client, "${surrender_canceled}", ygopro.constants.COLORS.BABYBLUE)
if ygopro.constants.MSG[msg] == 'NEW_PHASE'
phase = buffer.readInt16LE(1)
oppo_pos = if room.hostinfo.mode == 2 then 2 else 1
if client.pos == 0 and room.death == -2 and not (phase == 0x1 and room.turn < 2) and room.dueling_players[0].lp != room.dueling_players[oppo_pos].lp
win_pos = if room.dueling_players[0].lp > room.dueling_players[oppo_pos].lp then 0 else oppo_pos
ygopro.stoc_send_chat_to_room(room, "${death_finish_part1}" + room.dueling_players[win_pos].name + "${death_finish_part2}", ygopro.constants.COLORS.BABYBLUE)
if room.hostinfo.mode == 2
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos], 'DUEL_END')
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos + 1], 'DUEL_END')
room.dueling_players[oppo_pos - win_pos].destroy()
room.dueling_players[oppo_pos - win_pos + 1].destroy()
else
ygopro.ctos_send(room.dueling_players[oppo_pos - win_pos].server, 'SURRENDER')
if ygopro.constants.MSG[msg] == 'WIN' and client.pos == 0
pos = buffer.readUInt8(1)
pos = 1 - pos unless client.is_first or pos == 2
......@@ -1441,7 +1455,7 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
#log.info room.dueling_players, pos
room.scores[room.winner_name] = room.scores[room.winner_name] + 1
if room.death
if settings.modules.http.quick_death_rule == 1
if settings.modules.http.quick_death_rule == 1 or settings.modules.http.quick_death_rule == 3
room.death = -1
else
room.death = 5
......@@ -1908,7 +1922,7 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
client.side_interval = null
client.side_tcount = null
oppo_pos = if room.hostinfo.mode == 2 then 2 else 1
if settings.modules.http.quick_death_rule == 2 and room.started and room.death and room.scores[room.dueling_players[0].name] != room.scores[room.dueling_players[oppo_pos].name]
if settings.modules.http.quick_death_rule >= 2 and room.started and room.death and room.scores[room.dueling_players[0].name] != room.scores[room.dueling_players[oppo_pos].name]
win_pos = if room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[oppo_pos].name] then 0 else oppo_pos
ygopro.stoc_send_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE)
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos], 'DUEL_END')
......@@ -2319,16 +2333,25 @@ if settings.modules.http
death_room_found = false
for room in ROOM_all when room and room.established and room.started and !room.death and (u.query.death == "all" or u.query.death == room.port.toString())
death_room_found = true
oppo_pos = if room.hostinfo.mode == 2 then 2 else 1
if !room.changing_side and (!room.duel_count or room.turn)
room.death = (if room.turn then room.turn + 4 else 5)
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE)
switch settings.modules.http.quick_death_rule
when 3
room.death = -2
ygopro.stoc_send_chat_to_room(room, "${death_start_phase}", ygopro.constants.COLORS.BABYBLUE)
else
room.death = (if room.turn then room.turn + 4 else 5)
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE)
else
switch settings.modules.http.quick_death_rule
when 2
oppo_pos = if room.hostinfo.mode == 2 then 2 else 1
when 2,3
if room.scores[room.dueling_players[0].name] == room.scores[room.dueling_players[oppo_pos].name]
room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE)
if settings.modules.http.quick_death_rule == 3
room.death = -1
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE)
else
room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE)
else
win_pos = if room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[oppo_pos].name] then 0 else oppo_pos
ygopro.stoc_send_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE)
......
......@@ -1636,7 +1636,7 @@
}
ygopro.stoc_follow('GAME_MSG', true, function(buffer, info, client, server) {
var card, count, l, len2, line, loc, msg, oppo_pos, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos;
var card, count, l, len2, line, loc, msg, oppo_pos, phase, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos;
room = ROOM_all[client.rid];
if (!room) {
return;
......@@ -1698,7 +1698,7 @@
if (ygopro.constants.MSG[msg] === 'NEW_TURN') {
if (client.pos === 0) {
room.turn = room.turn + 1;
if (room.death) {
if (room.death && room.death !== -2) {
if (room.turn >= room.death) {
oppo_pos = room.hostinfo.mode === 2 ? 2 : 1;
if (room.dueling_players[0].lp !== room.dueling_players[oppo_pos].lp && room.turn > 1) {
......@@ -1726,6 +1726,22 @@
ygopro.stoc_send_chat(client, "${surrender_canceled}", ygopro.constants.COLORS.BABYBLUE);
}
}
if (ygopro.constants.MSG[msg] === 'NEW_PHASE') {
phase = buffer.readInt16LE(1);
oppo_pos = room.hostinfo.mode === 2 ? 2 : 1;
if (client.pos === 0 && room.death === -2 && !(phase === 0x1 && room.turn < 2) && room.dueling_players[0].lp !== room.dueling_players[oppo_pos].lp) {
win_pos = room.dueling_players[0].lp > room.dueling_players[oppo_pos].lp ? 0 : oppo_pos;
ygopro.stoc_send_chat_to_room(room, "${death_finish_part1}" + room.dueling_players[win_pos].name + "${death_finish_part2}", ygopro.constants.COLORS.BABYBLUE);
if (room.hostinfo.mode === 2) {
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos], 'DUEL_END');
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos + 1], 'DUEL_END');
room.dueling_players[oppo_pos - win_pos].destroy();
room.dueling_players[oppo_pos - win_pos + 1].destroy();
} else {
ygopro.ctos_send(room.dueling_players[oppo_pos - win_pos].server, 'SURRENDER');
}
}
}
if (ygopro.constants.MSG[msg] === 'WIN' && client.pos === 0) {
pos = buffer.readUInt8(1);
if (!(client.is_first || pos === 2)) {
......@@ -1742,7 +1758,7 @@
room.scores[room.winner_name] = room.scores[room.winner_name] + 1;
}
if (room.death) {
if (settings.modules.http.quick_death_rule === 1) {
if (settings.modules.http.quick_death_rule === 1 || settings.modules.http.quick_death_rule === 3) {
room.death = -1;
} else {
room.death = 5;
......@@ -2411,7 +2427,7 @@
client.side_tcount = null;
}
oppo_pos = room.hostinfo.mode === 2 ? 2 : 1;
if (settings.modules.http.quick_death_rule === 2 && room.started && room.death && room.scores[room.dueling_players[0].name] !== room.scores[room.dueling_players[oppo_pos].name]) {
if (settings.modules.http.quick_death_rule >= 2 && room.started && room.death && room.scores[room.dueling_players[0].name] !== room.scores[room.dueling_players[oppo_pos].name]) {
win_pos = room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[oppo_pos].name] ? 0 : oppo_pos;
ygopro.stoc_send_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE);
ygopro.stoc_send(room.dueling_players[oppo_pos - win_pos], 'DUEL_END');
......@@ -2970,16 +2986,29 @@
continue;
}
death_room_found = true;
oppo_pos = room.hostinfo.mode === 2 ? 2 : 1;
if (!room.changing_side && (!room.duel_count || room.turn)) {
room.death = (room.turn ? room.turn + 4 : 5);
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE);
switch (settings.modules.http.quick_death_rule) {
case 3:
room.death = -2;
ygopro.stoc_send_chat_to_room(room, "${death_start_phase}", ygopro.constants.COLORS.BABYBLUE);
break;
default:
room.death = (room.turn ? room.turn + 4 : 5);
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE);
}
} else {
switch (settings.modules.http.quick_death_rule) {
case 2:
oppo_pos = room.hostinfo.mode === 2 ? 2 : 1;
case 3:
if (room.scores[room.dueling_players[0].name] === room.scores[room.dueling_players[oppo_pos].name]) {
room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE);
if (settings.modules.http.quick_death_rule === 3) {
room.death = -1;
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE);
} else {
room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE);
}
} else {
win_pos = room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[oppo_pos].name] ? 0 : oppo_pos;
ygopro.stoc_send_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment