summaryrefslogblamecommitdiff
path: root/world/map/npc/052-2/partyroom.txt
blob: 6e16eb882a903196f417879d6948c807387cf90c (plain) (tree)

























































































































































































































                                                                                                                                                
                                   

                                               
                                               
                                                                
                                               
                                   
                                               











                                                                    
                                                   






























                                                                                                 
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Party room
// $@illia_progress = 6
//
// Level progress:
//     0: Initial state
//     1: Luvia is talking, then spawns after a teleport
//     2: Luvia spawned, and witch guards may spawn to help
//     3: Luvia is defeated
//-----------------------------------------------------------------------------

052-2.gat,88,19,0|script|#TriggerDialog|32767,3,2,{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_SpawnLuvia;
    end;

L_SpawnLuvia:
    set $@illia_level_7_progress, 1;
    cmdothernpc "Luvia", "Start";
    end;

L_ShouldNotBeHere:
    percentheal -100, 0;
    end;

}

// A trigger whose only purpose is to place Luvia npcs back in place.
// (even though the Janitor 7 will have done this job)
052-2.gat,77,48,0|script|#TriggerPlaceLuvia|32767,1,1,{
    if (strcharinfo(0) != $@ILLIA_HERO$) end;
    if ($@illia_progress == 7 && $@illia_level_7_progress == 0) goto L_PlaceLuvia;
    end;

L_PlaceLuvia:
    npcwarp 88, 15, "#LuviaDaemon";
    npcwarp 88, 15, "Luvia";
    end;

}

052-2.gat,88,15,0|script|Luvia|371,{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_Start;
    end;

OnCommandStart:
    goto L_Start;

L_Start:
    setnpctimer 0;
    if ($@illia_level_7_progress == 1)
        startnpctimer;
    end;

L_ShouldNotBeHere:
    percentheal -100, 0;
    end;

OnTimer1000:
    npctalk "Oh well, who thought you would survive so far?";
    end;

OnTimer5000:
    npctalk "All this way, for nothing, only to die from my hands...";
    end;

OnTimer10000:
    npctalk "Don't worry, you will continue to live, for my sake.";
    end;

OnTimer15000:
    npctalk "One piece of advice: get prepared!";
    stopnpctimer;
    setnpctimer 0;
    cmdothernpc "#LuviaDaemon", "Invoke";
    end;

}

052-2.gat,88,15,0|script|#LuviaDaemon|127,{
end;

OnCommandInvoke:
    setnpctimer 0;
    if ($@illia_level_7_progress == 1)
        startnpctimer;
    end;

OnTimer2000:
    if ($@illia_level_7_progress != 1) end;
    misceffect FX_DARK_TELEPORT;
    // Kill any mob existing on the map
    // That's to terminate any attempt at players mass-summoning mobs
    // and hide in a corner of the map.
    killmonster "052-2.gat", "All";
    npcwarp 1, 1, "Luvia";
    end;

OnTimer100:
    if ($@illia_progress != 7)
        goto L_Clear;
    if ($@illia_level_7_progress != 3)
        end;
    // Trance mode
    callsub S_SpawnWitchGuard;
    end;

OnTimer2600:
    if ($@illia_level_7_progress != 3)
        end;
    npcwarp 1, 1, "#LuviaDaemon";
    setnpctimer 0;
    end;

OnTimer5000:
    if ($@illia_level_7_progress != 1)
        end;
    // Warp to the place to spawn luvia once the teleport sequence is finished
    if (isloggedin($@ILLIA_HERO_ID) == 0)
        end;
    attachrid($@ILLIA_HERO_ID);
    set $@illia_luvia_x, getx();
    set $@illia_luvia_y, gety();
    npcwarp $@illia_luvia_x, $@illia_luvia_y, "#LuviaDaemon";

    detachrid;
    // This is a fix to force the official mana client to display a npc after a warp.
    // Note: the manaplus client do not need this.
    disablenpc "#LuviaDaemon";
    end;

OnTimer5500:
    if ($@illia_level_7_progress != 1) end;
    // See the note above.
    enablenpc "#LuviaDaemon";
    misceffect FX_EVIL_SUMMON;
    misceffect FX_CHANNELLING_CAST;
    monster "052-2.gat", $@illia_luvia_x, $@illia_luvia_y, "", 1102, 1, "#LuviaDaemon::onDeath";
    set $@illia_luvia_x, 0;
    set $@illia_luvia_y, 0;
    end;

OnTimer9000:
    if ($@illia_level_7_progress != 1) end;
    set $@illia_luvia_trance_delay, 900; // 15 minutes before turning in trance mode
    set $@illia_witch_guard_threshold, 30 + ($Illia_Luvia_Harvest*3)/5;
    if ($@illia_witch_guard_threshold > 100)
        set $@illia_witch_guard_threshold, 100;
    set $@illia_level_7_progress, 2;
    npcwarp 1, 1, "#LuviaDaemon";
    setnpctimer 0;
    end;

// Extra monster spawn
OnTimer26000:
    if ($@illia_progress != 7)
        goto L_Clear;
    if ($@illia_level_7_progress != 2)
        end;
    // The more players Luvia "harvested", the stronger she is.
    if (rand(100) >= $@illia_witch_guard_threshold)
        end;
    // Decrease her power over time.
    set $@illia_witch_guard_threshold, $@illia_witch_guard_threshold - 7;
    // Keep always a small probability when it reached the minimum
    if ($@illia_witch_guard_threshold <= 0)
        set $@illia_witch_guard_threshold, 6 + $Illia_Luvia_Harvest/5;
    callsub S_SpawnWitchGuard;
    end;

S_SpawnWitchGuard:
    if (isloggedin($@ILLIA_HERO_ID) == 0)
        end;
    attachrid($@ILLIA_HERO_ID);
    npcwarp getx(), gety(), "#LuviaDaemon";
    misceffect FX_EVIL_SUMMON;
    misceffect FX_GROUND_SPAWN;
    monster "052-2.gat", getx(), gety(), "", 1103, 1, "#LuviaDaemon::onWGD";
    detachrid;
    areatimer "052-2.gat", 73, 11, 115, 49, 0, "#LuviaDaemon::onWGS";
    return;

OnTimer30000:
    if ($@illia_level_7_progress != 2)
        end;
    npcwarp 1, 1, "#LuviaDaemon";
    set $@illia_luvia_trance_delay, $@illia_luvia_trance_delay - 30;
    if ($@illia_luvia_trance_delay <= 0)
        goto L_TriggerTrance;
    setnpctimer 0;
    end;

L_TriggerTrance:
    set $@illia_level_7_progress, 3;
    set $@illia_luvia_trance_delay, 0;
    areatimer "052-2.gat", 73, 11, 115, 49, 0, "#LuviaDaemon::onTT";
    setnpctimer 0;
    end;

L_Clear:
    stopnpctimer;
    setnpctimer 0;
    end;

onDeath:
    stopnpctimer;
    setnpctimer 0;
    if ($@illia_progress != 7)
        end;
    set $@illia_level_7_progress, 4;
    killmonster "052-2.gat", "#LuviaDaemon::onWGD";
    mapannounce "052-2.gat", "Luvia: How? By mere humans! But we will see again! Enjoy your victory while it lasts, " + $@ILLIA_HERO$ + "!!", 0;
    areatimer "052-2.gat", 73, 11, 115, 49, 2000, "#LuviaDaemon::onW00t";

    set $@illia_progress, 8;
    callfunc "UpdateIlliaProgress";
    // Set the number of common rewards rewards
    if ($Illia_Luvia_Harvest < 15)
        set $@illia_num_common_reward_items, 0;
    if ($Illia_Luvia_Harvest >= 15 && $Illia_Luvia_Harvest < 35)
        set $@illia_num_common_reward_items, 1;
    if ($Illia_Luvia_Harvest >= 35)
        set $@illia_num_common_reward_items, 2;

    // Set the number of unique rewards
    if ($Illia_Luvia_Harvest < 40)
        set $@illia_num_unique_reward_items, 1;
    if ($Illia_Luvia_Harvest >= 40)
        set $@illia_num_unique_reward_items, 2;
    set $Illia_Luvia_Harvest, 0;

    // Extend the time limit of +7 mins to leave enough time to pick
    // the rewards even if close to the time limit
    set $@illia_max_time, $@illia_max_time + 420;

    // Record how many times the quest was finished
    set $Illia_Win_Counter, $Illia_Win_Counter + 1;

    end;

onWGD:
    end;

onWGS:
    if ($@illia_level_7_progress == 2)
        message strcharinfo(0), "One of Luvia's guard spawned from the depths to assist her!";
    end;

onTT:
    if ($@illia_level_7_progress == 3)
        message strcharinfo(0), "Luvia seems to become in trance!";
    end;

onW00t:
    message strcharinfo(0), "You defeated this evil sorceress... But what about her sister now?";
    end;

}

// Warp from the party room, to the chest room
052-2.gat,88,12,0|script|#ToLuviaRoomDoor|32767,1,2,{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress < 4) end;
    warp "052-2.gat", 133, 84;
    end;
}