Files
systemrevivalserver/Migrations/20251227160629_Mob AI.cs
T
2025-12-27 11:09:09 -05:00

224 lines
11 KiB
C#

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");
}
}
}