mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 18:39:27 -05:00
Update server_functions.js to use condition tags
This commit is contained in:
+21
-17
@@ -2664,30 +2664,39 @@ function add_condition(target, condition, args) {
|
|||||||
}
|
}
|
||||||
var response = { response: "condition", name: condition, cevent: true };
|
var response = { response: "condition", name: condition, cevent: true };
|
||||||
var duration = args.duration || args.ms || def.duration;
|
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) {
|
if (duration == undefined) {
|
||||||
duration = 1000;
|
duration = 1000;
|
||||||
}
|
}
|
||||||
var C = { ms: duration };
|
var C = { ms: duration };
|
||||||
if (condition == "poisoned" && target.pnresistance) {
|
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;
|
duration *= (100 - target.pnresistance) / 100.0;
|
||||||
}
|
}
|
||||||
if (condition == "stunned") {
|
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.abs = true;
|
||||||
target.moving = false;
|
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 (condition == "burned") {
|
||||||
if (Math.random() < (target.firesistance || 0) / 100.0) {
|
|
||||||
return xy_emit(target, "ui", { type: "fire_resist", id: target.id });
|
|
||||||
}
|
|
||||||
|
|
||||||
duration = 5000;
|
duration = 5000;
|
||||||
if (!args.attack) {
|
if (!args.attack) {
|
||||||
args.attack = 1000;
|
args.attack = 1000;
|
||||||
@@ -2705,11 +2714,6 @@ function add_condition(target, condition, args) {
|
|||||||
C.fid = args.fid;
|
C.fid = args.fid;
|
||||||
disappearing_text({}, target, "BURN!", { xy: 1, size: "huge", color: "burn", nv: 1 }); //target.is_player&&"huge"||undefined
|
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") {
|
if (condition == "woven") {
|
||||||
C.s = min((target.is_monster && 20) || 5, (target.s.woven && target.s.woven.s + 1) || 1);
|
C.s = min((target.is_monster && 20) || 5, (target.s.woven && target.s.woven.s + 1) || 1);
|
||||||
C.speed = -3 * C.s;
|
C.speed = -3 * C.s;
|
||||||
|
|||||||
Reference in New Issue
Block a user