Page 1 of 2

BM Abilities - Need Input

Posted: Tue May 10, 2016 7:10 am
by Valorith
I will use this thread to try to get some specific ability questions answered. I am currently working on BM abilities. Right now my question is regarding:

"Grim Harvest: Harvests an organ out of a living body. Which organ it harvests is based on what your opponent has been affected by.

Works in conjunction with Union of Blood, Constrict, Exploding Cyst and Blood Letting Ritual."

My questions are:

-If the target is affected by multiple related spell effects (i.e. Constrict + Exploding Cyst), are multiple organs harvested?
-Does anyone remember exactly what the organs are called?
-What was the behavior once a BM harvested organs from a corpse? Did the corpse despawn or was there just some sort of flag set on the corpse that prevented a BM from continuously harvesting from the same corpse over and over?

Thanks!

Re: BM Abilities - Need Input

Posted: Tue May 10, 2016 9:58 am
by OncaLupe
You only harvest from the latest ability you casted on the target. If the debuff doesn't land or runs out you can't harvest until it or another is reapplied. You can get multiple organs from the same debuff only if it lasts long enough for multiple casts of Grim Harvest.

Quivering Brain from Bursting Cyst
Still Beating Heart from Union of Blood
Twitching Muscle from Constrict
Pulsating Stomach from Blood Letting Ritual

Harvest from a corpse? No. These are debuffs and can only be casted on live targets. If the target dies then you can't harvest anything from them, that's Necromancer territory.

Re: BM Abilities - Need Input

Posted: Tue May 10, 2016 1:37 pm
by Valorith
[quote="OncaLupe"]You only harvest from the latest ability you casted on the target. If the debuff doesn't land or runs out you can't harvest until it or another is reapplied. You can get multiple organs from the same debuff only if it lasts long enough for multiple casts of Grim Harvest.

Quivering Brain from Bursting Cyst
Still Beating Heart from Union of Blood
Twitching Muscle from Constrict
Pulsating Stomach from Blood Letting Ritual

Harvest from a corpse? No. These are debuffs and can only be casted on live targets. If the target dies then you can't harvest anything from them, that's Necromancer territory.[/quote]

Thank you for the clarification. I'm going to have to talk with Faux to see how best to detect the last applied relevant debuff, as apposed to just checking to see if the debuff is present at all.

Re: BM Abilities - Need Input

Posted: Tue May 10, 2016 4:57 pm
by Starcrusher
A lot of the time if you applied multiple eligible debuffs it wouldn't harvest anything. I suspect that was just their buggy code though....ours will be better.

Re: BM Abilities - Need Input

Posted: Tue May 10, 2016 11:05 pm
by OncaLupe
[quote="Valorith"]Thank you for the clarification. I'm going to have to talk with Faux to see how best to detect the last applied relevant debuff, as apposed to just checking to see if the debuff is present at all.[/quote]
For now at least, you can just check the debuffs one at a time and stop at the first one you find. It'd mean one debuff could take precedence over a newer debuff depending on the order you check, but at least it wouldn't require a (potentially) single use case function. Especially if something like that requires a complex system.

If there are other cases where order of applied buff/debuff matters, then fine, otherwise I'm not sure if it'd be worth it unless Faux or someone really wants to add it in. I personally don't see an issue with the simple check that we can do now for Grim Harvest.

Re: BM Abilities - Need Input

Posted: Wed May 11, 2016 8:15 am
by Valorith
Below is what I have come up with so far. I will need to do some more testing/debugging after work as the precast() check is not currently preventing cast on a target with no debuff and it always gives a quivering brain. Feel free to provide comments, etc.

Code: Select all

--[[
	Script Name		: Spells/Bloodmage/GrimHarvest.lua
	Script Purpose	: Grim Harvest
	Script Author	: Valorith
	Script Date		: 2016/05/11

	Parsed Description	: Harvests an organ out of a living body. Which organ it harvests is based on what your opponent has been affected by. 

Works in conjunction with Union of Blood, Constrict, Exploding Cyst and Blood Letting Ritual.

Quivering Brain from Bursting Cyst
Still Beating Heart from Union of Blood
Twitching Muscle from Constrict
Pulsating Stomach from Blood Letting Ritual
--]]
local quivering_brain = 1257554
local still_beating_heart = 1257556
local twitching_muscle = 1257557
local pulsating_stomach = 1257555

--Bursting Cyst
local burstingCystOne = 15504
local burstingCystTwo = 15517
local burstingCystThree = 15518
local burstingCystFour = 15519
local burstingCystFive = 27502

--Union of Blood
local unionOfBloodOne = 28316
local unionOfBloodTwo = 28317
local unionOfBloodThree = 28318
local unionOfBloodFour = 28319
local unionOfBloodFive = 28320
local unionOfBloodSix = 28321

--Constrict
local constrictOne = 15415
local constrictTwo = 15576
local constrictThree = 15577

--Blood Letting Ritual
local bloodLettingRitualOne = 28476
local bloodLettingRitualTwo = 28477

local debuffType = 0

