Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core/SAI: Creatures does not store Cooldown after Counterspell #13559

Closed
Rushor opened this issue Nov 14, 2014 · 29 comments
Closed

Core/SAI: Creatures does not store Cooldown after Counterspell #13559

Rushor opened this issue Nov 14, 2014 · 29 comments

Comments

@Rushor
Copy link
Contributor

Rushor commented Nov 14, 2014

Rev: All revisions since mangos

Problem:
Creatures scriptet with SAI will ignore Counterspells.

Reproduction:
Choose an creature, scripted with SAI, which casts spells and repeats them all 2 seconds. Use counterspell on them, while they cast a spell.

  • You wil see that the creature ignores the counterspell and instantly repeats the spellcast after the counterspell

How it should be:
After you counterspelled the creature, the creature should not be able to repeat the spell for 5 seconds

Notes:
I know this is a general issue, because cooldown for creatures is not implementet yet and this issue affects also creatures scriptet with escortAI or scriptedAI and so on, but i think if we could realise a 5 sec cooldown for all creatures using sai it would be a great success.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@P-Kito
Copy link
Contributor

P-Kito commented Nov 14, 2014

True!

But not only with SAI, all creatures have this behaviour I believe.

@Rushor
Copy link
Contributor Author

Rushor commented Nov 15, 2014

thats why i asked at least for a solution for sai - because nearly every creature in wow is scripted with sai right now :D
the solution for everything else can be done in the future.

@P-Kito
Copy link
Contributor

P-Kito commented Nov 15, 2014

Why would you only implement it for SAI, more generic for all creatures would be even more insane.

@Rushor
Copy link
Contributor Author

Rushor commented Nov 15, 2014

generic solution would be great, but probably someone instantly know a solution for sai. to my mind the finding of a solution for sai can be done faster, because it will affect a specific part in the core :D

@xerkoss
Copy link
Contributor

xerkoss commented Nov 17, 2014

Add cooldown to all generic creatures.
Add a cast flag ignore_cooldown in SAI.

@P-Kito
Copy link
Contributor

P-Kito commented Nov 17, 2014

👍
Do it then xD

@Rushor
Copy link
Contributor Author

Rushor commented Nov 17, 2014

i'm currious about every idea, but these two proposes really greases the steamplugs!
do you have more hints for that?

i only saw something with cds here http://docs.trinitycore.info/d8/d14/structgeneric__creature_1_1generic__creatureAI.html :/

@xerkoss
Copy link
Contributor

xerkoss commented Nov 17, 2014

something like this?

+++ SmartScript.cpp (working copy)
@@ -502,7 +502,17 @@
                            ENSURE_AI(SmartAI, me->AI())->SetCombatMove(_allowMove);
                         }

-                        me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
+                       if (e.action.cast.flags & SMARTCAST_IGNORE_COOLDOWN)
+                           me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
+                       else if (!me->HasSpellCooldown(e.action.cast.spell) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
+                       {
+                           me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);
+                           me->AddCreatureSpellCooldown(e.action.cast.spell);
+                       }
+                       else
+                           TC_LOG_DEBUG("scripts.ai", "Spell %u not cast because already has cooldown", e.action.cast.spell);
+
                     }
                     else if (go)
                         go->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) != 0);

@P-Kito
Copy link
Contributor

P-Kito commented Nov 18, 2014

What happens when you interupt mid-cast with Counterspell (mage)?
Will it stop casting it for 6 seconds & all of that school?

@xerkoss
Copy link
Contributor

xerkoss commented Nov 18, 2014

void Spell::EffectInterruptCast(SpellEffIndex effIndex)
void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)

@Rushor
Copy link
Contributor Author

Rushor commented Nov 18, 2014

okay i tested this part:

