Page 1 of 1

my first spell to work on

Posted: Wed Mar 06, 2019 7:08 am
by Ememjr
Please correct me if i am wrong

Code: Select all

--[[
    Script Name    : Spells/Scout/Rogue/Swashbuckler/Bladeweaver.lua
    Script Author  : Jabantiz
    Script Date    : 2013.12.16 01:12:03
    Script Purpose : 
                   : 
--]]

function cast(Caster, Target,STA,AGI,BA,MvP,resists)
    -- Increases STA of caster by 0.7
    AddSpellBonus(Target, 1, STA)

    -- Increases AGI of caster by 15.0
    AddSpellBonus(Target, 2, AGI)

    -- Adds 14.0% to base avoidance.
    AddSpellBonus(Target, 696, BA)

    -- Increases Mitigation of caster vs physical damage by 82
    AddSpellBonus(Target, 200, MvP)

    -- Increases Mitigation of caster vs elemental, noxious and arcane damage by 183
    AddSpellBonus(Target, 201, resists)
    AddSpellBonus(Target, 202, resists)
    AddSpellBonus(Target, 203, resists)

end

function remove(Caster, Target)
    RemoveSpellBonus(Target)
end
i modified the above spell script since it did not have the data for the spell passed to it by adding STA,AGI,BA,MvP,resists
problems i noticed
1. when tracing through the lua addspellbonus, for STA ,0 was passed to value instead of .7 i am guessing cuz this line

Code: Select all

sint32 value = lua_interface->GetSInt32Value(state, 3);
only accepts whole numbers and not decimal??
2. same thing for STA passed 0 but when i add manually(ie replace the AGI with 20) my AGI does increase
3. still testing BA and MvP (possible struct issue for displaying
4. resists updated correctly on character sheet

if i am correct about

Code: Select all

sint32 value = lua_interface->GetSInt32Value(state, 3);
only getting 0 from a .7 value cuz its an int then we should change that because there are many stats that increase by decimal .7, 1.2,78.5 etc

Re: my first spell to work on

Posted: Wed Mar 06, 2019 5:18 pm
by Jabantiz
It is going to be more then just that as I believe every where a stat like that (str/agi/sta/int/wis) is involved we only store an int and not a float.

Re: my first spell to work on

Posted: Wed Mar 06, 2019 6:22 pm
by Ememjr
i am going to start converting the code for those to be a float

Re: my first spell to work on

Posted: Thu Mar 07, 2019 9:51 am
by tyrbo
I think I ended up just rounding those values.

Re: my first spell to work on

Posted: Thu Mar 07, 2019 4:10 pm
by Jabantiz
If I remember correct the packet struct needs to be a sint16 so all the code probably followed that, so at some point the value will either need to be rounded or truncated when sent to the client.

Re: my first spell to work on

Posted: Thu Mar 07, 2019 5:50 pm
by Ememjr
yes it is rounded when sent to the client, but the server needs to handle the .2 etc cuz that can make alot of difference in stat calues etc later in game