From c62b1528b982bdb9d397c393d35ff68ecb7bd88b Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sat, 25 Dec 2021 12:29:02 -0300 Subject: Find the tanker and a random target for skills. --- npc/006-7/ctrl.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'npc/006-7/ctrl.txt') diff --git a/npc/006-7/ctrl.txt b/npc/006-7/ctrl.txt index 3217e432e..a8c58dd89 100644 --- a/npc/006-7/ctrl.txt +++ b/npc/006-7/ctrl.txt @@ -104,19 +104,39 @@ OnTimer5000: /* Prepare some data */ .@hp = getunitdata(.BOSS, UDT_HP) * 100 / getunitdata(.BOSS, UDT_MAXHP); + getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, .BOSS); + .@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, .@m$); + .@mvp=0;.@rnd=0;.@def=0; + for (.@i = 0; .@i < .@c; .@i++) { + if (!.@rnd || !rand2(.@c)) + .@rnd=.@pcs[.@i]; + if (getunitdata(.@pcs[.@i], UDT_DEF) > .@def) { + if (getunitdata(.@pcs[.@i], UDT_HP) < 1) continue; + .@mvp=.@pcs[.@i]; + .@def=getunitdata(.@pcs[.@i], UDT_DEF); + } + } .beats += 1; + /* Everyone is dead, get rid of them */ + if (!.@mvp || !.@rnd) { + mapwarp("006-7", "006-6", 40, 36); + initnpctimer; + end; + } + /* Decide the skill to use based on ~5s beats over 3 minutes */ switch (.beats % 18) { // Summon Reinforcements (every 60s) case 0: case 6: case 12: - unittalk(.BOSS, "Come forth, snow army, for the Icicle shall live forever!"); + unittalk(.BOSS, "Come forth, ##Bsnow army##b, for the Icicle shall live forever!"); specialeffect(64, AREA, .BOSS); sleep(500); monster("006-7", 44, 22, strmobinfo(1, Snowman), Snowman, max(1, (11 - .@hp) / 10)); break; + } initnpctimer; @@ -126,6 +146,8 @@ OnInit: .distance = 4; .ticks = gettimetick(2); .beats = 0; + .mvp = 0; + .def = 0; end; } -- cgit v1.2.3-60-g2f50