Mob AIv2 and player speed cap
This commit is contained in:
@@ -24,6 +24,11 @@ public class DungeonMobDefinition
|
||||
public MobType Type { get; set; } = MobType.Normal;
|
||||
public MobCategory Category { get; set; } = MobCategory.Undead;
|
||||
|
||||
/// <summary>
|
||||
/// AI behavior pattern for this mob
|
||||
/// </summary>
|
||||
public MobBehavior Behavior { get; set; } = MobBehavior.Aggressive;
|
||||
|
||||
public int MinTier { get; set; } = 1; // Minimum dungeon tier to spawn
|
||||
public int MaxTier { get; set; } = 99; // Maximum tier (for progression gating)
|
||||
|
||||
@@ -49,6 +54,21 @@ public class DungeonMobDefinition
|
||||
public float AggroRange { get; set; } = 150f; // Detection radius
|
||||
public float LeashRange { get; set; } = 400f; // Max chase distance before reset
|
||||
|
||||
/// <summary>
|
||||
/// Preferred combat distance (for ranged/skirmisher behaviors)
|
||||
/// </summary>
|
||||
public float PreferredRange { get; set; } = 40f;
|
||||
|
||||
/// <summary>
|
||||
/// Flee threshold - if HP drops below this %, mob may flee (for skirmisher/defensive)
|
||||
/// </summary>
|
||||
public float FleeThreshold { get; set; } = 0f;
|
||||
|
||||
/// <summary>
|
||||
/// Call for help radius - alerts nearby mobs when engaged
|
||||
/// </summary>
|
||||
public float CallForHelpRadius { get; set; } = 0f;
|
||||
|
||||
// Scaling per dungeon tier (multipliers)
|
||||
public float HealthPerTier { get; set; } = 1.2f;
|
||||
public float DamagePerTier { get; set; } = 1.15f;
|
||||
@@ -69,32 +89,38 @@ public class DungeonMobDefinition
|
||||
public string ResistancesJson { get; set; } = "{}";
|
||||
|
||||
/// <summary>
|
||||
/// JSON block for special abilities/behaviors
|
||||
/// Example: {"canFlee": true, "fleeHealthPercent": 0.2, "callsForHelp": true}
|
||||
/// JSON block for boss phases (for multi-phase bosses)
|
||||
/// Example: [{"hpThreshold": 0.75, "behavior": "Enrage"}, {"hpThreshold": 0.25, "behavior": "Summoner"}]
|
||||
/// </summary>
|
||||
[MaxLength(1024)]
|
||||
public string AbilitiesJson { get; set; } = "{}";
|
||||
[MaxLength(2048)]
|
||||
public string? PhasesJson { get; set; }
|
||||
|
||||
// Visuals
|
||||
/// <summary>
|
||||
/// JSON configuration for mob sprites and animations
|
||||
/// Example: {
|
||||
/// "sprites": {
|
||||
/// "idle_front": "assets/sprites/skeleton_idle_front.png",
|
||||
/// "idle_back": "assets/sprites/skeleton_idle_back.png",
|
||||
/// "run_front": "assets/sprites/skeleton_run_front.png"
|
||||
/// },
|
||||
/// Structure: {
|
||||
/// "spriteSheet": "textures/mobs/skeleton.png",
|
||||
/// "frameWidth": 64,
|
||||
/// "frameHeight": 64,
|
||||
/// "fps": 8,
|
||||
/// "animations": {
|
||||
/// "idle_front": {"frames": 8, "loop": true},
|
||||
/// "run_front": {"frames": 8, "loop": true}
|
||||
/// "idle_down": {"row": 0, "frames": 4, "fps": 4, "loop": true},
|
||||
/// "idle_up": {"row": 1, "frames": 4, "fps": 4, "loop": true},
|
||||
/// "idle_left": {"row": 2, "frames": 4, "fps": 4, "loop": true},
|
||||
/// "idle_right": {"row": 3, "frames": 4, "fps": 4, "loop": true},
|
||||
/// "walk_down": {"row": 4, "frames": 8, "fps": 8, "loop": true},
|
||||
/// "walk_up": {"row": 5, "frames": 8, "fps": 8, "loop": true},
|
||||
/// "walk_left": {"row": 6, "frames": 8, "fps": 8, "loop": true},
|
||||
/// "walk_right": {"row": 7, "frames": 8, "fps": 8, "loop": true},
|
||||
/// "attack_down": {"row": 8, "frames": 6, "fps": 12, "loop": false},
|
||||
/// "attack_up": {"row": 9, "frames": 6, "fps": 12, "loop": false},
|
||||
/// "attack_left": {"row": 10, "frames": 6, "fps": 12, "loop": false},
|
||||
/// "attack_right": {"row": 11, "frames": 6, "fps": 12, "loop": false},
|
||||
/// "cast_down": {"row": 12, "frames": 8, "fps": 10, "loop": false},
|
||||
/// "death": {"row": 16, "frames": 6, "fps": 8, "loop": false}
|
||||
/// }
|
||||
/// }
|
||||
/// If null/empty, client uses fallback placeholder shape
|
||||
/// </summary>
|
||||
[MaxLength(4096)]
|
||||
[MaxLength(8192)]
|
||||
public string? SpriteConfigJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -112,6 +138,12 @@ public class DungeonMobDefinition
|
||||
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
|
||||
// === Navigation Properties ===
|
||||
/// <summary>
|
||||
/// Abilities assigned to this mob
|
||||
/// </summary>
|
||||
public ICollection<MobAbilityAssignment> AbilityAssignments { get; set; } = new List<MobAbilityAssignment>();
|
||||
|
||||
// Helper to get parsed sprite config
|
||||
[NotMapped]
|
||||
public Dictionary<string, object>? SpriteConfig
|
||||
@@ -137,18 +169,17 @@ public class DungeonMobDefinition
|
||||
}
|
||||
|
||||
[NotMapped]
|
||||
public Dictionary<string, object> Abilities
|
||||
public List<MobPhaseConfig>? Phases
|
||||
{
|
||||
get
|
||||
{
|
||||
try { return JsonSerializer.Deserialize<Dictionary<string, object>>(AbilitiesJson) ?? new(); }
|
||||
catch { return new(); }
|
||||
if (string.IsNullOrEmpty(PhasesJson)) return null;
|
||||
try { return JsonSerializer.Deserialize<List<MobPhaseConfig>>(PhasesJson); }
|
||||
catch { return null; }
|
||||
}
|
||||
set { AbilitiesJson = JsonSerializer.Serialize(value); }
|
||||
set { PhasesJson = value != null ? JsonSerializer.Serialize(value) : null; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Calculate scaled stats for a specific level bracket
|
||||
/// Level bracket scaling: each bracket adds 15% to base stats
|
||||
@@ -178,3 +209,24 @@ public class DungeonMobDefinition
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for a boss phase
|
||||
/// </summary>
|
||||
public class MobPhaseConfig
|
||||
{
|
||||
/// <summary>HP threshold to trigger this phase (0-1)</summary>
|
||||
public float HpThreshold { get; set; }
|
||||
|
||||
/// <summary>New behavior for this phase</summary>
|
||||
public MobBehavior Behavior { get; set; }
|
||||
|
||||
/// <summary>Speed multiplier for this phase</summary>
|
||||
public float SpeedMultiplier { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>Damage multiplier for this phase</summary>
|
||||
public float DamageMultiplier { get; set; } = 1.0f;
|
||||
|
||||
/// <summary>Optional message to display when entering phase</summary>
|
||||
public string? PhaseMessage { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user