Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
0da49e5
Bumped everything to dotnet 10 and C# 14
grofit Dec 8, 2025
77977e6
Updated project extensions
grofit Dec 8, 2025
b74536e
Updated Race/Classes over to newer extension properties
grofit Dec 8, 2025
f714cc4
Moved more extensions over to properties
grofit Dec 8, 2025
6b030a1
Updated more properties
grofit Dec 9, 2025
7de1f1f
Updated more extensions to properties
grofit Dec 9, 2025
5e9ba75
Updated effect extensions to properties
grofit Dec 9, 2025
cc089cf
Added more properties from extensions
grofit Dec 9, 2025
c3d7a5d
Updated more extensions to properties
grofit Dec 9, 2025
8d6d288
Fixed issue with array.empty casting, also update asp nugets
grofit Dec 9, 2025
9a8d3c2
Updated more nugets
grofit Dec 9, 2025
11e988f
Bumped testing nugets
grofit Dec 9, 2025
754dc83
Fixed up some typos
grofit Dec 9, 2025
15dd02c
Bumped photino version
grofit Dec 9, 2025
ad2040a
Starting to add Enemy examples
grofit Dec 11, 2025
627775b
Making advanced enemies examples
grofit Dec 11, 2025
9ae2f5d
Updated Entity to now have optional template links
grofit Dec 16, 2025
78ba429
Added basic procedural effect builder
grofit Dec 18, 2025
c8ab034
Preliminary work is done and works
grofit Dec 19, 2025
5d34fd5
Moved effects over and looking for requirements now
grofit Dec 19, 2025
ae19b51
Removed IHasRequirements
grofit Dec 19, 2025
37cab00
Updated demo to show equipment example
grofit Dec 22, 2025
5e6c5d2
Merge branch 'spike/dotnet-10-remove-ihaseffects' into feature/dotnet-10
grofit Dec 22, 2025
30ceb38
Added more ability related classes
grofit Jan 12, 2026
cbb4f13
Added some basic high level genre summaries
grofit Jan 12, 2026
16d7be4
Added first stab at it
grofit Jan 19, 2026
f18768e
improved approach but still needs more streamlining
grofit Jan 19, 2026
b93c8be
Added component for crafted item stuffs
grofit Jan 20, 2026
a85b3f2
Got crafting template patterns working
grofit Jan 20, 2026
a99336f
Updating the way trade skills are handled
grofit Jan 21, 2026
a811ac6
Fixed up logic and tests
grofit Jan 21, 2026
6097fb6
Updated trade skill logic some more
grofit Jan 21, 2026
55620ac
Fixed crafting generation and component
grofit Jan 22, 2026
0cfc392
Separated more pattern stuff out
grofit Jan 22, 2026
bb4df88
Updated ship to be more inline with entity
grofit May 8, 2026
a001ac2
Merge branch 'spike/template-pattern-generators' into feature/dotnet-10
grofit May 8, 2026
9644c02
Minor updates
grofit May 8, 2026
33380bf
First stab at generic project handler
grofit May 8, 2026
029e622
Fixed loading for effects/requirements
grofit May 10, 2026
56c8f70
Updated csproj metadata
grofit May 10, 2026
3dbe45c
Added basic helper high level data loader
grofit May 10, 2026
468dfb8
Merge branch 'feature/editor-project-handling' into feature/dotnet-10
grofit May 10, 2026
0667de3
current spike has quirks
grofit May 11, 2026
32767f2
Moved to manifest approach
grofit May 11, 2026
0bd08e6
Moved to support generic templates
grofit May 11, 2026
7d5bb88
Moved to use plugin.json over manifest.json
grofit May 12, 2026
bf151d7
More updates to template
grofit May 12, 2026
aacd47c
Updated editors more
grofit May 12, 2026
4021721
More editor updates
grofit May 12, 2026
5ad2c87
Fixed the dropdown type resolution
grofit May 12, 2026
55877f2
Got child bits working for quests but still horrible
grofit May 12, 2026
f356e05
Got the collection based stuff working on quest and items/trade skills
grofit May 12, 2026
3f8a5de
Made sure the genre types are combined and output plugins in debug mode
grofit May 13, 2026
847a248
Improved type handling for plugins
grofit May 13, 2026
4527bd8
Added more to the scifi layer
grofit May 13, 2026
04fab6b
Updated more UI stuff for scifi
grofit May 13, 2026
eb0844b
Updated to support custom names in manifests
grofit May 13, 2026
100599b
Updated the plugin functionality
grofit May 14, 2026
03908f6
Fixed up locale page
grofit May 14, 2026
28d68b1
Ensuring AssetCode doesnt blow up on invocations when missing
grofit May 14, 2026
fce0672
Removed the old template editors as they are replaced with the dynami…
grofit May 14, 2026
93dcec2
Removed link to templates as its not needed
grofit May 14, 2026
ea7da22
Updated logic to handle generics
grofit May 14, 2026
c279e36
Added array to list changes on deserialization
grofit May 14, 2026
25f7dbe
Fixed issue with creating new templates
grofit May 14, 2026
f6e77db
Added logic to use existing extensions where possible
grofit May 14, 2026
bf709c1
Various updates to ITemplate types
grofit May 14, 2026
de86537
Updated architecture a bit to simplify
grofit May 14, 2026
29742ed
Removed dependency on Scifi from non editor app libs
grofit May 14, 2026
fab1bd3
Added basic paging to templates
grofit May 15, 2026
d1029db
Moving to better handle types
grofit May 15, 2026
bbd13e0
Separating out pure logic from views
grofit May 15, 2026
7eba472
Updated cloning to correctly account for variables
grofit May 15, 2026
9a00818
Tried to streamline loading more
grofit May 15, 2026
0902e72
Had to make serialization changes
grofit May 15, 2026
15f9020
Improving UX
grofit May 15, 2026
edb341f
Improved UX more
grofit May 15, 2026
a4d681f
Updated ux further for accordions
grofit May 15, 2026
d1873c0
Updated to remove plugin dependencies
grofit May 15, 2026
46fbdd6
Fixed issue when switching template types
grofit May 15, 2026
c771971
Fixed issue with it not loading/saving ship templates correctly
grofit May 15, 2026
6b39d13
Improved collection handling for accordions
grofit May 15, 2026
edd25ef
Adding initial support for entity templates
grofit May 15, 2026
a92eeb4
Adding more to the entity templates
grofit May 16, 2026
308c71a
Updating styling for new accordions
grofit May 16, 2026
7b7f110
Minor access property improvement
grofit May 16, 2026
3c798b5
Merge branch 'spike/more-plugins' into feature/dotnet-10
grofit May 16, 2026
00d30d5
Updated ability ui
grofit May 18, 2026
275c28a
Updating entity data interactions
grofit May 18, 2026
38db308
Updated to support slot types property in entity template
grofit May 18, 2026
81def29
Updated objective dropdown
grofit May 18, 2026
1f48e02
Added more changes related to handling de/serialization
grofit May 18, 2026
4126dcc
Made the associated editors contextual
grofit May 18, 2026
eb4b17e
Fixed issue with not reloading ship templates correctly
grofit May 19, 2026
a33f3a2
Adding improved locale support
grofit May 19, 2026
ca097e8
Made locales a bit more managable
grofit May 19, 2026
03c394a
Merge branch 'feature/dotnet-10-editor' into feature/dotnet-10
grofit May 19, 2026
3336836
Adding basic starting point for battle demo
grofit May 19, 2026
f8d7969
Added basic starting point
grofit May 20, 2026
5dc9acc
First basic ui and entities
grofit May 20, 2026
36465f5
Got basic turn order added
grofit May 20, 2026
e24a566
Made turns happen
grofit May 20, 2026
2ad7d08
Updated to improve spacing
grofit May 20, 2026
430d71d
Fixed up text
grofit May 20, 2026
9b5416d
Adding basic OpenRpg setup to DI
grofit May 20, 2026
5285bc1
Updated to use more OpenRpg stuff and fixed scene restart
grofit May 20, 2026
88be273
Added basic abilities
grofit May 20, 2026
06ce676
Updated abilities and targetting ui
grofit May 21, 2026
1c38a1a
Updated combat to use OpenRpg components for attacks
grofit May 21, 2026
95b3c26
Fixed bugs with Add/Reduce methods and damage calculation
grofit May 21, 2026
b90254e
Updated code structure
grofit May 21, 2026
231edbb
Adding readme to demo
grofit May 21, 2026
c250f22
Adding main menu for equipment
grofit May 21, 2026
a9680b9
Updating targetting and hp/mp persistence
grofit May 21, 2026
91cf1a2
Added potion logic
grofit May 21, 2026
5377d13
Added support for heal spells
grofit May 21, 2026
2fd837a
Added effects for resurrection to core and example
grofit May 21, 2026
9806b7d
Added more unit tests
grofit May 24, 2026
a4aa4cf
Added more tests for abilities and new life restore/resurrection code
grofit May 24, 2026
9960b22
Added more tests and updated more code to use the getandset approach
grofit May 24, 2026
e1e1b8a
Moved to store on the get on most object var extensions, also added t…
grofit May 24, 2026
9329893
Moving to make attacks and damage immutable now we can use records
grofit May 24, 2026
bbc7c7f
Removed item count from inventory
grofit May 24, 2026
760ff35
Stop being able to rez alive players
grofit May 24, 2026
a2ccf51
Added party creator and fixed up ui in char menu
grofit May 24, 2026
0011be7
Improved UI slightly
grofit May 24, 2026
ce7318c
Merge branch 'feature/examples' into feature/dotnet-10
grofit May 27, 2026
ae5a142
Moved to use ProjectContext and begun adding generated outputs
grofit May 27, 2026
e0e470a
Added new sections for the generated files settings
grofit May 27, 2026
894f231
Updated where file generator lives
grofit May 27, 2026
15f879e
Added first sweep at trying to generate lookups
grofit May 27, 2026
a9ba12e
Added logging
grofit May 27, 2026
0b4574b
Added ability to change where custom types should be output
grofit May 27, 2026
ee7a6c7
Moved conventions around for procedural bits
grofit May 27, 2026
33bc2b6
Fixed issue with the pattern crafting
grofit May 27, 2026
fefd27c
Updated how loot tables are handled to separate logic and data
grofit May 29, 2026
d1ba4cc
Updated projects to use newer loot data
grofit May 29, 2026
a2a2259
Merge branch 'feature/more-editor-updates' into feature/dotnet-10
grofit Jun 1, 2026
3909d61
Split out ability and item stuff from turn manager
grofit Jun 2, 2026
beed923
Trying to break down the logic more to be easier to understand
grofit Jun 5, 2026
3bed376
Added locale demo
grofit Jun 11, 2026
eecb742
Updated the logic for effect/requirements to cope with covariance of …
grofit Jun 11, 2026
bc47a6d
Updated quest handling and quest state demos
grofit Jun 11, 2026
76cb76a
First stab at trying to add objective tracking
grofit Jun 12, 2026
11ca1e5
Updated demo to set character quest state
grofit Jun 12, 2026
b9fea6f
Removed the older QuestState stuff now the newer approach works
grofit Jun 12, 2026
7759516
Adding faction requirements/demos
grofit Jun 12, 2026
dc29a9a
Added basic example of tags
grofit Jun 12, 2026
c29905d
Added basic seller example
grofit Jun 12, 2026
b4ec68d
Merge branch 'feature/more-editor-updates' into feature/dotnet-10
grofit Jun 12, 2026
24d6f11
Updated persistence demo and updated xunit
grofit Jun 13, 2026
5d6d7b0
Fixed issues in inventory transaction and added test/demo
grofit Jun 13, 2026
1e70aec
Added example for equipment slots
grofit Jun 13, 2026
6bd9106
Updated damages to be more interactive
grofit Jun 14, 2026
7dc9be6
Adding more demos for abilities to show targetting
grofit Jun 14, 2026
c43d97c
Updated demos to use light magic for healing
grofit Jun 15, 2026
f07af46
Added further procedural information to demos
grofit Jun 15, 2026
9fcadcb
Added attack modifier pipeline helper and demo
grofit Jun 16, 2026
3b6b9f0
Merge branch 'features/more-updates' into feature/dotnet-10
grofit Jul 8, 2026
eb4dad6
Updated to dotnet 10
grofit Jul 8, 2026
3b4518d
Hopefully fixed windows only build
grofit Jul 8, 2026
0f52209
Updating other bits to dotnet 10
grofit Jul 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build And Test
on: [push]

env:
BuildVersion: '0.43.${{github.run_number}}'
BuildVersion: '0.44.${{github.run_number}}'
SolutionFile: 'src/OpenRpg.sln'
DemoProject: 'src/OpenRpg.Demos.Web/OpenRpg.Demos.Web.csproj'
EditorProject: 'src/OpenRpg.Editor/OpenRpg.Editor.csproj'
Expand All @@ -14,10 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: .Net Restore
run: dotnet restore ${{ env.SolutionFile }}
Expand Down Expand Up @@ -63,10 +63,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Build Web Demo
run: dotnet publish -c Release -o demo "${{ env.DemoProject }}"
Expand Down Expand Up @@ -95,10 +95,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Setup .NET 9.0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v2
with:
dotnet-version: 9.0.x
dotnet-version: 10.0.x

- name: Build Editor App
run: dotnet publish -c Release -r win-x64 --sc /p:Version=${{ env.BuildVersion }} -o /editor "${{ env.EditorProject }}"
Expand Down
5 changes: 3 additions & 2 deletions build/pack.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set version=0.29.00
set version=0.43.00
dotnet pack ../src/OpenRpg.Core -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Items -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Combat -c Release -o ../../_dist /p:version=%version%
Expand All @@ -11,4 +11,5 @@ dotnet pack ../src/OpenRpg.Genres.Fantasy -c Release -o ../../_dist /p:version=%
dotnet pack ../src/OpenRpg.Cards -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.CurveFunctions -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Tags -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Items.TradeSkills -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Items.TradeSkills -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.AdviceEngine.Rx -c Release -o ../../_dist /p:version=%version%
116 changes: 114 additions & 2 deletions docs/quests.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,118 @@

The quests project builds upon the `OpenRpg.Items` project to allow a way to express quests that can be carried out by players within the game.

A `Quest` is a `Template` that generally contains information about the `Objective`, the `Rewards` as well as other metadata as well as a way to track the state of completed quests and faction information.
A `QuestTemplate` is a `Template` that generally contains information about the `Objectives`, the `Rewards` as well as other metadata and a way to track the state of completed quests and faction information.

> It is recommended you look over the interactive web demo for a more in depth example and explanation of this project.
> It is recommended you look over the interactive web demo for a more in depth example and explanation of this project.

## Quest Structure

```csharp
var quest = new QuestTemplate
{
Id = 1,
NameLocaleId = "Goblin Hunt",
DescriptionLocaleId = "Defeat 3 goblins terrorising the village.",
IsRepeatable = false,
Objectives = new List<Objective> { ... },
Rewards = new List<Reward> { ... },
Gifts = new List<Reward> { ... }, // items given at quest start
Variables = new QuestTemplateVariables() // stores Requirements at key 4003
};
```

### Objectives

Each `Objective` has an `ObjectiveType` (int) and an `Association` (AssociatedId + AssociatedValue).

| Type | Constant | Meaning |
|------|----------|---------|
| 1 | `TriggerObjective` | A trigger must be set |
| 2 | `ItemObjective` | Collect N items (AssociatedId = item template id, AssociatedValue = count) |
| 3 | `LevelObjective` | Reach a level (AssociatedValue = required level) |
| 4 | `ClassObjective` | Have a class (AssociatedId = class template id) |
| 5 | `EffectObjective` | Have an active effect (AssociatedId = effect id) |
| 6 | `QuestObjective` | Complete another quest (AssociatedId = quest id) |
| 30 | `CurrencyObjective` | Collect N currency (AssociatedValue = amount) |
| 31 | `EnemyDefeatedObjective` | Defeat N enemies (AssociatedId = enemy id, AssociatedValue = count) |
| 32 | `EnemySightedObjective` | Sight N enemies (AssociatedId = enemy id, AssociatedValue = count) |

