summaryrefslogblamecommitdiff
path: root/npc/042-2/boss.txt
blob: 9da2d925d97a22f96db7afc6a85f26f8161c4b61 (plain) (tree)
1
2
3
4
5
6
7
8
9







                                                        
                            



















                                                                     



                                 






                                       

                                   







                                                                           
                              


                                               








                                                                                                              


















                                                       
                                                                        










                                                                                           

                             

        












































                                                                                              


 
// TMW 2 Script
// Author:
//  Jesusalva
//  Micksha
// Description:
//  Basement Boss Fight

042-2,41,22,0	script	#KDoor0422	NPC_HIDDEN,0,0,{
    function kdoor0422Spawn;
    end;

OnTouch:
    .@label$=instance_npcname(.name$)+"::OnKillBoss";
    .@g=getcharid(2);
    if (($KAMELOT_QUEST[.@g] & 4) && !mobcount(getmap(), .@label$)) {
        warp "042-2@"+.@g, 58, 139;
    } else {
        dispbottom l("Powerful magic repels you!");
        percentheal -5, -5;
        slide 38, 28;
    }
    end;

OnArrival:
    .@g=getcharid(2);
    if (.@g < 1)
        percentheal -100, -100;
    if (getmap() != "042-2@"+.@g)
        end;
    if ($@KAMELOT_WAVE[.@g] != 3)
        end;
    $@KAMELOT_WAVE[.@g]+=1;
    initnpctimer;
    //if ($@KAMELOT_WAVE == 0)
    //    goto OnKillMob;
    // TODO: Fire dialog
    // TODO: Stun yourself for cutscene
    // ...
    end;

OnTimer1000:
    .@m$=instance_mapname("042-2");
    mapannounce .@m$, "??? : Where's Micksha? WHRE IS ARTHUR MICKSHA??", 0;
    .@gcount=$KAMELOT_PC[.@g];
    kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
    end;

OnTimer30000:
    .@m$=instance_mapname("042-2");
    mapannounce .@m$, "??? : MICKSHAAAAAAA!! YOU NEED TO FIX STUFF!!", 0;
    .@gcount=$KAMELOT_PC[.@g];
    kdoor0422Spawn(.@gcount*2, 20, 24, 59, 59);
    end;

OnTimer60000:
    .@m$=instance_mapname("042-2");
    .@n$=instance_npcname(.name$);
    mapannounce .@m$, "General Krukan : NO WAY I'M GOING OUT UNTIL I'M FIXED!!!!", 0;
    .@gcount=$KAMELOT_PC[.@g];
    kdoor0422Spawn(.@gcount*3, 20, 24, 59, 59);
    .@mob=monster(.@m$, 34, 26, strmobinfo(1, GeneralKrukan), GeneralKrukan, 1, .@n$+"::OnKillBoss"); // FIXME
    end;


OnKillMob:
    if (!playerattached()) end;
    .@g=getcharid(2);
    if (.@g < 1) percentheal -100, -100;
    getexp $KAMELOT_MX[.@g]*5, $KAMELOT_MX[.@g]*2;
    end;

OnKillBoss:
    .@g=getcharid(2);
    dispbottom l("This is all in KAMELOT for now.");
    $KAMELOT_QUEST[.@g]=$KAMELOT_QUEST[.@g]|4; // FIXME
    // Player Reward for completing this stage
    getitem GuildCoin, min(1, $KAMELOT_MX[.@g]/20);
    getexp $KAMELOT_MX[.@g]*50, $KAMELOT_MX[.@g]*10;
    // Guild Reward for completing this stage
    .@ggp=300+$KAMELOT_MX[.@g]*5;
    .@gxp=$KAMELOT_MX[.@g]*10;
    $GUILD_BANK[.@g]+=.@ggp;
    guildgetexp(.@gxp); // 10xp per player average level (max 1000/1500)
    // Announce
    mapannounce getmap(), strcharinfo(0)+" has defeated Krukan!", 0;
    // Guild Master Notification
    .@gm$=getguildmaster(.@g);
    if (!getcharid(3, .@gm$)) end;
    .@gma=getcharid(3, .@gm$);
    .@gmb=getcharid(0, .@gm$);
    if (!isloggedin(.@gma, .@gmb)) end;
    message .@gm$, strcharinfo(0)+" defeated Krukan: Guild GP +"+.@ggp+" Guild XP +"+.@gxp;

    // TODO: maptimer to give EXP to helpers/survivors
    // TODO: Arrest scene
    // TODO: Actual arresting
    end;

function kdoor0422Spawn {
    .@label$=instance_npcname(.name$)+"::OnKillMob";
    .@gcount=getarg(0);
    .@x1=getarg(1);
    .@y1=getarg(2);
    .@x2=getarg(3);
    .@y2=getarg(4);
    .@g=getcharid(2);
    if (.@g < 1) percentheal -100, -100;
    .@avg=$KAMELOT_MX[.@g];
    .@m$=getmap();
    freeloop(true);
    for (.@i=0; .@i < .@gcount; .@i++) {
        .@mobId=any(CursedSoldier, CursedArcher); // 50-50 ratio
        .@mob=areamonster(.@m$, 21, 24, 59, 99, strmobinfo(1, .@mobId), .@mobId, 1, .@label$);
        // Reconfigure the monster
        setunitdata(.@mob, UDT_LEVEL, .@avg);
        setunitdata(.@mob, UDT_STR, 1+.@avg/4);
        setunitdata(.@mob, UDT_AGI, 1+.@avg/4);
        setunitdata(.@mob, UDT_VIT, 1+.@avg/4);
        setunitdata(.@mob, UDT_INT, 1+.@avg/4);
        setunitdata(.@mob, UDT_DEX, 1+.@avg/4);
        setunitdata(.@mob, UDT_LUK, 1+.@avg/4);
        setunitdata(.@mob, UDT_ADELAY, 1672);
        setunitdata(.@mob, UDT_ATKRANGE, (.@mobId == CursedArcher ? any(6,7) : any(1,2)));
        // Battle Status
        setunitdata(.@mob, UDT_MAXHP,    .@avg*33);
        setunitdata(.@mob, UDT_HP,       .@avg*33);
        setunitdata(.@mob, UDT_ATKMIN,   .@avg*45/10);
        setunitdata(.@mob, UDT_ATKMAX,   .@avg*65/10);
        setunitdata(.@mob, UDT_DEF,      1+.@avg*9/10);
        setunitdata(.@mob, UDT_MDEF,     1+.@avg*5/10);
        setunitdata(.@mob, UDT_HIT,      .@avg*4); // Advised: x3
        setunitdata(.@mob, UDT_FLEE,     .@avg*35/10); // Advised: x4
        // Critical calculation
        .@min=2;
        .@max=max(.@min, min(25, .@avg/5));
        setunitdata(.@mob, UDT_CRIT,     rand2(.@min, .@max));
        // Loop through
    }
    freeloop(false);
    return;
}

// Script end
}