public int GetMemory(Creature other)
{
// Get NPC memory and last change date
var memory = other.Vars.Perm["npc_memory_" + this.Name] ?? 0;
var change = other.Vars.Perm["npc_memory_change_" + this.Name];
// Reduce memory by 1 each day
if (change != null && memory > 0)
{
TimeSpan diff = DateTime.Now - change;
memory = Math.Max(0, memory - Math.Floor(diff.TotalDays));
}
return (int)memory;
}