Commit 0de28045 authored by nanahira's avatar nanahira

improve death option

parent d60d2217
......@@ -122,6 +122,11 @@ catch
config = {}
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')
try
......@@ -1391,7 +1396,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (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 and settings.modules.http.quick_death_rule != 2
if settings.modules.http.quick_death_rule == 1
room.death = -1
else
room.death = 5
......@@ -2245,8 +2250,8 @@ if settings.modules.http
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
if settings.modules.http.quick_death_rule
if settings.modules.http.quick_death_rule == 2
switch settings.modules.http.quick_death_rule
when 2
if room.scores[room.dueling_players[0].name] == room.scores[room.dueling_players[1].name]
room.death = 5
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE)
......@@ -2254,7 +2259,7 @@ 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
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()
else
when 1
room.death = -1
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE)
else
......
......@@ -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');
try {
......@@ -1674,7 +1679,7 @@
room.scores[room.winner_name] = room.scores[room.winner_name] + 1;
}
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;
} else {
room.death = 5;
......@@ -2863,8 +2868,8 @@
room.death = (room.turn ? room.turn + 4 : 5);
ygopro.stoc_send_chat_to_room(room, "${death_start}", ygopro.constants.COLORS.BABYBLUE);
} else {
if (settings.modules.http.quick_death_rule) {
if (settings.modules.http.quick_death_rule === 2) {
switch (settings.modules.http.quick_death_rule) {
case 2:
if (room.scores[room.dueling_players[0].name] === room.scores[room.dueling_players[1].name]) {
room.death = 5;
ygopro.stoc_send_chat_to_room(room, "${death_start_siding}", ygopro.constants.COLORS.BABYBLUE);
......@@ -2873,11 +2878,12 @@
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();
}
} else {
break;
case 1:
room.death = -1;
ygopro.stoc_send_chat_to_room(room, "${death_start_quick}", ygopro.constants.COLORS.BABYBLUE);
}
} else {
break;
default:
room.death = 5;
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