viewing paste Unknown #21127 | Lua

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
-----------------------------------
-- Area: Al'Taieu
--  HNM: Absolute Virtue
-----------------------------------
 
require("scripts/globals/titles");
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/utils");
require("scripts/globals/spoofchat");
 
-----------------------------------
-- onMobInitialize Action
-----------------------------------
 
function onMobInitialize(mob)
    mob:setMobMod(MOBMOD_ADD_EFFECT,mob:getShortID());
    mob:setMobMod(MOBMOD_DRAW_IN, 2); -- Alliance Draw In
    mob:setMobMod(MOBMOD_MAGIC_COOL, 25);
end;
 
-----------------------------------
-- onMobSpawn Action
-----------------------------------
 
function onMobSpawn(mob)
    -- setMod
    mob:setMod(MOD_REGEN, 500);
    mob:setMod(MOD_REFRESH, 250);
    mob:setMod(MOD_UFASTCAST, 75);
    mob:setMod(MOD_COUNTER, 20);
    mob:setMod(MOD_MACC,925);
    mob:setMod(MOD_MATT,120);
    mob:setMod(MOD_DOUBLE_ATTACK, 10);
    mob:setMod(MOD_TRIPLE_ATTACK, 15);
    mob:setMod(MOD_STUNRES, 750);
    mob:setMod(MOD_PARALYZERES, 100);
 
    -- addMod
    mob:addMod(MOD_MDEF,100);
--[[[
    local JoL = GetMobByID(16912848);
    -- Special check for regen modification by JoL pets killed
    if (JoL:getLocalVar("JoL_Qn_xzomit_Killed") == 9) then
        mob:addMod(MOD_REGEN, -130)
    end
    if (JoL:getLocalVar("JoL_Qn_hpemde_Killed") == 9) then
        mob:addMod(MOD_REGEN, -130)
    end
end;
]]
 
    -- Special check for regen modification by JoL pets killed
    if (GetServerVariable("JoL_Qn_xzomit_Killed") == 9) then
        mob:addMod(MOD_REGEN, -130)
    end
    if (GetServerVariable("JoL_Qn_hpemde_Killed") == 9) then
        mob:addMod(MOD_REGEN, -130)
    end
end;
 
-----------------------------------
-- onMobEngage Action
-----------------------------------
 
function onMobEngage(mob, target)
    mob:delStatusEffect(EFFECT_RAGE);
end;
 
-----------------------------------
-- onMobDisEngage Action
-----------------------------------
 
function onMobDisEngage(mob, target)
    mob:delStatusEffect(EFFECT_RAGE);
end;
 
-----------------------------------
-- onMobFight Action
-----------------------------------
 
function onMobFight(mob, target)
    local WYNAV_1 = GetMobAction(mob:getID()+1);
    local WYNAV_2 = GetMobAction(mob:getID()+2);
    local WYNAV_3 = GetMobAction(mob:getID()+3);
    local WYNAV_4 = GetMobAction(mob:getID()+4);
    local DID2HR = mob:getLocalVar("DID2HR");
    local RND = math.random(1,12);
    local AV2HR = nil;
    local WynavTime = mob:getLocalVar("WynavTime")
 
    if (mob:getBattleTime() > 3600 and mob:getLocalVar("RAGED") == 0) then
        -- In retail, this is where it'd just depop instead..Except we'd be tracking it from JoL's pop time instead of BattleTime.
        mob:addStatusEffectEx(EFFECT_RAGE,0,1,0,0);
        mob:setLocalVar("RAGED", 1);
    end
 
    if (mob:getBattleTime() - mob:getLocalVar("WynavTime") > 90) then
        -- If all 4 aren't up, don't pop any. Timer resets even if none pop.
        if ((WYNAV_1 == ACTION_NONE or WYNAV_1 == ACTION_SPAWN)
        and (WYNAV_2 == ACTION_NONE or WYNAV_2 == ACTION_SPAWN)
        and (WYNAV_3 == ACTION_NONE or WYNAV_3 == ACTION_SPAWN)
        and (WYNAV_4 == ACTION_NONE or WYNAV_4 == ACTION_SPAWN)) then
            SpawnMob(mob:getID()+1, 300):updateEnmity(target);
            SpawnMob(mob:getID()+2, 300):updateEnmity(target);
            SpawnMob(mob:getID()+3, 300):updateEnmity(target);
            SpawnMob(mob:getID()+4, 300):updateEnmity(target);
            -- SpawnMob(mob:getID()+5, 300):updateEnmity(target);
            -- SpawnMob(mob:getID()+6, 300):updateEnmity(target);
            -- SpawnMob(mob:getID()+7, 300):updateEnmity(target);
        end
        mob:setLocalVar("WynavTime", mob:getBattleTime());
    else
        if (RND == 1) then
            AV2HR = 432;
        elseif (RND == 2) then
            AV2HR = 433;
        elseif (RND == 3) then
            AV2HR = 434;
        elseif (RND == 4) then
            AV2HR = 435;
        elseif (RND == 5) then
            AV2HR = 436;
        elseif (RND == 6) then
            AV2HR = 437;
        elseif (RND == 7) then
            AV2HR = 438;
        elseif (RND == 8) then
            AV2HR = 439;
        elseif (RND == 9) then
            AV2HR = 440;
        elseif (RND == 10) then
            AV2HR = 474;
        elseif (RND == 11) then
            AV2HR = 475;
        elseif (RND == 12) then
            AV2HR = 479;
        end
 
        if (AV2HR ~= nil) then
            if (mob:getHPP() <= 10 and DID2HR == 8) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 9);
            elseif (mob:getHPP() <= 20 and DID2HR == 7) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 8);
            elseif (mob:getHPP() <= 30 and DID2HR == 6) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 7);
            elseif (mob:getHPP() <= 40 and DID2HR == 5) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 6);
            elseif (mob:getHPP() <= 50 and DID2HR == 4) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 5);
            elseif (mob:getHPP() <= 60 and DID2HR == 3) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 4);
            elseif (mob:getHPP() <= 70 and DID2HR == 2) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 3);
            elseif (mob:getHPP() <= 80 and DID2HR == 1) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 2);
            elseif (mob:getHPP() <= 90 and DID2HR == 0) then
                mob:useMobAbility(AV2HR);
                mob:setLocalVar("DID2HR", 1);
            end
        end
    end
