From 39a9ea619a6ecd6e9d48fcd2e01ea1038cde9a4b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 26 May 2019 22:03:43 -0300 Subject: Difficulty is now based on number of previous victories vs defeats --- npc/functions/siege.txt | 54 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'npc/functions') diff --git a/npc/functions/siege.txt b/npc/functions/siege.txt index a8e2721de..06a250267 100644 --- a/npc/functions/siege.txt +++ b/npc/functions/siege.txt @@ -179,8 +179,13 @@ function script siege_check { // Players failed, so reduce score in 1 if (.@mb) { - $MK_TEMPVAR-=1; - kamibroadcast("Players failed to defend the city!!"+.@mb); + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR-=1; + kamibroadcast("Players failed to defend the city!!"); + debugmes "Number of boss grade monsters found: %d", .@mb; + $SIEGE_DIFFICULTY-=1; + } else { + $SIEGE_DIFFICULTY+=1; } return; } @@ -355,13 +360,25 @@ function script do_siege { .@n$=getarg(4); .@t=getarg(5); + // In past, we had a $@SIEGE_ to determine difficulty + // This behavior is now deprecated, we use a global $SIEGE_DIFFICULTY + // Which raises in 1 every victory and lowers in 1 every defeat (capped at 1) + if (!getd("$@SIEGE_"+.@c$)) { + .@difc=max(1, getd("$SIEGE_DIFFICULTY")); + + // And then, we reset $@SIEGE_ so it can be manipulated + // And set .@difc to this value + setd("$@SIEGE_"+.@c$, .@difc); + .@difc=getd("$@SIEGE_"+.@c$); + } + switch (.@t) { // Warmup case 70: case 95: - siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_cast(.@m$, .@n$, .@difc, .@tp); case 35: - siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_cast(.@o$, .@n$, .@difc, .@tp); break; // Setup and casts case 0: @@ -374,19 +391,19 @@ function script do_siege { mapannounce(.@m$, "##2Message to all NPCs in town: Take shelter!", bc_map); break; case 90: - siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); - siege_cast(.@o$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_cast(.@m$, .@n$, .@difc, .@tp); + siege_cast(.@o$, .@n$, .@difc, .@tp); break; // Boss stage case 280: - siege_boss(.@m$, getd("$@SIEGE_"+.@c$)); - siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_boss(.@m$, .@difc); + siege_cast(.@m$, .@n$, .@difc, .@tp); break; // Difficulty Raisers case 310: case 520: case 640: - .@varsig=getd("$@SIEGE_"+.@c$); + .@varsig=.@difc; setd("$@SIEGE_"+.@c$, .@varsig+1); // Regular flow case 195: @@ -404,13 +421,13 @@ function script do_siege { case 625: //case 640: difficulty raiser case 670: - siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_cast(.@m$, .@n$, .@difc, .@tp); break; // Ending flow // TODO: It would be better to make these values relative to MK_SIEGE_DURATION case 700: mapannounce("012-1", "##1The Monster Army is planning to retreat soon!", bc_map); - siege_cast(.@m$, .@n$, getd("$@SIEGE_"+.@c$), .@tp); + siege_cast(.@m$, .@n$, .@difc, .@tp); break; case 760: mapannounce("012-1", "##1The Monster Army is withdrawing within 30 seconds!", bc_map); @@ -444,32 +461,37 @@ OnRespawn: // Boss Death Labels OnSergeantDeath: - $MK_TEMPVAR+=1; + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR+=1; getitem StrangeCoin, rand(1,5); announce("##2The Monster Sergeant was defeated by "+strcharinfo(0)+"!", bc_all); end; OnLieutenantDeath: - $MK_TEMPVAR+=3; + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR+=3; getitem StrangeCoin, rand(5,10); announce("##2The Monster Lieutenant was defeated by "+strcharinfo(0)+"!", bc_all); end; OnCaptainDeath: - $MK_TEMPVAR+=5; + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR+=5; getitem StrangeCoin, rand(10,15); announce("##2The Monster Captain was defeated by "+strcharinfo(0)+"!", bc_all); end; OnColonelDeath: - $MK_TEMPVAR+=7; + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR+=7; getitem StrangeCoin, rand(15,20); $MOST_HEROIC$=strcharinfo(0); announce("##2The Monster Colonel was defeated by "+strcharinfo(0)+"!", bc_all); end; OnGeneralDeath: - $MK_TEMPVAR+=9; + if ($GAME_STORYLINE == 2) + $MK_TEMPVAR+=9; getitem StrangeCoin, rand(20,25); $MOST_HEROIC$=strcharinfo(0); announce("##2The Monster General was defeated by "+strcharinfo(0)+"!", bc_all); -- cgit v1.2.3-60-g2f50