ModernUO/Projects/UOContent/Spells
Kamron Batman f211607d63
perf(ai): make IsEnemy the single authority for Honor/Ethereal Voyage (#2655)
## Summary
Profiling with thousands of creatures in range of each other showed `BaseAI.IsInvalidFactionTarget` checking Ethereal Voyage and active Honor on every acquisition candidate and then calling `BaseCreature.IsEnemy`, which checked both again. This makes `IsEnemy` the single authority and removes the duplicate per-pair work.

## Changes
- **`BaseCreature.IsEnemy`**: the Ethereal Voyage check sat below the `m is not BaseCreature` early return, so it never reached players — the only mobiles that cast it. It is hoisted next to the Honor veto. `GetMaster()` was called three times per creature pair (inside `Ethics.Player.Find(m, true)` and twice at the bottom); it is now computed once.
- **`BaseAI.IsInvalidFactionTarget`**: reduced to `IsFriend` / `IsEnemy` / `CanBeHarmful`. The removed `Combatant != m` Honor exception was dead code — `IsEnemy` vetoed Honor unconditionally on the following line.
- **`Ethics.Player.Find`** / **`TransformationSpellHelper.GetContext`**: small simplifications on the same path.

## Behavior
- `ShouldAcquireOnApproach` and `OnAggressiveAction` only consult `IsEnemy`, so movement-triggered acquisition now respects Ethereal Voyage for players (previously a player under Ethereal Voyage walking past a monster was still acquired on approach).
- `BaseFactionGuard.IsEnemy` does not call base, so faction guards no longer skip honoring/voyaging enemy-faction players. Accepted: both mechanics describe monsters, not guards.
- `HealerAI`/`BerserkAI`/`PredatorAI` (`bFacFriend`) callers are unaffected — `IsFriend` already required a `BaseCreature`, so players were excluded before these checks ran. `MilitiaFighter`/`MilitiaCanoneer` return `false` for all players, so they are unaffected too.

## Testing
- `dotnet build` clean.
- Pure predicate reorder; no new tests.
2026-09-18 19:22:22 -07:00
..
Base perf(ai): make IsEnemy the single authority for Honor/Ethereal Voyage (#2655) 2026-09-18 19:22:22 -07:00
Bushido chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00
Chivalry feat: Adds Mobile.Murderer virtual property, consolidates kill-threshold checks (#2355) 2026-03-06 08:36:41 -08:00
Eighth feat: Adjusts fame and karma system with era gates for OSI accuracy (#2389) 2026-04-25 11:19:57 -07:00
Fifth feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
First feat: T2A defensive spells (#2378) 2026-03-22 11:18:34 -07:00
Fourth feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Gargoyle/SpellDefinitions fix: Fixes buffs don't start/stop properly. Streamlines constructor and Add/Remove buffs. (#2082) 2025-01-24 18:20:23 -08:00
Mysticism feat: Refactor Poison system, implement Darkglow & Parasitic effects (#2385) 2026-03-21 21:27:22 -07:00
Necromancy refactor: Changes BaseCreature to the SerializationGenerator (delta save requirement) (#2611) 2026-09-06 14:11:51 -07:00
Ninjitsu feat: derive the Running bit from the step pace and fix step-pacing bursts (#2599) 2026-08-30 16:48:52 -07:00
Second feat: T2A defensive spells (#2378) 2026-03-22 11:18:34 -07:00
Seventh feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Sixth feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Spellweaving refactor: Changes BaseCreature to the SerializationGenerator (delta save requirement) (#2611) 2026-09-06 14:11:51 -07:00
Targeting fix: Adjusts spell ranges to match OSI (#2171) 2025-05-01 20:03:56 -07:00
Third feat: convert all delta-time serialization to anchored time (#2589) 2026-08-22 19:34:43 -07:00
Initializer.cs fix: Adds Cleansing Winds Spell (#1126) 2022-07-17 07:49:55 -07:00
Reagent.cs Formats UO Content (#201) 2020-08-27 18:30:38 -07:00
UnsummonTimer.cs chore: Use var everywhere (#2294) 2025-12-27 16:47:28 -08:00