diff --git a/design/conditions.py b/design/conditions.py index 4d15dfa..11fa08a 100644 --- a/design/conditions.py +++ b/design/conditions.py @@ -307,6 +307,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, + "defense":"phresistance", "duration":3200, }, "deepfreezed":{ @@ -316,6 +317,7 @@ conditions={ "ui":True, "blocked":True, "debuff":True, + "defense":"fzresistance", }, "invincible":{ "name":"Invincible", @@ -330,6 +332,7 @@ conditions={ "ui":True, "debuff":True, "duration":5000, + "defense":"fzresistance", }, "burned":{ "name":"Burned", @@ -337,6 +340,7 @@ conditions={ "interval":210, "ui":True, "debuff":True, + "defense":"firesistance", }, "shocked":{ "name":"Shocked", @@ -360,6 +364,7 @@ conditions={ "duration":4000, "blocked":True, "debuff":True, + # "defense":"bmresistance", }, "easterluck":{ "skin":"easterluck", @@ -478,6 +483,7 @@ conditions={ "potionsm":0.5, "healm":0.25, "debuff":True, + "defense":"pnresistance", }, "cursed":{ "name":"Cursed", @@ -487,6 +493,7 @@ conditions={ "speed":-20, "duration":5000, "debuff":True, + # "defense":"bmresistance", }, "dampened":{ "name":"Dampened", diff --git a/js/game.js b/js/game.js index 6b0fe4d..5615ba9 100644 --- a/js/game.js +++ b/js/game.js @@ -2500,22 +2500,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"}); diff --git a/node/server.js b/node/server.js index d78a37d..360f3c7 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"); diff --git a/node/server_functions.js b/node/server_functions.js index 1825d06..9b6e7b9 100644 --- a/node/server_functions.js +++ b/node/server_functions.js @@ -2661,30 +2661,43 @@ function add_condition(target, condition, args) { } var response = { response: "condition", name: condition, cevent: true }; var duration = args.duration || args.ms || def.duration; + 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; } 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; @@ -2702,11 +2715,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;