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

Spell Flags Refactor #3751

Merged
merged 99 commits into from
Jan 5, 2025
Merged

Spell Flags Refactor #3751

merged 99 commits into from
Jan 5, 2025

Conversation

walt253
Copy link
Contributor

@walt253 walt253 commented Dec 11, 2024

This PR refactors the spell flags logic and introduces a number of improvements:

  • Custom Spells: It now supports custom Freeze, Heal, and Teleport spells. You can also truly combine multiple spell flags.

  • Refactored AreaAffectType: No longer hardcoded to Slow or Disease. The introduced SpellEffect field allows Gas to inflict various statuses on enemies or allies that aren't immune.

  • Spell Immunity: A new field in creature configuration files allows creatures to be immune to specific spell flags.

  • SpellFlags Accept Names: SpellFlags now accept names rather than numbers, making it easier to understand and configure.

  • Freeze Prisoners: No longer hardcoded to a specific instance. The freezer will now look for an appropriate instance that can freeze and use it.

  • Disease Improvement: Disease now has a new feature where it can spread the last active spell that inflicted it. For example, combining Disease + Chicken will spread both statuses.

  • Refactored Magic Use Powers: magic_use_power_heal, magic_use_power_timebomb, magic_use_power_chicken, and magic_use_power_disease have been merged into magic_use_power_apply_spell, which checks for immunities.

  • Deprecated: IMMUNE_TO_GAS, UNAFFECTED_BY_WIND, IMMUNE_TO_DISEASE, and NEVER_CHICKENS are deprecated. However, they are still supported for backward compatibility in the NamedCommand and will work with config or script commands, but their flags have been removed. All configs in the project have been updated accordingly.

  • Moved Flags: MagicFall and Grounded flags were removed from the spell flags. MagicFall is specifically for creature creation via the hero gate or summons, while Grounded is only used by Freeze against flying creatures. These flags have been moved to movement_flags.

This PR is large, so it will require thorough review and testing. I've tested the changes a bit, but the goal now is to identify any edge cases I might have missed or broken something else. I've left few comments on few parts of the code I've changed but I will add more to the PR itself to make it easier to review.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@walt253 walt253 requested a review from Spatulade December 11, 2024 01:37

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
The previous explanation was incorrect. While it's still not entirely accurate, 'CastAtThing' has become quite ambiguous, and its behavior depends on the configuration at the instance level. 'SelfCasted' is used for sound effects, and there's also a condition that checks the first argument when casting spells on creatures with a script command.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Forgot to remove it from this struct.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Should now be working fine with partial config.
@walt253 walt253 requested a review from Loobinex January 3, 2025 17:11
Loobinex and others added 11 commits January 3, 2025 19:02

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
long

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(<= 0 or > LONG_MAX)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
<= 0 was incorrect

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
I guess we only need to check < 0 + fix script error log to use correct %ld

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
walt253 and others added 7 commits January 4, 2025 00:06

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@walt253 walt253 requested review from benlp91 and removed request for Spatulade and benlp91 January 4, 2025 18:22

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@Loobinex Loobinex force-pushed the SpellFlagsRefactor branch from 62a54db to bf2a08e Compare January 5, 2025 12:02
@Loobinex Loobinex force-pushed the SpellFlagsRefactor branch from bf2a08e to 7666302 Compare January 5, 2025 12:04
@Loobinex Loobinex merged commit 1221267 into dkfans:master Jan 5, 2025
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.

NEW SPELL PROPERTY. NEW SPELL CURE. Immune to Freeze and Immune to Slow?
4 participants