Commit 61215b55 authored by nanahira's avatar nanahira

fix d3 rule

parent bfd20499
......@@ -314,7 +314,6 @@ class Room
@scores = {}
@duel_count = 0
@death = 0
@dueling = false
ROOM_all.push this
@hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo))
......@@ -1250,7 +1249,6 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
client.lp = room.hostinfo.start_lp
if client.pos == 0
room.turn = 0
room.dueling = true
room.duel_count = room.duel_count + 1
if room.death
if settings.modules.http.quick_death_rule and room.duel_count > 1
......@@ -1283,10 +1281,10 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
pos = buffer.readUInt8(1)
pos = 1 - pos unless client.is_first or pos == 2
reason = buffer.readUInt8(2)
room.dueling = false
#log.info {winner: pos, reason: reason}
#room.duels.push {winner: pos, reason: reason}
room.winner = pos
room.turn = 0
if room and !room.finished and room.dueling_players[pos]
room.winner_name = room.dueling_players[pos].name
#log.info room.dueling_players, pos
......@@ -1912,7 +1910,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 ""),
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
response.end(addCallback(u.query.callback, roomsjson))
......@@ -2044,7 +2042,7 @@ 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
if room.dueling or !room.duel_count
if !room.changing_side
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
......
......@@ -434,7 +434,6 @@
this.scores = {};
this.duel_count = 0;
this.death = 0;
this.dueling = false;
ROOM_all.push(this);
this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo)));
if (settings.lflist.length) {
......@@ -1495,7 +1494,6 @@
client.lp = room.hostinfo.start_lp;
if (client.pos === 0) {
room.turn = 0;
room.dueling = true;
room.duel_count = room.duel_count + 1;
if (room.death) {
if (settings.modules.http.quick_death_rule && room.duel_count > 1) {
......@@ -1536,8 +1534,8 @@
pos = 1 - pos;
}
reason = buffer.readUInt8(2);
room.dueling = false;
room.winner = pos;
room.turn = 0;
if (room && !room.finished && room.dueling_players[pos]) {
room.winner_name = room.dueling_players[pos].name;
room.scores[room.winner_name] = room.scores[room.winner_name] + 1;
......@@ -2415,7 +2413,7 @@
}
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'
});
}
}
......@@ -2579,7 +2577,7 @@
continue;
}
death_room_found = true;
if (room.dueling || !room.duel_count) {
if (!room.changing_side) {
room.death = (room.turn ? room.turn + 4 : 5);
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE);
} 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