using Cthangover.Core.Characters;
using Cthangover.Core.Utils;
namespace Cthangover.FFBattle.Actions
{
///
/// Executes a defensive action (buff/barrier). Increases the target's
/// by the value stored in
/// the "Defence" property on the action (default 4).
/// Defence acts as a shield against incoming physical damage in the
/// . Registered under ID "physics/defence".
///
public class FFDefenceExecutor : ActionBase
{
/// Hub registry key for this executor.
public override string ID => "FFDefenceExecutor";
/// Adds the action's "Defence" value (default 4) to the target's defence shield.
public override ChangedAttributes Execute(ActionCharacter action, Character user, Character target)
{
if (target == null || user == null || !CheckRequiredAndUsePoint(action, user))
return new ChangedAttributes { Result = false };
var defenceDelta = action.GetInt("Defence", 4);
target.Attributes.Defence.Value += defenceDelta;
GameLogger.Log("FF_BATTLE",
$"{user.Name} defends → +{defenceDelta} defence for {target?.Name}",
LogLevel.Debug);
return new ChangedAttributes { Result = true, Target = { Defence = defenceDelta } };
}
}
}