From 770c961594e295093368f7872e298591f0b7dc4a Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Sun, 10 Dec 2023 14:45:30 -0500 Subject: [PATCH 1/8] Update conditions, add tags for some debuffs to simplify some debuff checks. --- design/conditions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/design/conditions.py b/design/conditions.py index 4d15dfa..3f1316c 100644 --- a/design/conditions.py +++ b/design/conditions.py @@ -307,6 +307,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, + "tag":"physical" "duration":3200, }, "deepfreezed":{ @@ -316,6 +317,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, + "tag":"freeze", }, "invincible":{ "name":"Invincible", @@ -330,6 +332,7 @@ conditions={ "ui":True, "debuff":True, "duration":5000, + "tag":"freeze", }, "burned":{ "name":"Burned", @@ -337,6 +340,7 @@ conditions={ "interval":210, "ui":True, "debuff":True, + "tag":"burn", }, "shocked":{ "name":"Shocked", @@ -360,6 +364,7 @@ conditions={ "duration":4000, "blocked":True, "debuff":True, + "tag":"dark", }, "easterluck":{ "skin":"easterluck", @@ -478,6 +483,7 @@ conditions={ "potionsm":0.5, "healm":0.25, "debuff":True, + "tag":"poison", }, "cursed":{ "name":"Cursed", @@ -487,6 +493,7 @@ conditions={ "speed":-20, "duration":5000, "debuff":True, + "tag":"dark", }, "dampened":{ "name":"Dampened", From fe1dd32321b8f13436653f65195af3bc69d31589 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Sun, 10 Dec 2023 14:48:42 -0500 Subject: [PATCH 2/8] Change tag for stunned condition from Physical to Stun --- design/conditions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/design/conditions.py b/design/conditions.py index 3f1316c..db5b986 100644 --- a/design/conditions.py +++ b/design/conditions.py @@ -307,7 +307,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, - "tag":"physical" + "tag":"stun" "duration":3200, }, "deepfreezed":{ 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 3/8] 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; From 265b14849394d07b2b0f3a8135046950a0e12b9d Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Sun, 10 Dec 2023 15:05:26 -0500 Subject: [PATCH 4/8] Update server.js to use condition tags --- node/server.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/node/server.js b/node/server.js index dbd3838..1a4f3a4 100644 --- a/node/server.js +++ b/node/server.js @@ -3413,12 +3413,7 @@ function complete_attack(attacker, target, info) { o_attack = attack = ceil(attack); if (info.conditions.includes("frozen") && !target.immune && target.hp > attack) { - if (Math.random() < target.fzresistance / 100.0) { - xy_emit(target, "ui", { type: "freeze_resist", id: target.id }); - } else { - add_condition(target, "frozen"); - disappearing_text(target.socket, target, "FREEZE!", { xy: 1, size: "huge", color: "freeze", nv: 1 }); //target.is_player&&"huge"||undefined - } + add_condition(target, "frozen"); } if (info.conditions.includes("burned") && !target.immune && target.hp > attack) { @@ -3434,13 +3429,9 @@ function complete_attack(attacker, target, info) { add_condition(target, "woven"); } - if ( - info.conditions.includes("stunned") && - target.hp > attack && - add_condition(target, "stunned", { duration: 2000 }) - ) { - disappearing_text(target.socket, target, "STUN!", { xy: 1, size: "huge", color: "stun", nv: 1 }); - } //target.is_player&&"huge"||undefined + if (info.conditions.includes("stunned") && target.hp > attack) { + add_condition(target, "stunned", { duration: 2000 }); + } if (info.procs && target.a.putrid) { add_condition(attacker, "poisoned"); From 1cc5abb2b1acd6292b9430b6518b58317eb80bf5 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:26:00 -0500 Subject: [PATCH 5/8] Change "tag" to "defense" Changed the tags of conditions to instead be "defense" which is a string for the name of the appropriate resistance stat. Some conditions have the "bmresistance" for their "defense", but are commented out, may be added in a future update. --- design/conditions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/design/conditions.py b/design/conditions.py index db5b986..0bfb69c 100644 --- a/design/conditions.py +++ b/design/conditions.py @@ -307,7 +307,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, - "tag":"stun" + "defense":"phresistance" "duration":3200, }, "deepfreezed":{ @@ -317,7 +317,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, - "tag":"freeze", + "defense":"fzresistance", }, "invincible":{ "name":"Invincible", @@ -332,7 +332,7 @@ conditions={ "ui":True, "debuff":True, "duration":5000, - "tag":"freeze", + "defense":"fzresistance", }, "burned":{ "name":"Burned", @@ -340,7 +340,7 @@ conditions={ "interval":210, "ui":True, "debuff":True, - "tag":"burn", + "defense":"firesistance", }, "shocked":{ "name":"Shocked", @@ -364,7 +364,7 @@ conditions={ "duration":4000, "blocked":True, "debuff":True, - "tag":"dark", + # "defense":"bmresistance", }, "easterluck":{ "skin":"easterluck", @@ -483,7 +483,7 @@ conditions={ "potionsm":0.5, "healm":0.25, "debuff":True, - "tag":"poison", + "defense":"pnresistance", }, "cursed":{ "name":"Cursed", @@ -493,7 +493,7 @@ conditions={ "speed":-20, "duration":5000, "debuff":True, - "tag":"dark", + # "defense":"bmresistance", }, "dampened":{ "name":"Dampened", From 67b2cffcc8c9c24191636eb6890b3348bc9b1e21 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:28:13 -0500 Subject: [PATCH 6/8] Update server_functions.js to use new "defense" attribute on conditions --- node/server_functions.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/node/server_functions.js b/node/server_functions.js index de13799..66e52a3 100644 --- a/node/server_functions.js +++ b/node/server_functions.js @@ -2664,23 +2664,27 @@ 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 (def.defense) { + if (Math.random() < (target[def.defense] || 0) / 100.0) { + return xy_emit(target, "ui", { type: condition + "_resist", id: target.id }); } } + // if (def.tag === "stun") { + // if (Math.random() < (target.phresistance || 0) / 100.0) { + // } + // } 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; } From 050fe4421c568c2a7e9d650b08c0ba9709b7ae16 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:33:47 -0500 Subject: [PATCH 7/8] Update game.js to use new resist emits. --- js/game.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/game.js b/js/game.js index 2341574..10ae768 100644 --- a/js/game.js +++ b/js/game.js @@ -2495,22 +2495,22 @@ function init_socket(args) sender.a_direction=sender.direction=data.direction; } } - else if(data.type=="poison_resist") + else if(data.type=="poisoned_resist") { var target=get_entity(data.id); if(target) d_text("RESIST!",target,{color:"#68B84B"}); } - else if(data.type=="freeze_resist") + else if(data.type=="frozen_resist"||data.type=="deepfreezed_resist") { var target=get_entity(data.id); if(target) d_text("RESIST!",target,{color:"#66C1C8"}); } - else if(data.type=="fire_resist") + else if(data.type=="burned_resist") { var target=get_entity(data.id); if(target) d_text("RESIST!",target,{color:"#B22F1A"}); } - else if(data.type=="stun_resist") + else if(data.type=="stunned_resist") { var target=get_entity(data.id); if(target) d_text("RESIST!",target,{color:"crit"}); From 3d9d2035fbc025f68a3f800f717479f498ec0c0d Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Wed, 13 Dec 2023 14:40:18 -0500 Subject: [PATCH 8/8] Update conditions.py (fix missing comma) --- design/conditions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/design/conditions.py b/design/conditions.py index 0bfb69c..11fa08a 100644 --- a/design/conditions.py +++ b/design/conditions.py @@ -307,7 +307,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, - "defense":"phresistance" + "defense":"phresistance", "duration":3200, }, "deepfreezed":{