function precast(Caster)
	--Check to see if a relevent debuff is on the GetTarget
	target = GetOffensiveTarget(Caster)
	

	if HasDetrimentalEffect(target, burstingCystOne) or HasDetrimentalEffect(target, burstingCystTwo) or HasDetrimentalEffect(target, burstingCystThree) or HasDetrimentalEffect(target, burstingCystFour) or HasDetrimentalEffect(target, burstingCystFive) then
        debuffType = 1
        SetPrecastFlag(Caster, true)
    elseif HasDetrimentalEffect(target, unionOfBloodOne) or HasDetrimentalEffect(target, unionOfBloodTwo) or HasDetrimentalEffect(target, unionOfBloodThree) or HasDetrimentalEffect(target, unionOfBloodFour) or HasDetrimentalEffect(target, unionOfBloodFive) or HasDetrimentalEffect(target, unionOfBloodSix) then
        debuffType = 2
        SetPrecastFlag(Caster, true)
    elseif HasDetrimentalEffect(target, constrictOne) or HasDetrimentalEffect(target, constrictTwo) or HasDetrimentalEffect(target, constrictThree) then
        debuffType = 3
        SetPrecastFlag(Caster, true)
    elseif HasDetrimentalEffect(target, bloodLettingRitualOne) or HasDetrimentalEffect(target, bloodLettingRitualTwo) then
       debuffType = 4
        SetPrecastFlag(Caster, true)
    else
        debuffType = 0
        SetPrecastFlag(Caster, false)
        PopupMessage(Caster, 'red', 12, 'Spell Requirements Not Met')
    end
	
	
	
end

function cast(Caster)
    
    target = GetOffensiveTarget(Caster)
    
    if debuffType == 1 then
        -- Give Quivering Brain
        AddItem(Caster, quivering_brain, 1)
    elseif debuffType == 2 then
        --Give Still Beating Hear
        AddItem(Caster, still_beating_heart, 1)
    elseif debuffType == 3 then
        --Give Twitching Muscle
        AddItem(Caster, twitching_muscle, 1)
    elseif debuffType == 4 then
        --Give Pulsating Stomach
        AddItem(Caster, pulsating_stomach, 1)
    end
end

function tick(Caster)
	-- code to process each call_frequency (tick) set in spell_details
end

function apply_beneficial(Caster)
	-- code to apply beneficial effects
end

function remove_beneficial(Caster)
	-- code to remove beneficial effects
end

function apply_detrimental(Caster)
	-- code to apply detrimental effects
end

function remove_detrimental(Caster)
	-- code to remove detrimental effects
end


Re: BM Abilities - Need Input

Posted: Wed May 11, 2016 9:33 am
by Faux
Thats a crapload of stuff to put in the script. We can make that significantly simpler. I can add in a function that checks for spell line rather than spell id, which would immediately cut the function calls by around 80%. I'll be on irc tonight and we can talk about it.

If you need it based on first cast, we can do that too.

Re: BM Abilities - Need Input

Posted: Wed May 11, 2016 10:32 am
by OncaLupe
Grim Harvest would always cast in Live, so no checks should be done in precast if we want to match that.

Also, I'm fairly sure you can't use variables like that with debuffType. Scripts are global and called when needed, so that variable would be the same for everyone casting Grim Harvest.

Finally, I thought debuffs on NPCs weren't fully working yet? Last I heard anyway.

Re: BM Abilities - Need Input

Posted: Wed May 11, 2016 12:49 pm
by Valorith
[quote="OncaLupe"]Grim Harvest would always cast in Live, so no checks should be done in precast if we want to match that.
[/quote]

Which behavior do we want on NT?

[quote="OncaLupe"]
Also, I'm fairly sure you can't use variables like that with debuffType. Scripts are global and called when needed, so that variable would be the same for everyone casting Grim Harvest.[/quote]

I was curious about that and wanted to test it. Oddly I was getting the same behavior with both implementations: the first item was always added. I will change it back so that debuffType is declared and populated separately inside cast(). I did put this together in a limited period of time before work and will do more testing/tweaking (also will adjust with any updates Faux makes).

[quote="OncaLupe"]
Finally, I thought debuffs on NPCs weren't fully working yet? Last I heard anyway.[/quote]

3/4 related debuffs are simply dots. Constrict is the lone stat debuff (movement slow) and will be implemented later. I should be able to set up grim harvest now though and it will detect Constrict once it is used.

Thanks for the feedback!

Re: BM Abilities - Need Input

Posted: Wed May 11, 2016 6:56 pm
by OncaLupe
[quote="Valorith"]Which behavior do we want on NT?[/quote]
We generally want to match Live at sunset unless there's a specific reason to change something.

[quote="Valorith"]Oddly I was getting the same behavior with both implementations: the first item was always added.[/quote]
[quote="Valorith"]3/4 related debuffs are simply dots.[/quote]
I did some testing of this, and there are some problems with this setup. First issue is your tests, which is why it's always giving the quivering brain. HasDetrimentalEffect/HasBeneficialEffect both return '1' or '0', not 'true' or 'false'. The way Lua apparently works, is doing the test as you have always returns true. You'll need to set it up like this:

Code: Select all

if (HasDetrimentalEffect(target, constrictOne) == 1) then
Second, HasDetrimentalEffect() will not register DoTs, I guess since they're not using the ApplyDetrimentalEffectTargets(). I was able to detect a movement debuff on a target, but could not detect a DoT. This can possibly be adjusted, or add a new function to test for DoTs.