summaryrefslogblamecommitdiff
path: root/npc/018-6-3/main.txt
blob: 90601b54d907168e1d085a1122d5ec9a46e82bbe (plain) (tree)








































                                                                               
                                   






                          

                                                                                                                      


           








                                                     
                                                       
                                     
                                                             
                                               
                                                                                                                                                 










                                                                                   
     



           

                                                       
                                       

        



























                                           






                                                                















































                                     


 
// TMW2 Scripts
// Author:
//    Jesusalva
// Description:
//    Controls Forgotten Shrine

// 01863_RelevanceCheck ( Room ID )
function	script	01863_RelevanceCheck	{
    .@id=getarg(0);
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q < 3)
        Exception("INVALID QUEST STATE, REVCHECK", RB_DEFAULT|RB_ISFATAL);
    if (.@q != 3)
        return false;
    if (.@q3 & .@id)
        return false;
    return true;
}

// Main Controller for Instanced maps
018-6-3,0,0,0	script	#01863_InstCtrl	NPC_HIDDEN,{
    end;

// Map, x1, y1, x2, y2, mob, amount
function AreaMonsterB {
    .@m$=getarg(0);
    .@x1=getarg(1);
    .@x2=getarg(3);
    .@y1=getarg(2);
    .@y2=getarg(4);
    .@mi=getarg(5);
    .@am=getarg(6);
    if (!.@am)
        return;
    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am);
    //, instance_npcname(.name$)+"::OnKill"+.@mi);
    return;
}

// Map, x1, y1, x2, y2, mob, bossID
function AreaMonsterBoss {
    .@m$=getarg(0);
    .@x1=getarg(1);
    .@x2=getarg(3);
    .@y1=getarg(2);
    .@y2=getarg(4);
    .@mi=getarg(5);
    .@id=getarg(6);
    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, 1, instance_npcname(.name$)+"::OnKill"+.@id);
    return;
}

// BossRoom ( RoomID, x1, y1, x2, y2, adjustment )
// Adjustment is for bigger rooms. Defaults to false.
function BossRoom {
    .@id=getarg(0);
    .@x1=getarg(1);
    .@y1=getarg(2);
    .@x2=getarg(3);
    .@y2=getarg(4);
    .@ad=getarg(5, false);
    // True: Must spawn boss, False: Allow to use warps
    if (01863_RelevanceCheck(.@id)) {
        mapannounce getmap(), l("BOSS FIGHT!"), bc_map|bc_pc;
        // Spawn a boss. Aggressive chance: 33%
        AreaMonsterBoss(getmap(), .@x1, .@y1, .@x2, .@y2, any(HolyPixie, NulityPixie, VanityPixie, TerraniteProtector, GoboBear, Centaur), .@id);

        // BIG ROOM: 6~12 support units
        // SMALL ROOM: 5~10 support units
        AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2 BlackSlime, rand2(2,4)+.@ad);
        AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2 DarkLizard, rand2(1,2)+.@ad);
        AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2 BlackScorpion, rand2(1,2));
        AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2 Archant, rand2(1,2)-.@ad);
        // Only spawn the fast Hooded Ninja on big rooms
        if (.@ad) {
            AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2 HoodedNinja, any(0,0,1));
        }
    }

    return;
}

// W - West, C - Center, E - East, N - North, S - South
OnRoomNorth:
    BossRoom(1, 62, 41, 121, 58, true);
    end;

OnRoomNW:
    BossRoom(2, 48, 65, 68, 85);
    end;

OnRoomNC:
    BossRoom(4, 77, 65, 103, 76);
    end;

OnRoomNE:
    BossRoom(8, 111, 65, 131, 85);
    end;

OnRoomSW:
    BossRoom(16, 48, 95, 68, 115);
    end;

OnRoomSC:
    BossRoom(32, 77, 104, 103, 115);
    end;

OnRoomSE:
    BossRoom(64, 111, 95, 131, 115);
    end;

OnRoomSouth:
    BossRoom(128, 62, 122, 121, 139, true);
    end;

// Kill boss will use setq3 and also erase any remaining monster
OnKill1:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|1;
    killmonsterall(getmap());
    end;

OnKill2:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|2;
    killmonsterall(getmap());
    end;

OnKill4:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|4;
    killmonsterall(getmap());
    end;

OnKill8:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|8;
    killmonsterall(getmap());
    end;

OnKill16:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|16;
    killmonsterall(getmap());
    end;

OnKill32:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|32;
    killmonsterall(getmap());
    end;

OnKill64:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|64;
    killmonsterall(getmap());
    end;

OnKill128:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|128;
    killmonsterall(getmap());
    end;

OnKill256:
    .@q3=getq3(LoFQuest_Barbara);
    setq3 LoFQuest_Barbara, .@q3|256;
    killmonsterall(getmap());
    end;

}