summaryrefslogblamecommitdiff
path: root/npc/034-4/lobby.txt
blob: f0a5e6740ce605185a93dad0b77f1baaccf126aa (plain) (tree)
1
2
3
4
5
6





                                             





















                                                                            
 































































































































































                                                                                                                                
 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Gemini Sisters Quest - Part C: Showdown

034-4,98,22,0	script	#GeminiPartD	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(13);
    .@p=getcharid(1);
    if ($@VALIA_STATUS[.@p] < 15) {
        dispbottom l("Luvia is too dangerous to be left alone.");
        end;
    }
    if (mobcount(getmap(), "all") > 0) {
        dispbottom l("I cannot leave until Luvia and her allies are dead.");
        end;
    }
    if (mobcount(getmap(), "all") <= 0 && $@VALIA_STATUS[.@p] == 14) {
        $@VALIA_STATUS[.@p]=15;
    }
    if ($@VALIA_STATUS[.@p] >= 15) {
        slide 143, 96;
    }
    end;
}

// 98 36 with radius 12?
034-4,98,28,0	script	#GeminiShowdown	NPC_HIDDEN,2,1,{
    end;
OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(13);
    .@p=getcharid(1);
    if (strcharinfo(0) != getpartyleader(.@p)) end;

    if (!.state) {
        .mp$ = getmap();
        .beats = 0;
        .pid = getcharid(1);
        .state = true;
        initnpctimer;
        killmonsterall(.mp$); // Cancel everything done thus far, incl. showdown
    }
    end;

OnABC:
    end;

OnTimer1000:
    .luvia = monster(.mp$, 98, 32, "Luvia Gemini", Luvia, 1);
    immortal(.luvia);
    setunitdata(.luvia, UDT_MODE, MD_BOSS|MD_PLANT|MD_NOKNOCKBACK);
    end;

OnTimer2500:
    unittalk(.luvia, "Ara! Look at who is trying to sneak past me!");
    end;

OnTimer6000:
    unittalk(.luvia, "How silly. I prepared this party for ya, you know.");
    end;

OnTimer9500:
    unittalk(.luvia, "Isbamuth wants all of you dead ─ And I'll carry out his orders.");
    end;

OnTimer13000:
    unittalk(.luvia, "Long live Isbamuth... And death to traitors! Now begone!!");
    end;

OnTimer15000:
    // Create a new Luvia Gemini
    unitwarp(.luvia, "034-4", 98, 32);
    unitkill(.luvia);
    .luvia = monster(.mp$, 98, 38, "Luvia Gemini", Luvia, 1, "#GeminiShowdown::OnABC");

    // Grant her more HP if more players came to attack her
    .@hp = getunitdata(.luvia, UDT_MAXHP) + (getmapusers(.mp$) * 10000);
    setunitdata(.luvia, UDT_MAXHP, .@hp);
    setunitdata(.luvia, UDT_HP,    .@hp);

    // Reconfigure the AI
    .@opt=getunitdata(.luvia, UDT_MODE);
    // Add knockback immunity
    .@opt=.@opt|MD_NOKNOCKBACK;
    // Make it more op
    .@opt=.@opt|MD_DETECTOR;
    .@opt=.@opt|MD_CASTSENSOR_CHASE;
    .@opt=.@opt|MD_CASTSENSOR_IDLE;
    .@opt=.@opt|MD_CHANGECHASE;
    .@opt=.@opt|MD_CHANGETARGET_MELEE;
    .@opt=.@opt|MD_CHANGETARGET_CHASE;
    setunitdata(.luvia, UDT_MODE, .@opt);


    // Prepare the party, lalala!
    .@pi = getmapusers(.mp$) * 2 + 1;
    monster(.mp$, 117, 51, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  83, 58, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  83, 51, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$, 114, 29, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  98, 22, strmobinfo(1, Scar), Scar, .@pi);
    $@VALIA_STATUS[.pid] = 14;
    end;

// The fight loops from 20k (the restart point)
// So this cycle happens every 10 seconds
OnTimer60000:
OnTimer45000:
    consolewarn("Warning, fail-safe mechanism triggered to Luvia.");
OnTimer30000:
    if (mobcount(.mp$, "#GeminiShowdown::OnABC") < 1) {
        stopnpctimer;
        end;
    }
    .beats+=1;

    /* Prepare some data */
    .@hp = getunitdata(.luvia, UDT_HP) * 10 / getunitdata(.luvia, UDT_MAXHP);
    getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, .luvia);
    .@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, .@m$);
    .@mvp=0;.@rnd=0;.@def=-1;
    for (.@i = 0; .@i < .@c; .@i++) {
        if (!.@rnd || !rand2(.@c))
            .@rnd=.@pcs[.@i];
        if (readbattleparam(.@pcs[.@i], UDT_DEF) > .@def) {
            if (readparam(Hp, .@pcs[.@i]) < 1) continue;
            .@mvp=.@pcs[.@i];
            .@def=readbattleparam(.@pcs[.@i], UDT_DEF);
        }
    }

    // Luvia's spell casting
    // She casts every ~30 seconds
    switch (.beats % 18) {
    case 0:
    case 6:
    case 12:
        unittalk(.luvia, "Hahahah, die, die!");
        specialeffect(64, AREA, .luvia);
        sleep(1000);
        monster(.mp$, .@x, .@y, strmobinfo(1, Scar), Scar, max(1, (11 - .@hp) / 10));
        break;
    case 3:
    case 9:
    case 15:
        specialeffect(60, AREA, .luvia);
        sleep(500);
        switch (rand2(3)) {
        case 1:
            unittalk(.luvia, "I am your doom, and ##Bpoison##b is my tool!");
            .@sc = (.@hp < 1 ? SC_DPOISON : SC_POISON);
            break;
        case 2:
            unittalk(.luvia, "You shall ##Bbleed##b, and cease!");
            .@sc = SC_BLOODING;
            break;
        case 3:
            unittalk(.luvia, "The dead are ##Bsilent##b, just like you!");
            .@sc = SC_SILENCE;
            break;
        default:
            unittalk(.luvia, "You won't see what killed you when ##Bblind##b!");
            .@sc = SC_BLIND;
            break;
        }
        areasc(9, 45000, .@sc, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .luvia, 95000);
        .@dmg=100 + (max(1, (11 - .@hp) / 10) * 40);
        areaharm(.luvia, 9, .@dmg, HARM_MAGI, any(Ele_Water,Ele_Fire,Ele_Wind,Ele_Earth), "filter_always", BL_PC|BL_MER|BL_HOM);
        break;
    }

    // FIXME: Spawn other stuff as well, stronger stuff.
    // Let them come from the doors
    setnpctimer 20000;
    end;

OnInit:
OnInstanceInit:
    .state = false;
    .mp$ = "";
    .pid = 0;
    .luvia = 0;
    .beats = 0;
    end;
}