spellParams.Vx and spellParams.Mx

Post Reply
Ouren
Posts: 2
Joined: Mon Jul 18, 2016 10:00 pm

spellParams.Vx and spellParams.Mx

Post by Ouren » Sun Feb 19, 2017 3:16 pm

Hello everyone! I'm new to the database stuff, and while I am not making a private server, I did have questions about how some of this worked. I have been looking over some of the spells and abilities and have been unable to decipher what spellParams actually affects. I cannot find a script called spellParams, and I cannot find any of the "V50", "M100" targets or what these numbers mean. I searched the wiki and the forums for spellParams, and can't seem to turn anything up. Additionally, I'm curious as to how the Lua scripts' parameters determine what element each spell is. I only see marginal differences in the spellParams.Vx values, with little change to the spellParams.Mx values. As far as I can tell, neither of these scripts are expressing what element the spells are.

Any insight would be very helpful! Thank you!

Blizzard.lua

Code: Select all

function onSpellCast(caster, target, spell)
    local spellParams = {};
    spellParams.hasMultipleTargetReduction = false;
    spellParams.resistBonus = 1.0;
    spellParams.V0 = 70;
    spellParams.V50 = 130;
    spellParams.V100 = 180;
    spellParams.V200 = 180;
    spellParams.M0 = 1.2;
    spellParams.M50 = 1;
    spellParams.M100 = 0;
    spellParams.M200 = 0;
Aero.lua

Code: Select all

function onSpellCast(caster, target, spell)
    local spellParams = {};
    spellParams.hasMultipleTargetReduction = false;
    spellParams.resistBonus = 1.0;
    spellParams.V0 = 40;
    spellParams.V50 = 120;
    spellParams.V100 = 170;
    spellParams.V200 = 170;
    spellParams.M0 = 1.6;
    spellParams.M50 = 1;
    spellParams.M100 = 0;
    spellParams.M200 = 0;

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: spellParams.Vx and spellParams.Mx

Post by Delaide » Sun Feb 19, 2017 9:03 pm

Check the scripts/globals/magic.lua:

Code: Select all

function doElementalNuke(caster, spell, target, spellParams)
    local DMG = 0;
    local V = 0;
    local M = 0;
    local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
    local hasMultipleTargetReduction = spellParams.hasMultipleTargetReduction; --still unused!!!
    local resistBonus = spellParams.resistBonus;
    local mDMG = caster:getMod(MOD_MAGIC_DAMAGE);

    --[[
            Calculate base damage:
            D = mDMG + V + (dINT × M)
            D is then floored
            For dINT reduce by amount factored into the V value (example: at 134 INT, when using V100 in the calculation, use dINT = 134-100 = 34)
      ]]

    if (dINT <= 49) then
        V = spellParams.V0;
        M = spellParams.M0;
        DMG = math.floor(DMG + mDMG + V + (dINT * M));

        if (DMG <= 0) then
            return 0;
        end

    elseif (dINT >= 50 and dINT <= 99) then
        V = spellParams.V50;
        M = spellParams.M50;
        DMG = math.floor(DMG + mDMG + V + ((dINT - 50) * M));

    elseif (dINT >= 100 and dINT <= 199) then
        V = spellParams.V100;
        M = spellParams.M100;
        DMG = math.floor(DMG + mDMG + V + ((dINT - 100) * M));

    elseif (dINT > 199) then
        V = spellParams.V200;
        M = spellParams.M200;
        DMG = math.floor(DMG + mDMG + V + ((dINT - 200) * M));
    end

    --get resist multiplier (1x if no resist)
    local diff = caster:getStat(MOD_INT) - target:getStat(MOD_INT);
    local resist = applyResistance(caster, spell, target, diff, ELEMENTAL_MAGIC_SKILL, resistBonus);

    --get the resisted damage
    DMG = DMG * resist;

    --add on bonuses (staff/day/weather/jas/mab/etc all go in this function)
    DMG = addBonuses(caster, spell, target, DMG);

    --add in target adjustment
    local ele = spell:getElement();
    DMG = adjustForTarget(target, DMG, ele);

    --add in final adjustments
    DMG = finalMagicAdjustments(caster, target, spell, DMG);

    return DMG;
end
So, for your example, blizzard,
v0 = 70, so if your int is 49 or less, base damage = 70, if your int is 50-99, use 130 base, and if your int is 100 or more, base is 180, and for int of 200+, your base is also 180.

M is the multiplier for additional damage over the int grouping.

For example, if your int is 75
DMG = math.floor(DMG + mDMG + 130 + ((75 - 50) * 1));

The DMG will factor in resists and other stuff, and the mDMG will factor in the mod setting for MOD_MAGIC_DAMAGE.

Somewhere, the base in the sql file spell_list should come up, in the case of blizzard, that is 46 damage base.

Someone else can correct me if I am wrong, but this is what I see when tracing it.

PS. I am far from a good coder, so please take what I say as the way I am seeing it.

Ouren
Posts: 2
Joined: Mon Jul 18, 2016 10:00 pm

Re: spellParams.Vx and spellParams.Mx

Post by Ouren » Mon Feb 20, 2017 11:58 am

Thanks for the info!
Regarding element, that still seems very mysterious.

Delaide
Posts: 478
Joined: Sat Jun 14, 2014 8:58 am

Re: spellParams.Vx and spellParams.Mx

Post by Delaide » Tue Feb 21, 2017 2:30 am

Oh, element is handled all over.

For example, first, the mobs are assigned values for their element weakness/strength in the SQL.

Example: Aern:

Code: Select all

INSERT INTO `mob_family_system` VALUES (3,'Aern',15,'Luminian',0,40,120,140,1,1,1,1,1,1,1,3,3,3,3,1,1,1,1,1,1,1,1,1,1,0.5,1,0,1,0);
http://ffxiclopedia.wikia.com/wiki/Category:Aern

Everything is 1 until the Light column. From the wiki you can see:
Strong against: Light +50%
That aligns with the 0.5. So, normal damage from everything (Why everything is 1), except light.

The spell is also categorized by element in the spell_list.

From there, go back to the magic.lua file.
Somewhere in there, magic happens. Also, I assume in the battleutil core files. It should factor in strengths and weaknesses for damage and resists. Sorry, someone more familiar than I will need to de-mystify it.

User avatar
TeoTwawki
Developer
Posts: 527
Joined: Mon Jul 15, 2013 9:50 pm

Re: spellParams.Vx and spellParams.Mx

Post by TeoTwawki » Tue Feb 21, 2017 1:14 pm

Spells have an element field in their sql entries.

Code: Select all

INSERT INTO `spell_list` VALUES (spellid,'name',jobs,group,element,zonemisc,validTargets,skill,mpCost,castTime,recastTime,message,magicBurstMessage,animation,animationTime,AOE,base,multiplier,CE,VE,requirements,spell_range,required_expansion);
Note the CE and VE there are only for spells that use static amounts instead of generating enmity via dmg dealt or hp cured.
Which reminds me we handle Bio's enmity wrong. It shouldn't trigger updateEnmityFromDamage but it does.
It should be static like a non damaging enfeeble.
https://www.bluegartr.com/threads/12485 ... ost6558390
yet another item in my backlog of little things I keep forgetting about
Hi, I run The Demiurge server.


Image
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. - Martin Golding
PLS USE [ code ] CODE TAGS [ /code ] WHEN POSTING CODE
DO NOT PRIVATE MESSAGE ME ABOUT BUGS

Post Reply