Подготовка сущности божества
This commit is contained in:
@@ -101,9 +101,61 @@ internal partial class DeityProcessor(
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ProcessSanctification()
|
private void ProcessSanctification()
|
||||||
{
|
{
|
||||||
|
// Получаем выравнивание божества
|
||||||
|
string? deityAlignment = Input.GetOptional<string>("alignment");
|
||||||
|
|
||||||
// По умолчанию любое освящение
|
// По умолчанию любое освящение
|
||||||
Object.Sanctification = DeitySanctification.Any;
|
Object.Sanctification = DeitySanctification.Any;
|
||||||
Object.SanctificationMust = false;
|
Object.SanctificationMust = false;
|
||||||
|
|
||||||
|
// Определяем освящение на основе выравнивания божества
|
||||||
|
if (!string.IsNullOrEmpty(deityAlignment))
|
||||||
|
{
|
||||||
|
switch (deityAlignment)
|
||||||
|
{
|
||||||
|
case "LG":
|
||||||
|
case "NG":
|
||||||
|
case "CG":
|
||||||
|
Object.Sanctification = DeitySanctification.Holy;
|
||||||
|
break;
|
||||||
|
case "LE":
|
||||||
|
case "NE":
|
||||||
|
case "CE":
|
||||||
|
Object.Sanctification = DeitySanctification.Unholy;
|
||||||
|
break;
|
||||||
|
case "N":
|
||||||
|
case "LN":
|
||||||
|
case "CN":
|
||||||
|
case "Any":
|
||||||
|
Object.Sanctification = DeitySanctification.Any;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проверяем, требует ли божество определенного выравнивания от последователей
|
||||||
|
JArray? followerAlignments = Input.GetOptional<JArray>("follower_alignment");
|
||||||
|
if (followerAlignments != null && followerAlignments.Count > 0)
|
||||||
|
{
|
||||||
|
// Если выравнивание последователей ограничено, то освящение обязательно
|
||||||
|
Object.SanctificationMust = true;
|
||||||
|
|
||||||
|
// Если освящение Any, но выравнивания последователей ограничены только добрыми или злыми,
|
||||||
|
// уточняем тип освящения
|
||||||
|
if (Object.Sanctification == DeitySanctification.Any)
|
||||||
|
{
|
||||||
|
bool allGood = followerAlignments.All(a => a.ToString() is "LG" or "NG" or "CG");
|
||||||
|
bool allEvil = followerAlignments.All(a => a.ToString() is "LE" or "NE" or "CE");
|
||||||
|
|
||||||
|
if (allGood)
|
||||||
|
{
|
||||||
|
Object.Sanctification = DeitySanctification.Holy;
|
||||||
|
}
|
||||||
|
else if (allEvil)
|
||||||
|
{
|
||||||
|
Object.Sanctification = DeitySanctification.Unholy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Pf2eModel.Model.Base;
|
using Pf2eModel.Model.Base;
|
||||||
using Pf2eModel.Model.Common;
|
using Pf2eModel.Model.Common;
|
||||||
|
using Pf2eModel.Model.Common.I18n;
|
||||||
using Pf2eModel.Model.Enum;
|
using Pf2eModel.Model.Enum;
|
||||||
using Pf2eModel.Model.Structure.DeityRelation;
|
using Pf2eModel.Model.Structure.DeityRelation;
|
||||||
|
|
||||||
@@ -53,7 +54,35 @@ public class Deity : IEntity
|
|||||||
public bool SanctificationMust { get; set; }
|
public bool SanctificationMust { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Аттрибуты божества.
|
/// Заветы божества.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 6)]
|
||||||
|
[Comment("Заветы божества")]
|
||||||
|
public LocaleString Edicts { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Анафемы божества.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 7)]
|
||||||
|
[Comment("Анафемы божества")]
|
||||||
|
public LocaleString Anathema { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Религиозный символ божества.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 8)]
|
||||||
|
[Comment("Религиозный символ божества")]
|
||||||
|
public LocaleString ReligiousSymbol { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Священное животное божества.
|
||||||
|
/// </summary>
|
||||||
|
[Column(Order = 9)]
|
||||||
|
[Comment("Священное животное божества")]
|
||||||
|
public LocaleString SacredAnimal { get; set; } = null!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Атрибуты божества.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICollection<DeityAttribute> DeityAttributes { get; set; } = new List<DeityAttribute>();
|
public ICollection<DeityAttribute> DeityAttributes { get; set; } = new List<DeityAttribute>();
|
||||||
|
|
||||||
|
|||||||
@@ -434,6 +434,11 @@ public partial class Pf2eDbContext
|
|||||||
{
|
{
|
||||||
BindEntity(entity);
|
BindEntity(entity);
|
||||||
|
|
||||||
|
BindLocaleString(entity, d => d.Anathema);
|
||||||
|
BindLocaleString(entity, d => d.Edicts);
|
||||||
|
BindLocaleString(entity, d => d.ReligiousSymbol);
|
||||||
|
BindLocaleString(entity, d => d.SacredAnimal);
|
||||||
|
|
||||||
entity
|
entity
|
||||||
.HasMany(e => e.DeityAttributes)
|
.HasMany(e => e.DeityAttributes)
|
||||||
.WithOne(e => e.Deity)
|
.WithOne(e => e.Deity)
|
||||||
@@ -461,10 +466,7 @@ public partial class Pf2eDbContext
|
|||||||
entity.HasMany(e => e.Skills).WithMany();
|
entity.HasMany(e => e.Skills).WithMany();
|
||||||
});
|
});
|
||||||
modelBuilder.Entity<DeityAttribute>(entity => { });
|
modelBuilder.Entity<DeityAttribute>(entity => { });
|
||||||
modelBuilder.Entity<DeityDomain>(entity =>
|
modelBuilder.Entity<DeityDomain>(entity => { });
|
||||||
{
|
|
||||||
// Связь теперь настроена в конфигурации Domain
|
|
||||||
});
|
|
||||||
modelBuilder.Entity<DeitySpell>(entity =>
|
modelBuilder.Entity<DeitySpell>(entity =>
|
||||||
{
|
{
|
||||||
entity
|
entity
|
||||||
|
|||||||
Reference in New Issue
Block a user