if (!me->HasSpellCooldown(e.action.cast.spell) && !me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
                    {
                        me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
                        me->AddCreatureSpellCooldown(e.action.cast.spell);
                    }

with this creature: npc=29129. They cast the spell: 37361 every 1 seconds.
I Counterspelled the creature and the creature repeated the spellcast instantly after 1 sec.

Probably because the gcd for this spell itself is only 1.5 sec.

We have the problem, that the given time from (f.ex.: counterspell = 8 sec) the interrupt cast will not be added to the spellcooldown of the creature.

We cast counterspell on the creature and the cooldown for the spell still remains on 1.5 sec and is not inceased by the effect of the counterspell to 8 sec.

@ccrs
Copy link
Contributor

ccrs commented Nov 18, 2014

track the code applied for players and try to adapt it to a general case (units)

think thats the proper solution, as all units can be affected by silence (if the arent inmune of course)

@Rushor
Copy link
Contributor Author

Rushor commented Nov 18, 2014

nevertheless i think the part in smart_action_cast is needed because we need the check, if the creature has a spellcooldown or not - just a good starting point^^

@Rushor
Copy link
Contributor Author

Rushor commented Nov 18, 2014

probably we could use something like this:

void IsInteruptSpell(SpellInfo const* spell)
        {
            if (spell->HasEffect(SPELL_EFFECT_INTERRUPT_CAST))
                {
                    interrupted = true;
                    events.ScheduleEvent(EVENT_INTERRUPT_OVER, spell->GetDuration());
                }        
        }

but this must be modified to the sai, dunno how to bring this stuff to unit.cpp

@ghost
Copy link

ghost commented Nov 21, 2014

Why is the spell cooldown being added, if, what's needed is spell school lock timer? Each ability locks given school for a different period of time. This discussion is mostly incorrect...

I don't think such mechanic currently works for creatures

@P-Kito
Copy link
Contributor

P-Kito commented Nov 21, 2014

That's true and that's what the discussion is about here.
Make interupts work for creatures like they do for players.

@xerkoss
Copy link
Contributor

xerkoss commented Nov 21, 2014

PlayerSpellMap is used on players and returns m_spells. What means m_spells for pets? and for creatures? it's a missing value on db making us crazy?

PlayerSpellMap PetSpellMap ¿CreatureSpellMap?

@xerkoss
Copy link
Contributor

xerkoss commented Nov 25, 2014

m_spells are taken from creature_template spell1-spell8. If no value, ProhibitSpellSchool can't add cooldown.
Anyway, cooldown and silence check it's necessary.

@Rushor
Copy link
Contributor Author

Rushor commented Nov 25, 2014

so u mean if the creature has no script assigned and uses a rndmscript(foregot the name for this) which includes the use of the values in spell 1-8, the creature will have a normal cooldown- and interrupt behaviour?

@xerkoss
Copy link
Contributor

xerkoss commented Nov 25, 2014

I'm just saying that to add the cooldown spells for that school they need to be in creature_template.
Only requires the cooldown check. Easily to add in (SAI) but is better to implement in (CastSpell) function.

@Aokromes
Copy link
Member

This was fixed already no?

@Trisjdc
Copy link
Contributor

Trisjdc commented Feb 13, 2015

No

@Shauren
Copy link
Member

Shauren commented Feb 17, 2015

Fixed in 6.x branch

Shauren referenced this issue Feb 17, 2015
* Refactored cooldown handling to separate class shared by creatures and players
* Updated and enabled cooldown packets
* Implemented creature school lockouts
* Implemented spell charges
* Fixed AuraUpdate structure
* Fixed aura flag AFLAG_NOCASTER handling
* Implemented spell charge related auras
@ghost
Copy link

ghost commented Feb 17, 2015

Will u port this to 3.3.5 ?

@Kittnz
Copy link
Contributor

Kittnz commented Feb 17, 2015

I hope someone will :)

@Shauren
Copy link
Member

Shauren commented Feb 17, 2015

I will not. 3.3.5a branch is dead to me

@P-Kito
Copy link
Contributor

P-Kito commented Feb 17, 2015

Alot of people using it still. Wouldn't be a waste ;-P

@P-Kito
Copy link
Contributor

P-Kito commented Feb 24, 2015

Can someone port this to 3.3.5a? :/

@Killyana
Copy link
Contributor

Fixed by f4c1a8f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants