Refactor skill allocation to upgrade; implement skill requirements and resource checks; remove experience from Pet model; update README for skill tree progress

This commit is contained in:
2025-02-08 22:46:19 -03:00
parent f553196ca0
commit 653cc451d2
13 changed files with 723 additions and 355 deletions

View File

@@ -11,7 +11,7 @@ using PetCompanion.Data;
namespace PetCompanion.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250204213845_InitialCreate")]
[Migration("20250209011029_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@@ -108,9 +108,6 @@ namespace PetCompanion.Migrations
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<int>("Experience")
.HasColumnType("INTEGER");
b.Property<DateTime>("GatherActionSince")
.HasColumnType("TEXT");
@@ -136,9 +133,6 @@ namespace PetCompanion.Migrations
b.Property<int>("PetGatherAction")
.HasColumnType("INTEGER");
b.Property<int>("SkillPoints")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
@@ -250,9 +244,6 @@ namespace PetCompanion.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PointsCost")
.HasColumnType("INTEGER");
b.PrimitiveCollection<string>("SkillsIdRequired")
.HasColumnType("TEXT");
@@ -270,7 +261,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum health of your pet, making it more resilient.",
Icon = "❤",
Name = "Vitality Mastery",
PointsCost = 1,
Type = 0
},
new
@@ -279,7 +269,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum intelligence of your pet, improving its learning capabilities.",
Icon = "🧠",
Name = "Mind Enhancement",
PointsCost = 1,
Type = 0
},
new
@@ -288,7 +277,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum strength of your pet, making it more powerful.",
Icon = "💪",
Name = "Strength Training",
PointsCost = 1,
Type = 0
},
new
@@ -297,7 +285,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum charisma of your pet, making it more charming.",
Icon = "🎭",
Name = "Charisma Boost",
PointsCost = 1,
Type = 0
},
new
@@ -306,7 +293,6 @@ namespace PetCompanion.Migrations
Description = "Increases luck of your pet, making it more fortunate to find rare items.",
Icon = "🍀",
Name = "Luck of the Draw",
PointsCost = 1,
SkillsIdRequired = "[4]",
Type = 0
},
@@ -316,7 +302,6 @@ namespace PetCompanion.Migrations
Description = "Increases agility of your pet, making it faster in combat.",
Icon = "🏃",
Name = "Agility Training",
PointsCost = 1,
SkillsIdRequired = "[3]",
Type = 0
},
@@ -326,9 +311,17 @@ namespace PetCompanion.Migrations
Description = "Increases perception of your pet, making it more aware of its surroundings.",
Icon = "👀",
Name = "Perception Boost",
PointsCost = 1,
SkillsIdRequired = "[2]",
Type = 0
},
new
{
Id = 8,
Description = "Increases the amount of resources gathered by your pet.",
Icon = "📦",
Name = "Resourcefulness",
SkillsIdRequired = "[5,6,7]",
Type = 1
});
});
@@ -525,6 +518,153 @@ namespace PetCompanion.Migrations
SkillId = 7,
Tier = 3,
Value = 3m
},
new
{
Id = 22,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 1,
Value = 1m
},
new
{
Id = 23,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 2,
Value = 2m
},
new
{
Id = 24,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 3,
Value = 3m
});
});
modelBuilder.Entity("PetCompanion.Models.SkillRequirement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Cost")
.HasColumnType("INTEGER");
b.Property<string>("Resource")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SkillId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SkillId");
b.ToTable("SkillRequirement");
b.HasData(
new
{
Id = 1,
Cost = 100,
Resource = "Wisdom",
SkillId = 1
},
new
{
Id = 2,
Cost = 150,
Resource = "Food",
SkillId = 1
},
new
{
Id = 3,
Cost = 150,
Resource = "Wisdom",
SkillId = 2
},
new
{
Id = 4,
Cost = 100,
Resource = "Gold",
SkillId = 3
},
new
{
Id = 5,
Cost = 150,
Resource = "Food",
SkillId = 3
},
new
{
Id = 6,
Cost = 200,
Resource = "Wisdom",
SkillId = 4
},
new
{
Id = 7,
Cost = 200,
Resource = "Gold",
SkillId = 5
},
new
{
Id = 8,
Cost = 200,
Resource = "Gold",
SkillId = 6
},
new
{
Id = 9,
Cost = 100,
Resource = "Gold",
SkillId = 7
},
new
{
Id = 10,
Cost = 100,
Resource = "Junk",
SkillId = 7
},
new
{
Id = 11,
Cost = 500,
Resource = "Gold",
SkillId = 8
},
new
{
Id = 12,
Cost = 500,
Resource = "Junk",
SkillId = 8
},
new
{
Id = 13,
Cost = 300,
Resource = "Wisdom",
SkillId = 8
},
new
{
Id = 14,
Cost = 300,
Resource = "Food",
SkillId = 8
});
});
@@ -606,6 +746,17 @@ namespace PetCompanion.Migrations
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.SkillRequirement", b =>
{
b.HasOne("PetCompanion.Models.Skill", "Skill")
.WithMany("SkillRequirements")
.HasForeignKey("SkillId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
{
b.Navigation("EquippedItemsList");
@@ -627,6 +778,8 @@ namespace PetCompanion.Migrations
b.Navigation("Effects");
b.Navigation("PetSkills");
b.Navigation("SkillRequirements");
});
#pragma warning restore 612, 618
}

