Skip to content

Conversation

@55Honey
Copy link
Contributor

@55Honey 55Honey commented Feb 7, 2024

Adds a new method to add and remove mechanic immunities. See azerothcore#167

Tested on AC with:

local function ImmunityOff(eventid, delay, repeats, creature)
    creature:SetImmuneTo(26, false)
    creature:SendUnitSay("I am interruptable now.", 0)
end

local function Cast(eventid, delay, repeats, creature)
    creature:CastSpell(creature, 57775, false)
end

local function EnterCombat(event, creature, target)
    creature:SetImmuneTo(26, true)
    creature:SendUnitSay("You can not interrupt me.", 0)
    
    creature:RegisterEvent(Cast, 5500, 0)
    creature:RegisterEvent(ImmunityOff, 15000, 1)
end

local function LeaveCombat(event, creature)
    creature:RemoveEvents()
end

RegisterCreatureEvent(113, 1, EnterCombat)
RegisterCreatureEvent(113, 2, LeaveCombat) -- OnLeaveCombat
RegisterCreatureEvent(113, 4, LeaveCombat) -- OnDied

image

@55Honey
Copy link
Contributor Author

55Honey commented Feb 8, 2024

I do not mind adjusting the PR, but I have no idea what it fails the build for. It compiles just fine on AC with the same 2 changes. If anyone has an idea, feel free to advice.

@Foereaper Foereaper merged commit 4e6c7b0 into ElunaLuaEngine:master Feb 9, 2024
@55Honey 55Honey deleted the mechanic branch February 9, 2024 17:23
Niam5 added a commit that referenced this pull request Feb 11, 2024
Also rearranged expansion specific functions to make sure the nullptrs are at the end of the list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants