Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Commit

Permalink
Merge branch 'genre-switch'
Browse files Browse the repository at this point in the history
  • Loading branch information
grofit committed Aug 20, 2021
2 parents c79137f + 89ce73e commit 3950d92
Show file tree
Hide file tree
Showing 71 changed files with 843 additions and 476 deletions.
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 0.19.{build}
version: 0.20.{build}
branches:
only:
- master
Expand All @@ -14,9 +14,9 @@ dotnet_csproj:
file_version: '{version}'
informational_version: '{version}'
before_build:
- cmd: nuget restore src/OpenRpg.Genres.Fantasy.sln
- cmd: nuget restore src/OpenRpg.Genres.sln
build:
project: src/OpenRpg.Genres.Fantasy.sln
project: src/OpenRpg.Genres.sln
publish_nuget: true
verbosity: minimal
artifacts:
Expand Down
4 changes: 4 additions & 0 deletions build/pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set version=0.7.00
dotnet pack ../src/OpenRpg.Genres -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.Scifi -c Release -o ../../_dist /p:version=%version%
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ This builds on top of the `OpenRpg` core library and adds common genres infrastr
[![Nuget Version][nuget-image]][nuget-url]
[![Join Discord Chat][discord-image]][discord-url]

This contains common fantasy related helpers, i.e providing helpers for str, dex, con, int, wis, cha releated stats and
## Summary
This contains common helpers for various genres, such as fantasy or scifi, i.e providing helpers for str, dex, con, int, wis, cha releated stats and
common item qualities and damage types which all adhere to common fantasy settings.

As with all layers on top of OpenRpg feel free to use parts or all of this as well as augment it to fit your needs.
Expand Down
18 changes: 0 additions & 18 deletions src/OpenRpg.Genres.Fantasy.sln

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
namespace OpenRpg.Genres.Fantasy.Combat.Modifiers
{
/// <summary>
/// This can be useful for those scenarios where you only want light to be seen as a healing mechanism not a damage one
/// This can be useful for those scenarios where you only want light to be seen as a healing mechanism not a damage one etc
/// </summary>
/// <remarks>
/// This is a purely optional helper
/// </remarks>
public class RemoveLightDamageModifier : IAttackModifier
public class RemoveDamageTypeModifier : IAttackModifier
{
public int DamageType { get; }

public RemoveDamageTypeModifier(int damageType)
{ DamageType = damageType; }

public bool ShouldApply(Attack attack) => true;

public Attack ModifyValue(Attack attack)
{
attack.Damages = attack.Damages.Where(x => x.Type != DamageTypes.LightDamage).ToArray();
attack.Damages = attack.Damages.Where(x => x.Type != DamageType).ToArray();
return attack;
}
}
Expand Down
26 changes: 0 additions & 26 deletions src/OpenRpg.Genres.Fantasy/Defaults/DefaultCharacter.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using OpenRpg.Core.Effects;
using OpenRpg.Core.Extensions;
using OpenRpg.Core.Stats;
using OpenRpg.Genres.Fantasy.Characters;
using OpenRpg.Genres.Fantasy.Effects;
using OpenRpg.Genres.Fantasy.Extensions;
using OpenRpg.Genres.Fantasy.Stats;
Expand Down
20 changes: 0 additions & 20 deletions src/OpenRpg.Genres.Fantasy/Defaults/DefaultEquipment.cs

This file was deleted.

26 changes: 0 additions & 26 deletions src/OpenRpg.Genres.Fantasy/Equipment/IEquipment.cs

This file was deleted.

59 changes: 13 additions & 46 deletions src/OpenRpg.Genres.Fantasy/Extensions/EquipmentExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,54 +1,21 @@
using System.Collections.Generic;
using System.Linq;
using OpenRpg.Core.Effects;
using OpenRpg.Genres.Fantasy.Equipment;
using OpenRpg.Items;
using OpenRpg.Genres.Fantasy.Equipment.Slots;
using OpenRpg.Genres.Fantasy.Types;
using OpenRpg.Items.Equipment;
using OpenRpg.Items.Extensions;

namespace OpenRpg.Genres.Fantasy.Extensions
{
public static class EquipmentExtensions
{
public static IEnumerable<IEquipmentSlot<IItem>> GetEquipmentSlots(this IEquipment equipment)
{
yield return equipment.BackSlot;
yield return equipment.FootSlot;
yield return equipment.HeadSlot;
yield return equipment.NeckSlot;
yield return equipment.Ring1Slot;
yield return equipment.Ring2Slot;
yield return equipment.WristSlot;
yield return equipment.OffHandSlot;
yield return equipment.MainHandSlot;
yield return equipment.LowerBodySlot;
yield return equipment.UpperBodySlot;
}

private static void ProcessEquipmentSlot(IEquipmentSlot<IItem> equipmentSlot, List<Effect> effectList)
{
if(equipmentSlot?.SlottedItem == null) { return; }
var effects = equipmentSlot.SlottedItem.GetItemEffects();
effectList.AddRange(effects);
}

public static ICollection<Effect> GetEquipmentEffects(this IEquipment equipment)
{
var equipmentEffects = new List<Effect>();

ProcessEquipmentSlot(equipment.NeckSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.OffHandSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.LowerBodySlot, equipmentEffects);
ProcessEquipmentSlot(equipment.UpperBodySlot, equipmentEffects);
ProcessEquipmentSlot(equipment.BackSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.FootSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.HeadSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.Ring1Slot, equipmentEffects);
ProcessEquipmentSlot(equipment.Ring2Slot, equipmentEffects);
ProcessEquipmentSlot(equipment.WristSlot, equipmentEffects);
ProcessEquipmentSlot(equipment.MainHandSlot, equipmentEffects);

return equipmentEffects;
}
public static BackSlot BackSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.BackSlot) as BackSlot;
public static FootSlot FootSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.FootSlot) as FootSlot;
public static HeadSlot HeadSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.HeadSlot) as HeadSlot;
public static NeckSlot NeckSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.NeckSlot) as NeckSlot;
public static RingSlot Ring1Slot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.Ring1Slot) as RingSlot;
public static RingSlot Ring2Slot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.Ring2Slot) as RingSlot;
public static WristSlot WristSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.WristSlot) as WristSlot;
public static OffHandSlot OffHandSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.OffHandSlot) as OffHandSlot;
public static MainHandSlot MainHandSlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.MainHandSlot) as MainHandSlot;
public static LowerBodySlot LowerBodySlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.LowerBodySlot) as LowerBodySlot;
public static UpperBodySlot UpperBodySlot(this IEquipment equipment) => equipment.Slots.Get(EquipmentSlotTypes.UpperBodySlot) as UpperBodySlot;
}
}
Loading

0 comments on commit 3950d92

Please sign in to comment.