From b89e9caf6bb1936a758db2e90f1d2ad0ffd8f04b Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Sun, 10 Dec 2023 15:04:53 -0500 Subject: [PATCH] Update server_functions.js to use condition tags --- node/server_functions.js | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/node/server_functions.js b/node/server_functions.js index cf08d69..de13799 100644 --- a/node/server_functions.js +++ b/node/server_functions.js @@ -2664,30 +2664,39 @@ function add_condition(target, condition, args) { } var response = { response: "condition", name: condition, cevent: true }; var duration = args.duration || args.ms || def.duration; + if (def.tag === "stun") { + if (Math.random() < (target.phresistance || 0) / 100.0) { + return xy_emit(target, "ui", { type: "stun_resist", id: target.id }); + } + } else if (def.tag === "burn") { + if (Math.random() < (target.firesistance || 0) / 100.0) { + return xy_emit(target, "ui", { type: "fire_resist", id: target.id }); + } + } else if (def.tag === "poison") { + if (Math.random() < (target.pnresistance || 0) / 100.0) { + return xy_emit(target, "ui", { type: "poison_resist", id: target.id }); + } + } else if (def.tag === "freeze") { + if (Math.random() < (target.fzresistance || 0) / 100.0) { + return xy_emit(target, "ui", { type: "freeze_resist", id: target.id }); + } + } if (duration == undefined) { duration = 1000; } var C = { ms: duration }; if (condition == "poisoned" && target.pnresistance) { - if (Math.random() < (target.pnresistance || 0) / 100.0) { - return xy_emit(target, "ui", { type: "poison_resist", id: target.id }); - } - duration *= (100 - target.pnresistance) / 100.0; } if (condition == "stunned") { - if (Math.random() < (target.phresistance || 0) / 100.0) { - return xy_emit(target, "ui", { type: "stun_resist", id: target.id }); - } - target.abs = true; target.moving = false; + disappearing_text(target.socket, target, "STUN!", { xy: 1, size: "huge", color: "stun", nv: 1 }); + } + if (condition == "frozen") { + disappearing_text(target.socket, target, "FREEZE!", { xy: 1, size: "huge", color: "freeze", nv: 1 }); } if (condition == "burned") { - if (Math.random() < (target.firesistance || 0) / 100.0) { - return xy_emit(target, "ui", { type: "fire_resist", id: target.id }); - } - duration = 5000; if (!args.attack) { args.attack = 1000; @@ -2705,11 +2714,6 @@ function add_condition(target, condition, args) { C.fid = args.fid; disappearing_text({}, target, "BURN!", { xy: 1, size: "huge", color: "burn", nv: 1 }); //target.is_player&&"huge"||undefined } - if (condition == "deepfreezed") { - if (Math.random() < (target.fzresistance || 0) / 100.0) { - return xy_emit(target, "ui", { type: "freeze_resist", id: target.id }); - } - } if (condition == "woven") { C.s = min((target.is_monster && 20) || 5, (target.s.woven && target.s.woven.s + 1) || 1); C.speed = -3 * C.s;