viewing paste Unknown #20243 | Text

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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
-----------------------------------
-- Area: Legion: Hidden bonus Hall.
--  HNM: Mars
-- Legion Secret Bonus Boss
-----------------------------------
 
require("scripts/globals/status");
require("scripts/globals/magic");
require("scripts/globals/utils");
require("scripts/globals/spoofchat");
 
-----------------------------------
-- onMobInitialize Action
-----------------------------------
 
function onMobInitialize(mob)
    -- setMobMod
    mob:setMobMod(MOBMOD_AUTO_SPIKES, mob:getShortID()); -- Needed for auto spikes
    -- mob:setMobMod(MOBMOD_MAIN_2HOUR, 1); -- Enables Blood Weapon
    -- mob:setMobMod(MOBMOD_SUB_2HOUR, 1); -- Enables Mighty Strikes
 
    -- Effects
    mob:addStatusEffect(EFFECT_DAMAGE_SPIKES,5,0,0); -- Needed for auto spikes
    mob:getStatusEffect(EFFECT_DAMAGE_SPIKES):setFlag(32); -- Make spikes undispellable.
end;
 
-----------------------------------
-- onMobSpawn Action
-----------------------------------
 
function onMobSpawn(mob)
    -- setMod
    mob:setMod(MOD_REGEN, 20);
    mob:setMod(MOD_REFRESH, 20);
    mob:setMod(MOD_REGAIN, 25);
    mob:setMod(MOD_HASTE_ABILITY, 10);
    mob:setMod(MOD_UFASTCAST, 75);
    mob:setMod(MOD_COUNTER, 10);
    mob:setMod(MOD_TRIPLE_ATTACK, 1);
 
    -- addMod
    mob:addMod(MOD_ACC, 25);
    mob:addMod(MOD_DOUBLE_ATTACK, 5);
    mob:addMod(MOD_MATT, 25);
    mob:addMod(MOD_MACC, 80);
    mob:addMod(MOD_INT, 10);
 
    -- Vars
    mob:setLocalVar("MagicElement", math.random(1,6));
    -- 0 = Stops rotating weakness
    -- 1 = Fire
    -- 2 = Ice
    -- 3 = Wind
    -- 4 = Earth
    -- 5 = Lightning
    -- 6 = Water
    mob:setLocalVar("SpikesElement", math.random(1,6));
    -- 0 = Retaliation
    -- 1 = Fire
    -- 2 = Ice
    -- 3 = Wind
    -- 4 = Earth
    -- 5 = Lightning
    -- 6 = Water
    mob:setLocalVar("PhysicalElement", math.random(1,4));
    -- 0 = Stops rotating weakness
    -- 1 = Slashing
    -- 2 = Piercing
    -- 3 = Blunt
    -- 4 = H2H
end;
 
-----------------------------------
-- onMobEngaged Action
-----------------------------------
 
function onMobEngaged(mob, target)
    if (target:getParty() ~= nil) then
        local targets = target:getParty(); -- local targets = mob:getEnmityList();
        for hey, dude in pairs(targets) do
            if (dude:isPC()) then
                dude:ChangeMusic(0, 195); -- Background Music (Day time, 7:00 -> 18:00)
                dude:ChangeMusic(1, 195); -- Background Music (Night time, 18:00 -> 7:00)
                dude:ChangeMusic(2, 195); -- SoloBattle Music
                dude:ChangeMusic(3, 195); -- Party Battle Music
            end
        end
    elseif (target:isPC()) then
        target:ChangeMusic(0, 195); -- Background Music (Day time, 7:00 -> 18:00)
        target:ChangeMusic(1, 195); -- Background Music (Night time, 18:00 -> 7:00)
        target:ChangeMusic(2, 195); -- SoloBattle Music
        target:ChangeMusic(3, 195); -- Party Battle Music
    end
    mob:SpoofChatParty("I am Mars, god of war. Have you entered this hall to challenge me mortal?", MESSAGE_SAY)
    mob:SpoofChatParty("Do you think yourself fit to battle a god?", MESSAGE_SAY)
end;
 
