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





                                                 









                                                        





                                                        




                                   

















                                                                                                        
                     























                                                                                                                          
                     














                                                                          

                                                                   

                                                
                                                                           
                 













                                                                   

                                                                       

                                                                                 
                                                                          








                                              
                     



                                      
                       
                                      
                     








                                                                
                     








                                      
                     



                                              
                     




                                 
                                            






























                                                                            
                     



















                                                                  





                                                                                                 
                                     




                       
               

                    








                                       




                                                                               
 
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Gemini Sisters Quest - Outside the Building

034-3,23,50,0	script	#GeminiBack2	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(8);
    .@p=getcharid(1);
    warp "val2@"+.@p, 37, 25;
    end;
}

034-3,57,29,0	script	#GeminiDoor	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(8);
    .@p=getcharid(1);
    if ($@VALIA_STATUS[.@p] >= 9) {
        warp "val4@"+.@p, 43, 51;
        end;
    }
    slide 58, 34;
    percentheal -20, 0;
    dispbottom l("You are pushed back violently. There is probably some way to break this barrier.");
    end;
}

034-3,51,38,0	script	Engravings#Gemini	NPC_NO_SPRITE,{
    mes l("You can read some words engraved inside this rock, but some are erased by wind and time:");
    next;
    mes l("\".. can use this .. power..´. . .´. . . amplify a spell ..´.");
    mes l(" . ´´. Don't let .. spell power .´..´ . .. fade away ...");
    mes l("´ .Use lazurite stones ´..´. they will appear. ..´ .. drop them inside .. this circle.");
    mes l(". ´ power.. drains .. life..´. .´  focus . .not move at all´. .\"");
    next;
    mes l("Below this strange writing, you notice a word still deeply engraved in the stone:");
    next;
    mesq b("catalazuli");
    next;
    .@p=getcharid(1);
    mes l("... that looks like an incantation or something.");
    if (strcharinfo(0) != getpartyleader(.@p)) {
        mes l("I probably should let %s chant it.", getpartyleader(.@p));
        close;
    }
    next;
    mes l("I think this blue circle right here can be helpful to break the enchantment that blocks the door of the Inn.");
    next;
    mes l("Let's see how I can activate it...");
    mes l("But I should probably get inside it, first.");
    close;

OnChannel:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(8);

    // Check location
    getmapxy(.@m$, .@x, .@y, 0);
    if (.@x < 52 ||
        .@x > 54 ||
        .@y < 37 ||
        .@y > 38) end;

    // Only party leader may proceed
    .@p=getcharid(1);
    if (strcharinfo(0) != getpartyleader(.@p)) {
        percentheal 0, -25;
        specialeffect(312, AREA, getcharid(3));
        dispbottom l("Argh! I assume I can't do this chant!");
        end;
    }

    // Bonus is based on int
    .@bonus = readparam2(bInt) / 25;
    // Unlike TMW's, all Lazurites show up at same place
    // ...
    // amount of initial magic power
    .@magic_power = 1811 + readparam2(bInt)*2;
    // Channelling required power depends on the base Int of the character
    .@magic_power_required = 5707 - 2*readparam2(bInt);
    // magic power loss depends also on Int. TMW uses 53, we use 21
    .@magic_power_loss = 21 - (((readparam2(bInt)+1)*2)/10);

    dispbottom l("Ok, let's stay focused now!");
    areamonster getmap(), 27, 20, 77, 47, strmobinfo(1, Forain), Forain, 1;
    // TODO: Loop
    debugmes "NPC: %s / %s (%d)", .name$, .extname$, instance_id();
    .aid=getcharid(3);
    .mp$=getmap();
    .power=.@magic_power;
    .state=0;
    .maxpw=.@magic_power_required;
    .mloss=.@magic_power_loss;
    initnpctimer;
    end;

OnTimer13000:
    initnpctimer; // Reset timer
    // Time to spawn monsters
    .@pc = getmapusers(.mp$);
    areamonster .mp$, 56, 30, 60, 31, "Guardian", Scar, 1+.@pc;
    areamonster .mp$, 27, 20, 77, 47, strmobinfo(1, Forain), Forain, 2;
    // Terranites only show up when doing multiplayer, based on number of players
    if (.@pc >= 2)
        areamonster .mp$, 56, 30, 60, 31, "Guardian", Terranite, (.@pc/2);
