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

Fix some Gothic 1 magic bugs #682

Merged
merged 5 commits into from
Sep 9, 2024
Merged

Fix some Gothic 1 magic bugs #682

merged 5 commits into from
Sep 9, 2024

Conversation

thokkat
Copy link
Contributor

@thokkat thokkat commented Sep 6, 2024

This PR fixes issues 1. and 2. from #661 and 18.1 and 18.2 from G1 bug discussion.

(1) Broken firerain effect is fixed by adding it's Target_collect_algo attribute to Item::isSpellShoot. I proposed this change some time ago but withdrew because it would break Stormfist. Found out now that projectile property is hardcoded (source) and used that for Stormfist.

(2) Added a missing perc trigger on collision to make icewave freezing work.

(18.1/2.) Spell targets can be restricted based on attribute Target_collect_type, meaning orc priest just cannot be targeted. For TARGET_TYPE_UNDEAD I took C_NpcIsUndead script function from G2 as reference since it doesn't exist in G1.
Target type is not always correctly set in vanilla. For example icewave can target items.

While at it also limited focus search for interactives in combat to only bow and crossbow as magic can't target those.

Copy link
Owner

@Try Try left a comment

Choose a reason for hiding this comment

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

Hi, @thokkat and thanks for PR!

(18.1/2.) Spell targets can be restricted ...

This part seem to be a reference?

@@ -995,6 +999,27 @@ static bool checkFlag(Interactive& i,WorldObjects::SearchFlg f){
return true;
}

template<class T>
bool checkTargetType(T&, TargetType) { return true; }
Copy link
Owner

Choose a reason for hiding this comment

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

Function can be static

if(!isSpellOrRune())
return false;
bool g1 = world.version().game==1;
if(g1 && spellId()==47)
Copy link
Owner

Choose a reason for hiding this comment

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

nitpick: better to decouple 47 in something like const int32_t SPL_STORMFIST = 47

game/world/objects/item.cpp Show resolved Hide resolved
bool checkTargetType(T&, TargetType) { return true; }

static bool checkTargetType(Npc& n, TargetType t) {
if(bool(t&(TARGET_TYPE_ALL|TARGET_TYPE_NPCS)))
Copy link
Owner

Choose a reason for hiding this comment

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

Is this code also G1 only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No can be used for G2. SPL_WindFist has TARGET_TYPE_NPCS. If changed to TARGET_TYPE_UNDEAD novices can't be targeted anymore.

Here it's just a leftover because non-npcs can't be targeted anyway. Mostly if G2 does something different G1 stuff is still functional but unused,

game/graphics/effect.cpp Show resolved Hide resolved
@Try
Copy link
Owner

Try commented Sep 7, 2024

not about red ci: microsoft decided that they want to rename some stuff in dx.
should be fixed by: 1af5396 c56eb99

@thokkat
Copy link
Contributor Author

thokkat commented Sep 8, 2024

(18.1/2.) Spell targets can be restricted ...

This part seem to be a reference?

Meant issues 18.1 and 18.2 in bug discussion

18.1 Destroy Undead instantly kills Grash-Varrag-Arushat (5th undead priest), long before player has Uriziel
savegame: save_slot_7.sav.tar.gz
no ticket created
screenshot: n/a

18.2 Destroy Undead kills all undead and regular orcs and minecrawler warriors and Demons. Is that base game behaviour?
savegame: save_slot_4.sav.tar.gz
no ticket created
screenshot: n/a

@Try Try merged commit 221ca57 into Try:master Sep 9, 2024
1 check passed
@Try
Copy link
Owner

Try commented Sep 9, 2024

Merged, thanks!

@Abendlied Abendlied mentioned this pull request Sep 11, 2024
14 tasks
@Abendlied
Copy link

Not sure if it is correct to comment after succesful merge.

This PR fixes issues 1. and 2. from #661 and 18.1 and 18.2 from G1 bug #622.

18.1 Destroy Undead instantly kills Grash-Varrag-Arushat (5th undead priest), long before player has Uriziel
savegame: save_slot_7.sav.tar.gz
no ticket created
screenshot: n/a

18.2 Destroy Undead kills all undead and regular orcs and minecrawler warriors and Demons. Is that base game behaviour?
savegame: save_slot_4.sav.tar.gz
no ticket created
screenshot: n/a

what I understood you have fixed here is that destroy undead cannot focus on enemies. While it appears to fix the problem, the player can still kill Grash-Varrag-Arushat as well as MC warriors etc. with that spell by aiming free (without focusing). Standing directly infront of G-V-A and charging the spell still kills him even if not focused.

@Abendlied
Copy link

BIG thank you for this PR @thokkat!
fire rain and ice wave work flawlessly now thanks to your work.

@thokkat thokkat deleted the magic-p2 branch September 13, 2024 11:27
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.

3 participants