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
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
c4ceee5
SpellFlagsRefactor
walt253 Dec 11, 2024
2f09848
Clarify comments about CastAtThing & SelfCasted
walt253 Dec 11, 2024
6c89475
Clean-up config_creature.h
walt253 Dec 11, 2024
9b5c3be
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 11, 2024
13d8db6
Fix for slap not exploding frozen creature
walt253 Dec 12, 2024
7d39d6e
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 12, 2024
fbab7f7
Better check&fix for backward compatibility
walt253 Dec 12, 2024
2136b17
Split 'delete_effects_attached_to_creature'
walt253 Dec 12, 2024
7e6d84e
Fix a mistake
walt253 Dec 12, 2024
979d1b9
delete_armour_effects_attached_to_creature
walt253 Dec 12, 2024
877610d
Added comments for every spell flags on magic.cfg
walt253 Dec 13, 2024
28a4d3b
Handles all the cases for the "useless" spell flags
walt253 Dec 13, 2024
b612098
Revert last commit
walt253 Dec 13, 2024
8f28750
Stop non functional spell flags to be set on config
walt253 Dec 13, 2024
2348021
Fix related to delete_thing_structure
walt253 Dec 13, 2024
beb5e1d
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 13, 2024
6b9b186
Fix Chicken countdown and implements HealingRecovery
walt253 Dec 13, 2024
d1a2ea2
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 13, 2024
bfaa0fb
Fix a mistake
walt253 Dec 13, 2024
f9ead38
Update magic.cfg
walt253 Dec 14, 2024
e5bbc68
Various bug fixes
walt253 Dec 14, 2024
9b6ea71
Update engine_redraw.c
walt253 Dec 14, 2024
f07080d
Update engine_redraw.c
walt253 Dec 14, 2024
b4ed9cb
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 14, 2024
a0b9cb5
Complete Fear Implementation
walt253 Dec 14, 2024
8944082
Update creature_states_combt.c
walt253 Dec 14, 2024
48ffea9
Remove CSAfF_ExpLevelUp + Various clean-up.
walt253 Dec 14, 2024
1f9ef9c
Define WEIGHT_DIVISOR constant
walt253 Dec 14, 2024
3127255
Names changes for functions
walt253 Dec 14, 2024
01d50e3
Remove EXP_LEVEL_UP from configs
walt253 Dec 14, 2024
662b59d
Remove Fat check on compute_creature_weight + grammar fix
walt253 Dec 14, 2024
237489b
Rename another function
walt253 Dec 14, 2024
b04e0ff
Remove SPLK_NONE constant
walt253 Dec 14, 2024
1b52dde
Clean-up CSAfF_CalledToArms
walt253 Dec 14, 2024
9119b3a
Implements Cleanse Support
walt253 Dec 14, 2024
6285d08
Implements DamageOverTime + Better Cleanse
walt253 Dec 15, 2024
cdea7e5
Update config for new properties flags
walt253 Dec 15, 2024
075101a
Update thing_creature.c
walt253 Dec 15, 2024
047cffb
Oops fix GameTurnDelta duration
walt253 Dec 15, 2024
e9ec104
Fix: better aura effect implementation & clean-up bad code
walt253 Dec 15, 2024
a668ec4
Update thing_creature.c
walt253 Dec 15, 2024
a519cdc
lvl_script_commands.c replace the switch with bitwise left shift oper…
walt253 Dec 15, 2024
746da13
Update lvl_script_commands.c
walt253 Dec 15, 2024
31371df
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 17, 2024
d9a6313
fix
walt253 Dec 18, 2024
4991e05
Update magic.cfg
walt253 Dec 18, 2024
d4b9dae
Various fixes based on feedback
walt253 Dec 18, 2024
ef12eae
Mad Killing remove traces of combat when it ends
walt253 Dec 18, 2024
d48ae80
Fix SelfCasted comment + -script command check
walt253 Dec 18, 2024
8d696fe
Better Cleanse implementation & Improved DoT implementation
walt253 Dec 18, 2024
ee4f677
Update thing_creature.c
walt253 Dec 18, 2024
ea9d060
IMPORTANT BUG FIX
walt253 Dec 19, 2024
0985e82
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 19, 2024
cf241f8
remove damage type
walt253 Dec 20, 2024
459d436
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 21, 2024
ed53570
random sound play in script command too
walt253 Dec 21, 2024
9cecf97
use to_flag for clarity
walt253 Dec 21, 2024
625bd44
Update lvl_script_commands.c
walt253 Dec 21, 2024
fd5535d
script command accepts numbers
walt253 Dec 21, 2024
2a90333
Fixed blocking build warning
Loobinex Dec 22, 2024
1f357c5
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 22, 2024
1a120cc
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 27, 2024
5fb4138
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 27, 2024
c8d4e93
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 28, 2024
0328475
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 29, 2024
d458089
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 29, 2024
2088e08
Init immunity flags at correct location
walt253 Dec 29, 2024
0105983
clean-up removed variable from init
walt253 Dec 29, 2024
ffbe100
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 29, 2024
166a0e4
Merge branch 'master' into SpellFlagsRefactor
walt253 Dec 29, 2024
29da00e
Update creature_control.h
walt253 Dec 29, 2024
bc05ed6
Merge branch 'master' into SpellFlagsRefactor
walt253 Jan 1, 2025
35c0fbd
fix aura for special
walt253 Jan 2, 2025
b348be8
Merge branch 'master' into SpellFlagsRefactor
walt253 Jan 2, 2025
3196595
clean-up comment + fix aura/duration
walt253 Jan 2, 2025
04ba982
better implementation for script command
walt253 Jan 3, 2025
5cd573f
Update lvl_script_commands.c
walt253 Jan 3, 2025
190de96
fix longs
walt253 Jan 3, 2025
7e43301
Merge branch 'master' into SpellFlagsRefactor
walt253 Jan 3, 2025
7427daf
cleanup of toflag stuff
Loobinex Jan 3, 2025
55e7b3d
fix indentation
walt253 Jan 3, 2025
b7e124f
Update config_magic.c
walt253 Jan 3, 2025
b461ac8
error when invalid flag on config
walt253 Jan 3, 2025
0df8b4c
Update config_crtrmodel.c
walt253 Jan 3, 2025
ec94a85
Update lvl_script_commands.c
walt253 Jan 3, 2025
2acd405
deallocate script value if spellimmunity flag is out of range
walt253 Jan 3, 2025
6fb1cfa
value1 < 0
walt253 Jan 3, 2025
3815881
Update lvl_script_commands.c
walt253 Jan 3, 2025
16fe7e0
CleanseFlag clean-up too
walt253 Jan 3, 2025
a72e94d
renamed magic_spell_flags
Loobinex Jan 3, 2025
68278ad
adding numbers power of 2 on magic.cfg
walt253 Jan 3, 2025
de925aa
Update magic.cfg
walt253 Jan 3, 2025
6fa761e
Update imp.cfg
walt253 Jan 3, 2025
044c884
Reworked jobs to be the same as spellimmunity
Loobinex Jan 4, 2025
03999ab
Update lvl_script_commands.c
walt253 Jan 4, 2025
7e271e9
Merge branch 'master' into SpellFlagsRefactor
walt253 Jan 4, 2025
234c6e3
fix mistake
walt253 Jan 4, 2025
1c0e287
Update imp.cfg
walt253 Jan 4, 2025
7666302
Don't duplicate SpellImmunity on campaign configs
Loobinex Jan 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename another function
creature_is_immune_to_spell_effect instead of creature_is_immune_to_spell_flags