OnTimer10000:
OnTimer8000:
OnTimer6000:
OnTimer4000:
OnTimer2000:
    if (instance_id() < 0) end;

    if (!attachrid(.aid)) {
        npctalk "The caster ceased to exist!";
        stopnpctimer;
        end;
    }

    getmapxy(.@m$, .@x, .@y, 0, .aid);
    if (.@m$ != .mp$) {
        npctalk "The caster is gone!";
        stopnpctimer;
        end;
    }
    if (.@x < 52 ||
        .@x > 54 ||
        .@y < 37 ||
        .@y > 38) {
        npctalk "The caster left the power circle!";
        dispbottom l("The magic accumulated backfires at you!");
        heal -(.power), -(.power/2);
        stopnpctimer;
        end;
    }

    // Harm you
    //misceffect FX_CHANNELLING_RAISE;
    percentheal -4, -1;

    if (ispcdead()) {
        npctalk "The caster is dead!";
        stopnpctimer;
        end;
    }
    if (Sp <= 0) {
        npctalk "The caster ran out of mana!";
        stopnpctimer;
        end;
    }

    // Deplete power over time
    // But only if not doing solo
    if (getmapusers(.mp$) > 1 || .mloss < 0)
        .power -= .mloss;

    // Remove stones inside the circle
    .@cat=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteShard, true) * 12;
    .@cbt=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteCrystal, true) * 32;
    .@cct=getareadropitem(.mp$, 52, 37, 54, 39, LazuriteHeart, true) * 65;

    // Grant them POWER
    .power+=.@cat+.@cbt+.@cct;
    .@cur = 4 * .power / .maxpw; // Goes from 0 to 4

    // Check status and update
    if (.@cur < .status)
        npctalk "NOTICING a sudden power loss!";
    else if (.@cur > .status)
        npctalk "NOTICING an increase of power!";
    .status=.@cur;

    // Are we done?
    if (.power >= .maxpw) {
        npctalk "*the gate spell has been redefined*";
        if (getcharid(1) > 0) {
            $@VALIA_STATUS[getcharid(1)]=9;
            stopnpctimer;
            .power=0;
            .mloss=0;
            .maxpw=0;
            .state=0;
            .mp$="";
            .aid=0;
        }
        stopnpctimer;
        end;
    }
    detachrid();
    // Should we spawn items?
    .@t = (getnpctimer(0)+500) / 1000;
    // Item time!
    if (.@t == 6 ||
        .@t == 10) {
        .@i = 0;
        // More Shards than Crystals and Hearts
        freeloop(true);
        while (.@i < ((5-getmapusers(.mp$)) * 2 + 5)) {
            .@it=any(LazuriteShard, LazuriteShard, LazuriteShard,
                     LazuriteCrystal, LazuriteCrystal,
                     LazuriteHeart);
            makeitem(.@it, 1, .mp$, rand2(27, 77), rand2(20, 47));
            .@i += 1;
        }
        freeloop(false);
    }
    end;

OnTalkNearby:
    // not very obvious stuff by gumi
    .@no_nick$ = strip(substr($@p0$, getstrlen(strcharinfo(PC_NAME)) + 3, getstrlen($@p0$) - 1));
    .@message$ = strtoupper(.@no_nick$);
    if (.@message$ == "CATALAZULI") {
        goto OnChannel;
    }
    end;

OnInit:
OnInstanceInit:
    .distance=3;
    .pid=getnpcid();
    // For players
    .aid=0;
    .mp$="";
    .power=0;
    .state=0;
    .maxpw=0;
    .mloss=0;

    debugmes "Gemini Pattern %d", .pid;
    //defpattern(.pid, "^([Kk][Aa][Tt][Aa][Zz][Uu][Ll][Ii])$", "OnTalkNearby");
    defpattern(.pid, "^(.*)$", "OnTalkNearby");
    activatepset(.pid);
    end;
}