From 3d22dae83b8a80ba6bac493c6fd5b6012d98c239 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 19 Feb 2022 12:11:04 +0100 Subject: [PATCH] feat(combat): return current target from combat technique --- .../Techniques/ICombatTechnique.cs | 5 ++--- .../Techniques/SimpleAttackTechnique.cs | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Extensions/NosSmooth.Extensions.Combat/Techniques/ICombatTechnique.cs b/Extensions/NosSmooth.Extensions.Combat/Techniques/ICombatTechnique.cs index 3aa71ad..e75c22a 100644 --- a/Extensions/NosSmooth.Extensions.Combat/Techniques/ICombatTechnique.cs +++ b/Extensions/NosSmooth.Extensions.Combat/Techniques/ICombatTechnique.cs @@ -5,7 +5,6 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using NosSmooth.Extensions.Combat.Operations; -using OneOf.Types; using Remora.Results; namespace NosSmooth.Extensions.Combat.Techniques; @@ -32,8 +31,8 @@ public interface ICombatTechnique /// If error is returned, the combat will be cancelled. /// /// The combat state. - /// A result that may or may not succeed. - public Result HandleCombatStep(ICombatState state); + /// An id of the current target entity or an error. + public Result HandleCombatStep(ICombatState state); /// /// Handles an error from . diff --git a/Extensions/NosSmooth.Extensions.Combat/Techniques/SimpleAttackTechnique.cs b/Extensions/NosSmooth.Extensions.Combat/Techniques/SimpleAttackTechnique.cs index d754379..bccc608 100644 --- a/Extensions/NosSmooth.Extensions.Combat/Techniques/SimpleAttackTechnique.cs +++ b/Extensions/NosSmooth.Extensions.Combat/Techniques/SimpleAttackTechnique.cs @@ -63,7 +63,7 @@ public class SimpleAttackTechnique : ICombatTechnique } /// - public Result HandleCombatStep(ICombatState state) + public Result HandleCombatStep(ICombatState state) { var map = state.Game.CurrentMap; if (map is null) @@ -106,10 +106,10 @@ public class SimpleAttackTechnique : ICombatTechnique { if (skillResult.Error is SkillNotFoundError) { - return Result.FromSuccess(); + return _target.Id; } - return Result.FromError(skillResult); + return Result.FromError(skillResult); } _currentSkill = skillResult.Entity; @@ -141,7 +141,7 @@ public class SimpleAttackTechnique : ICombatTechnique state.UseSkill(_currentSkill, _target); } - return Result.FromSuccess(); + return _target.Id; } /// -- 2.49.0