### Rewards

Rewards have a `RewardType`, `RewardChance`, and `Association`. Common types include experience, currency, and item rewards.

### Requirements

Requirements live on `quest.Variables.Requirements` (key 4003) and gate quest acceptance. They are checked via `ICharacterRequirementChecker`.

## Objective Verification

The `ICharacterObjectiveChecker` follows the same pattern as `ICharacterRequirementChecker` — it has four overloads for different contexts:

```csharp
public interface ICharacterObjectiveChecker : IObjectiveChecker<Character>
{
// Stateless checks — verified from live character state
bool IsObjectiveMet(Character character, Objective objective); // level, class, effects
bool IsObjectiveMet(IQuestState state, Objective objective); // quest prerequisites
bool IsObjectiveMet(ITriggerState state, Objective objective); // trigger objectives

// Stateful checks — verified from accumulated progress
bool IsObjectiveMet(IObjectiveState state, Objective objective, int questId, int objectiveIndex);
}
```

**Stateless objectives** (trigger, quest, level, class, effect) are checked against live game state each time.

**Stateful objectives** (items, kills, currency) compare accumulated progress against the required threshold.

### Batch Checking

```csharp
// Check all objectives for a quest across all four contexts
var allMet = ObjectiveChecker.AreObjectivesMet(character, questData);
```

