summaryrefslogblamecommitdiff
path: root/npc/003-0/sage.txt
blob: 5b723460480d71c0e2add17f7180bb60cd498314 (plain) (tree)
























































                                                                                                                                           


                                                                                                                          







                                                                                                        
               


























                                                                                                                          
               


























                                                                                                                         
               

                                                                             


                                                           




                                                                                                                      


                                        




                                                                                            
 




                                                                     
 
                                   







































































































                                                                                                                
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Leader of the SAGE class

003-0,34,37,0	script	Sage Master	NPC_PLAYER,{
    /*
    if (!is_staff())
        goto L_Close;
    */
    if (!(MAGIC_SUBCLASS & CL_SAGE))
        goto L_SignUp;
    goto L_Member;

// Sign Up
L_SignUp:
    // Not allowed if subclass filled or not from main class
    if (total_subclass() >= max_subclass() || getskilllv(WIZARD_MAGE) < 2)
        goto L_Close;
    mesn;
    mesq l("Hey there! Do you want to join the Sage Class?");
    mesc l("Warning: If you join a subclass, you can't leave it later!"), 1;
    next;
    if (askyesno() != ASK_YES)
        close;
    // TODO: Requeriment for signing up to a subclass? Or is the tier + skill quest hard enough?
    MAGIC_SUBCLASS=MAGIC_SUBCLASS|CL_SAGE;
    mesn;
    mesq l("Welcome to the sage guild!");
    close;

// Close
L_Close:
    goodbye;
    closedialog;
    close;

L_Missing:
    mesn;
    mesq l("Hey hey! You don't have that stuff, CAN'T YOU READ?!");
    percentheal 0, -10;
    next;
    goto L_Member;

// Membership area
// Sage
//  CR_TRUST (raise Max HP in 200 and Holy Resistance in 5%, passive)
//  AL_ANGELUS (DEF Increase 5% for	15s/LVL, 14x14 area for PARTY)
//  PR_REDEMPTIO (suicide with death penalty. Revive dead party members on a 29x29 area. Min. 1% xp. 0.01% xp penalty reduction per revive)
//  MER_INCAGI (raise agi and move speed for 20s/LVL. Have an HP cost.)
//  SM_BASH up to level 4 (+220% dmg and +20% acc). PS. If you have MP, SM_BASH is very powerful.

L_Member:
    mesn;
    mesq l("Hey there! Do you want to learn new skills for a very small teaching fee?");
    select
        rif(sk_intcost(SA_FREECAST) && && getskilllv(SA_FREECAST) < (1+degree_subclass()/2), l("Learn Action Casting")),
        rif(sk_intcost(SA_DRAGONOLOGY) && getskilllv(SA_DRAGONOLOGY) < (1+degree_subclass()/2), l("Learn Dragon Slayer")),
        rif(sk_intcost(TMW2_SAGE) && sk_canlvup(TMW2_SAGE), l("Improve Mana Wisdom")),
        rif(sk_intcost(SA_FLAMELAUNCHER) && sk_canlvup(SA_FLAMELAUNCHER), l("Improve Fire Weapon")),
        rif(sk_intcost(SA_FROSTWEAPON) && sk_canlvup(SA_FROSTWEAPON), l("Improve Ice Weapon")),
        rif(sk_intcost(SA_LIGHTNINGLOADER) && sk_canlvup(SA_LIGHTNINGLOADER), l("Improve Wind Weapon")),
        rif(sk_intcost(SA_SEISMICWEAPON) && sk_canlvup(SA_SEISMICWEAPON), l("Improve Earth Weapon")),
        l("Leave Subclass"),
        l("Nothing at the moment.");
    mes "";
    switch (@menu) {
        case 1:
            mesc l("[Action Casting]");
            mesc l("Allows to move/attack while casting. (Melee attacks still interrupt casting!)");
            mes "";
            mesn;
            mesq l("This useful skill will only require:");
            mesc l("@@/@@ @@", countitem(Tentacle),         (getskilllv(SA_FREECAST)+1)*10, getitemlink(Tentacle));
            mesc l("@@/@@ @@", countitem(MushroomSpores),   (getskilllv(SA_FREECAST)+1)*5,  getitemlink(MushroomSpores));
            mesc l("@@/@@ @@", countitem(WolvernTooth),     (getskilllv(SA_FREECAST)+1)*3,  getitemlink(WolvernTooth));
            mesc l("@@/@@ @@", countitem(RedScorpionClaw),  (getskilllv(SA_FREECAST)+1)*1,  getitemlink(RedScorpionClaw));
            next;
            if (askyesno() == ASK_YES) {
                if (
                    countitem(Tentacle)          < (getskilllv(SA_FREECAST)+1)*10 ||
                    countitem(MushroomSpores)    < (getskilllv(SA_FREECAST)+1)*5 ||
                    countitem(WolvernTooth)      < (getskilllv(SA_FREECAST)+1)*3 ||
                    countitem(RedScorpionClaw)   < (getskilllv(SA_FREECAST)+1)*1) goto L_Missing;

                delitem Tentacle,            (getskilllv(SA_FREECAST)+1)*10;
                delitem MushroomSpores,      (getskilllv(SA_FREECAST)+1)*5;
                delitem WolvernTooth,        (getskilllv(SA_FREECAST)+1)*3;
                delitem RedScorpionClaw,     (getskilllv(SA_FREECAST)+1)*1;

                sk_lvup(SA_FREECAST);

                next;
            }
            break;
        case 2:
            mesc l("[Dragon Slayer]");
            mesc l("Raises attack and resistance against dragons. Also raises int. Passive.");
            mes "";
            mesn;
            mesq l("This useful skill will only require:");
            mesc l("@@/@@ @@", countitem(Acorn),         (getskilllv(SA_DRAGONOLOGY)+1)*70, getitemlink(Acorn));
            mesc l("@@/@@ @@", countitem(Root),          (getskilllv(SA_DRAGONOLOGY)+1)*10, getitemlink(Root));
            mesc l("@@/@@ @@", countitem(FrozenYetiTear),(getskilllv(SA_DRAGONOLOGY)+1)*2,  getitemlink(FrozenYetiTear));
            mesc l("@@/@@ @@", countitem(FluoPowder),    (getskilllv(SA_DRAGONOLOGY)+1)*1,  getitemlink(FluoPowder));
            next;
            if (askyesno() == ASK_YES) {
                if (
                    countitem(Acorn)            < (getskilllv(SA_DRAGONOLOGY)+1)*70 ||
                    countitem(Root)             < (getskilllv(SA_DRAGONOLOGY)+1)*10 ||
                    countitem(FrozenYetiTear)   < (getskilllv(SA_DRAGONOLOGY)+1)*2 ||
                    countitem(FluoPowder)       < (getskilllv(SA_DRAGONOLOGY)+1)*1) goto L_Missing;

                delitem Acorn,          (getskilllv(SA_DRAGONOLOGY)+1)*70;
                delitem Root,           (getskilllv(SA_DRAGONOLOGY)+1)*10;
                delitem FrozenYetiTear, (getskilllv(SA_DRAGONOLOGY)+1)*2;
                delitem FluoPowder,     (getskilllv(SA_DRAGONOLOGY)+1)*1;

                sk_lvup(SA_DRAGONOLOGY);

                next;
            }
            break;
        case 3:
            mesc l("[Mana Wisdom]");
            mesc l("Increase mana experience gain, when using mana skills.");
            mes "";
            mesn;
            mesq l("This useful skill will only require:");
            mesc l("@@/@@ @@", countitem(Acorn),            (getskilllv(TMW2_SAGE)+1)*60, getitemlink(Acorn));
            mesc l("@@/@@ @@", countitem(Bread),            (getskilllv(TMW2_SAGE)+1)*30, getitemlink(Bread));
            mesc l("@@/@@ @@", countitem(SmallMushroom),    (getskilllv(TMW2_SAGE)+1)*20, getitemlink(SmallMushroom));
            mesc l("@@/@@ @@", countitem(PinkBlobime),      (getskilllv(TMW2_SAGE)+1)*20,  getitemlink(PinkBlobime));
            mesc l("@@/@@ @@", countitem(RedApple),         (getskilllv(TMW2_SAGE)+1)*15,  getitemlink(RedApple));
            next;
            if (askyesno() == ASK_YES) {
                if (
                    countitem(Acorn)         < (getskilllv(TMW2_SAGE)+1)*60 ||
                    countitem(Bread)         < (getskilllv(TMW2_SAGE)+1)*30 ||
                    countitem(SmallMushroom) < (getskilllv(TMW2_SAGE)+1)*20 ||
                    countitem(PinkBlobime)   < (getskilllv(TMW2_SAGE)+1)*20 ||
                    countitem(RedApple)      < (getskilllv(TMW2_SAGE)+1)*15) goto L_Missing;

                delitem Acorn,          (getskilllv(TMW2_SAGE)+1)*60;
                delitem Bread,          (getskilllv(TMW2_SAGE)+1)*30;
                delitem SmallMushroom,  (getskilllv(TMW2_SAGE)+1)*20;
                delitem PinkBlobime,    (getskilllv(TMW2_SAGE)+1)*20;
                delitem RedApple,       (getskilllv(TMW2_SAGE)+1)*15;

                sk_lvup(TMW2_SAGE);

                next;
            }
            break;
        // Weapon Enhance
        case 4:
        case 5:
        case 6:
        case 7:
            setarray .@ASkill, SA_FLAMELAUNCHER, SA_FROSTWEAPON, SA_LIGHTNINGLOADER, SA_SEISMICWEAPON;
            setarray .@AItem, Curshroom, Coral, BatWing, PileOfAsh;
            setarray .@BItem, Ruby, Sapphire, Emerald, Topaz;
            setarray .@ASkill$, "Fire", "Ice", "Wind", "Earth";

            .@index=@menu-4;

            .@Skill$=.@ASkill$[.@index];
            .@Skill=.@ASkill[.@index];
            .@Item=.@AItem[.@index];
            .@ItemB=.@BItem[.@index];

        	deletearray(.@ASkill);
        	deletearray(.@AItem);
        	deletearray(.@BItem);
        	deletearray(.@ASkill$);

            mesc l("[@@ Weapon]", .@Skill$);
            mesc l("Temporaly switch weapon element to @@. Success rate is fixed at 70%.", .@Skill$);
            mes "";
            mesn;
            mesq l("This useful skill will only require:");
            mesc l("@@/@@ @@", countitem(.@Item),       (getskilllv(.@Skill)+1)*30, getitemlink(.@Item));
            mesc l("@@/@@ @@", countitem(FluoPowder),   (getskilllv(.@Skill)+1)*15, getitemlink(FluoPowder));
            mesc l("@@/@@ @@", countitem(HerbalTea),    (getskilllv(.@Skill)+1)*3, getitemlink(HastePotion));
            mesc l("@@/@@ @@", countitem(WoodenLog),    (getskilllv(.@Skill)+1)*2,  getitemlink(DiamondPowder));
            mesc l("@@/@@ @@", countitem(.@ItemB),      (getskilllv(.@Skill)+1)*1,  getitemlink(.@ItemB));
            next;
            if (askyesno() == ASK_YES) {
                if (
                    countitem(.@Item)           < (getskilllv(.@Skill)+1)*30 ||
                    countitem(FluoPowder)       < (getskilllv(.@Skill)+1)*15 ||
                    countitem(HerbalTea)        < (getskilllv(.@Skill)+1)*3 ||
                    countitem(WoodenLog)        < (getskilllv(.@Skill)+1)*2 ||
                    countitem(.@ItemB)          < (getskilllv(.@Skill)+1)*1) goto L_Missing;

                delitem .@Item,         (getskilllv(.@Skill)+1)*30;
                delitem FluoPowder,     (getskilllv(.@Skill)+1)*15;
                delitem HerbalTea,      (getskilllv(.@Skill)+1)*3;
                delitem WoodenLog,      (getskilllv(.@Skill)+1)*2;
                delitem .@ItemB,        (getskilllv(.@Skill)+1)*1;

                sk_lvup(.@Skill);

                next;
            }
            break;
        case 8:
            // All skills related may include the basic class skills if they're related.
            mesc l("WARNING: If you leave the subclass, you'll lose all skills related to it!"), 1;
            mesc l("This cannot be undone. Are you sure?"), 1;
            mes "";
            if (askyesno() == ASK_YES) {
                mes "";
                if (validatepin()) {
                    skill SA_FREECAST, 0, 0;
                    skill SA_DRAGONOLOGY, 0, 0;
                    skill TMW2_SAGE, 0, 0;
                    skill SA_FLAMELAUNCHER, 0, 0;
                    skill SA_FROSTWEAPON, 0, 0;
                    skill SA_LIGHTNINGLOADER, 0, 0;
                    skill SA_SEISMICWEAPON, 0, 0;
                    MAGIC_SUBCLASS=MAGIC_SUBCLASS^CL_SAGE;
                    mesc l("You abandoned the SAGE class!"), 1;
                    close;
                } else {
                    mesc l("Failed to validate pin. Aborting.");
                    next;
                }
            } else {
                mes "";
                mesc l("Operation aborted. Phew!");
                next;
            }
            break;
        default:
            goto L_Close;
    }

    goto L_Member;

OnInit:
    .@npcId = getnpcid(0, .name$);
    //setunitdata(.@npcId, UDT_HEADTOP, WarlordHelmet); // TODO: wizard hat
    setunitdata(.@npcId, UDT_HEADMIDDLE, SorcererRobe);
    setunitdata(.@npcId, UDT_HEADBOTTOM, NPCEyes);
    setunitdata(.@npcId, UDT_WEAPON, JeansChaps);
    setunitdata(.@npcId, UDT_HAIRSTYLE, 2);
    setunitdata(.@npcId, UDT_HAIRCOLOR, 4);

    .sex=G_MALE;
    .distance=5;
    end;
}