Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
push:
branches: [ main ]
pull_request:

jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore

- name: Test
run: dotnet test --no-build
27 changes: 27 additions & 0 deletions ClassCrawler.Tests/ClassCrawler.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>

<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ClassCrawler\ClassCrawler.csproj" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions ClassCrawler.Tests/CombatEngineTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ClassCrawler.Tests;

/// <summary>Placeholder tests for CombatEngine. Students will complete these.</summary>
public class CombatEngineTests
{
[Fact(Skip = "Not yet implemented")]
public void RunCombat_ReturnsOutcome()
{
// TODO: Implement
throw new NotImplementedException();
}
}
12 changes: 12 additions & 0 deletions ClassCrawler.Tests/CombatStrategyTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ClassCrawler.Tests;

/// <summary>Placeholder tests for combat strategies. Students will complete these.</summary>
public class CombatStrategyTests
{
[Fact(Skip = "Not yet implemented")]
public void MeleeStrategy_Execute_ReturnsCombatResult()
{
// TODO: Implement
throw new NotImplementedException();
}
}
12 changes: 12 additions & 0 deletions ClassCrawler.Tests/InventoryTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ClassCrawler.Tests;

/// <summary>Placeholder tests for player inventory management. Students will complete these.</summary>
public class InventoryTests
{
[Fact(Skip = "Not yet implemented")]
public void AddItem_IncreasesInventoryCount()
{
// TODO: Implement
throw new NotImplementedException();
}
}
12 changes: 12 additions & 0 deletions ClassCrawler.Tests/ItemTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ClassCrawler.Tests;

/// <summary>Placeholder tests for item usage. Students will complete these.</summary>
public class ItemTests
{
[Fact(Skip = "Not yet implemented")]
public void Potion_Use_RestoresHealth()
{
// TODO: Implement
throw new NotImplementedException();
}
}
12 changes: 12 additions & 0 deletions ClassCrawler.Tests/LootResolverTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace ClassCrawler.Tests;

