Commit ff8fd7b4 authored by nanahira's avatar nanahira

Merge branch 'mc'

parents b1e4c6e8 86b019aa
...@@ -98,8 +98,6 @@ ...@@ -98,8 +98,6 @@
"death_start": "Over-time match has begun, player with higher LP will win the single game after 4 turns.", "death_start": "Over-time match has begun, player with higher LP will win the single game after 4 turns.",
"death_start_siding": "Extra time match starts, player with higher LP will win the single game after 4 turns.", "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_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.",
"death_start_extra": "The Duel is counted as extra duel which will end in 4 turns, player with higher LP will win.",
"death_remain_part1": "The Duel will be ended in ", "death_remain_part1": "The Duel will be ended in ",
"death_remain_part2": " turns. At the end of that turn, player with higher LP wins.", "death_remain_part2": " turns. At the end of that turn, player with higher LP wins.",
"death_remain_final": "The Duel will continue until the first change in LP (and increase or a decrease), and at the end of the turn, the player with the highest LP total becomes the winner.", "death_remain_final": "The Duel will continue until the first change in LP (and increase or a decrease), and at the end of the turn, the player with the highest LP total becomes the winner.",
...@@ -208,8 +206,6 @@ ...@@ -208,8 +206,6 @@
"death_start": "加时赛开始,从本回合开始计算4回合,基本分高的玩家获得本次决斗的胜利。", "death_start": "加时赛开始,从本回合开始计算4回合,基本分高的玩家获得本次决斗的胜利。",
"death_start_siding": "加时赛开始,下次决斗的第4回合结束时,基本分高的玩家决斗胜利。", "death_start_siding": "加时赛开始,下次决斗的第4回合结束时,基本分高的玩家决斗胜利。",
"death_start_quick": "加时赛开始,下次决斗将进入猝死赛,基本分发生变动的回合结束时将决出胜负。", "death_start_quick": "加时赛开始,下次决斗将进入猝死赛,基本分发生变动的回合结束时将决出胜负。",
"death_start_final": "本次决斗将进入猝死赛,基本分发生变动的回合结束时,基本分高的玩家将获得本次决斗的胜利。",
"death_start_extra": "本次决斗为额外决斗,第4回合结束时,基本分高的玩家获得本次决斗的胜利。",
"death_remain_part1": "本次决斗将在", "death_remain_part1": "本次决斗将在",
"death_remain_part2": "回合后结束,基本分高的玩家将获得本次决斗的胜利。", "death_remain_part2": "回合后结束,基本分高的玩家将获得本次决斗的胜利。",
"death_remain_final": "若本回合基本分发生变动,在该回合结束时决斗即告结束,生命值多的玩家获得本场决斗的胜利。", "death_remain_final": "若本回合基本分发生变动,在该回合结束时决斗即告结束,生命值多的玩家获得本场决斗的胜利。",
......
...@@ -314,7 +314,6 @@ class Room ...@@ -314,7 +314,6 @@ class Room
@scores = {} @scores = {}
@duel_count = 0 @duel_count = 0
@death = 0 @death = 0
@dueling = false
ROOM_all.push this ROOM_all.push this
@hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo)) @hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo))
...@@ -1250,15 +1249,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1250,15 +1249,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
client.lp = room.hostinfo.start_lp client.lp = room.hostinfo.start_lp
if client.pos == 0 if client.pos == 0
room.turn = 0 room.turn = 0
room.dueling = true
room.duel_count = room.duel_count + 1 room.duel_count = room.duel_count + 1
if room.death
if settings.modules.http.quick_death_rule and room.duel_count > 1
room.death = -1
ygopro.stoc_send_chat_to_room(room, "${death_start_final}", ygopro.constants.COLORS.BABYBLUE)
else
room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_extra}", ygopro.constants.COLORS.BABYBLUE)
#ygopro.stoc_send_chat_to_room(room, "LP跟踪调试信息: #{client.name} 初始LP #{client.lp}") #ygopro.stoc_send_chat_to_room(room, "LP跟踪调试信息: #{client.name} 初始LP #{client.lp}")
...@@ -1283,14 +1274,19 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1283,14 +1274,19 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
pos = buffer.readUInt8(1) pos = buffer.readUInt8(1)
pos = 1 - pos unless client.is_first or pos == 2 pos = 1 - pos unless client.is_first or pos == 2
reason = buffer.readUInt8(2) reason = buffer.readUInt8(2)
room.dueling = false
#log.info {winner: pos, reason: reason} #log.info {winner: pos, reason: reason}
#room.duels.push {winner: pos, reason: reason} #room.duels.push {winner: pos, reason: reason}
room.winner = pos room.winner = pos
room.turn = 0
if room and !room.finished and room.dueling_players[pos] if room and !room.finished and room.dueling_players[pos]
room.winner_name = room.dueling_players[pos].name room.winner_name = room.dueling_players[pos].name
#log.info room.dueling_players, pos #log.info room.dueling_players, pos
room.scores[room.winner_name] = room.scores[room.winner_name] + 1 room.scores[room.winner_name] = room.scores[room.winner_name] + 1
if room.death
if settings.modules.http.quick_death_rule
room.death = -1
else
room.death = 5
#lp跟踪 #lp跟踪
if ygopro.constants.MSG[msg] == 'DAMAGE' and client.pos == 0 if ygopro.constants.MSG[msg] == 'DAMAGE' and client.pos == 0
...@@ -1912,7 +1908,7 @@ if settings.modules.http ...@@ -1912,7 +1908,7 @@ if settings.modules.http
name: player.name + (if settings.modules.http.show_ip and pass_validated and player.ip != '::ffff:127.0.0.1' then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.http.show_info and room.started and not (room.hostinfo.mode == 2 and player.pos > 1) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + ")") else ""), name: player.name + (if settings.modules.http.show_ip and pass_validated and player.ip != '::ffff:127.0.0.1' then (" (IP: " + player.ip.slice(7) + ")") else "") + (if settings.modules.http.show_info and room.started and not (room.hostinfo.mode == 2 and player.pos > 1) then (" (Score:" + room.scores[player.name] + " LP:" + (if player.lp? then player.lp else room.hostinfo.start_lp) + ")") else ""),
pos: player.pos pos: player.pos
), ),
istart: if room.started then (if settings.modules.http.show_info then ("Duel:" + room.duel_count + " Turn:" + (if room.turn? then room.turn else 0) + (if room.death then "/" + (if room.death > 0 then room.death - 1 else "Death") else "")) else 'start') else 'wait' istart: if room.started then (if settings.modules.http.show_info then ("Duel:" + room.duel_count + " " + (if room.changing_side then "Siding" else "Turn:" + (if room.turn? then room.turn else 0) + (if room.death then "/" + (if room.death > 0 then room.death - 1 else "Death") else ""))) else 'start') else 'wait'
), null, 2 ), null, 2
response.end(addCallback(u.query.callback, roomsjson)) response.end(addCallback(u.query.callback, roomsjson))
...@@ -2044,7 +2040,7 @@ if settings.modules.http ...@@ -2044,7 +2040,7 @@ if settings.modules.http
death_room_found = false 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()) 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 death_room_found = true
if room.dueling or !room.duel_count if !room.changing_side
room.death = (if room.turn then room.turn + 4 else 5) room.death = (if room.turn then room.turn + 4 else 5)
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE)
else else
......
...@@ -450,7 +450,6 @@ ...@@ -450,7 +450,6 @@
this.scores = {}; this.scores = {};
this.duel_count = 0; this.duel_count = 0;
this.death = 0; this.death = 0;
this.dueling = false;
ROOM_all.push(this); ROOM_all.push(this);
this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo))); this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo)));
if (settings.lflist.length) { if (settings.lflist.length) {
...@@ -1540,17 +1539,7 @@ ...@@ -1540,17 +1539,7 @@
client.lp = room.hostinfo.start_lp; client.lp = room.hostinfo.start_lp;
if (client.pos === 0) { if (client.pos === 0) {
room.turn = 0; room.turn = 0;
room.dueling = true;
room.duel_count = room.duel_count + 1; room.duel_count = room.duel_count + 1;
if (room.death) {
if (settings.modules.http.quick_death_rule && room.duel_count > 1) {
room.death = -1;
ygopro.stoc_send_chat_to_room(room, "${death_start_final}", ygopro.constants.COLORS.BABYBLUE);
} else {
room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_extra}", ygopro.constants.COLORS.BABYBLUE);
}
}
} }
} }
if (ygopro.constants.MSG[msg] === 'NEW_TURN') { if (ygopro.constants.MSG[msg] === 'NEW_TURN') {
...@@ -1581,12 +1570,19 @@ ...@@ -1581,12 +1570,19 @@
pos = 1 - pos; pos = 1 - pos;
} }
reason = buffer.readUInt8(2); reason = buffer.readUInt8(2);
room.dueling = false;
room.winner = pos; room.winner = pos;
room.turn = 0;
if (room && !room.finished && room.dueling_players[pos]) { if (room && !room.finished && room.dueling_players[pos]) {
room.winner_name = room.dueling_players[pos].name; room.winner_name = room.dueling_players[pos].name;
room.scores[room.winner_name] = room.scores[room.winner_name] + 1; room.scores[room.winner_name] = room.scores[room.winner_name] + 1;
} }
if (room.death) {
if (settings.modules.http.quick_death_rule) {
room.death = -1;
} else {
room.death = 5;
}
}
} }
if (ygopro.constants.MSG[msg] === 'DAMAGE' && client.pos === 0) { if (ygopro.constants.MSG[msg] === 'DAMAGE' && client.pos === 0) {
pos = buffer.readUInt8(1); pos = buffer.readUInt8(1);
...@@ -2549,7 +2545,7 @@ ...@@ -2549,7 +2545,7 @@
} }
return results1; return results1;
})(), })(),
istart: room.started ? (settings.modules.http.show_info ? "Duel:" + room.duel_count + " Turn:" + (room.turn != null ? room.turn : 0) + (room.death ? "/" + (room.death > 0 ? room.death - 1 : "Death") : "") : 'start') : 'wait' istart: room.started ? (settings.modules.http.show_info ? "Duel:" + room.duel_count + " " + (room.changing_side ? "Siding" : "Turn:" + (room.turn != null ? room.turn : 0) + (room.death ? "/" + (room.death > 0 ? room.death - 1 : "Death") : "")) : 'start') : 'wait'
}); });
} }
} }
...@@ -2739,7 +2735,7 @@ ...@@ -2739,7 +2735,7 @@
continue; continue;
} }
death_room_found = true; death_room_found = true;
if (room.dueling || !room.duel_count) { if (!room.changing_side) {
room.death = (room.turn ? room.turn + 4 : 5); room.death = (room.turn ? room.turn + 4 : 5);
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE);
} else { } else {
......
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