Problems with empathy and buff duration

Post Reply
Enignite
Posts: 2
Joined: Thu Apr 30, 2015 3:26 pm

Problems with empathy and buff duration

Post by Enignite » Tue Sep 01, 2015 5:56 am

Wrote a section in spirit_link.lua to handle empathy buff transfer, it seems to be working except the buffs do not wear off on the wyvern until you zone or dismiss it. It's also suppose to transfer buffs from left to right but they aren't ordered here so they are as they appear in the status.lua

Code: Select all


    Effect_list = {
    EFFECT_FLEE,
    EFFECT_HASTE,
    EFFECT_BLAZE_SPIKES,
    EFFECT_ICE_SPIKES,
    EFFECT_BLINK,
    EFFECT_STONESKIN,
    EFFECT_SHOCK_SPIKES,
    EFFECT_AQUAVEIL,
    EFFECT_PROTECT,
    EFFECT_SHELL,
    EFFECT_REGEN,
    EFFECT_REFRESH,
    EFFECT_BOOST,
    EFFECT_BERSERK,
    EFFECT_DEFENDER,
    EFFECT_AGGRESSOR,
    EFFECT_FOCUS,
    EFFECT_DODGE,
    EFFECT_SOULEATER,
    EFFECT_LAST_RESORT,
    EFFECT_COPY_IMAGE,
    EFFECT_THIRD_EYE,
    EFFECT_WARCRY,
    EFFECT_HOLY_CIRCLE,
    EFFECT_ARCANE_CIRCLE,
    EFFECT_STR_BOOST,
    EFFECT_DEX_BOOST,
    EFFECT_VIT_BOOST,
    EFFECT_AGI_BOOST,
    EFFECT_INT_BOOST,
    EFFECT_MND_BOOST,
    EFFECT_CHR_BOOST,
    EFFECT_MAX_HP_BOOST,
    EFFECT_MAX_MP_BOOST,
    EFFECT_ACCURACY_BOOST,
    EFFECT_ATTACK_BOOST,
    EFFECT_EVASION_BOOST,
    EFFECT_DEFENSE_BOOST,
    EFFECT_ENFIRE,
    EFFECT_ENBLIZZARD,
    EFFECT_ENAERO,
    EFFECT_ENSTONE,
    EFFECT_ENTHUNDER,
    EFFECT_ENWATER,
    EFFECT_BARFIRE,
    EFFECT_BARBLIZZARD,
    EFFECT_BARAERO,
    EFFECT_BARSTONE,
    EFFECT_BARTHUNDER,
    EFFECT_BARWATER,
    EFFECT_BARSLEEP,
    EFFECT_BARPOISON,
    EFFECT_BARPARALYZE,
    EFFECT_BARBLIND,
    EFFECT_BARSILENCE,
    EFFECT_BARPETRIFY,
    EFFECT_BARVIRUS,
--    EFFECT_RERAISE, -- Causes server to crash
    EFFECT_PHALANX,
    EFFECT_WARDING_CIRCLE,
    EFFECT_ANCIENT_CIRCLE,
    EFFECT_STR_BOOST_II,
    EFFECT_DEX_BOOST_II,
    EFFECT_VIT_BOOST_II,
    EFFECT_AGI_BOOST_II,
    EFFECT_INT_BOOST_II,
    EFFECT_MND_BOOST_II,
    EFFECT_CHR_BOOST_II,
    EFFECT_PHYSICAL_SHIELD,
    EFFECT_ARROW_SHIELD,
    EFFECT_MAGIC_SHIELD,
    EFFECT_SHINING_RUBY,
    EFFECT_POTENCY,
    EFFECT_REGAIN,
    EFFECT_PAX,
    EFFECT_INTENSION,
    EFFECT_QUICKENING,
    EFFECT_SUBLIMATION_ACTIVATED,
    EFFECT_SUBLIMATION_COMPLETE,
    EFFECT_MAGIC_ATK_BOOST,
    EFFECT_MAGIC_DEF_BOOST,
    EFFECT_PAEON,
    EFFECT_BALLAD,
    EFFECT_MINNE,
    EFFECT_MINUET,
    EFFECT_MADRIGAL,
    EFFECT_PRELUDE,
    EFFECT_MAMBO,
    EFFECT_AUBADE,
    EFFECT_PASTORAL,
    EFFECT_HUM,
    EFFECT_FANTASIA,
    EFFECT_OPERETTA,
    EFFECT_CAPRICCIO,
    EFFECT_SERENADE,
    EFFECT_ROUND,
    EFFECT_GAVOTTE,
    EFFECT_FUGUE,
    EFFECT_RHAPSODY,
    EFFECT_ARIA,
    EFFECT_MARCH,
    EFFECT_ETUDE,
    EFFECT_CAROL,
--    EFFECT_HYMNUS, -- Causes server to crash
    EFFECT_MAZURKA,
    EFFECT_SIRVENTE,
    EFFECT_DIRGE,
    EFFECT_SCHERZO,
    EFFECT_FIGHTERS_ROLL,
    EFFECT_MONKS_ROLL,
    EFFECT_HEALERS_ROLL,
    EFFECT_WIZARDS_ROLL,
    EFFECT_WARLOCKS_ROLL,
    EFFECT_ROGUES_ROLL,
    EFFECT_GALLANTS_ROLL,
    EFFECT_CHAOS_ROLL,
    EFFECT_BEAST_ROLL,
    EFFECT_CHORAL_ROLL,
    EFFECT_HUNTERS_ROLL,
    EFFECT_SAMURAI_ROLL,
    EFFECT_NINJA_ROLL,
    EFFECT_DRACHEN_ROLL,
    EFFECT_EVOKERS_ROLL,
    EFFECT_MAGUSS_ROLL,
    EFFECT_CORSAIRS_ROLL,
    EFFECT_PUPPET_ROLL,
    EFFECT_DANCERS_ROLL,
    EFFECT_SCHOLARS_ROLL,
    EFFECT_BOLTERS_ROLL,
    EFFECT_CASTERS_ROLL,
    EFFECT_COURSERS_ROLL,
    EFFECT_BLITZERS_ROLL,
    EFFECT_TACTICIANS_ROLL,
    EFFECT_ALLIES_ROLL,
    EFFECT_MISERS_ROLL,
    EFFECT_COMPANIONS_ROLL,
    EFFECT_AVENGERS_ROLL,
    EFFECT_HASSO,
    EFFECT_SEIGAN,
    EFFECT_DRAIN_SAMBA,
    EFFECT_ASPIR_SAMBA,
    EFFECT_HASTE_SAMBA
    }
    
    local counter = player:getMerit(MERIT_EMPATHY);
    
    for i, Buff in ipairs(Effect_list) do
    
        local emp = player:getStatusEffect(Buff);
        local emp_pet = pet:getStatusEffect(Buff);

        if (emp ~= nil and emp_pet == nil) then
        --print('Copied Buff');
            local effectId = emp:getType();
            local power = emp:getPower();
            local tick = emp:getTick();
            local duration = emp:getDuration();
            local subId = emp:getSubType();
            local subpower = emp:getSubPower();
            local tier = emp:getTier();
            pet:addStatusEffect(effectId, power, tick, duration, subId, subpower, tier);
            local startTime = emp:getStartTime();
            local newEffect = pet:getStatusEffect(effectId);
            newEffect:setStartTime(startTime);

            counter = counter - 5;
            if (counter == 0) then
                break;
            end
        end
    end

