Skip to content

Commit

Permalink
Specific messages instead of FFT for disengage (kaansoral#136)
Browse files Browse the repository at this point in the history
* Specific messages instead of FFT for disengage

* return early to prevent ghost messages for disengage
  • Loading branch information
thmsndk authored May 21, 2024
1 parent 4a9f945 commit c584e56
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
42 changes: 40 additions & 2 deletions js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -2400,8 +2400,46 @@ function init_socket(args)
}
else if(data.type=="disengage")
{
var m=get_entity(data.id);
if(m) d_text("FFT..",m,{color:"#84A1D1"});
const m = get_entity(data.id);
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")
{
Expand Down
7 changes: 4 additions & 3 deletions node/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11431,7 +11431,8 @@ function stop_pursuit(monster, args) {
monster.u = true;
monster.irregular = 2;
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) {
Expand Down Expand Up @@ -11753,7 +11754,7 @@ function update_instance(instance) {
var theone = random_one(c);
if (theone) {
if (monster.target && get_player(monster.target)) {
stop_pursuit(monster);
stop_pursuit(monster, { cause: "anger" });
}
target_player(monster, theone);
}
Expand All @@ -11778,7 +11779,7 @@ function update_instance(instance) {
var theone = random_one(c);
if (theone) {
if (monster.target && get_player(monster.target)) {
stop_pursuit(monster);
stop_pursuit(monster, { cause: "warpstomp" });
}
target_player(monster, theone);
port_monster(monster, theone, { stomp: 160 });
Expand Down

0 comments on commit c584e56

Please sign in to comment.