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

Prevent point blank spellcasting into low obstacles #1861

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

petchema
Copy link
Collaborator

When enemy casters can see their target but are right behind some obstacle (say low obstacles like tables, fountains,...), the SphereCast used to check whether they're free to cast can miss the obstacle and allow them to cast, potentially damaging themselves (in classic lich style). An easily reproducible example of such behavior can be triggered in Orsinium entrance hall, if you agro the orc shaman but keep tables in his way.

Starting SphereCast from some position behind the caster could be a workaround, but since its radius is usually larger than caster's capsule radius, it's not very satisfactory (you don't start the SphereCast from inside a "known empty space"; The right offset would also depend on enemy capsule radius).
So instead I prepend the SphereCast test with a SphereCheck at its origin, temporarily excluding caster's collider.

I do not check whether that SphereCheck hits the target (point blank shooting), so HasClearPathToShootProjectile() will return false in this case, favoring other attack types (melee, touch spells,...)

When enemy casters can see their target but are right behind some
obstacle (say low obstacles like tables, fountains,...), the SphereCast
used to check whether they're free to cast can miss the obstacle and
allow them to cast, potentially damaging themselves (in classic lich
style). An easily reproducible example of such behavior can be triggered
in Orsinium entrance hall, if you agro the orc shaman but keep tables in
his way.

Starting SphereCast from some position behind the caster could be a
workaround, but since its radius is usually larger than caster's capsule
radius, it's not very satisfactory (you don't start the SphereCast from
inside a "known empty space"; The right offset would also depend on
enemy capsule radius).
So instead I prepend the SphereCast test with a SphereCheck at its
origin, temporarily excluding caster's collider.

I do not check whether that SphereCheck hits the target (point blank
shooting), so HasClearPathToShootProjectile() will return false in this
case, favoring other attack types (melee, touch spells,...)
@Interkarma Interkarma merged commit 8039b4c into Interkarma:master Aug 15, 2020
@petchema
Copy link
Collaborator Author

One drawback of this PR is that it prevents daedra lords from attempting to shoot at you in the "crossbow room" at the end of the Mantellan Crux. (Without it they sometimes hit their own "balcony", but enough fireballs make it thru to make them dangerous)

petchema pushed a commit to petchema/daggerfall-unity that referenced this pull request Jul 26, 2023
nuking themselves with spells at range in the presence of low obstacles.

A side effect of this PR however, is that daedra lords in the "crossbow
room" near the end of Mantellan Crux stopped shooting at the player
altogether, making this room much less threatening.

This new PR checks for obstacles a bit in front of the enemies, so they
can still cast from behind thin obstacles (rationale: spells start from
arm's reach). It's a bit crude, for example it doesn't change from where
the spells will be really cast, but from testing different casters
(namely, beside Mantellan Crux's daedra lords: Karolys lich and
Gortwog's shaman in entrance of Orsinium), I haven't experienced
regressions.
petchema pushed a commit to petchema/daggerfall-unity that referenced this pull request Jul 26, 2023
PR Interkarma#1861 was added to prevent caster enemies from nuking themselves with
spells at range in the presence of low obstacles.

A side effect of this PR however, is that daedra lords in the "crossbow
room" near the end of Mantellan Crux stopped shooting at the player
altogether, making this room much less threatening.

This new PR checks for obstacles a bit in front of the enemies, so they
can still cast from behind thin obstacles (rationale: spells start from
arm's reach). It's a bit crude, for example it doesn't change from where
the spells will be really cast, but from testing different casters
(namely, beside Mantellan Crux's daedra lords: Karolys lich and
Gortwog's shaman in entrance of Orsinium), I haven't experienced
regressions.
Interkarma added a commit that referenced this pull request Aug 9, 2023
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