## Objective State Tracking

`IObjectiveState` stores per-quest-per-objective progress as a dictionary of composite keys to int counts.

The composite key combines `questId` and `objectiveIndex` into a single int: `(questId << 16) | objectiveIndex`.

```csharp
// Access via entity variables (optional — can also use standalone)
character.Variables.ObjectiveState.GetObjectiveProgress(questId, objectiveIndex);
character.Variables.ObjectiveState.AddObjectiveProgress(questId, objectiveIndex, 1);
character.Variables.ObjectiveState.IsObjectiveComplete(questId, objectiveIndex, requiredAmount);
character.Variables.ObjectiveState.ClearQuestObjectives(questId, quest.Objectives.Count);
```

Progress is **push-based** — game code explicitly calls `AddObjectiveProgress` when events happen (enemy killed, item collected, etc.).

## QuestData

`QuestData` is a proper `ITemplateData` instance that bundles quest definition, state, and objective state. It links to the template via `TemplateId` (like `ItemData`):

```csharp
var questData = new QuestData(quest.Id, QuestStateTypes.QuestActive);
// questData.TemplateId — links to the QuestTemplate
// questData.State — current state (NotStarted/Active/Complete)
// questData.ObjectiveState — per-objective progress
```

## Typical Usage

```csharp
// Accept a quest
var questData = new QuestData(quest.Id, QuestStateTypes.QuestActive);
questData.ObjectiveState.ClearQuestObjectives(quest.Id, quest.Objectives.Count);

// Track progress (called by game code when events happen)
questData.ObjectiveState.AddObjectiveProgress(quest.Id, objectiveIndex, 1);

// Check if all objectives are met
var canComplete = ObjectiveChecker.AreObjectivesMet(character, quest, questData);

// Complete the quest
questData.State = QuestStateTypes.QuestComplete;
```
6 changes: 3 additions & 3 deletions src/OpenRpg.AdviceEngine.Rx/OpenRpg.AdviceEngine.Rx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
<PackageProjectUrl>https://github.com/openrpg/OpenRpg</PackageProjectUrl>
<Description>A Utility AI flavoured framework to provide advice about what entities should do</Description>
<PackageTags>rpg game-development xna monogame unity godot rx</PackageTags>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8</LangVersion>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14</LangVersion>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\OpenRpg.AdviceEngine\OpenRpg.AdviceEngine.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Reactive" Version="6.0.1" />
<PackageReference Include="System.Reactive" Version="6.1.0" />
</ItemGroup>

