summaryrefslogblamecommitdiff
path: root/npc/magic/level2-lay-on-hands.txt
blob: 1d515324f1de861b90a6595033fd895e68d6e3c3 (plain) (tree)


















                                                   


                                              





















                                                                
                          









                                                                        

                                                      


                                          
                                              
        
                                             

                                                 
                                                           




                                                       
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_INMA (Level 1)
// School: Life 2

function	script	SK_Inma	{
    // FIXME: #inma Mouboo
    // In some cases it is... aborted
    if (getunittype(@skillTarget) == UNITTYPE_PC) {
        .@me=getcharid(3);
        .@ok=true;
        attachrid(@skillTarget);
        // TODO: detect if is a bot...
        // FIXME: 099-4 and 099-5 special rules
        // Kill the GM Event
        if (isequipped(MagicGMTopHat))
            .@ok=false;
        // Ailments which prevent inma from working
        if (getstatus(SC_BLOODING) ||
            getstatus(SC_HALT_REGENERATION) ||
            getstatus(SC_CURSE))
            .@ok=false;
        if (getstatus(SC_POISON) && !getstatus(SC_SLOWPOISON))
            .@ok=false;
        if (getstatus(SC_DPOISON) && !getstatus(SC_SLOWPOISON))
            .@ok=false;
        // Already dead
        if (Hp < 1)
            .@ok=false;
        // Finished
        .@limit=MaxHp-Hp;
        detachrid();
        attachrid(.@me);
        if (!.@ok) return;
    } else {
        if (getunitdata(@skillTarget, UDT_HP) < 1) return;
        .@limit=getunitdata(@skillTarget, UDT_MAXHP)-
                getunitdata(@skillTarget, UDT_HP);
    }
    if (@skillTarget == getcharid(3)) return; // No self casting
    if (isequipped(MagicGMTopHat)) return; // Kill the GM event
    if (.@limit <= 0) return; // No need for healing
    // Apply effects
    .@PW=60+(20*@skillLv);
    .@dmg=AdjustSpellpower(.@PW);

    // Capped to what you need or your own health - the smallest of them
    .@dmg = min(.@dmg, .@limit, Hp);

    // Pay with 20% of your healing total
    heal -(.@dmg/5), 0;

    // Heal the target instantly
    harm(@skillTarget, -(.@dmg), HARM_MISC);
    specialeffect(FX_MAGIC_WHITE, AREA, @skillTarget);
    specialeffect(FX_MAGIC_WHITE, AREA, getcharid(3));

    // Specifics
    if (getskilllv(SKILL_MAGIC_DARK) >= 2)
        SC_Bonus(10, SC_HALT_REGENERATION, 1);
    else
        SC_Bonus(5, SC_HALT_REGENERATION, 1);

    // Gives EXP according to how much you healed
    setq2(MagicQuest_Healing, getq2(MagicQuest_Healing)+1);
    getexp .@dmg*getskilllv(SKILL_MAGIC_LIFE), .@PW/10;
    GetManaExp(@skillId, 2);
    return;
}