Skip to content

Commit

Permalink
Do not use protect against doors (#3658)
Browse files Browse the repository at this point in the history
Fixes #3657
  • Loading branch information
Loobinex authored Nov 10, 2024
1 parent 22e0bd4 commit 5580061
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions levels/legacy_cfgs/creature.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ RangeIncreaseOnExp = 2
DexterityIncreaseOnExp = 35
DefenseIncreaseOnExp = 35

[instance10]
Name = REBOUND
ValidateTargetFunc = validate_target_benefits_from_defensive 0 0

[instance16]
Name = SLOW
ResetTime = 550
Expand Down
11 changes: 5 additions & 6 deletions src/creature_instances.c
Original file line number Diff line number Diff line change
Expand Up @@ -1445,14 +1445,13 @@ TbBool validate_target_benefits_from_defensive
ERRORLOG("Invalid creature control");
return false;
}
// As long as the target is fighting, return true, no matter what thing the target is attacking.
// Even if the target is attacking a door or dungeon heart, it still needs defensive buffs because
// the hostile keepers can use keeper offensive spells.
if (cctrl->combat_flags == 0)
// When the target is fighting creatures, return true because it needs defensive buffs.
// Doors and Hearts do not fight back, and keepers only defend by dropping units.
if (any_flag_is_set(cctrl->combat_flags, (CmbtF_Melee|CmbtF_Ranged|CmbtF_Waiting)))
{
return false; // Not in any combat.
return true; // In combat with creatures.
}
return true;
return false;
}

/**
Expand Down

0 comments on commit 5580061

Please sign in to comment.