Skip to content

Commit

Permalink
Have added cards project, also changed variables a bit
Browse files Browse the repository at this point in the history
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
grofit committed May 22, 2021
1 parent 36bfb34 commit 6864394
Show file tree
Hide file tree
Showing 37 changed files with 272 additions and 25 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
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
Expand Down
3 changes: 2 additions & 1 deletion build/pack.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dotnet pack ../src/OpenRpg.Combat -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Localization -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Data -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Quests -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Genres.Fantasy -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Genres.Fantasy -c Release -o ../../_dist /p:version=%version%
dotnet pack ../src/OpenRpg.Cards -c Release -o ../../_dist /p:version=%version%
9 changes: 9 additions & 0 deletions src/OpenRpg.Cards/DefaultCardVariables.cs
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
{

}
}
14 changes: 14 additions & 0 deletions src/OpenRpg.Cards/Effects/CardEffects.cs
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; }
}
}
13 changes: 13 additions & 0 deletions src/OpenRpg.Cards/Genres/ClassCard.cs
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) { }
}
}
25 changes: 25 additions & 0 deletions src/OpenRpg.Cards/Genres/Conventions/GenericDataCard.cs
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 src/OpenRpg.Cards/Genres/Conventions/GenericDataCardWithEffects.cs
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;
}
}
15 changes: 15 additions & 0 deletions src/OpenRpg.Cards/Genres/EffectCard.cs
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)
{
}
}
}
26 changes: 26 additions & 0 deletions src/OpenRpg.Cards/Genres/EquipmentCard.cs
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();
}
}
25 changes: 25 additions & 0 deletions src/OpenRpg.Cards/Genres/ItemCard.cs
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; }
}
}
13 changes: 13 additions & 0 deletions src/OpenRpg.Cards/Genres/RaceCard.cs
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) {}
}
}
11 changes: 11 additions & 0 deletions src/OpenRpg.Cards/ICard.cs
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; }
}
}
9 changes: 9 additions & 0 deletions src/OpenRpg.Cards/ICardVariables.cs
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>
{

}
}
19 changes: 19 additions & 0 deletions src/OpenRpg.Cards/OpenRpg.Cards.csproj
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>
13 changes: 13 additions & 0 deletions src/OpenRpg.Cards/Types/CardTypes.cs
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;
}
}
12 changes: 12 additions & 0 deletions src/OpenRpg.Combat/Abilities/Ability.cs
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();
}
}
9 changes: 9 additions & 0 deletions src/OpenRpg.Combat/Abilities/DefaultAbilityVariables.cs
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
{

}
}
7 changes: 7 additions & 0 deletions src/OpenRpg.Combat/Abilities/IAbilityVariables.cs
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>
{}
}
1 change: 0 additions & 1 deletion src/OpenRpg.Combat/OpenRpg.Combat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PackageTags>rpg game-development xna monogame unity godot</PackageTags>
</PropertyGroup>


<ItemGroup>
<ProjectReference Include="..\OpenRpg.Core\OpenRpg.Core.csproj" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Classes/DefaultClassTemplateVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Classes
{
public class DefaultClassTemplateVariables : DefaultVariables<float>, IClassTemplateVariables
public class DefaultClassTemplateVariables : DefaultVariables<object>, IClassTemplateVariables
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Classes/DefaultClassVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Classes
{
public class DefaultClassVariables : DefaultVariables<float>, IClassVariables
public class DefaultClassVariables : DefaultVariables<object>, IClassVariables
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Classes/IClassTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace OpenRpg.Core.Classes
{
public interface IClassTemplate : IHasDataId, IHasAssetCode, IHasEffects, IHasRequirements, IHasLocaleDescription
public interface IClassTemplate : IHasDataId, IHasEffects, IHasRequirements, IHasLocaleDescription
{
IClassTemplateVariables Variables { get; }
}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Classes/IClassTemplateVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Classes
{
public interface IClassTemplateVariables : IVariables<float>
public interface IClassTemplateVariables : IVariables<object>
{
}
}
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Classes/IClassVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Classes
{
public interface IClassVariables : IVariables<float>
public interface IClassVariables : IVariables<object>
{
}
}
7 changes: 0 additions & 7 deletions src/OpenRpg.Core/Common/IHasAssetCode.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Races/DefaultRaceTemplateVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Races
{
public class DefaultRaceTemplateVariables : DefaultVariables<float>, IRaceTemplateVariables
public class DefaultRaceTemplateVariables : DefaultVariables<object>, IRaceTemplateVariables
{

}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Races/IRaceTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace OpenRpg.Core.Races
{
public interface IRaceTemplate : IHasDataId, IHasAssetCode, IHasEffects, IHasRequirements, IHasLocaleDescription
public interface IRaceTemplate : IHasDataId, IHasEffects, IHasRequirements, IHasLocaleDescription
{
IRaceTemplateVariables Variables { get; }
}
Expand Down
2 changes: 1 addition & 1 deletion src/OpenRpg.Core/Races/IRaceTemplateVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Core.Races
{
public interface IRaceTemplateVariables : IVariables<float>
public interface IRaceTemplateVariables : IVariables<object>
{
}
}
2 changes: 1 addition & 1 deletion src/OpenRpg.Items/DefaultItemVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OpenRpg.Items
{
public class DefaultItemVariables : DefaultVariables<float>, IItemVariables
public class DefaultItemVariables : DefaultVariables<object>, IItemVariables
{

}
Expand Down
Loading

0 comments on commit 6864394

Please sign in to comment.