-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(Core/Spells): Adding CCDelay #1969
Conversation
Implementing CCDelay
src/server/game/Spells/Spell.cpp
Outdated
if (_spell->Id == 49376) | ||
return delayForInstantSpells; | ||
// Maim | ||
if (_spell->Id == 22570 || 49802) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (_spell->Id == 22570 || _spell->Id == 49802)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lineagedr fixed !
And it passed Travis build... Strange
src/server/game/Spells/Spell.cpp
Outdated
if (_spell->Id == 9005 || _spell->Id == 9823 || _spell->Id == 9827 || _spell->Id == 27006 || _spell->Id == 49803) | ||
return delayForOpenerStuns; | ||
// Entangling roots | ||
if (_spell->Id == 339 || _spell->Id == 1062 || _spell->Id == 5195 || _spell->Id == 5196 || _spell->Id == 9852 || _spell->Id == 9853 || _spell->Id == 26989 || _spell->Id == 53308) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entire code could be improved there's no need to check for all of these spells where you could do:
if (_spell->Mechanic == MECHANIC_ROOT)
And for stuns
if (_spell->Mechanic == MECHANIC_STUN)
And so on and so fourth. Take a look at: https://github.com/azerothcore/azerothcore-wotlk/blob/master/src/server/game/Miscellaneous/SharedDefines.h#L1203
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true but some spells like Dragon's Breath
, Frost Nova
, Mage - Pet - Freeze
, Felguard's Intercept
and more doesn't have any mechanic assigned, so I prefered to keep the basic functioning by doing case by case.
Plus, there is some spells like hunter traps, or priest's Mind Control that don't require a delay.
I know if there is a delay on Mind Control
and the targeted player use Repentance at the same time, priest will get 1min cc instead of 10sec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For spells such as Dragon's Breath you can use
if (_spell->SpellIconID == 1548)
Frost nova:
MECHANIC_ROOT
Water Elemental Freeze:
if (_spell->Id == 33395)
It's fine to use Ids for spells that have no mechanic or special cases such as the hunter traps where they share MECHANIC_STUN, but using this:
// Entangling roots
if (_spell->Id == 339 || _spell->Id == 1062 || _spell->Id == 5195 || _spell->Id == 5196 || _spell->Id == 9852 || _spell->Id == 9853 || _spell->Id == 26989 || _spell->Id == 53308)
Instead of this:
// Entangling roots
if (_spell->Mechanic == MECHANIC_ROOT)
Is madness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lineagedr Should be better now
Can you run the bash script here https://github.com/azerothcore/azerothcore-wotlk/tree/master/apps/git_tools ? it's to help with writing commits And thank you for the PR (you said you would open it and you did, a man of his word!) |
@lineagedr another review ? please :P |
The code is the same. Maybe worse than before because now it's unorganized. It's still using dozens of spell ids instead of their mechanic. |
@lineagedr As I said, _spell->Mechanic is the 4th column of Spell.dbc (https://wowdev.wiki/DB/Spell) and in a lot of cases it's not filled up with a mechanic even if the spell applies one. // src/server/game/Spells/SpellInfo.cpp L. 867
bool SpellInfo::HasAura(AuraType aura) const
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (Effects[i].IsAura(aura))
return true;
return false;
} Switch's have the same access time on all elements, so it's better to use it rather than a loop + if / else chaining like Moreover, saying "this code is worse" without giving details or solution is completely useless. So please, next time you want to correct someone, make yourself more useful and show him how to do :) |
Checking by ids is really the way to go here in most cases. Is this affecting spells casted by creatures? Can this break boss encounters? |
@GitVerge |
Yup I'll do that, thanks. |
@Shard-MW I've already showed you how to do it. And I've said that for the spells that have no mechanic you can use their Ids: Look at your code:
Is better than this lol:
I've rewritten your code: https://pastebin.com/9p5MkDZt You can see the difference. |
@lineagedr And nope, I'm saying that, this : case 339: // Druid - Entangling roots
case 1062:
case 5195:
case 5196:
case 9852:
case 9853:
case 26989:
case 53308: is better than this : case SPELLFAMILY_DRUID:
if (_spell->Mechanic == MECHANIC_BANISH) // Cyclone
return delayForBanishes;
if (_spell->Mechanic == MECHANIC_ROOT) // Entangling Root
return delayForRoots;
if (_spell->Mechanic == MECHANIC_STUN) // Bash, Maim, Feral charge - Bear
return delayForStuns;
if (_spell->Mechanic == MECHANIC_SLEEP) // Hibernate
return delayForDisorients;
if (_spell->SpellIconID == 495) // Pounce
return delayForStuns;
break; because you'll have to check the familyName + check 5 And if you truly want to use CCDelay based on mechanics only, for (uint8 i = 0; i < CCDArraySize; ++i)
if (_spell->HasAura(auraWithCCD[i]))
return auraCCDelay[i]; is enough to produce the same result as your entire (re)code. |
No, this:
Is for ALL spells with certain mods: Including creature spells. |
@lineagedr // Other
for (uint8 i = 0; i < (sizeof(auraWithCCD) / sizeof(*auraWithCCD)); ++i)
if (_spell->HasAura(auraWithCCD[i]))
return delayForInstantSpells; And what's the point of using switch + conditions if you're doing the same treatment on player's and other's spells? T_T |
@Shard-MW How is it doing the same treatment? Above the loop the player spells have custom delay. If every player spell was returning the delayForInstantSpells then it would be the same treatment. Anyway here's a version with switches: https://pastebin.com/TYGLj9eu: |
I do understand the way that @Shard-MW has done this, as some spell don't contain mechanics, but i have implented my own version of this into Oregoncore This way i have done it, reads the mechanics of the spell by using a loop for each spell to check the max effects and then returns the value. I will go through this code when i have more time for a better review (most likely Friday) and can leave some feedback |
make a case for each spell - good choice(no). for now best option at @talamortis oregon |
@Viste If I may ask, which spells does it break? |
also are you saying my way is incorrect? |
no you way is best for now |
@Viste azerothcore-wotlk/src/server/game/Spells/Spell.cpp Lines 6591 to 6593 in f7c936b
I'm using the first switch to :
|
@Yehonal yes correct, it is a queue of actions. The weird thing is that because it impacts spells but not gameobject movement, that will generate some behaviours the classic players are familiar with but might confuse people. E.g. a spell evaluation happening before cast will happen at time X, but actually spell is cast at X + 400 where the player conditions changed - but still the spell will land. In WOTLK anyway, this "diff" time is not 400 MS. after a lot of research on videos by a group of tester in my old project, we came up with 150 to 200 ms as the correct number. |
after i've said it, why you closed it? i don't understand why it's so difficult to move code in modules for you...we've such amazing possibility to keep the core clean and fixed (with module workarounds) at the same time...meh |
i feel like it's a git accident but not sure yet |
@Yehonal Keep calm, it's just an accident. I'll reopen it and all my others PR. I've just deleted some of my branch by mistake... |
Any news about the module? :) |
I used to have about a month and it feels pretty good now what state it is |
It must be done with a module, it's easy, safer and the best way to do it.
We should stop to add more and more custom options directly into the core.
…On Wed, 19 Feb 2020 at 11:19, PKL ***@***.***> wrote:
I used to have about a month and it feels pretty good now what state it is
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1969?email_source=notifications&email_token=AABD5FCBXVVDJDI2VRO55L3RDUBURA5CNFSM4HYAC2N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMHGHKY#issuecomment-588145579>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABD5FCRXW7LL55TPKVKMZ3RDUBURANCNFSM4HYAC2NQ>
.
|
what mikk said looks to me like it was an official feature as I expected, and not really "custom" however if it's considered custom, @Shard-MW could make it into a module, but please answer something |
The feature is official and it's not "a real feature". It's just a matter
of how the retail handled the spell packets, with a window queue of 400 ms
that allowed players to play with certain "strategies". We don't have such
queue at the moment and the spell packets are instant.
The code of this PR is just an hack to emulate such queue. That's why it's
better to provide a module
…On Wed, 19 Feb 2020, 21:41 Barbz, ***@***.***> wrote:
what mikk said looks to me like it was an official feature as I expected,
and not really "custom"
however if it's considered custom, @Shard-MW <https://github.com/Shard-MW>
could make it into a module, but please answer something
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1969?email_source=notifications&email_token=AABD5FGZWD25DMIMLY37TDDRDWKQJA5CNFSM4HYAC2N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMJO2XY#issuecomment-588442975>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABD5FGOMFKVYVTTKHMV6QTRDWKQJANCNFSM4HYAC2NQ>
.
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be moved under a module that can be used as a workaround until the queue will be implemented
I'll do it, I just don't have time yet
I don't think it's a good idea to implement the 400ms batch cuz players will feel the game more slower (and that's why it has been deleted in MoP? retail feels more dynamic now) |
Any update? |
Here are some interesting sources: https://github.com/magey/classic-warrior/wiki/Spell-batching |
Any updates on this? |
I really interested in this fix. As result of this thread, this behavior is indeed correct aligned with the official (even if an emulation). This behavior really makes difference on PvP experience. I can volunteer to re-open the PR and work on improvements in order to merge this on mainline. Just I would need help/directives from maintainers Thank you |
Implementing CCDelay
ISSUES ADDRESSED:
Closes #1968
TESTS PERFORMED:
Tests performed are explained in the issue
Target branch(es):
Master