summaryrefslogblamecommitdiff
path: root/npc/006-7/ctrl.txt
blob: 0ddaca18502879875d532b78d0994c5817877c3a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                        





                                                                                             


                                                     
                                




                                                                                                     


                                                                                             
                                                         
                                        
                                                         
         








                                                         

                                                 


                                                                       
                                                                     






















                                                        
                                                                   









                                                                        
 
                              






                      
                                 

                                                   
                                                                                        

                                
                                      
                                                                             
                   
                                   


                     


                                                                            











                                                              
                
 






                                           

                                                                   
                                              


            
                                                                                           
                                                                              
                    

                                                                                            
                          





            

                                        



















                                                                                                                     



































































                                                                                                                         

     






                            

             


        
// TMW2 Script
// Author:
//    Jesusalva

006-7,44,50,0	script	#OutOf0067	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    if (!$@ICICLE_CHALLENGE)
        warp "006-6", 40, 36;
    end;

OnRw:
    getexp 1000000, 0;
    Mobpt += 10000;
    dispbottom l("Der Schneemann has been defeated: %s Monster Points gained.", fnum(10000));
    end;
}

006-7,44,50,0	script	Ice Lord	NPC_YETIFLY,{
    if ($@ICICLE_CHALLENGE) end;
    if (.ticks > gettimetick(2)) {
        mesn;
        mesq l("This challenge will be available in %s. Please wait until then.", FuzzyTime(.ticks));
        close;
    }
    mesn;
    mesq l("With Magic and Blades, The Icicle shall break. Do you undertake the challenge?");
    mesc l("Advised: 6+ players"), 1;
    mesc l("Advised: 1+ mage, 1+ tanker, 2+ healers"), 1;
    mesc l("Time Limit: 90 minutes"), 1;
    mesc l("Enter/Leave after start: %s", b(l("NO"))), 1;
    next;
    select
        l("Not yet."),
        l("Bring it on!"),
        rif(REBIRTH, l("Bring me, my worst nightmare."));
    mes "";
    if (@menu == 1) {
        closeclientdialog;
        close;
    }

    .ticks = gettimetick(2) + 5400; // 90 minutes
    .BOSS = monster("006-7", 44, 36, "Der Schneemann", SnowmanBoss, 1);
    .@mlt = (@menu == 2 ? 10 : 15);

    setunitdata(.BOSS, UDT_MAXHP, 1000000 * .@mlt / 10); // 1M ~ 1.5M
    setunitdata(.BOSS, UDT_HP,    1000000 * .@mlt / 10);
    // Reconfigure the AI
    .@opt=getunitdata(.BOSS, UDT_MODE);
    // Disable looting
    if (.@opt & MD_LOOTER)
        .@opt=.@opt^MD_LOOTER;
    // Add knockback immunity
    .@opt=.@opt|MD_NOKNOCKBACK;
    // Mark as boss
    .@opt=.@opt|MD_BOSS;
    // Mark as aggressive
    .@opt=.@opt|MD_AGGRESSIVE;
    .@opt=.@opt|MD_ANGRY;
    // 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(.BOSS, UDT_MODE, .@opt);

    // Nerf the damage, but never miss a hit
    setunitdata(.BOSS, UDT_ATKMIN,   60 * .@mlt / 10); // 60~90 dmg
    setunitdata(.BOSS, UDT_ATKMAX,   60 * .@mlt / 10);
    setunitdata(.BOSS, UDT_ADELAY, 2220 / .@mlt * 10); // 2220 or 1480ms
    setunitdata(.BOSS, UDT_HIT,      2400);

    // Boosting the defense is not necessary
    // It nerfs weapons to 40% (bows to 20%)
    // Then it resists 50% of Neutral element.
    // Note it is strong against Water (25% dmg)
    // And weak against Fire (snow) and Wind (100% dmg)
    // Otherwise, behave as Ghost element

    $@ICICLE_CHALLENGE = true;
    disablenpc .name$;
    initnpctimer;
    closeclientdialog;
    close;

// Heart
OnTimer5000:
    /* Maybe the fight is over */
    if (!mobcount("006-7", "all"))
        maptimer2("006-7", 10, "#OutOf0067::OnRw");
    if (.ticks < gettimetick(2) || !mobcount("006-7", "all") || !getmapusers("006-7")) {
        killmonsterall("006-7");
        enablenpc .name$;
        npctalk "The battle is over!";
        .ticks = min(.ticks, gettimetick(2) + 1800); // Min. Cooldown: 30 min
        .beats = 0;
        $@ICICLE_CHALLENGE = false;
        stopnpctimer;
        end;
    }

    /* 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) {
    // (1/6) Summon Reinforcements (every 60s)
    case 0:
    case 6:
    case 12:
        unittalk(.BOSS, "Come forth, ##Bsnow army##b, for the Icicle shall live forever!");
        specialeffect(65, AREA, .BOSS); // Actually 64, but won't do well here
        sleep(1000);
        monster("006-7", 44, 22, strmobinfo(1, Snowman), Snowman, max(1, (11 - .@hp) / 10));
        break;
    // (2/6) Tanker (~30s)
    case 1:
    case 4:
    case 7:
    case 10:
    case 13:
    case 16:
        specialeffect(702, AREA, .BOSS);
        sleep(1000);
        if (.@hp <= 3) {
            // Third Attack Pattern: Judgment
            unittalk(.BOSS, "%s cannot stop me! ##BJudgment##b!", strcharinfo(0, "cursed player", .@mvp));
            .@PW=250; .@SPW=60; .@RG=3;
        } else if (.@hp <= 7) {
            // Second Attack Pattern: Holy Light
            unittalk(.BOSS, "%s, I'll show you no mercy! ##BHoly Light##b!", strcharinfo(0, "cursed player", .@mvp));
            .@PW=125; .@SPW=25; .@RG=1;
        } else {
            // First Attack Pattern: Napalm Beat
            unittalk(.BOSS, "This battle is over, %s! ##BNapalm Beat##b!", strcharinfo(0, "cursed player", .@mvp));
            .@PW=35; .@SPW=5; .@RG=2;
        }
        .@mtk = calcdmg(.BOSS, .@mvp, HARM_MAGI) * 2;
        .@dmg = .@mtk * .@PW / 100;
        .@dsb = .@mtk * .@SPW / 100;
        sleep(1000);
        areaharm(.@mvp, .@RG, .@dsb, HARM_MAGI, Ele_Holy);
        harm(.@mvp, .@dmg, HARM_MAGI, Ele_Holy);
        break;
    // (3/6) Random Target (~60s)
    case 2:
    case 8:
    case 14:
        specialeffect(50, AREA, .BOSS);
        sleep(1000);
        .@time=rand2(18000, 36000) + 10000 - (.@hp * 1000);
        // Switch between curse and disable
        if (any(true,false)) {
            unittalk(.BOSS, "I hereby ##Bcurse##b you, %s!", strcharinfo(0, "cursed player", .@rnd));
            sc_start(SC_CURSE, .@time, 1, 10000, SCFLAG_FIXEDRATE, .@rnd);
        } else {
            unittalk(.BOSS, "I shall ##Bdisable##b you, %s!", strcharinfo(0, "cursed player", .@rnd));
            sc_start(SC_BLIND, .@time / 2, 1, 10000, SCFLAG_FIXEDRATE, .@rnd);
            sc_start(SC_SILENCE, .@time / 2, 1, 10000, SCFLAG_FIXEDRATE, .@rnd);
        }
        // Second pattern: Bleeding ON
        if (.@hp <= 7) {
            sc_start(SC_BLOODING, 10000, 1, 9000-(.@hp*1000), SCFLAG_FIXEDRATE, .@rnd);
        }
        break;
    // (4/6) Traps (~60s)
    case 3:
    case 9:
    case 15:
        .@x1=rand2(31, 58); .@x2=rand2(31, 58); .@x3=rand2(31, 58);
        .@y1=rand2(23, 49); .@y2=rand2(23, 49); .@y3=rand2(23, 49);
        break;
    // (5/6) Weak AOE (~60s)
    case 5:
    case 11:
    case 17:
        break;
    }
    // Strong AOE: Every 3 minutes (case = 0)
    // Stalls all other skills for a while
    if (.beats % 18 == 0) {
        specialeffect(66, AREA, .BOSS);
        unittalk(.BOSS, "I am the Icicle, the immortal.");
        sleep(1500);
        specialeffect(700, AREA, .BOSS);
        unittalk(.BOSS, "You're no match for me, so...");
        sleep(1500);
        specialeffect(700, AREA, .BOSS);
        if (.@hp <= 3) {
            unittalk(.BOSS, "Perish! ##BSnowstorm##b!");
            .@dmg=rand2(750, 1000);
            areasc(3, 5000, SC_FREEZE, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .BOSS, 2000);
            areasc(6, 10000, SC_BLIND, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .BOSS, 2000);
        } else if (.@hp <= 7) {
            unittalk(.BOSS, "Perish! ##BBlizzard##b!");
            .@dmg=rand2(500, 750);
            areasc(3, 5000, SC_FREEZE, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .BOSS, 1500);
        } else {
            unittalk(.BOSS, "Perish! ##BShattering Winds##b!");
            .@dmg=rand2(350, 500);
        }
        /* Three blocks */
        specialeffect(66, AREA, .BOSS);
        areaharm(.BOSS, 6, .@dmg, HARM_MAGI, Ele_Neutral);
        sleep(500);
        specialeffect(66, AREA, .BOSS);
        areaharm(.BOSS, 12, .@dmg, HARM_MAGI, Ele_Water);
        sleep(500);
        specialeffect(66, AREA, .BOSS);
        specialeffect(312, AREA, .BOSS);
        areaharm(.BOSS, 18, .@dmg, HARM_MAGI, Ele_Holy);
        areasc(18, .@dmg*rand2(50, 100), SC_COLD, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .BOSS, 10001 - (.@hp * 1000));
    }

    initnpctimer;
    end;

OnInit:
    .distance = 4;
    .ticks = gettimetick(2);
    .beats = 0;
    .mvp = 0;
    .def = 0;
    end;
}