/// <summary>Placeholder tests for loot resolution. Students will complete these.</summary>
public class LootResolverTests
{
[Fact(Skip = "Not yet implemented")]
public void ResolveLoot_ReturnsItemList()
{
// TODO: Implement
throw new NotImplementedException();
}
}
48 changes: 48 additions & 0 deletions ClassCrawler.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassCrawler", "ClassCrawler\ClassCrawler.csproj", "{94F8E38A-9D6D-44D1-866F-2461D88DF238}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ClassCrawler.Tests", "ClassCrawler.Tests\ClassCrawler.Tests.csproj", "{A693E9EC-85B8-418A-9E54-ED5406527BFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|x64.ActiveCfg = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|x64.Build.0 = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|x86.ActiveCfg = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Debug|x86.Build.0 = Debug|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|Any CPU.Build.0 = Release|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|x64.ActiveCfg = Release|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|x64.Build.0 = Release|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|x86.ActiveCfg = Release|Any CPU
{94F8E38A-9D6D-44D1-866F-2461D88DF238}.Release|x86.Build.0 = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|x64.ActiveCfg = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|x64.Build.0 = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|x86.ActiveCfg = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Debug|x86.Build.0 = Debug|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|Any CPU.Build.0 = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|x64.ActiveCfg = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|x64.Build.0 = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|x86.ActiveCfg = Release|Any CPU
{A693E9EC-85B8-418A-9E54-ED5406527BFE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
41 changes: 41 additions & 0 deletions ClassCrawler/Characters/Character.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using ClassCrawler.Combat;

namespace ClassCrawler.Characters;

/// <summary>Abstract base class for all characters in the game.</summary>
public abstract class Character
{
/// <summary>The character's display name.</summary>
public string Name { get; set; } = string.Empty;

/// <summary>The character's current health points.</summary>
public int Health { get; set; }

/// <summary>The character's maximum health points.</summary>
public int MaxHealth { get; set; }

/// <summary>The base damage this character deals per attack.</summary>
public int AttackPower { get; set; }

/// <summary>Reduces incoming damage by this amount.</summary>
public int Defense { get; set; }

/// <summary>The character's current level.</summary>
public int Level { get; set; }

/// <summary>Indicates whether the character is still alive.</summary>
public bool IsAlive => Health > 0;

/// <summary>The combat strategy used when this character attacks.</summary>
public ICombatStrategy? CombatStrategy { get; set; }

/// <summary>Applies damage to this character.</summary>
public abstract void TakeDamage(int amount);

/// <summary>Returns a human-readable description of this character.</summary>
public virtual string GetDescription()
{
// TODO: Implement
throw new NotImplementedException();
}
}
32 changes: 32 additions & 0 deletions ClassCrawler/Characters/Dragon.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace ClassCrawler.Characters;

/// <summary>A fearsome dragon — the ultimate dungeon boss.</summary>
public class Dragon : Enemy
{
/// <summary>Initialises a Dragon with default starting stats.</summary>
public Dragon()
{
Name = "Dragon";
Health = 200;
MaxHealth = 200;
AttackPower = 35;
Defense = 15;
Level = 10;
ExperienceReward = 200;
GoldReward = 100;
}

/// <summary>Returns a description of the Dragon's attack.</summary>
public override string GetAttackDescription()
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Applies damage to the Dragon, reducing its health.</summary>
public override void TakeDamage(int amount)
{
// TODO: Implement
throw new NotImplementedException();
}
}
19 changes: 19 additions & 0 deletions ClassCrawler/Characters/Enemy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using ClassCrawler.Items;

namespace ClassCrawler.Characters;

/// <summary>Abstract base class for all enemy characters.</summary>
public abstract class Enemy : Character
{
/// <summary>The amount of experience awarded to the player upon defeating this enemy.</summary>
public int ExperienceReward { get; set; }

/// <summary>The amount of gold awarded to the player upon defeating this enemy.</summary>
public int GoldReward { get; set; }

/// <summary>Items that may be dropped by this enemy when defeated.</summary>
public List<Item> LootTable { get; set; } = new();

/// <summary>Returns a description of this enemy's attack action.</summary>
public abstract string GetAttackDescription();
}
32 changes: 32 additions & 0 deletions ClassCrawler/Characters/Goblin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace ClassCrawler.Characters;

/// <summary>A weak but cunning enemy found in early dungeon rooms.</summary>
public class Goblin : Enemy
{
/// <summary>Initialises a Goblin with default starting stats.</summary>
public Goblin()
{
Name = "Goblin";
Health = 30;
MaxHealth = 30;
AttackPower = 5;
Defense = 2;
Level = 1;
ExperienceReward = 10;
GoldReward = 5;
}

/// <summary>Returns a description of the Goblin's attack.</summary>
public override string GetAttackDescription()
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Applies damage to the Goblin, reducing its health.</summary>
public override void TakeDamage(int amount)
{
// TODO: Implement
throw new NotImplementedException();
}
}
32 changes: 32 additions & 0 deletions ClassCrawler/Characters/Orc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
namespace ClassCrawler.Characters;

/// <summary>A brutish enemy with high health and strong attacks.</summary>
public class Orc : Enemy
{
/// <summary>Initialises an Orc with default starting stats.</summary>
public Orc()
{
Name = "Orc";
Health = 60;
MaxHealth = 60;
AttackPower = 12;
Defense = 5;
Level = 3;
ExperienceReward = 25;
GoldReward = 15;
}

/// <summary>Returns a description of the Orc's attack.</summary>
public override string GetAttackDescription()
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Applies damage to the Orc, reducing its health.</summary>
public override void TakeDamage(int amount)
{
// TODO: Implement
throw new NotImplementedException();
}
}
51 changes: 51 additions & 0 deletions ClassCrawler/Characters/Player.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using ClassCrawler.Items;

namespace ClassCrawler.Characters;

/// <summary>Represents the player character controlled by the user.</summary>
public class Player : Character
{
/// <summary>The items currently carried by the player.</summary>
public List<Item> Inventory { get; set; } = new();

/// <summary>The total experience points earned by the player.</summary>
public int Experience { get; set; }

/// <summary>The amount of gold the player is carrying.</summary>
public int Gold { get; set; }

/// <summary>Adds an item to the player's inventory.</summary>
public void AddItem(Item item)
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Removes an item from the player's inventory.</summary>
public void RemoveItem(Item item)
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Uses an item from the player's inventory on this player.</summary>
public void UseItem(Item item)
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Adds experience points and checks for level-up.</summary>
public void AddExperience(int amount)
{
// TODO: Implement
throw new NotImplementedException();
}

/// <summary>Applies damage to the player, reducing their health.</summary>
public override void TakeDamage(int amount)
{
// TODO: Implement
throw new NotImplementedException();
}
}
Loading
Loading