View File

@@ -40,7 +40,6 @@ namespace PetCompanion.Migrations
Name = table.Column<string>(type: "TEXT", nullable: false),
Class = table.Column<int>(type: "INTEGER", nullable: false),
Level = table.Column<int>(type: "INTEGER", nullable: false),
Experience = table.Column<int>(type: "INTEGER", nullable: false),
Health = table.Column<int>(type: "INTEGER", nullable: false),
MaxHealth = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<string>(type: "TEXT", nullable: false),
@@ -48,8 +47,7 @@ namespace PetCompanion.Migrations
PetGatherAction = table.Column<int>(type: "INTEGER", nullable: false),
GatherActionSince = table.Column<DateTime>(type: "TEXT", nullable: false),
PetBasicAction = table.Column<int>(type: "INTEGER", nullable: false),
BasicActionCooldown = table.Column<DateTime>(type: "TEXT", nullable: false),
SkillPoints = table.Column<int>(type: "INTEGER", nullable: false)
BasicActionCooldown = table.Column<DateTime>(type: "TEXT", nullable: false)
},
constraints: table =>
{
@@ -65,7 +63,6 @@ namespace PetCompanion.Migrations
Name = table.Column<string>(type: "TEXT", nullable: false),
Description = table.Column<string>(type: "TEXT", nullable: false),
Type = table.Column<int>(type: "INTEGER", nullable: false),
PointsCost = table.Column<int>(type: "INTEGER", nullable: false),
Icon = table.Column<string>(type: "TEXT", nullable: false),
SkillsIdRequired = table.Column<string>(type: "TEXT", nullable: true)
},
@@ -216,18 +213,40 @@ namespace PetCompanion.Migrations
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "SkillRequirement",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
SkillId = table.Column<int>(type: "INTEGER", nullable: false),
Resource = table.Column<string>(type: "TEXT", nullable: false),
Cost = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SkillRequirement", x => x.Id);
table.ForeignKey(
name: "FK_SkillRequirement_Skills_SkillId",
column: x => x.SkillId,
principalTable: "Skills",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "Skills",
columns: new[] { "Id", "Description", "Icon", "Name", "PointsCost", "SkillsIdRequired", "Type" },
columns: new[] { "Id", "Description", "Icon", "Name", "SkillsIdRequired", "Type" },
values: new object[,]
{
{ 1, "Increases maximum health of your pet, making it more resilient.", "❤", "Vitality Mastery", 1, null, 0 },
{ 2, "Increases maximum intelligence of your pet, improving its learning capabilities.", "🧠", "Mind Enhancement", 1, null, 0 },
{ 3, "Increases maximum strength of your pet, making it more powerful.", "💪", "Strength Training", 1, null, 0 },
{ 4, "Increases maximum charisma of your pet, making it more charming.", "🎭", "Charisma Boost", 1, null, 0 },
{ 5, "Increases luck of your pet, making it more fortunate to find rare items.", "🍀", "Luck of the Draw", 1, "[4]", 0 },
{ 6, "Increases agility of your pet, making it faster in combat.", "🏃", "Agility Training", 1, "[3]", 0 },
{ 7, "Increases perception of your pet, making it more aware of its surroundings.", "👀", "Perception Boost", 1, "[2]", 0 }
{ 1, "Increases maximum health of your pet, making it more resilient.", "❤", "Vitality Mastery", null, 0 },
{ 2, "Increases maximum intelligence of your pet, improving its learning capabilities.", "🧠", "Mind Enhancement", null, 0 },
{ 3, "Increases maximum strength of your pet, making it more powerful.", "💪", "Strength Training", null, 0 },
{ 4, "Increases maximum charisma of your pet, making it more charming.", "🎭", "Charisma Boost", null, 0 },
{ 5, "Increases luck of your pet, making it more fortunate to find rare items.", "🍀", "Luck of the Draw", "[4]", 0 },
{ 6, "Increases agility of your pet, making it faster in combat.", "🏃", "Agility Training", "[3]", 0 },
{ 7, "Increases perception of your pet, making it more aware of its surroundings.", "👀", "Perception Boost", "[2]", 0 },
{ 8, "Increases the amount of resources gathered by your pet.", "📦", "Resourcefulness", "[5,6,7]", 1 }
});
migrationBuilder.InsertData(
@@ -255,7 +274,31 @@ namespace PetCompanion.Migrations
{ 18, "Agility", 6, 3, 3m },
{ 19, "Perception", 7, 1, 1m },
{ 20, "Perception", 7, 2, 2m },
{ 21, "Perception", 7, 3, 3m }
{ 21, "Perception", 7, 3, 3m },
{ 22, "Resourcefulness", 8, 1, 1m },
{ 23, "Resourcefulness", 8, 2, 2m },
{ 24, "Resourcefulness", 8, 3, 3m }
});
migrationBuilder.InsertData(
table: "SkillRequirement",
columns: new[] { "Id", "Cost", "Resource", "SkillId" },
values: new object[,]
{
{ 1, 100, "Wisdom", 1 },
{ 2, 150, "Food", 1 },
{ 3, 150, "Wisdom", 2 },
{ 4, 100, "Gold", 3 },
{ 5, 150, "Food", 3 },
{ 6, 200, "Wisdom", 4 },
{ 7, 200, "Gold", 5 },
{ 8, 200, "Gold", 6 },
{ 9, 100, "Gold", 7 },
{ 10, 100, "Junk", 7 },
{ 11, 500, "Gold", 8 },
{ 12, 500, "Junk", 8 },
{ 13, 300, "Wisdom", 8 },
{ 14, 300, "Food", 8 }
});
migrationBuilder.CreateIndex(
@@ -282,6 +325,11 @@ namespace PetCompanion.Migrations
name: "IX_SkillEffects_SkillId",
table: "SkillEffects",
column: "SkillId");
migrationBuilder.CreateIndex(
name: "IX_SkillRequirement_SkillId",
table: "SkillRequirement",
column: "SkillId");
}
/// <inheritdoc />
@@ -305,6 +353,9 @@ namespace PetCompanion.Migrations
migrationBuilder.DropTable(
name: "SkillEffects");
migrationBuilder.DropTable(
name: "SkillRequirement");
migrationBuilder.DropTable(
name: "GameItems");

