Bard "Resist" Spells

Post Reply
RwNigma
Posts: 3
Joined: Mon Sep 21, 2015 9:38 am

Bard "Resist" Spells

Post by RwNigma » Sat Dec 12, 2015 2:37 pm

Currently trying to code these:
Herb Pastoral
Scop's Operetta
Fowl Aubade
Goblin Gavotte
Gold Capriccio
Shining Fantasia
Puppet's Operetta
Warding Round

Started with Herb Pastoral. I made a herb_pastoral.lua within scripts\globals\spells and then a pastoral.lua within scripts\globals\effects.

herb_pastoral.lua

Code: Select all

-----------------------------------------
-- Spell: Herb Pastoral
-- Gives party members increased resistance to Poison
-----------------------------------------

require("scripts/globals/status");

-----------------------------------------
-- OnSpellCast
-----------------------------------------

function onMagicCastingCheck(caster,target,spell)
    return 0;
end;

function onSpellCast(caster,target,spell)

    local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing
    local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED);

    local power = 9;

    if (sLvl+iLvl > 130) then
        power = power + math.floor((sLvl+iLvl-130) / 18);
    end

    if (power >= 30) then
        power = 30;
    end

    local iBoost = caster:getMod(MOD_PASTORAL_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT);
    if (iBoost > 0) then
        power = power + 1 + (iBoost-1)*3;
    end

    if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then
        power = power * 2;
    elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then
        power = power * 1.5;
    end
    caster:delStatusEffect(EFFECT_MARCATO);

    local duration = 240;
    duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1);

    if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then
        duration = duration * 2;
    end

    if not (target:addBardSong(caster,EFFECT_PASTORAL,power,0,duration,caster:getID(), 0, 2)) then
        spell:setMsg(75);
    end

    return EFFECT_PASTORAL;
end;
pastoral.lua

Code: Select all

-----------------------------------
--
--          
--
-----------------------------------

-----------------------------------
-- onEffectGain Action
-----------------------------------

function onEffectGain(target,effect)
end;

-----------------------------------
-- onEffectTick Action
-----------------------------------

function onEffectTick(target,effect)
end;

-----------------------------------
-- onEffectLose Action
-----------------------------------

function onEffectLose(target,effect)
end;
"Prelude.lua" looks just like the above.
"Madrigal.lua" has the MOD_ACC applied. Would this mean that Prelude isn't actually adding anything?
Carol uses an array of "resistMod"
Etude uses "getSubPower".

When I cast the spell it doesn't crash me, but upon resolution of the spell it crashes the client. I looked within modifier.h and it isn't there. At the bottom there are MOD_SPARE's that could be used, but for ease of use is there anyway to have them be in order? If not do we just use these spares; take them off of the spare list and add them under // Bard? If we do this too add the new spells we'd be left with only 3 documented spares.

Any ideas would be much appreciated.

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Bard "Resist" Spells

Post by kjLotus » Sat Dec 12, 2015 2:56 pm

looks like prelude doesn't do anything, /checkparam is an easy way to make sure

when you add new modifiers, you use the spare numbers and then replace the spare numbers (their only purpose is to make it easier to know which number to use next)

RwNigma
Posts: 3
Joined: Mon Sep 21, 2015 9:38 am

Re: Bard "Resist" Spells

Post by RwNigma » Sat Dec 12, 2015 5:56 pm

So Updating the modifier files won't be too hard? Just have to make sure the spare is used and a new one is made in its place? What about changing the numbers? Does it allow for you to do that as long as you're able to do so in sequential order?

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Bard "Resist" Spells

Post by kjLotus » Sat Dec 12, 2015 11:05 pm

RwNigma wrote:So Updating the modifier files won't be too hard? Just have to make sure the spare is used and a new one is made in its place?
yes
RwNigma wrote:What about changing the numbers? Does it allow for you to do that as long as you're able to do so in sequential order?
no, you'd have to change all the modifier values in the db too (item mods, mob mods, etc), so it's kind of a waste of time
they don't need to be sequential since they don't represent anything that needs to be expressed sequentially. a number is just some stat

Post Reply