Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4094,3 +4094,7 @@ When setting a property like MORE to the a spell or skill defname, trying to rea
4-12-2025, Nolok
- Fixed: Malformed spell flags being returned via scripts.
- Fixed: REGION ISEVENT didn't (always?) find REGIONTYPES.

05-12-2025, canerksk
- Changed: NPCs cast distance now depends on the caster's RANGE (if set, otherwise fall back to the default value).
- Added: TAG.OVERRIDE.SPELL_MAXDIST to set a custom maximum distance from the target for spellcasting.
10 changes: 9 additions & 1 deletion src/game/chars/CCharNPCAct_Magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,16 @@ bool CChar::NPC_FightMagery(CChar * pChar)
if ((iSpellCount < 1) && !pWand)
return false;

int iMaxDist = ((UO_MAP_VIEW_SIGHT * 3) / 4); // (14 * 3) / 4 = 10
if (pChar->_uiRange)
iMaxDist = pChar->_uiRange; // char range

CVarDefCont *pValueMaxDist = GetKey("OVERRIDE.SPELL_MAXDIST", true);
if (pValueMaxDist)
iMaxDist = (int)pValueMaxDist->GetValNum();

int iDist = GetTopDist3D(pChar);
if (iDist > ((UO_MAP_VIEW_SIGHT * 3) / 4)) // way too far away . close in.
if (iDist > iMaxDist) // way too far away . close in.
return false;

if ((iDist <= 1) && (Skill_GetBase(SKILL_TACTICS) > 200) && (!g_Rand.GetVal(2)))
Expand Down