Ритуалы!

This commit is contained in:
2025-05-06 19:25:11 +04:00
parent 5693fa8ce8
commit 6abda701a4
28 changed files with 1543 additions and 244 deletions
+44 -9
View File
@@ -18,6 +18,7 @@ using Pf2eModel.Model.Structure.BackgroundRelation;
using Pf2eModel.Model.Structure.ClassRelation;
using Pf2eModel.Model.Structure.DeityRelation;
using Pf2eModel.Model.Structure.FeatRelation;
using Pf2eModel.Model.Structure.RitualRelation;
using Pf2eModel.Model.Structure.SpellRelation;
namespace Pf2eModel;
@@ -81,7 +82,7 @@ public partial class Pf2eDbContext
.HasPostgresEnum<SpellDamageKinds>()
.HasPostgresEnum<SpellTradition>()
.HasPostgresEnum<AttributeValues>()
.HasPostgresEnum<TrainingStage>()
.HasPostgresEnum<TrainingRank>()
.HasPostgresEnum<SourceCategory>();
}
@@ -436,6 +437,8 @@ public partial class Pf2eDbContext
BindLocaleString(entity, s => s.Trigger, false);
BindLocaleString(entity, s => s.Target, false);
BindLocaleString(entity, s => s.Cost, false);
BindLocaleString(entity, s => s.Requirement, false);
entity
.HasMany(e => e.SpellAreas)
@@ -443,13 +446,6 @@ public partial class Pf2eDbContext
.HasForeignKey(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade);
entity
.HasOne(e => e.SpellRitual)
.WithOne(e => e.Spell)
.HasForeignKey<SpellRitual>(e => e.SpellId)
.OnDelete(DeleteBehavior.Cascade)
.IsRequired(false);
entity
.HasMany(e => e.SpellDefenses)
.WithOne(e => e.Spell)
@@ -461,7 +457,46 @@ public partial class Pf2eDbContext
BindLocaleString(entity, a => a.Details, false);
});
modelBuilder.Entity<SpellDefense>(entity => { });
modelBuilder.Entity<SpellRitual>(entity => { });
// Ritual
modelBuilder.Entity<Ritual>(entity =>
{
BindEntity(entity);
BindLocaleString(entity, s => s.RangeString, false);
BindLocaleString(entity, s => s.Target, false);
BindLocaleString(entity, s => s.Cost, false);
BindLocaleString(entity, s => s.Requirement, false);
BindLocaleString(entity, s => s.PrimaryCheckSuffix, false);
BindLocaleString(entity, s => s.SecondaryCastersSuffix, false);
entity
.HasOne(r => r.Area)
.WithOne(a => a.Ritual)
.HasForeignKey<RitualArea>(a => a.RitualId)
.OnDelete(DeleteBehavior.Cascade);
entity
.HasMany(r => r.Checks)
.WithOne(c => c.Ritual)
.HasForeignKey(c => c.RitualId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<RitualArea>(entity =>
{
BindLocaleString(entity, a => a.Details, false);
});
modelBuilder.Entity<RitualCheck>(entity =>
{
BindLocaleString(entity, a => a.TrainingString, false);
entity
.HasOne(c => c.Training)
.WithMany()
.HasForeignKey(c => c.TrainingId)
.OnDelete(DeleteBehavior.SetNull);
});
// Trait
modelBuilder.Entity<Trait>(entity =>