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

Follow up fix for TARGET_TYPE #685

Merged
merged 2 commits into from
Sep 19, 2024
Merged

Follow up fix for TARGET_TYPE #685

merged 2 commits into from
Sep 19, 2024

Conversation

thokkat
Copy link
Contributor

@thokkat thokkat commented Sep 13, 2024

#682 allowed focus only if npc guild matches the spell's TARGET_TYPE. But that spell could still hit and cause damage.

Tested both G1&G2. Projectile spells hit only if TARGET_TYPE allows for, while spells like firerain ignore type and always hit.

I guess in theory there's same behavior for items and interactives but they can't be damaged anyway so ignore them.

@thokkat thokkat mentioned this pull request Sep 13, 2024
14 tasks
@Try
Copy link
Owner

Try commented Sep 14, 2024

#682 allowed focus only if npc guild matches the spell's TARGET_TYPE. But that spell could still hit and cause damage.

Are you sure, that engine also need to check target type on collision? To me checking only C_CanNpcCollideWithSpell makes more sense, and TARGET_TYPE is essentially a hint for game-interface.

@thokkat
Copy link
Contributor Author

thokkat commented Sep 14, 2024

This is how fireball looks with undead type.

6.mp4

In contrast firerain with undead type makes everyone angry

7.mp4

Other reason I found for preventing collision for projectile spells is that AssessDamage perc is not sent. Undead priest in G1 orc temple triggers a dialog after some hits but those spells with non-matching target type never trigger it.

@Try
Copy link
Owner

Try commented Sep 15, 2024

This is how fireball looks with undead type.

Hm, yeah. Still in case of G2 this feel-like leftover from G1, that wasn't intended to be in game:

  • in G2-scripts targetCollectType is effectively unused
  • G2 has C_CanNpcCollideWithSpell api to achieve same purpose
    While change is vital for G1, for G2 it falls into "bug reproduction" category.

Can we instead make no change to current G2 implementation, and provide a default implementation of GameScript::canNpcCollideWithSpell for G1?

@@ -2815,6 +2815,24 @@ void Npc::runEffect(Effect&& e) {
visual.startEffect(owner, std::move(e), 0, true);
}

bool Npc::isSpellTargetType(TargetType t) const {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: isSpellTargetType -> isTargetableBySpell

@thokkat
Copy link
Contributor Author

thokkat commented Sep 18, 2024

Can we instead make no change to current G2 implementation, and provide a default implementation of GameScript::canNpcCollideWithSpell for G1?

Done. Just wasn't getting what you were up to initially :)

@Try Try merged commit b825da6 into Try:master Sep 19, 2024
1 check passed
@Try
Copy link
Owner

Try commented Sep 19, 2024

Merged, thanks!

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