-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have added cards project, also changed variables a bit
Variables used to all be floats but this is not applicable in all cases, so have made most objects other than stats. Have also removed IHasAssetCode as in most cases this can be expressed as a variable if needed and can be made more specific for each use case this way.
- Loading branch information
Showing
37 changed files
with
272 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version: 0.13.{build} | ||
version: 0.14.{build} | ||
branches: | ||
only: | ||
- master | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OpenRpg.Core.Variables; | ||
|
||
namespace OpenRpg.Cards | ||
{ | ||
public class DefaultCardVariables : DefaultVariables<object>, ICardVariables | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Collections.Generic; | ||
using OpenRpg.Core.Common; | ||
using OpenRpg.Core.Effects; | ||
|
||
namespace OpenRpg.Cards.Effects | ||
{ | ||
public class CardEffects : IHasDataId, IHasLocaleDescription, IHasEffects | ||
{ | ||
public int Id { get; set; } | ||
public string NameLocaleId { get; set; } | ||
public string DescriptionLocaleId { get; set; } | ||
public IEnumerable<Effect> Effects { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using OpenRpg.Cards.Genres.Conventions; | ||
using OpenRpg.Cards.Types; | ||
using OpenRpg.Core.Classes; | ||
|
||
namespace OpenRpg.Cards.Genres | ||
{ | ||
public class ClassCard : GenericDataCardWithEffects<IClassTemplate> | ||
{ | ||
public override int CardType => CardTypes.ClassCard; | ||
|
||
public ClassCard(IClassTemplate data) : base(data) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using OpenRpg.Core.Common; | ||
using OpenRpg.Core.Effects; | ||
using OpenRpg.Items; | ||
|
||
namespace OpenRpg.Cards.Genres.Conventions | ||
{ | ||
public abstract class GenericDataCard<T> : ICard | ||
where T : IHasLocaleDescription | ||
{ | ||
public abstract int CardType { get; } | ||
public ICardVariables Variables { get; set; } = new DefaultCardVariables(); | ||
|
||
public T Data { get; } | ||
|
||
protected GenericDataCard(T data) | ||
{ Data = data; } | ||
|
||
public virtual string NameLocaleId => Data.NameLocaleId; | ||
public virtual string DescriptionLocaleId => Data.DescriptionLocaleId; | ||
public abstract IEnumerable<Effect> Effects { get; } | ||
|
||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/OpenRpg.Cards/Genres/Conventions/GenericDataCardWithEffects.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
using OpenRpg.Core.Common; | ||
using OpenRpg.Core.Effects; | ||
|
||
namespace OpenRpg.Cards.Genres.Conventions | ||
{ | ||
public abstract class GenericDataCardWithEffects<T> : GenericDataCard<T> | ||
where T : IHasLocaleDescription, IHasEffects | ||
{ | ||
protected GenericDataCardWithEffects(T data) : base(data) | ||
{ } | ||
|
||
public override IEnumerable<Effect> Effects => Data.Effects; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using OpenRpg.Cards.Effects; | ||
using OpenRpg.Cards.Genres.Conventions; | ||
using OpenRpg.Cards.Types; | ||
|
||
namespace OpenRpg.Cards.Genres | ||
{ | ||
public class EffectCard : GenericDataCardWithEffects<CardEffects> | ||
{ | ||
public override int CardType => CardTypes.EffectCard; | ||
|
||
public EffectCard(CardEffects data) : base(data) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using OpenRpg.Cards.Types; | ||
using OpenRpg.Core.Effects; | ||
using OpenRpg.Items; | ||
using OpenRpg.Items.Extensions; | ||
|
||
namespace OpenRpg.Cards.Genres | ||
{ | ||
public class EquipmentCard : ICard | ||
{ | ||
public Guid UniqueId { get; set; } = Guid.NewGuid(); | ||
public string AssetCode { get; set; } | ||
|
||
public int CardType => CardTypes.EquipmentCard; | ||
public ICardVariables Variables { get; protected set; } = new DefaultCardVariables(); | ||
public IItem Data { get; } | ||
|
||
public EquipmentCard(IItem item) | ||
{ Data = item; } | ||
|
||
public string NameLocaleId => Data.ItemTemplate.NameLocaleId; | ||
public string DescriptionLocaleId => Data.ItemTemplate.DescriptionLocaleId; | ||
public IEnumerable<Effect> Effects => Data.GetItemEffects(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using OpenRpg.Cards.Types; | ||
using OpenRpg.Core.Effects; | ||
using OpenRpg.Items; | ||
using OpenRpg.Items.Extensions; | ||
|
||
namespace OpenRpg.Cards.Genres | ||
{ | ||
public class ItemCard : ICard | ||
{ | ||
public int CardType => CardTypes.ItemCard; | ||
public ICardVariables Variables { get; protected set; } = new DefaultCardVariables(); | ||
|
||
public IItem Data { get; } | ||
|
||
public ItemCard(IItem item) | ||
{ Data = item; } | ||
|
||
public string NameLocaleId => Data.ItemTemplate.NameLocaleId; | ||
public string DescriptionLocaleId => Data.ItemTemplate.DescriptionLocaleId; | ||
public IEnumerable<Effect> Effects => Data.GetItemEffects(); | ||
public string AssetCode { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using OpenRpg.Cards.Genres.Conventions; | ||
using OpenRpg.Cards.Types; | ||
using OpenRpg.Core.Races; | ||
|
||
namespace OpenRpg.Cards.Genres | ||
{ | ||
public class RaceCard : GenericDataCardWithEffects<IRaceTemplate> | ||
{ | ||
public override int CardType => CardTypes.RaceCard; | ||
|
||
public RaceCard(IRaceTemplate data) : base(data) {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using OpenRpg.Core.Common; | ||
using OpenRpg.Core.Effects; | ||
|
||
namespace OpenRpg.Cards | ||
{ | ||
public interface ICard : IHasLocaleDescription, IHasEffects | ||
{ | ||
int CardType { get; } | ||
ICardVariables Variables { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OpenRpg.Core.Variables; | ||
|
||
namespace OpenRpg.Cards | ||
{ | ||
public interface ICardVariables : IVariables<object> | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Version>0.0.0</Version> | ||
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks> | ||
<Title>OpenRpg.Cards</Title> | ||
<Authors>Grofit (LP)</Authors> | ||
<PackageLicenseUrl>https://github.com/openrpg/OpenRpg/blob/master/LICENSE</PackageLicenseUrl> | ||
<PackageProjectUrl>https://github.com/openrpg/OpenRpg</PackageProjectUrl> | ||
<Description>Adds a basic starting point for wrapping objects as cards for card game scenarios</Description> | ||
<PackageTags>rpg game-development xna monogame unity godot</PackageTags> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OpenRpg.Core\OpenRpg.Core.csproj" /> | ||
<ProjectReference Include="..\OpenRpg.Items\OpenRpg.Items.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace OpenRpg.Cards.Types | ||
{ | ||
public class CardTypes | ||
{ | ||
public static readonly int Unknown = 0; | ||
|
||
public static readonly int RaceCard = 1; | ||
public static readonly int ClassCard = 2; | ||
public static readonly int ItemCard = 3; | ||
public static readonly int EquipmentCard = 4; | ||
public static readonly int EffectCard = 5; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using OpenRpg.Core.Common; | ||
|
||
namespace OpenRpg.Combat.Abilities | ||
{ | ||
public class Ability : IHasDataId, IHasLocaleDescription | ||
{ | ||
public int Id { get; set; } | ||
public string NameLocaleId { get; set; } | ||
public string DescriptionLocaleId { get; set; } | ||
public IAbilityVariables AbilityVariables { get; set; } = new DefaultAbilityVariables(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using OpenRpg.Core.Variables; | ||
|
||
namespace OpenRpg.Combat.Abilities | ||
{ | ||
public class DefaultAbilityVariables : DefaultVariables<object>, IAbilityVariables | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using OpenRpg.Core.Variables; | ||
|
||
namespace OpenRpg.Combat.Abilities | ||
{ | ||
public interface IAbilityVariables : IVariables<object> | ||
{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.