Specific messages instead of FFT for disengage (#136)

* Specific messages instead of FFT for disengage

* return early to prevent ghost messages for disengage
This commit is contained in:
thmsndk
2024-05-21 10:39:54 +02:00
committed by GitHub
parent 4a9f9455cb
commit c584e56f09
2 changed files with 44 additions and 5 deletions
+40 -2
View File
@@ -2400,8 +2400,46 @@ function init_socket(args)
} }
else if(data.type=="disengage") else if(data.type=="disengage")
{ {
var m=get_entity(data.id); const m = get_entity(data.id);
if(m) d_text("FFT..",m,{color:"#84A1D1"}); if(!m) {
return
}
// disengage | event_lop can cause monsters to randomly disengage, this is during the grinch event.
// cant_move_smart | if smart move fails to move the monster to the target
// kill_monster | call relates to free_last_hits
// firecrackers |
// stop() | mechagnomes
// defeat | defeated_by_a_monster function
// redirect | something with the rage_list
// anger
// warpstomp
// exceeds_range
// cant_move
let text = "FFT..";
let color = "#84A1D1";
switch (data.cause) {
case "taunt redirect":
text = "GRR.."
break;
case "agitate redirect":
text = "GRRRR.."
break;
case "absorb redirect":
text = "GRRR.."
break;
case "bored":
// if last attack is too long ago.
text = "Yawns.."
case "player_gone":
// different instance, dead player, invis player
text = "Huh?!"
case "scare":
text = "EEP.."
break;
}
d_text(text, m, {color});
} }
else if(data.type=="mheal") else if(data.type=="mheal")
{ {
+4 -3
View File
@@ -11431,7 +11431,8 @@ function stop_pursuit(monster, args) {
monster.u = true; monster.u = true;
monster.irregular = 2; monster.irregular = 2;
calculate_monster_stats(monster); calculate_monster_stats(monster);
xy_emit(monster, "ui", { id: monster.id, type: "disengage", event: true }); // Forward args.cause to the UI so it can give different messages
xy_emit(monster, "ui", { id: monster.id, type: "disengage", event: true, cause: args.cause });
} }
function defeated_by_a_monster(attacker, player) { function defeated_by_a_monster(attacker, player) {
@@ -11753,7 +11754,7 @@ function update_instance(instance) {
var theone = random_one(c); var theone = random_one(c);
if (theone) { if (theone) {
if (monster.target && get_player(monster.target)) { if (monster.target && get_player(monster.target)) {
stop_pursuit(monster); stop_pursuit(monster, { cause: "anger" });
} }
target_player(monster, theone); target_player(monster, theone);
} }
@@ -11778,7 +11779,7 @@ function update_instance(instance) {
var theone = random_one(c); var theone = random_one(c);
if (theone) { if (theone) {
if (monster.target && get_player(monster.target)) { if (monster.target && get_player(monster.target)) {
stop_pursuit(monster); stop_pursuit(monster, { cause: "warpstomp" });
} }
target_player(monster, theone); target_player(monster, theone);
port_monster(monster, theone, { stomp: 160 }); port_monster(monster, theone, { stomp: 160 });