using Cthangover.Core.Characters;
namespace Cthangover.CardBattle.Actions
{
///
/// Executor that adds a fixed amount of defence to the target character.
/// Defence acts as a damage-absorbing shield that is consumed before health when the
/// character takes damage (see ). The defence delta
/// comes from the "Defence" property on the action card.
/// Registered in under "physics/defence".
///
public class PhysicsDefenceActionCard : ActionBase
{
///
/// Unique identifier registered in as "physics/defence".
///
public override string ID => "PhysicsDefenceActionCard";
///
/// Adds a flat defence value to after deducting action points
/// from . The returned carries the
/// defence delta for floating text display.
///
public override ChangedAttributes Execute(ActionCharacter actionCard, Character user, Character target)
{
if (target == null || user == null || !CheckRequiredAndUsePoint(actionCard, user))
return new ChangedAttributes { Result = false };
var defenceDelta = actionCard.GetInt("Defence");
target.Attributes.Defence.Value += defenceDelta;
return new ChangedAttributes { Result = true, Target = { Defence = defenceDelta}};
}
}
}