View File

@@ -105,9 +105,6 @@ namespace PetCompanion.Migrations
b.Property<int>("Class")
.HasColumnType("INTEGER");
b.Property<int>("Experience")
.HasColumnType("INTEGER");
b.Property<DateTime>("GatherActionSince")
.HasColumnType("TEXT");
@@ -133,9 +130,6 @@ namespace PetCompanion.Migrations
b.Property<int>("PetGatherAction")
.HasColumnType("INTEGER");
b.Property<int>("SkillPoints")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
@@ -247,9 +241,6 @@ namespace PetCompanion.Migrations
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("PointsCost")
.HasColumnType("INTEGER");
b.PrimitiveCollection<string>("SkillsIdRequired")
.HasColumnType("TEXT");
@@ -267,7 +258,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum health of your pet, making it more resilient.",
Icon = "❤",
Name = "Vitality Mastery",
PointsCost = 1,
Type = 0
},
new
@@ -276,7 +266,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum intelligence of your pet, improving its learning capabilities.",
Icon = "🧠",
Name = "Mind Enhancement",
PointsCost = 1,
Type = 0
},
new
@@ -285,7 +274,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum strength of your pet, making it more powerful.",
Icon = "💪",
Name = "Strength Training",
PointsCost = 1,
Type = 0
},
new
@@ -294,7 +282,6 @@ namespace PetCompanion.Migrations
Description = "Increases maximum charisma of your pet, making it more charming.",
Icon = "🎭",
Name = "Charisma Boost",
PointsCost = 1,
Type = 0
},
new
@@ -303,7 +290,6 @@ namespace PetCompanion.Migrations
Description = "Increases luck of your pet, making it more fortunate to find rare items.",
Icon = "🍀",
Name = "Luck of the Draw",
PointsCost = 1,
SkillsIdRequired = "[4]",
Type = 0
},
@@ -313,7 +299,6 @@ namespace PetCompanion.Migrations
Description = "Increases agility of your pet, making it faster in combat.",
Icon = "🏃",
Name = "Agility Training",
PointsCost = 1,
SkillsIdRequired = "[3]",
Type = 0
},
@@ -323,9 +308,17 @@ namespace PetCompanion.Migrations
Description = "Increases perception of your pet, making it more aware of its surroundings.",
Icon = "👀",
Name = "Perception Boost",
PointsCost = 1,
SkillsIdRequired = "[2]",
Type = 0
},
new
{
Id = 8,
Description = "Increases the amount of resources gathered by your pet.",
Icon = "📦",
Name = "Resourcefulness",
SkillsIdRequired = "[5,6,7]",
Type = 1
});
});
@@ -522,6 +515,153 @@ namespace PetCompanion.Migrations
SkillId = 7,
Tier = 3,
Value = 3m
},
new
{
Id = 22,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 1,
Value = 1m
},
new
{
Id = 23,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 2,
Value = 2m
},
new
{
Id = 24,
Effect = "Resourcefulness",
SkillId = 8,
Tier = 3,
Value = 3m
});
});
modelBuilder.Entity("PetCompanion.Models.SkillRequirement", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("Cost")
.HasColumnType("INTEGER");
b.Property<string>("Resource")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("SkillId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SkillId");
b.ToTable("SkillRequirement");
b.HasData(
new
{
Id = 1,
Cost = 100,
Resource = "Wisdom",
SkillId = 1
},
new
{
Id = 2,
Cost = 150,
Resource = "Food",
SkillId = 1
},
new
{
Id = 3,
Cost = 150,
Resource = "Wisdom",
SkillId = 2
},
new
{
Id = 4,
Cost = 100,
Resource = "Gold",
SkillId = 3
},
new
{
Id = 5,
Cost = 150,
Resource = "Food",
SkillId = 3
},
new
{
Id = 6,
Cost = 200,
Resource = "Wisdom",
SkillId = 4
},
new
{
Id = 7,
Cost = 200,
Resource = "Gold",
SkillId = 5
},
new
{
Id = 8,
Cost = 200,
Resource = "Gold",
SkillId = 6
},
new
{
Id = 9,
Cost = 100,
Resource = "Gold",
SkillId = 7
},
new
{
Id = 10,
Cost = 100,
Resource = "Junk",
SkillId = 7
},
new
{
Id = 11,
Cost = 500,
Resource = "Gold",
SkillId = 8
},
new
{
Id = 12,
Cost = 500,
Resource = "Junk",
SkillId = 8
},
new
{
Id = 13,
Cost = 300,
Resource = "Wisdom",
SkillId = 8
},
new
{
Id = 14,
Cost = 300,
Resource = "Food",
SkillId = 8
});
});
@@ -603,6 +743,17 @@ namespace PetCompanion.Migrations
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.SkillRequirement", b =>
{
b.HasOne("PetCompanion.Models.Skill", "Skill")
.WithMany("SkillRequirements")
.HasForeignKey("SkillId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Skill");
});
modelBuilder.Entity("PetCompanion.Models.Pet", b =>
{
b.Navigation("EquippedItemsList");
@@ -624,6 +775,8 @@ namespace PetCompanion.Migrations
b.Navigation("Effects");
b.Navigation("PetSkills");
b.Navigation("SkillRequirements");
});
#pragma warning restore 612, 618
}