Skip to content

Fix npc magic casting in Gothic 1 - #1075

Draft
thokkat wants to merge 1 commit into
Try:masterfrom
thokkat:fix-AiMagic
Draft

thokkat wants to merge 1 commit into
Try:masterfrom
thokkat:fix-AiMagic

Conversation

@thokkat

@thokkat thokkat commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Opened to share current state and avoid overlapping work as there were some G1 magic PR's lately. Main fix is to have npcs in Gothic 1 cast spells correctly.

Changes:

  • change time when npcs release a spell (e.g. skeleton mages wouldn't cast anything visually)
  • casting doesn't require BS_CASTING
  • avoid soft lock if a spell is drawn the moment npc wants to talk
  • fix automatic weapon draw on AI_Attack. Ice Golem was in infinite weapon draw loop.

@Abendlied

Copy link
Copy Markdown
Contributor

There is some slight overlap with Pyrokinesis casting. #1055
I was currently working on implementation of Control as well but have not issued a PR just yet as it is not feature-complete yet on my side. I only have the issue in GitHub so far: #1061
Then also, there is a Telekinesis PR from another contributor: #1059 which seems to call endCastSpell(true) and must invoke mana-release function, seems conflicting on first glance.

From what I understand, and I do not fully understand everything in this PR, this is changing how spells are handled, how they are released (with invokeManaRelease() for every spell) and terminated/cancelled.
In the end it is sort of an architectual change, relevant for the spells in implementation.

I can publish my work in progress for Control today or tomorrow, so we can see how compatible the concept actually is. Generally, I think it does make sense to take architectual decissions first, then implement the spells after the architecture is defined. So your fix should go first, if that makes sense.

@thokkat

thokkat commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator Author

tldr: Care only about player vs environment. Npc casting can be buggy in Gothic 1 and fixed by this PR. Only relevant for Pyrokinesis as Telekinesis/Control are hero only spells (not used by ai). This PR can be last after other magic stuff is merged.

In the end it is sort of an architectual change, relevant for the spells in implementation.

The relevant change is that endCastSpell is now called after invokeMana conditionally for npc. There was an issue with how/when npc casting called script. Other stuff is mostly cleanup and beautify things.

Commit message name is a bit misleading. I looked into invest spells some time ago, noticed npc casting problems and wanted to address them first and have not changed it yet.

I can publish my work in progress for Control today or tomorrow, so we can see how compatible the concept actually is.

No need to change anything. I do it on my side if necessary :).

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