Resistance System

This commit is contained in:
dingo
2025-12-26 10:40:09 -05:00
parent 2d847c91dd
commit fd056692df
16 changed files with 2862 additions and 8 deletions
+23
View File
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json;
using DataServer.Data.Enums;
namespace DataServer.Data.Entities;
@@ -80,5 +81,27 @@ public class DungeonItemDefinition
// Legacy field - kept for backwards compatibility
public int SpriteId { get; set; } = 0;
/// <summary>
/// JSON block for resistance bonuses when equipped
/// Example: {"fire": 0.15, "ice": 0.10}
/// Values are percentage (0.15 = 15% resistance)
/// </summary>
[MaxLength(1024)]
public string ResistancesJson { get; set; } = "{}";
/// <summary>
/// Helper to get/set resistances dictionary
/// </summary>
[NotMapped]
public Dictionary<string, float> Resistances
{
get
{
try { return JsonSerializer.Deserialize<Dictionary<string, float>>(ResistancesJson) ?? new(); }
catch { return new(); }
}
set { ResistancesJson = JsonSerializer.Serialize(value); }
}
public bool IsEnabled { get; set; } = true;
}