Mob AIv2 and player speed cap

This commit is contained in:
dingo
2025-12-27 11:09:09 -05:00
parent 4d26c37671
commit 9c67dd3935
14 changed files with 3479 additions and 34 deletions
File diff suppressed because it is too large Load Diff
+223
View File
@@ -0,0 +1,223 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SystemRevivalServer.Migrations
{
/// <inheritdoc />
public partial class MobAI : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AbilitiesJson",
table: "dungeon_mob_definitions");
migrationBuilder.AlterColumn<string>(
name: "SpriteConfigJson",
table: "dungeon_mob_definitions",
type: "varchar(8192)",
maxLength: 8192,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(4096)",
oldMaxLength: 4096,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Behavior",
table: "dungeon_mob_definitions",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<float>(
name: "CallForHelpRadius",
table: "dungeon_mob_definitions",
type: "float",
nullable: false,
defaultValue: 0f);
migrationBuilder.AddColumn<float>(
name: "FleeThreshold",
table: "dungeon_mob_definitions",
type: "float",
nullable: false,
defaultValue: 0f);
migrationBuilder.AddColumn<string>(
name: "PhasesJson",
table: "dungeon_mob_definitions",
type: "varchar(2048)",
maxLength: 2048,
nullable: true)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<float>(
name: "PreferredRange",
table: "dungeon_mob_definitions",
type: "float",
nullable: false,
defaultValue: 0f);
migrationBuilder.CreateTable(
name: "dungeon_mob_abilities",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Description = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Key = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
AbilityType = table.Column<int>(type: "int", nullable: false),
Targeting = table.Column<int>(type: "int", nullable: false),
BaseDamage = table.Column<int>(type: "int", nullable: false),
DamagePerTier = table.Column<float>(type: "float", nullable: false),
DamageTypeKey = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Range = table.Column<float>(type: "float", nullable: false),
AoeRadius = table.Column<float>(type: "float", nullable: false),
ConeAngle = table.Column<float>(type: "float", nullable: false),
Cooldown = table.Column<float>(type: "float", nullable: false),
CastTime = table.Column<float>(type: "float", nullable: false),
AnimationDuration = table.Column<float>(type: "float", nullable: false),
ProjectileSpeed = table.Column<float>(type: "float", nullable: false),
ProjectileSprite = table.Column<string>(type: "varchar(256)", maxLength: 256, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
EffectDuration = table.Column<float>(type: "float", nullable: false),
DotDamagePerTick = table.Column<int>(type: "int", nullable: false),
DotTickInterval = table.Column<float>(type: "float", nullable: false),
SpeedModifier = table.Column<float>(type: "float", nullable: false),
DisplacementDistance = table.Column<float>(type: "float", nullable: false),
SummonMobId = table.Column<int>(type: "int", nullable: true),
SummonCount = table.Column<int>(type: "int", nullable: false),
StatModifier = table.Column<float>(type: "float", nullable: false),
AffectedStat = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
HpThresholdBelow = table.Column<float>(type: "float", nullable: true),
HpThresholdAbove = table.Column<float>(type: "float", nullable: true),
MinTargetsInRange = table.Column<int>(type: "int", nullable: true),
Priority = table.Column<int>(type: "int", nullable: false),
ManaCost = table.Column<int>(type: "int", nullable: false),
AnimationKey = table.Column<string>(type: "varchar(32)", maxLength: 32, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
SoundEffectKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
VisualEffectKey = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_dungeon_mob_abilities", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "dungeon_mob_ability_assignments",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
MobDefinitionId = table.Column<int>(type: "int", nullable: false),
AbilityDefinitionId = table.Column<int>(type: "int", nullable: false),
CooldownOverride = table.Column<float>(type: "float", nullable: true),
DamageOverride = table.Column<int>(type: "int", nullable: true),
PriorityOverride = table.Column<int>(type: "int", nullable: true),
Phase = table.Column<int>(type: "int", nullable: false),
MinHpPercent = table.Column<float>(type: "float", nullable: true),
MaxHpPercent = table.Column<float>(type: "float", nullable: true),
IsEnabled = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_dungeon_mob_ability_assignments", x => x.Id);
table.ForeignKey(
name: "FK_dungeon_mob_ability_assignments_dungeon_mob_abilities_Abilit~",
column: x => x.AbilityDefinitionId,
principalTable: "dungeon_mob_abilities",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_dungeon_mob_ability_assignments_dungeon_mob_definitions_MobD~",
column: x => x.MobDefinitionId,
principalTable: "dungeon_mob_definitions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_dungeon_mob_ability_assignments_AbilityDefinitionId",
table: "dungeon_mob_ability_assignments",
column: "AbilityDefinitionId");
migrationBuilder.CreateIndex(
name: "IX_dungeon_mob_ability_assignments_MobDefinitionId",
table: "dungeon_mob_ability_assignments",
column: "MobDefinitionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "dungeon_mob_ability_assignments");
migrationBuilder.DropTable(
name: "dungeon_mob_abilities");
migrationBuilder.DropColumn(
name: "Behavior",
table: "dungeon_mob_definitions");
migrationBuilder.DropColumn(
name: "CallForHelpRadius",
table: "dungeon_mob_definitions");
migrationBuilder.DropColumn(
name: "FleeThreshold",
table: "dungeon_mob_definitions");
migrationBuilder.DropColumn(
name: "PhasesJson",
table: "dungeon_mob_definitions");
migrationBuilder.DropColumn(
name: "PreferredRange",
table: "dungeon_mob_definitions");
migrationBuilder.AlterColumn<string>(
name: "SpriteConfigJson",
table: "dungeon_mob_definitions",
type: "varchar(4096)",
maxLength: 4096,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(8192)",
oldMaxLength: 8192,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "AbilitiesJson",
table: "dungeon_mob_definitions",
type: "varchar(1024)",
maxLength: 1024,
nullable: false,
defaultValue: "")
.Annotation("MySql:CharSet", "utf8mb4");
}
}
}
+221 -7
View File
@@ -963,11 +963,6 @@ namespace SystemRevivalServer.Migrations
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("AbilitiesJson")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("varchar(1024)");
b.Property<float>("AggroRange")
.HasColumnType("float");
@@ -1004,6 +999,12 @@ namespace SystemRevivalServer.Migrations
b.Property<int>("BaseXp")
.HasColumnType("int");
b.Property<int>("Behavior")
.HasColumnType("int");
b.Property<float>("CallForHelpRadius")
.HasColumnType("float");
b.Property<int>("Category")
.HasColumnType("int");
@@ -1023,6 +1024,9 @@ namespace SystemRevivalServer.Migrations
b.Property<float>("DropChanceMultiplier")
.HasColumnType("float");
b.Property<float>("FleeThreshold")
.HasColumnType("float");
b.Property<float>("HealthPerTier")
.HasColumnType("float");
@@ -1049,6 +1053,13 @@ namespace SystemRevivalServer.Migrations
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("PhasesJson")
.HasMaxLength(2048)
.HasColumnType("varchar(2048)");
b.Property<float>("PreferredRange")
.HasColumnType("float");
b.Property<string>("ResistancesJson")
.IsRequired()
.HasMaxLength(1024)
@@ -1058,8 +1069,8 @@ namespace SystemRevivalServer.Migrations
.HasColumnType("float");
b.Property<string>("SpriteConfigJson")
.HasMaxLength(4096)
.HasColumnType("varchar(4096)");
.HasMaxLength(8192)
.HasColumnType("varchar(8192)");
b.Property<string>("TintColor")
.IsRequired()
@@ -1298,6 +1309,185 @@ namespace SystemRevivalServer.Migrations
b.ToTable("dungeon_stash_items");
});
modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AbilityDefinitionId")
.HasColumnType("int");
b.Property<float?>("CooldownOverride")
.HasColumnType("float");
b.Property<int?>("DamageOverride")
.HasColumnType("int");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<float?>("MaxHpPercent")
.HasColumnType("float");
b.Property<float?>("MinHpPercent")
.HasColumnType("float");
b.Property<int>("MobDefinitionId")
.HasColumnType("int");
b.Property<int>("Phase")
.HasColumnType("int");
b.Property<int?>("PriorityOverride")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AbilityDefinitionId");
b.HasIndex("MobDefinitionId");
b.ToTable("dungeon_mob_ability_assignments");
});
modelBuilder.Entity("DataServer.Data.Entities.MobAbilityDefinition", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AbilityType")
.HasColumnType("int");
b.Property<string>("AffectedStat")
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property<float>("AnimationDuration")
.HasColumnType("float");
b.Property<string>("AnimationKey")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property<float>("AoeRadius")
.HasColumnType("float");
b.Property<int>("BaseDamage")
.HasColumnType("int");
b.Property<float>("CastTime")
.HasColumnType("float");
b.Property<float>("ConeAngle")
.HasColumnType("float");
b.Property<float>("Cooldown")
.HasColumnType("float");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<float>("DamagePerTier")
.HasColumnType("float");
b.Property<string>("DamageTypeKey")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("varchar(32)");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<float>("DisplacementDistance")
.HasColumnType("float");
b.Property<int>("DotDamagePerTick")
.HasColumnType("int");
b.Property<float>("DotTickInterval")
.HasColumnType("float");
b.Property<float>("EffectDuration")
.HasColumnType("float");
b.Property<float?>("HpThresholdAbove")
.HasColumnType("float");
b.Property<float?>("HpThresholdBelow")
.HasColumnType("float");
b.Property<bool>("IsEnabled")
.HasColumnType("tinyint(1)");
b.Property<string>("Key")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("ManaCost")
.HasColumnType("int");
b.Property<int?>("MinTargetsInRange")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<int>("Priority")
.HasColumnType("int");
b.Property<float>("ProjectileSpeed")
.HasColumnType("float");
b.Property<string>("ProjectileSprite")
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<float>("Range")
.HasColumnType("float");
b.Property<string>("SoundEffectKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<float>("SpeedModifier")
.HasColumnType("float");
b.Property<float>("StatModifier")
.HasColumnType("float");
b.Property<int>("SummonCount")
.HasColumnType("int");
b.Property<int?>("SummonMobId")
.HasColumnType("int");
b.Property<int>("Targeting")
.HasColumnType("int");
b.Property<DateTime>("UpdatedAt")
.HasColumnType("datetime(6)");
b.Property<string>("VisualEffectKey")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.HasKey("Id");
b.ToTable("dungeon_mob_abilities");
});
modelBuilder.Entity("DataServer.Data.Session", b =>
{
b.Property<ulong>("Id")
@@ -1673,6 +1863,25 @@ namespace SystemRevivalServer.Migrations
b.Navigation("Definition");
});
modelBuilder.Entity("DataServer.Data.Entities.MobAbilityAssignment", b =>
{
b.HasOne("DataServer.Data.Entities.MobAbilityDefinition", "AbilityDefinition")
.WithMany()
.HasForeignKey("AbilityDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DataServer.Data.Entities.DungeonMobDefinition", "MobDefinition")
.WithMany("AbilityAssignments")
.HasForeignKey("MobDefinitionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AbilityDefinition");
b.Navigation("MobDefinition");
});
modelBuilder.Entity("DataServer.Data.Session", b =>
{
b.HasOne("DataServer.Data.Account", "Account")
@@ -1718,6 +1927,11 @@ namespace SystemRevivalServer.Migrations
{
b.Navigation("Entries");
});
modelBuilder.Entity("DataServer.Data.Entities.DungeonMobDefinition", b =>
{
b.Navigation("AbilityAssignments");
});
#pragma warning restore 612, 618
}
}