Clean-up game_loop.c comments
  • Loading branch information
walt253 committed Dec 14, 2024
commit 237489b9c52daefec0b5885d511c2854247ba15f
4 changes: 2 additions & 2 deletions src/creature_instances.c
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ TbBool validate_target_non_idle(struct Thing* source, struct Thing* target, CrIn
long state_type = get_creature_state_type(target);
if ((state_type != CrStTyp_Idle)
&& !creature_under_spell_effect(target, spconf->spell_flags)
&& !creature_is_immune_to_spell_flags(target, spconf->spell_flags))
&& !creature_is_immune_to_spell_effect(target, spconf->spell_flags))
{
return true;
}
Expand Down Expand Up @@ -1384,7 +1384,7 @@ TbBool validate_target_even_in_prison
struct SpellConfig *spconf = get_spell_config(inst_inf->func_params[0]);
if (spell_config_is_invalid(spconf)
|| creature_under_spell_effect(target, spconf->spell_flags)
|| creature_is_immune_to_spell_flags(target, spconf->spell_flags))
|| creature_is_immune_to_spell_effect(target, spconf->spell_flags))
{
// If this instance has wrong spell, or the target has been affected by this spell, return false.
SYNCDBG(12, "%s(%d) is not a valid target for %s because it has been affected by the spell.",
Expand Down
8 changes: 4 additions & 4 deletions src/game_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void process_dungeon_destroy(struct Thing* heartng)
struct Dungeon* dungeon = get_dungeon(plyr_idx);
struct Thing* soultng = thing_get(dungeon->free_soul_idx);
struct ObjectConfigStats* objst = get_object_model_stats(heartng->model);
struct CreatureControl* sctrl; // For 'soultng' strange case.
struct CreatureControl* sctrl;
if (dungeon->heart_destroy_state == 0)
{
return;
Expand Down Expand Up @@ -129,7 +129,7 @@ void process_dungeon_destroy(struct Thing* heartng)
}
else if (dungeon->heart_destroy_turn == 20)
{
// Strange case, not sure why it's required.
// Sets soultng to be invisible for a short amount of time.
sctrl = creature_control_get_from_thing(soultng);
set_flag(sctrl->spell_flags, CSAfF_Invisibility);
sctrl->force_visible = 0;
Expand All @@ -146,13 +146,13 @@ void process_dungeon_destroy(struct Thing* heartng)
}
else if (dungeon->heart_destroy_turn == 28)
{
// Strange case, not sure why it's required.
// Clears soultng invisibility.
sctrl = creature_control_get_from_thing(soultng);
clear_flag(sctrl->spell_flags, CSAfF_Invisibility);
sctrl->force_visible = 0;
}
else if (dungeon->heart_destroy_turn == 30)
{ // 'soultng' is deleted shortly after so why even bother making it invisible with spell flags? Perhaps it could use rendering flag instead?
{
dungeon->free_soul_idx = 0;
delete_thing_structure(soultng, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lvl_script_value.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ TbResult script_use_spell_on_creature(PlayerNumber plyr_idx, ThingModel crmodel,
}
SpellKind spkind = (fmcl_bytes >> 8) & 255;
struct SpellConfig *spconf = get_spell_config(spkind);
if ((spconf->caster_affected) && (!creature_is_immune_to_spell_flags(thing, spconf->spell_flags)))
if ((spconf->caster_affected) && (!creature_is_immune_to_spell_effect(thing, spconf->spell_flags)))
{ // Immunity is handled in 'apply_spell_effect_to_thing', but this command plays sounds, so check for it.
if (thing_is_picked_up(thing))
{
Expand Down
2 changes: 1 addition & 1 deletion src/magic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ static TbResult magic_use_power_apply_spell(PowerKind power_kind, PlayerNumber p
}
}
// Check if the creature kind isn't affected by that spell.
if (creature_is_immune_to_spell_flags(thing, spconf->spell_flags))
if (creature_is_immune_to_spell_effect(thing, spconf->spell_flags))
{
thing_play_sample(thing, 58, 20, 0, 3, 0, 2, 128);
walt253 marked this conversation as resolved.
Show resolved Hide resolved
return Lb_SUCCESS;
Expand Down
6 changes: 3 additions & 3 deletions src/player_compchecks.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ struct Thing *computer_check_creatures_in_room_for_accelerate(struct Computer2 *
i = cctrl->next_in_room;
// Per creature code
if (!creature_under_spell_effect(thing, CSAfF_Speed)
&& !creature_is_immune_to_spell_flags(thing, CSAfF_Speed))
&& !creature_is_immune_to_spell_effect(thing, CSAfF_Speed))
{
long n = get_creature_state_besides_move(thing);
struct StateInfo* stati = get_thing_state_info_num(n);
Expand Down Expand Up @@ -828,7 +828,7 @@ struct Thing *computer_check_creatures_in_room_for_flight(struct Computer2 *comp
i = cctrl->next_in_room;
// Per creature code
if (!creature_under_spell_effect(thing, CSAfF_Flying)
&& !creature_is_immune_to_spell_flags(thing, CSAfF_Flying))
&& !creature_is_immune_to_spell_effect(thing, CSAfF_Flying))
{
long n = get_creature_state_besides_move(thing);
struct StateInfo* stati = get_thing_state_info_num(n);
Expand Down Expand Up @@ -868,7 +868,7 @@ struct Thing *computer_check_creatures_in_room_for_vision(struct Computer2 *comp
i = cctrl->next_in_room;
// Per creature code
if (!creature_under_spell_effect(thing, CSAfF_Sight)
&& !creature_is_immune_to_spell_flags(thing, CSAfF_Sight))
&& !creature_is_immune_to_spell_effect(thing, CSAfF_Sight))
{
long n = get_creature_state_besides_move(thing);
struct StateInfo* stati = get_thing_state_info_num(n);
Expand Down
4 changes: 2 additions & 2 deletions src/player_compevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ PowerKind computer_choose_attack_spell(struct Computer2 *comp, struct ComputerEv
powerst = get_power_model_stats(caspl->pwkind);
spconf = get_spell_config(powerst->spell_idx);
if (!creature_under_spell_effect(creatng, spconf->spell_flags)
walt253 marked this conversation as resolved.
Show resolved Hide resolved
&& !creature_is_immune_to_spell_flags(creatng, spconf->spell_flags))
&& !creature_is_immune_to_spell_effect(creatng, spconf->spell_flags))
{
if (computer_able_to_use_power(comp, caspl->pwkind, cevent->param1, caspl->amount_able)) {
cevent->param3 = i;
Expand Down Expand Up @@ -830,7 +830,7 @@ long computer_event_check_imps_in_danger(struct Computer2 *comp, struct Computer
if ((CREATURE_RANDOM(creatng, 150) == 1)
&& computer_able_to_use_power(comp, PwrK_CONCEAL, 8, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Invisibility)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Invisibility))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Invisibility))
{ // TODO: check if PwrK_CONCEAL is still applying Invisibility, in case it changes?
walt253 marked this conversation as resolved.
Show resolved Hide resolved
magic_use_available_power_on_thing(creatng->owner, PwrK_CONCEAL, 8, 0, 0, creatng, PwMod_Default);
}
Expand Down
10 changes: 5 additions & 5 deletions src/player_comptask.c
Original file line number Diff line number Diff line change
Expand Up @@ -3115,7 +3115,7 @@ long task_magic_speed_up(struct Computer2 *comp, struct ComputerTask *ctask)
}
if (computer_able_to_use_power(comp, PwrK_SPEEDCRTR, ctask->attack_magic.splevel, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Speed)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Speed))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Speed))
{
if (try_game_action(comp, dungeon->owner, GA_UsePwrSpeedUp, ctask->attack_magic.splevel, 0, 0, ctask->attack_magic.target_thing_idx, 0) > Lb_OK)
{
Expand All @@ -3124,7 +3124,7 @@ long task_magic_speed_up(struct Computer2 *comp, struct ComputerTask *ctask)
}
else if (computer_able_to_use_power(comp, PwrK_PROTECT, ctask->attack_magic.splevel, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Armour)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Armour))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Armour))
{
if (try_game_action(comp, dungeon->owner, GA_UsePwrArmour, ctask->attack_magic.splevel, 0, 0, ctask->attack_magic.target_thing_idx, 0) > Lb_OK)
{
Expand All @@ -3133,7 +3133,7 @@ long task_magic_speed_up(struct Computer2 *comp, struct ComputerTask *ctask)
}
else if (computer_able_to_use_power(comp, PwrK_REBOUND, ctask->attack_magic.splevel, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Rebound)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Rebound))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Rebound))
{
if (try_game_action(comp, dungeon->owner, GA_UsePwrRebound, ctask->attack_magic.splevel, 0, 0, ctask->attack_magic.target_thing_idx, 0) > Lb_OK)
{
Expand All @@ -3142,7 +3142,7 @@ long task_magic_speed_up(struct Computer2 *comp, struct ComputerTask *ctask)
}
if (computer_able_to_use_power(comp, PwrK_FLIGHT, ctask->attack_magic.splevel, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Flying)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Flying))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Flying))
{
if (try_game_action(comp, dungeon->owner, GA_UsePwrFlight, ctask->attack_magic.splevel, 0, 0, ctask->attack_magic.target_thing_idx, 0) > Lb_OK)
{
Expand All @@ -3151,7 +3151,7 @@ long task_magic_speed_up(struct Computer2 *comp, struct ComputerTask *ctask)
}
if (computer_able_to_use_power(comp, PwrK_VISION, ctask->attack_magic.splevel, 1)
&& !creature_under_spell_effect(creatng, CSAfF_Sight)
&& !creature_is_immune_to_spell_flags(creatng, CSAfF_Sight))
&& !creature_is_immune_to_spell_effect(creatng, CSAfF_Sight))
{
if (try_game_action(comp, dungeon->owner, GA_UsePwrVision, ctask->attack_magic.splevel, 0, 0, ctask->attack_magic.target_thing_idx, 0) > Lb_OK)
{
Expand Down
2 changes: 1 addition & 1 deletion src/power_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void process_disease(struct Thing *creatng)
&& ((get_creature_model_flags(thing) & CMF_IsSpecDigger) == 0)
walt253 marked this conversation as resolved.
Show resolved Hide resolved
&& (thing->owner != cctrl->disease_caster_plyridx)
&& !creature_under_spell_effect(thing, CSAfF_Disease)
&& !creature_is_immune_to_spell_flags(thing, CSAfF_Disease)
&& !creature_is_immune_to_spell_effect(thing, CSAfF_Disease)
&& (cctrl->disease_caster_plyridx != game.neutral_player_num))
{ // Apply the spell kind stored in 'active_disease_spell'.
apply_spell_effect_to_thing(thing, cctrl->active_disease_spell, cctrl->explevel);
walt253 marked this conversation as resolved.
Show resolved Hide resolved
Loobinex marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
40 changes: 20 additions & 20 deletions src/thing_creature.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ TbBool creature_under_spell_effect_f(const struct Thing *thing, unsigned long sp
/* Returns if the creature kind is immune to spell flags.
* @param thing The thing to be checked.
* @param spell_flags The spell flags to be checked. */
TbBool creature_is_immune_to_spell_flags_f(const struct Thing *thing, unsigned long spell_flags, const char *func_name)
TbBool creature_is_immune_to_spell_effect_f(const struct Thing *thing, unsigned long spell_flags, const char *func_name)
{
struct CreatureStats *crstat = creature_stats_get(thing->model);
if (creature_stats_invalid(crstat))
Expand Down Expand Up @@ -876,7 +876,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
struct Thing *ntng;
TbBool affected = false;
if (flag_is_set(spconf->spell_flags, CSAfF_Slow)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Slow)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Slow)))
{
if (!creature_under_spell_effect(thing, CSAfF_Slow))
{
Expand All @@ -887,7 +887,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Speed)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Speed)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Speed)))
{
if (!creature_under_spell_effect(thing, CSAfF_Speed))
{
Expand All @@ -897,7 +897,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Armour)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Armour)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Armour)))
{
if (!creature_under_spell_effect(thing, CSAfF_Armour))
{
Expand Down Expand Up @@ -927,7 +927,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Rebound)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Rebound)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Rebound)))
{
if (!creature_under_spell_effect(thing, CSAfF_Rebound))
{
Expand All @@ -936,7 +936,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Flying)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Flying)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Flying)))
{
if (!creature_under_spell_effect(thing, CSAfF_Flying))
{
Expand All @@ -946,7 +946,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Invisibility)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Invisibility)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Invisibility)))
{
if (!creature_under_spell_effect(thing, CSAfF_Invisibility))
{
Expand All @@ -956,7 +956,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Sight)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Sight)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Sight)))
{
if (!creature_under_spell_effect(thing, CSAfF_Sight))
{
Expand All @@ -965,7 +965,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Light)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Light)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Light)))
{
if (!crstat->illuminated)
{
Expand All @@ -978,7 +978,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
}
}
if (flag_is_set(spconf->spell_flags, CSAfF_Disease)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Disease)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Disease)))
{
if (!creature_under_spell_effect(thing, CSAfF_Disease))
{
Expand Down Expand Up @@ -1019,7 +1019,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Chicken)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Chicken)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Chicken)))
{
if (!creature_under_spell_effect(thing, CSAfF_Chicken))
{
Expand All @@ -1035,7 +1035,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_MadKilling)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_MadKilling)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_MadKilling)))
{
if (!creature_under_spell_effect(thing, CSAfF_MadKilling))
{
Expand All @@ -1044,7 +1044,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_UseMePlease)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_UseMePlease)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_UseMePlease)))
{
if (!creature_under_spell_effect(thing, CSAfF_UseMePlease))
{
Expand All @@ -1053,7 +1053,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Teleport)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Teleport)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Teleport)))
{
if (!creature_under_spell_effect(thing, CSAfF_Teleport))
{
Expand All @@ -1064,7 +1064,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Timebomb)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Timebomb)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Timebomb)))
{
if (!creature_under_spell_effect(thing, CSAfF_Timebomb))
{
Expand All @@ -1075,7 +1075,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Freeze)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Freeze)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Freeze)))
{
if (!creature_under_spell_effect(thing, CSAfF_Freeze))
{
Expand All @@ -1091,7 +1091,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Fear)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Fear))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Fear))
&& (crstat->fear_stronger > 0))
{
if (!creature_under_spell_effect(thing, CSAfF_Fear))
Expand Down Expand Up @@ -1129,7 +1129,7 @@ TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTur
affected = true;
}
if (flag_is_set(spconf->spell_flags, CSAfF_Heal)
&& (!creature_is_immune_to_spell_flags(thing, CSAfF_Heal)))
&& (!creature_is_immune_to_spell_effect(thing, CSAfF_Heal)))
{
// 'CSAfF_Heal' is only for checking config or immunity, flag is never set to creature.
Loobinex marked this conversation as resolved.
Show resolved Hide resolved
HitPoints healing_recovery;
Expand Down Expand Up @@ -1417,7 +1417,7 @@ void apply_spell_effect_to_thing(struct Thing *thing, SpellKind spell_idx, long
ERRORLOG("Spell %s config is invalid", spell_code_name(spell_idx));
return; // Exit the function, spell config is invalid.
}
if (creature_is_immune_to_spell_flags(thing, spconf->spell_flags))
if (creature_is_immune_to_spell_effect(thing, spconf->spell_flags))
{
SYNCDBG(7, "Creature %s index %d is immune to all spell flags %d set on %s", thing_model_name(thing), (int)thing->index, (uint)spconf->spell_flags, spell_code_name(spell_idx));
return; // Exit the function, creature is immune to all spell flags set on spell_idx.
walt253 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -4876,7 +4876,7 @@ long player_list_creature_filter_in_fight_and_not_affected_by_spell(const struct
{
return -1;
}
if (creature_is_immune_to_spell_flags(thing, spconf->spell_flags))
if (creature_is_immune_to_spell_effect(thing, spconf->spell_flags))
{
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/thing_creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ TbBool remove_creature_lair(struct Thing *thing);
TbBool creature_affected_by_slap(const struct Thing *thing);
TbBool creature_under_spell_effect_f(const struct Thing *thing, unsigned long spell_flags, const char *func_name);
#define creature_under_spell_effect(thing, spell_flags) creature_under_spell_effect_f(thing, spell_flags, __func__)
TbBool creature_is_immune_to_spell_flags_f(const struct Thing *thing, unsigned long spell_flags, const char *func_name);
#define creature_is_immune_to_spell_flags(thing, spell_flags) creature_is_immune_to_spell_flags_f(thing, spell_flags, __func__)
TbBool creature_is_immune_to_spell_effect_f(const struct Thing *thing, unsigned long spell_flags, const char *func_name);
#define creature_is_immune_to_spell_effect(thing, spell_flags) creature_is_immune_to_spell_effect_f(thing, spell_flags, __func__)

TbBool set_thing_spell_flags_f(struct Thing *thing, SpellKind spell_idx, GameTurnDelta duration, long spell_lev, const char *func_name);
#define set_thing_spell_flags(thing, spell_idx, duration, spell_lev) set_thing_spell_flags_f(thing, spell_idx, duration, spell_lev, __func__)
Expand Down
Loading