-
Notifications
You must be signed in to change notification settings - Fork 535
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] Allow targetfind to reject matching allegiances for ENEMY search #5628
[core] Allow targetfind to reject matching allegiances for ENEMY search #5628
Conversation
This touches a lot of stuff, gotta make sure it doesn't break anything, added hold label |
Yup looks like some stuff broke because targetflags != findflags. it fixed my exact bug but some AoEs stopped working. Time to add targetflags into targetfind We already do some jank conversions from targetflags -> findflags, so makes me wonder if it just should have been this way to begin with... |
aad074c
to
c283121
Compare
Updated code
c283121
to
fa70a4f
Compare
Alright, go ahead and re-review. had to touch more stuff |
@@ -531,7 +531,7 @@ void CMobController::CastSpell(SpellID spellid) | |||
{ | |||
// chance to target party | |||
PMob->PAI->TargetFind->reset(); | |||
PMob->PAI->TargetFind->findWithinArea(PMob, AOE_RADIUS::ATTACKER, PSpell->getRange()); | |||
PMob->PAI->TargetFind->findWithinArea(PMob, AOE_RADIUS::ATTACKER, PSpell->getRange(), 0, 0); |
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.
Can we use the enum values here instead of 0s please?
FINDFLAGS_NONE etc
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.
there isnt an enum for targettype value 0
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.
enum TARGETTYPE
{
TARGET_SELF = 0x01,
TARGET_PLAYER_PARTY = 0x02,
TARGET_ENEMY = 0x04,
TARGET_PLAYER_ALLIANCE = 0x08,
TARGET_PLAYER = 0x10,
TARGET_PLAYER_DEAD = 0x20,
TARGET_NPC = 0x40, // an npc is a mob that looks like an npc and fights on the side of the character
TARGET_PLAYER_PARTY_PIANISSIMO = 0x80,
TARGET_PET = 0x100,
TARGET_PLAYER_PARTY_ENTRUST = 0x200,
TARGET_IGNORE_BATTLEID = 0x400, // Can hit targets that do not have the same battle ID
};
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.
No reason you can't add FINDFLAGS_NONE
, rather than piping in a raw number that means the same thing
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.
or TARGET_NONE
, whatever
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.
Then the storage and the argument types become the enum:
FIND_TYPE m_findType;
FINDFLAGS m_findFlags; // what to search for
TARGETTYPE m_targetFlags; // targetflags to reject potentially bad targets
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.
Then the storage and the argument types become the enum:
FIND_TYPE m_findType; FINDFLAGS m_findFlags; // what to search for TARGETTYPE m_targetFlags; // targetflags to reject potentially bad targets
Apparently implementing this is editing a ton of stuff and I don't really have time to test every single permutation of spell/ability/mobskill/petskill right now
I've made the other changes asked of, though.
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.
Yeah, that one was a "we should probably do this at some point" thing, currently looks good 👍
fa70a4f
to
a6c1aca
Compare
a6c1aca
to
df8ce3c
Compare
I affirm:
What does this pull request do?
This fixes an issue where due to some odd conditions Yagudo could sweep themselves, stun themselves, and break their states causing a crash.
Fixes #5618
Steps to test these changes
See #5618
Also test bomb toss suicide
!exec target:useMobAbility(592)
and see it worksTest moonlight, curaga, firaga, see them all work.