Implement Teleport ability and update ability/effects TODO docs
- Add Teleport handling in DungeonSimulation ability switch and implemented-type list - Teleport mob toward target using displacement distance with walkable-position fallback search - Add Teleport success/failure diagnostics - Update AbilitySystemWalkthrough status and add effect animation builder TODOs
This commit is contained in:
@@ -219,7 +219,6 @@ If animation is visible but no damage/effect occurs, failure is usually in selec
|
||||
- `HazardZone`
|
||||
|
||||
### Not implemented in `DungeonSimulation.ProcessMobAbility`
|
||||
- `HealSelf`
|
||||
- `HealAlly`
|
||||
- `HealAoe`
|
||||
- `Silence` (enum exists; not routed in switch)
|
||||
@@ -229,7 +228,6 @@ If animation is visible but no damage/effect occurs, failure is usually in selec
|
||||
- `Enrage`
|
||||
- `Shield`
|
||||
- `Charge`
|
||||
- `Teleport`
|
||||
- `Retreat`
|
||||
- `PhaseChange`
|
||||
|
||||
@@ -247,13 +245,22 @@ Given tests like:
|
||||
- `TST Type 27 Teleport`
|
||||
|
||||
Likely reasons:
|
||||
1. Types like `HealSelf` and `Teleport` are not implemented in runtime effect switch.
|
||||
1. Some tested types are still not implemented in runtime effect switch (`HealAlly`, `HealAoe`, `Retreat`, etc.).
|
||||
2. `Targeting` enum values (like `RandomEnemy`) are not yet fully honored by ability resolution.
|
||||
3. Previously, mana/range could select unusable abilities; this was partially guarded, but non-implemented types still naturally do nothing.
|
||||
4. AI has a second ability executor (`MobAI.ExecuteAbility`) with limited coverage (summon-focused), creating behavior split risk.
|
||||
|
||||
---
|
||||
|
||||
## 12) Effect Visual TODO
|
||||
|
||||
1. Add per-ability effect animation binding for non-mob effects (projectile impact, ground AoE, buffs/debuffs).
|
||||
2. Add an effect animation builder/editor (parallel to mob animation assignment flow).
|
||||
3. For `ProjectileAoe`: if no explicit impact animation is configured, render a fallback expanded effect to the AoE radius for hit readability.
|
||||
4. For `GroundAoe`: support explicit placement animation key at the cast location and optional looping zone effect key.
|
||||
|
||||
---
|
||||
|
||||
## 10) Refactor Targets (Recommended Order)
|
||||
|
||||
1. Unify execution entry
|
||||
@@ -316,4 +323,3 @@ Likely reasons:
|
||||
- `DungeonHandler.RefreshMobCacheAsync`
|
||||
- `DungeonHandler.TickAll`
|
||||
- `DungeonHandler.SendDungeonStateAsync`
|
||||
|
||||
|
||||
@@ -525,6 +525,10 @@ public partial class DungeonSimulation
|
||||
case MobAbilityType.HealSelf:
|
||||
ProcessHealSelfAbility(mob, ability.Definition);
|
||||
break;
|
||||
|
||||
case MobAbilityType.Teleport:
|
||||
ApplyTeleport(mob, ability.Definition, target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,6 +576,7 @@ public partial class DungeonSimulation
|
||||
MobAbilityType.Pull => true,
|
||||
MobAbilityType.HazardZone => true,
|
||||
MobAbilityType.HealSelf => true,
|
||||
MobAbilityType.Teleport => true,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
@@ -1159,6 +1164,79 @@ public partial class DungeonSimulation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyTeleport(MobInstance mob, MobAbilityDefinition ability, PlayerInstance target)
|
||||
{
|
||||
float maxTeleport = ability.DisplacementDistance > 0
|
||||
? ability.DisplacementDistance
|
||||
: Math.Max(ability.Range, 100f);
|
||||
maxTeleport = Math.Max(32f, maxTeleport);
|
||||
|
||||
// Prefer blinking near the target instead of directly on top.
|
||||
const float stopShort = 30f;
|
||||
float toTargetX = target.X - mob.X;
|
||||
float toTargetY = target.Y - mob.Y;
|
||||
float toTargetDist = MathF.Sqrt(toTargetX * toTargetX + toTargetY * toTargetY);
|
||||
if (toTargetDist <= 0.001f)
|
||||
{
|
||||
Console.WriteLine($"[Teleport] Mob {mob.Id} ({mob.Name}) skipped: target overlap.");
|
||||
return;
|
||||
}
|
||||
|
||||
float desiredTravel = Math.Min(maxTeleport, Math.Max(0f, toTargetDist - stopShort));
|
||||
if (desiredTravel < 8f)
|
||||
{
|
||||
desiredTravel = Math.Min(maxTeleport, toTargetDist);
|
||||
}
|
||||
|
||||
float rawX = mob.X + (toTargetX / toTargetDist) * desiredTravel;
|
||||
float rawY = mob.Y + (toTargetY / toTargetDist) * desiredTravel;
|
||||
|
||||
if (TryFindWalkableNear(rawX, rawY, out float finalX, out float finalY))
|
||||
{
|
||||
mob.X = finalX;
|
||||
mob.Y = finalY;
|
||||
mob.UpdateFacingDirection(target.X, target.Y);
|
||||
Console.WriteLine(
|
||||
$"[Teleport] Mob {mob.Id} ({mob.Name}) -> ({finalX:F1},{finalY:F1}) target=({target.X:F1},{target.Y:F1}) max={maxTeleport:F1}");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine(
|
||||
$"[Teleport] Mob {mob.Id} ({mob.Name}) failed: no walkable destination near ({rawX:F1},{rawY:F1})");
|
||||
}
|
||||
|
||||
private bool TryFindWalkableNear(float x, float y, out float walkableX, out float walkableY)
|
||||
{
|
||||
if (CanMoveTo(x, y))
|
||||
{
|
||||
walkableX = x;
|
||||
walkableY = y;
|
||||
return true;
|
||||
}
|
||||
|
||||
const int maxRadius = 96;
|
||||
const int step = 12;
|
||||
for (int radius = step; radius <= maxRadius; radius += step)
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
float angle = (MathF.PI * 2f * i) / 8f;
|
||||
float testX = x + MathF.Cos(angle) * radius;
|
||||
float testY = y + MathF.Sin(angle) * radius;
|
||||
if (CanMoveTo(testX, testY))
|
||||
{
|
||||
walkableX = testX;
|
||||
walkableY = testY;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
walkableX = x;
|
||||
walkableY = y;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SpawnHazardZone(MobInstance mob, MobAbilityDefinition ability, float x, float y)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user