Copied the stuff inside the if statement from COR ele shots, it seems to be the only lua using set/getStartTime(), is not implemented or is something else wrong with the this script/pet buffs?

Tested Boost/Focus/Dodge/En-/Spikes/Stoneskin/Regen and few other buffs, Hasso applied a STR/Acc boost but according to wiki it should do nothing, Seigan + Third Eye both transferred but had no effect while Third Eye on it's own worked. Haste transferred but doesn't seem to be working (pet:getStat(MOD_HASTE_MAGIC) returns nil and I don't see any difference in attack speed with hasso/haste/march). Currently doesn't transfer two different tiers of same type of song as they are considered the same effect, tried comparing the tiers but it only detects the first applied song. Removed Reraise and Hymnus even though they are suppose to transfer as they crash the server when the wyvern dies.

EDIT:: Fixed the buff duration issue, getDuration(); was returning a value 1000 times higher than the actual duration, it's working now (including StartTime so they wear off at same time).

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Problems with empathy and buff duration

Post by kjLotus » Tue Sep 01, 2015 6:25 pm

FYI: haste is not a stat, it is a mod, so getStat will return nil for it

Enignite
Posts: 2
Joined: Thu Apr 30, 2015 3:26 pm

Re: Problems with empathy and buff duration

Post by Enignite » Wed Sep 02, 2015 5:31 am

That would make sense, just replaced MOD_ATT with what I wanted without thinking.

Haste is transferring and pet:getMod(MOD_HASTE_MAGIC) is returning the correct value but even if I set Haste (spell) to power = 400 it's not having any effect on the wyvern, is there specific way to apply it to pets or is it not coded?

User avatar
kjLotus
Lead Developer
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Problems with empathy and buff duration

Post by kjLotus » Wed Sep 02, 2015 6:34 pm

Enignite wrote:That would make sense, just replaced MOD_ATT with what I wanted without thinking.

Haste is transferring and pet:getMod(MOD_HASTE_MAGIC) is returning the correct value but even if I set Haste (spell) to power = 400 it's not having any effect on the wyvern, is there specific way to apply it to pets or is it not coded?
It's entirely possible that the pet AI does not look into haste for calculating their delay, but I do not know off the top of my head.

I do hate to always be mentioning this, but it'll most likely work as expected once I'm done the AI rewrite. They'll all use the same common code so stupid cases like this don't keep popping up.

In the wise words of the XIV dev team: "please look forward to it"

Post Reply