-----------------------------------
-- onMobFight Action
-----------------------------------
 
function onMobFight(mob, target)
    local Mars_2hr_Used = mob:getLocalVar("Mars_2hr");
 
    if (mob:getHPP() <= 9) then -- Time for BW(3rd use) and MS(2nd use) together!
        if (Mars_2hr_Used == 3) then
            mob:SpoofChatParty("That you should fight a god this far...Deplorable.", MESSAGE_SAY);
            mob:useMobAbility(432); -- Do Mighty Strikes!
            mob:setMod(MOD_TRIPLE_ATTACK, 2);
            mob:setLocalVar("Mars_2hr", 4);
        elseif (Mars_2hr_Used == 4) then
            mob:SpoofChatParty("You shall not survive this day, I AM THE GOD OF WAR!!!", MESSAGE_SAY);
            mob:setMod(MOD_UFASTCAST, 80);
            mob:setLocalVar("MagicElement", 0);
            mob:setLocalVar("SpikesElement", 0);
            mob:setLocalVar("PhysicalElement", 0);
            mob:useMobAbility(439); -- Do Blood Weapon!
            mob:addStatusEffect(EFFECT_HASTE,200,0,200);
            mob:setLocalVar("Mars_2hr", 5);
        end
    elseif (mob:getHPP() <= 25) then -- 2nd BW time!
        if (Mars_2hr_Used == 2) then
            mob:SpoofChatParty("It has been over 1000 years since I have been so...Entertained.", MESSAGE_SAY);
            mob:SpoofChatParty("Show me more, mortal! More! Bleed for the god of war!", MESSAGE_SAY);
            mob:useMobAbility(439); -- Do Blood Weapon!
            mob:setLocalVar("Mars_2hr", 3);
        end
    elseif (mob:getHPP() <= 70) then -- 1st MS time!
        if (Mars_2hr_Used == 1) then
            mob:SpoofChatParty("Hmmph. You've managed to scratch me.", MESSAGE_SAY);
            mob:SpoofChatParty("Very well then, I shall show you my full might!", MESSAGE_SAY);
            mob:useMobAbility(432); -- Do Mighty Strikes!
            mob:setLocalVar("Mars_2hr", 2);
        end
    elseif (mob:getHPP() <= 85) then -- 1st BW time!
        if (Mars_2hr_Used == 0) then
            mob:SpoofChatParty("Such hubris...You shall learn to show me the proper respect, mortal!", MESSAGE_SAY);
            mob:useMobAbility(439); -- Do Blood Weapon!
            mob:setLocalVar("Mars_2hr", 1);
        end
    end
 
    if (Mars_2hr_Used < 4) then -- After 4th use of 2hr, no more ele switching.
        local MARS_ELEMENT = mob:getLocalVar("MagicElement");
        -- target:PrintToPlayer( string.format( "Mars Weakness: '%u' ", MARS_ELEMENT) );
        if (MARS_ELEMENT == 6) then -- Water
            mob:setMod(MOD_FIRE_ABSORB,50);
            mob:setMod(MOD_LTNG_NULL,200);
            mob:setMod(MOD_EARTH_NULL,200);
            mob:setMod(MOD_WIND_NULL,200);
            mob:setMod(MOD_ICE_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        elseif (MARS_ELEMENT == 5) then -- Lightning
            mob:setMod(MOD_WATER_ABSORB,50);
            mob:setMod(MOD_EARTH_NULL,200);
            mob:setMod(MOD_WIND_NULL,200);
            mob:setMod(MOD_ICE_NULL,200);
            mob:setMod(MOD_FIRE_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        elseif (MARS_ELEMENT == 4) then -- Earth
            mob:setMod(MOD_LTNG_ABSORB,50);
            mob:setMod(MOD_WATER_NULL,200);
            mob:setMod(MOD_WIND_NULL,200);
            mob:setMod(MOD_ICE_NULL,200);
            mob:setMod(MOD_FIRE_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        elseif (MARS_ELEMENT == 3) then -- Wind
            mob:setMod(MOD_EARTH_ABSORB,50);
            mob:setMod(MOD_WATER_NULL,200);
            mob:setMod(MOD_LTNG_NULL,200);
            mob:setMod(MOD_ICE_NULL,200);
            mob:setMod(MOD_FIRE_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        elseif (MARS_ELEMENT == 2) then -- Ice
            mob:setMod(MOD_WIND_ABSORB,50);
            mob:setMod(MOD_WATER_NULL,200);
            mob:setMod(MOD_LTNG_NULL,200);
            mob:setMod(MOD_EARTH_NULL,200);
            mob:setMod(MOD_FIRE_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        elseif (MARS_ELEMENT == 1) then -- Fire
            mob:setMod(MOD_ICE_ABSORB,50);
            mob:setMod(MOD_WATER_NULL,200);
            mob:setMod(MOD_LTNG_NULL,200);
            mob:setMod(MOD_EARTH_NULL,200);
            mob:setMod(MOD_WIND_NULL,200);
            mob:setMod(MOD_LIGHT_NULL,200);
            mob:setMod(MOD_DARK_NULL,200);
        end
    end
end;
 
-----------------------------------
-- onMagicHit
-----------------------------------
 
function onMagicHit(caster, target, spell)
    local mob = nil;
    if (caster:getID() == target:getID()) then
        -- This is a self cast spell
        mob = caster;
    else
        -- This is not a self cast spell.
        mob = target;
    end
 
    if (mob ~= nil) then
        local SPELL_ELEMENT = spell:getElement();
        local MARS_ELEMENT = mob:getLocalVar("MagicElement");
        local Mars_2hr_Used = mob:getLocalVar("Mars_2hr");
 
        --[[
        local player = nil;
        if (caster:isPC()) then
            player = caster;
        elseif (target:isPC()) then
            player = target;
        end
        if (player ~= nil) then
            player:PrintToPlayer( string.format( "Spell Ele: '%u' ", SPELL_ELEMENT) );
            player:PrintToPlayer( string.format( "Mars Weakness: '%u' ", MARS_ELEMENT) );
        end
        ]]--
 
        if (Mars_2hr_Used < 4) then -- After 4th use of 2hr, no more ele switching.
            if (SPELL_ELEMENT == ELE_WATER) then
                mob:useMobAbility(572); -- Water Blade
                mob:setLocalVar("SpikesElement", 6);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            elseif (SPELL_ELEMENT == ELE_LIGHTNING) then
                mob:useMobAbility(571); -- Lightning Blade
                mob:setLocalVar("SpikesElement", 5);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            elseif (SPELL_ELEMENT == ELE_EARTH) then
                mob:useMobAbility(570); -- Earth Blade
                mob:setLocalVar("SpikesElement", 4);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            elseif (SPELL_ELEMENT == ELE_WIND) then
                mob:useMobAbility(569); -- Wind Blade
                mob:setLocalVar("SpikesElement", 3);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            elseif (SPELL_ELEMENT == ELE_ICE) then
                mob:useMobAbility(568); -- Ice Blade
                mob:setLocalVar("SpikesElement", 2);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            elseif (SPELL_ELEMENT == ELE_FIRE) then
                mob:useMobAbility(567); -- Fire Blade
                mob:setLocalVar("SpikesElement", 1);
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            else
                mob:useMobAbility(573); -- Great Wheel
                mob:setLocalVar("SpikesElement", math.random(1,6));
                mob:setLocalVar("MagicElement", math.random(1,6));
                mob:setTP(10);
            end
        end
    end
 
    return 1;
end;
 
-----------------------------------
-- onWeaponskillHit
-----------------------------------
 
function onWeaponskillHit(mob, attacker, weaponskill)
    if (math.random(1,15) == 8) then
        -- 1 in 8 chance of reaction
        mob:useMobAbility(573); -- Great Wheel
    -- elseif (math.random(1,15) == 8) then
       -- Add weakness hint maybe?
    end
 
    return 1;
end;
-----------------------------------
-- onSpikesDamage
-----------------------------------
 
function onSpikesDamage(mob,target,damage)
    local SPIKE_ELEMENT = mob:getLocalVar("SpikesElement");
    local dmg = math.random(6,12);
    -- target:PrintToPlayer( string.format( "Spike Ele: '%u' ", SPIKE_ELEMENT) );
    if (SPIKE_ELEMENT == 6) then -- Water
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_DROWN, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        if (math.random(0,99) <= 20) then
            target:addStatusEffect(EFFECT_ATTACK_DOWN, 10, 0, 60);
        end
        return SUBEFFECT_DELUGE_SPIKES,44,dmg;
    elseif (SPIKE_ELEMENT == 5) then -- Lightning
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_SHOCK, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        return SUBEFFECT_SHOCK_SPIKES,44,dmg;
    elseif (SPIKE_ELEMENT == 4) then -- Earth
        if (math.random(0,99) <= 25) then
            target:addStatusEffect(EFFECT_PETRIFICATION, 1, 0, math.random(15,30))
        end
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_RASP, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        return SUBEFFECT_STONE_SPIKES,44,dmg;
    elseif (SPIKE_ELEMENT == 3) then -- Wind
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_CHOKE, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        if (math.random(0,99) <= 20) then
            target:addStatusEffect(EFFECT_DEFENSE_DOWN, 10, 0, 60);
        end
        return SUBEFFECT_WIND_SPIKES,44,dmg;
    elseif (SPIKE_ELEMENT == 2) then -- Ice
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_FROST, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        return SUBEFFECT_ICE_SPIKES,44,dmg;
    elseif (SPIKE_ELEMENT == 1) then -- Fire
        if (math.random(0,99) <= 66) then
            target:addStatusEffect(EFFECT_BURN, dmg*0.5, 3, 90, FLAG_ERASBLE);
        end
        dmg = dmg+5;
        return SUBEFFECT_BLAZE_SPIKES,44,dmg;
    else -- Retaliation. Just straight dmg and extra TP for Mars.
        if (math.random(0,99) <= getHitRate(mob,target,true)) then -- Evading means no retaliation proc.
            local STRVIT = mob:getStat(MOD_STR) - target:getStat(MOD_VIT);
            if (STRVIT > 20) then
                STRVIT = 20 + (STRVIT - 20);
                dmg = STRVIT * 0.5;
            end
            dmg = utils.clamp(dmg, 2, 240);
            -- Mar's retaliation bypasses shadows because TeoTwawki is just evil like that.
            mob:addTP(10); -- Forget math, just straight 100/3000 per hit is good enough.
            return SUBEFFECT_COUNTER,536,dmg;
        else
            return 0, 0, 0;
        end
    end
end;
 
-----------------------------------
-- onMobDeath
-----------------------------------
 
function onMobDeath(mob,killer)
    if (killer:getParty() ~= nil) then
        local targets = killer:getParty(); -- local targets = mob:getEnmityList();
        for hey, dude in pairs(targets) do
            if (dude:isPC()) then
                dude:ChangeMusic(0, 0); -- Background Music (Day time, 7:00 -> 18:00)
                dude:ChangeMusic(1, 0); -- Background Music (Night time, 18:00 -> 7:00)
                dude:ChangeMusic(2, 195); -- SoloBattle Music
                dude:ChangeMusic(3, 195); -- Party Battle Music
            end
        end
    elseif (killer:isPC()) then
        killer:ChangeMusic(0, 0); -- Background Music (Day time, 7:00 -> 18:00)
        killer:ChangeMusic(1, 0); -- Background Music (Night time, 18:00 -> 7:00)
        killer:ChangeMusic(2, 195); -- SoloBattle Music
        killer:ChangeMusic(3, 195); -- Party Battle Music
    end
    mob:SpoofChatParty("...I...Defeated...Content...At last...", MESSAGE_SAY)
    mob:SpoofChatParty("As you watch the gods form dissolve you see it smile, its hunger for battle finally sated.", MESSAGE_ECHO)
    -- insert code to spawn lootbox here, move battlefield win stuff into exit portal.
    -- mob:getBattlefield():win();
end;
Viewed 347 times, submitted by unknown.