</Project>
5 changes: 3 additions & 2 deletions src/OpenRpg.AdviceEngine/Applicators/IApplicator.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using System.Collections.Generic;
using OpenRpg.Core.Requirements;
using OpenRpg.Entities.Requirements;

namespace OpenRpg.AdviceEngine.Applicators
{
public interface IApplicator : IHasRequirements
public interface IApplicator
{
int Priority { get; }
bool CanApplyTo(IAgent agent);
void ApplyTo(IAgent agent);
IReadOnlyCollection<Requirement> Requirements { get; }
}
}
18 changes: 4 additions & 14 deletions src/OpenRpg.AdviceEngine/Extensions/UtilityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,14 @@ public static class UtilityExtensions
{
public static float CalculateScore(this IReadOnlyCollection<KeyValuePair<UtilityKey, float>> variableUtilities)
{ return CalculateScore(variableUtilities.Select(x => x.Value).ToArray()); }

public static float CalculateScore(this IReadOnlyCollection<float> utilities)
{
var score = 1.0f;
var compensationFactor = (float)(1.0 - 1.0 / utilities.Count);
foreach (var utility in utilities)
{
var modification = (float)((1.0 - utility) * compensationFactor);
var scaledUtility = utility + (modification * utility);
score *= scaledUtility;
}
return score;
}

public static float CalculateScore(params float[] utilities)
{ return CalculateScore(utilities as IReadOnlyCollection<float>); }

public static float CalculateScore(this IReadOnlyCollection<float> utilities)
{
var score = 1.0f;
var compensationFactor = (float)(1.0 - 1.0 / utilities.Length);
var compensationFactor = (float)(1.0 - 1.0 / utilities.Count);
foreach (var utility in utilities)
{
var modification = (float)((1.0 - utility) * compensationFactor);
Expand Down
4 changes: 2 additions & 2 deletions src/OpenRpg.AdviceEngine/OpenRpg.AdviceEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<PackageProjectUrl>https://github.com/openrpg/OpenRpg.AdviceEngine</PackageProjectUrl>
<Description>A Utility AI flavoured framework to provide advice about what entities should do</Description>
<PackageTags>rpg game-development xna monogame unity godot</PackageTags>
<TargetFramework>netstandard2.1</TargetFramework>
<LangVersion>8</LangVersion>
<TargetFramework>net10.0</TargetFramework>
<LangVersion>14</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/OpenRpg.Cards/Effects/CardEffects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
using System.Collections.Generic;
using OpenRpg.Core.Common;
using OpenRpg.Core.Effects;
using OpenRpg.Entities.Effects;

namespace OpenRpg.Cards.Effects
{
public class CardEffects : IHasDataId, IHasLocaleDescription, IHasEffects
public class CardEffects : IHasDataId, IHasLocaleDescription
{
public int Id { get; set; }
public string NameLocaleId { get; set; }
public string DescriptionLocaleId { get; set; }

public IReadOnlyCollection<IEffect> Effects { get; set; } = Array.Empty<IEffect>();
}
}
1 change: 0 additions & 1 deletion src/OpenRpg.Cards/Genres/AbilityCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using OpenRpg.Cards.Types;
using OpenRpg.Combat.Abilities;
using OpenRpg.Core.Effects;
using OpenRpg.Entities.Effects;

namespace OpenRpg.Cards.Genres
{
Expand Down
3 changes: 2 additions & 1 deletion src/OpenRpg.Cards/Genres/ClassCard.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using OpenRpg.Cards.Genres.Conventions;
using OpenRpg.Cards.Types;
using OpenRpg.Entities.Classes.Templates;
using OpenRpg.Entities.Classes.Variables;

namespace OpenRpg.Cards.Genres
{
public class ClassCard : GenericDataCardWithEffects<ClassTemplate>
public class ClassCard : TemplateDataCardWithEffects<ClassTemplate, ClassTemplateVariables>
{
public override int CardType => CardTypes.ClassCard;

Expand Down
1 change: 0 additions & 1 deletion src/OpenRpg.Cards/Genres/Conventions/GenericDataCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using OpenRpg.Cards.Variables;
using OpenRpg.Core.Common;
using OpenRpg.Core.Effects;
using OpenRpg.Entities.Effects;

namespace OpenRpg.Cards.Genres.Conventions
{
Expand Down
16 changes: 0 additions & 16 deletions src/OpenRpg.Cards/Genres/Conventions/GenericDataCardWithEffects.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Collections.Generic;
using OpenRpg.Core.Common;
using OpenRpg.Core.Effects;
using OpenRpg.Core.Templates;
using OpenRpg.Core.Templates.Variables;
using OpenRpg.Entities.Effects;
using OpenRpg.Entities.Extensions;

namespace OpenRpg.Cards.Genres.Conventions
{
public abstract class TemplateDataCardWithEffects<T,TTemplateVars> : GenericDataCard<T>
where T : ITemplate<TTemplateVars>
where TTemplateVars : ITemplateVariables
{
protected TemplateDataCardWithEffects(T data) : base(data)
{ }

public override IReadOnlyCollection<IEffect> Effects => Data.Variables.Effects;
}
}
8 changes: 6 additions & 2 deletions src/OpenRpg.Cards/Genres/EffectCard.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using OpenRpg.Cards.Effects;
using System.Collections.Generic;
using OpenRpg.Cards.Effects;
using OpenRpg.Cards.Genres.Conventions;
using OpenRpg.Cards.Types;
using OpenRpg.Core.Effects;

namespace OpenRpg.Cards.Genres
{
public class EffectCard : GenericDataCardWithEffects<CardEffects>
public class EffectCard : GenericDataCard<CardEffects>
{
public override int CardType => CardTypes.EffectCard;

public override IReadOnlyCollection<IEffect> Effects => Data.Effects;

public EffectCard(CardEffects data) : base(data)
{
Expand Down
3 changes: 2 additions & 1 deletion src/OpenRpg.Cards/Genres/ItemCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using OpenRpg.Cards.Variables;
using OpenRpg.Core.Effects;
using OpenRpg.Entities.Effects;
using OpenRpg.Entities.Extensions;
using OpenRpg.Items;

namespace OpenRpg.Cards.Genres
Expand All @@ -18,6 +19,6 @@ public ItemCard(Item item)

public string NameLocaleId => Data.Template.NameLocaleId;
public string DescriptionLocaleId => Data.Template.DescriptionLocaleId;
public IReadOnlyCollection<IEffect> Effects => Data.Template.Effects;
public IReadOnlyCollection<IEffect> Effects => Data.Template.Variables.Effects;
}
}
3 changes: 2 additions & 1 deletion src/OpenRpg.Cards/Genres/RaceCard.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using OpenRpg.Cards.Genres.Conventions;
using OpenRpg.Cards.Types;
using OpenRpg.Entities.Races.Templates;
using OpenRpg.Entities.Races.Variables;

namespace OpenRpg.Cards.Genres
{
public class RaceCard : GenericDataCardWithEffects<RaceTemplate>
public class RaceCard : TemplateDataCardWithEffects<RaceTemplate, RaceTemplateVariables>
{
public override int CardType => CardTypes.RaceCard;

Expand Down
Loading
Loading