Commit 0de28045 authored by nanahira's avatar nanahira

improve death option

parent d60d2217
...@@ -122,6 +122,11 @@ catch ...@@ -122,6 +122,11 @@ catch
config = {} config = {}
settings = global.settings = merge(default_config, config, { arrayMerge: (destination, source) -> source }) settings = global.settings = merge(default_config, config, { arrayMerge: (destination, source) -> source })
#reset http.quick_death_rule from true to 1
if settings.modules.http.quick_death_rule == true
settings.modules.http.quick_death_rule = 1
setting_save(settings)
# 读取数据 # 读取数据
default_data = loadJSON('./data/default_data.json') default_data = loadJSON('./data/default_data.json')
try try
...@@ -1391,7 +1396,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1391,7 +1396,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
#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 room.death
if settings.modules.http.quick_death_rule and settings.modules.http.quick_death_rule != 2 if settings.modules.http.quick_death_rule == 1
room.death = -1 room.death = -1
else else
room.death = 5 room.death = 5
...@@ -2245,8 +2250,8 @@ if settings.modules.http ...@@ -2245,8 +2250,8 @@ if settings.modules.http
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
if settings.modules.http.quick_death_rule switch settings.modules.http.quick_death_rule
if settings.modules.http.quick_death_rule == 2 when 2
if room.scores[room.dueling_players[0].name] == room.scores[room.dueling_players[1].name] if room.scores[room.dueling_players[0].name] == room.scores[room.dueling_players[1].name]
room.death = 5 room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE)
...@@ -2254,12 +2259,12 @@ if settings.modules.http ...@@ -2254,12 +2259,12 @@ if settings.modules.http
win_pos = if room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[1].name] then 0 else 1 win_pos = if room.scores[room.dueling_players[0].name] > room.scores[room.dueling_players[1].name] then 0 else 1
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_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE)
room.dueling_players[1 - win_pos].destroy() room.dueling_players[1 - win_pos].destroy()
else when 1
room.death = -1 room.death = -1
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE)
else else
room.death = 5 room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE)
response.writeHead(200) response.writeHead(200)
if death_room_found if death_room_found
response.end(addCallback(u.query.callback, "['death ok', '" + u.query.death + "']")) response.end(addCallback(u.query.callback, "['death ok', '" + u.query.death + "']"))
......
...@@ -160,6 +160,11 @@ ...@@ -160,6 +160,11 @@
} }
}); });
if (settings.modules.http.quick_death_rule === true) {
settings.modules.http.quick_death_rule = 1;
setting_save(settings);
}
default_data = loadJSON('./data/default_data.json'); default_data = loadJSON('./data/default_data.json');
try { try {
...@@ -1674,7 +1679,7 @@ ...@@ -1674,7 +1679,7 @@
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 (room.death) {
if (settings.modules.http.quick_death_rule && settings.modules.http.quick_death_rule !== 2) { if (settings.modules.http.quick_death_rule === 1) {
room.death = -1; room.death = -1;
} else { } else {
room.death = 5; room.death = 5;
...@@ -2863,8 +2868,8 @@ ...@@ -2863,8 +2868,8 @@
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 {
if (settings.modules.http.quick_death_rule) { switch (settings.modules.http.quick_death_rule) {
if (settings.modules.http.quick_death_rule === 2) { case 2:
if (room.scores[room.dueling_players[0].name] === room.scores[room.dueling_players[1].name]) { if (room.scores[room.dueling_players[0].name] === room.scores[room.dueling_players[1].name]) {
room.death = 5; room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE);
...@@ -2873,13 +2878,14 @@ ...@@ -2873,13 +2878,14 @@
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_chat_to_room(room, "${death2_finish_part1}" + room.dueling_players[win_pos].name + "${death2_finish_part2}", ygopro.constants.COLORS.BABYBLUE);
room.dueling_players[1 - win_pos].destroy(); room.dueling_players[1 - win_pos].destroy();
} }
} else { break;
case 1:
room.death = -1; room.death = -1;
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE);
} break;
} else { default:
room.death = 5; room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", 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