end;
 
------------------------------------
-- onSpellPrecast
------------------------------------
 
function onSpellPrecast(mob, spell)
    if (spell:getID() == 218) then -- Meteor
        spell:setAoE(SPELLAOE_RADIAL);
        spell:setFlag(SPELLFLAG_HIT_ALL);
        spell:setRadius(30);
        spell:setAnimation(280); -- AoE Meteor Animation
        spell:setMPCost(1);
    end
end;
 
------------------------------------
-- onMonsterMagicPrepare
------------------------------------
 
function onMonsterMagicPrepare(caster, target)
    if (caster:hasStatusEffect(EFFECT_MANAFONT)) then
        if (math.random(1,3) ~= 2) then
            return 218; -- Meteor
        else
            return 219; -- Comet
        end
    elseif (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
        return 466; -- Virelai
    end
end;
 
-----------------------------------
-- onMagicHit
-----------------------------------
 
function onMagicHit(caster, target, spell)
    local REGEN = target:getMod(MOD_REGEN);
    local DAY = VanadielDayElement();
    local ELEM = spell:getElement();
    if (GetServerVariable("AV_Regen_Reduction") < 60) then
        -- Had to serverVar the regen instead of localVar because localVar reset on claim loss.
        if (ELEM == DAY and (caster:isPC() or caster:isPet())) then
            SetServerVariable("AV_Regen_Reduction", 1+GetServerVariable("AV_Regen_Reduction"));
            target:addMod(MOD_REGEN, -2);
        end
    end
    return 1;
end;
 
-----------------------------------
-- onAdditionalEffect Action
-----------------------------------
 
function onAdditionalEffect(mob,target,damage)
    if (math.random(1,15) ~= 5 or target:hasStatusEffect(EFFECT_TERROR) == true) then
        return 0,0,0;
    else
        local duration = 5;
        target:addStatusEffect(EFFECT_TERROR,1,0,duration);
        return SUBEFFECT_NONE,0,EFFECT_TERROR;
    end
end;
 
-----------------------------------
-- onMobDespawn
-----------------------------------
 
function onMobDespawn(mob)
    SetServerVariable("AV_Regen_Reduction", 0);
    DespawnMob(16912877);
    DespawnMob(16912878);
    DespawnMob(16912879);
    DespawnMob(16912880);
end;
 
-----------------------------------
-- onMobDeath
-----------------------------------
 
function onMobDeath(mob, killer)
    killer:addTitle(VIRTUOUS_SAINT);
    SetServerVariable("AV_Regen_Reduction", 0);
    DespawnMob(16912877);
    DespawnMob(16912878);
    DespawnMob(16912879);
    DespawnMob(16912880);
end;
Viewed 663 times, submitted by Guest.