using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SystemRevivalServer.Migrations { /// public partial class MobAI : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "AbilitiesJson", table: "dungeon_mob_definitions"); migrationBuilder.AlterColumn( 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( name: "Behavior", table: "dungeon_mob_definitions", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "CallForHelpRadius", table: "dungeon_mob_definitions", type: "float", nullable: false, defaultValue: 0f); migrationBuilder.AddColumn( name: "FleeThreshold", table: "dungeon_mob_definitions", type: "float", nullable: false, defaultValue: 0f); migrationBuilder.AddColumn( name: "PhasesJson", table: "dungeon_mob_definitions", type: "varchar(2048)", maxLength: 2048, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "PreferredRange", table: "dungeon_mob_definitions", type: "float", nullable: false, defaultValue: 0f); migrationBuilder.CreateTable( name: "dungeon_mob_abilities", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "varchar(256)", maxLength: 256, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Key = table.Column(type: "varchar(64)", maxLength: 64, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), AbilityType = table.Column(type: "int", nullable: false), Targeting = table.Column(type: "int", nullable: false), BaseDamage = table.Column(type: "int", nullable: false), DamagePerTier = table.Column(type: "float", nullable: false), DamageTypeKey = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Range = table.Column(type: "float", nullable: false), AoeRadius = table.Column(type: "float", nullable: false), ConeAngle = table.Column(type: "float", nullable: false), Cooldown = table.Column(type: "float", nullable: false), CastTime = table.Column(type: "float", nullable: false), AnimationDuration = table.Column(type: "float", nullable: false), ProjectileSpeed = table.Column(type: "float", nullable: false), ProjectileSprite = table.Column(type: "varchar(256)", maxLength: 256, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), EffectDuration = table.Column(type: "float", nullable: false), DotDamagePerTick = table.Column(type: "int", nullable: false), DotTickInterval = table.Column(type: "float", nullable: false), SpeedModifier = table.Column(type: "float", nullable: false), DisplacementDistance = table.Column(type: "float", nullable: false), SummonMobId = table.Column(type: "int", nullable: true), SummonCount = table.Column(type: "int", nullable: false), StatModifier = table.Column(type: "float", nullable: false), AffectedStat = table.Column(type: "varchar(32)", maxLength: 32, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), HpThresholdBelow = table.Column(type: "float", nullable: true), HpThresholdAbove = table.Column(type: "float", nullable: true), MinTargetsInRange = table.Column(type: "int", nullable: true), Priority = table.Column(type: "int", nullable: false), ManaCost = table.Column(type: "int", nullable: false), AnimationKey = table.Column(type: "varchar(32)", maxLength: 32, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), SoundEffectKey = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), VisualEffectKey = table.Column(type: "varchar(64)", maxLength: 64, nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), IsEnabled = table.Column(type: "tinyint(1)", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), UpdatedAt = table.Column(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(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), MobDefinitionId = table.Column(type: "int", nullable: false), AbilityDefinitionId = table.Column(type: "int", nullable: false), CooldownOverride = table.Column(type: "float", nullable: true), DamageOverride = table.Column(type: "int", nullable: true), PriorityOverride = table.Column(type: "int", nullable: true), Phase = table.Column(type: "int", nullable: false), MinHpPercent = table.Column(type: "float", nullable: true), MaxHpPercent = table.Column(type: "float", nullable: true), IsEnabled = table.Column(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"); } /// 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( 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( name: "AbilitiesJson", table: "dungeon_mob_definitions", type: "varchar(1024)", maxLength: 1024, nullable: false, defaultValue: "") .Annotation("MySql:CharSet", "utf8mb4"); } } }