Commit pending working-tree changes (local edits, line endings)
This commit is contained in:
1 parent
6f61990b71
commit
18616852e1
5 files changed
+1315
-1315
No files matched your search
@@ -1,56 +1,56 @@
|
||||
using Cthangover.Core.Cards.StatusEffect;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a physical attack action. Calculates damage as
|
||||
/// <c>action.Attack × user.Attack</c>, then routes through
|
||||
/// <see cref="StatusEffectQueue.OnDealDamage"/> and
|
||||
/// <see cref="StatusEffectQueue.OnTakeDamage"/> for status-effect
|
||||
/// hooks. Subtraction is applied defence-first: <see cref="CharacterAttributes.Defence"/>
|
||||
/// absorbs damage point-for-point before health is reduced.
|
||||
/// Registered under ID <c>"physics/attack"</c>.
|
||||
/// </summary>
|
||||
public class FFDamageExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFDamageExecutor";
|
||||
|
||||
/// <summary>Applies attack damage with status hooks and defence absorption; consumes the action's required points.</summary>
|
||||
public override ChangedAttributes Execute(ActionCharacter action, Character user, Character target)
|
||||
{
|
||||
if (target == null || user == null || !CheckRequiredAndUsePoint(action, user))
|
||||
return new ChangedAttributes { Result = false };
|
||||
|
||||
var damageDelta = Mathf.RoundToInt(action.GetFloat("Attack", 1f) * user.Attributes.Attack.Value);
|
||||
StatusEffectService.Of(target).OnTakeDamage(user, ref damageDelta);
|
||||
StatusEffectService.Of(user).OnDealDamage(target, ref damageDelta);
|
||||
|
||||
var defenceDelta = 0;
|
||||
var ignoreArmor = user.HasPassiveEffect("IgnoreArmor");
|
||||
if (!ignoreArmor && target.Attributes.Defence.Value > 0)
|
||||
{
|
||||
defenceDelta = target.Attributes.Defence.Value >= damageDelta
|
||||
? damageDelta
|
||||
: target.Attributes.Defence.Value;
|
||||
damageDelta -= defenceDelta;
|
||||
}
|
||||
|
||||
target.Attributes.Defence.Value -= defenceDelta;
|
||||
target.Attributes.Health.Value -= damageDelta;
|
||||
|
||||
GameLogger.Log("FF_BATTLE",
|
||||
$"{user.Name} attacks {target.Name}: damage={damageDelta} defence={defenceDelta}",
|
||||
LogLevel.Debug);
|
||||
|
||||
return new ChangedAttributes
|
||||
{
|
||||
Result = true,
|
||||
Target = { Damage = damageDelta, Defence = -defenceDelta }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
using Cthangover.Core.Cards.StatusEffect;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a physical attack action. Calculates damage as
|
||||
/// <c>action.Attack × user.Attack</c>, then routes through
|
||||
/// <see cref="StatusEffectQueue.OnDealDamage"/> and
|
||||
/// <see cref="StatusEffectQueue.OnTakeDamage"/> for status-effect
|
||||
/// hooks. Subtraction is applied defence-first: <see cref="CharacterAttributes.Defence"/>
|
||||
/// absorbs damage point-for-point before health is reduced.
|
||||
/// Registered under ID <c>"physics/attack"</c>.
|
||||
/// </summary>
|
||||
public class FFDamageExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFDamageExecutor";
|
||||
|
||||
/// <summary>Applies attack damage with status hooks and defence absorption; consumes the action's required points.</summary>
|
||||
public override ChangedAttributes Execute(ActionCharacter action, Character user, Character target)
|
||||
{
|
||||
if (target == null || user == null || !CheckRequiredAndUsePoint(action, user))
|
||||
return new ChangedAttributes { Result = false };
|
||||
|
||||
var damageDelta = Mathf.RoundToInt(action.GetFloat("Attack", 1f) * user.Attributes.Attack.Value);
|
||||
StatusEffectService.Of(target).OnTakeDamage(user, ref damageDelta);
|
||||
StatusEffectService.Of(user).OnDealDamage(target, ref damageDelta);
|
||||
|
||||
var defenceDelta = 0;
|
||||
var ignoreArmor = user.HasPassiveEffect("IgnoreArmor");
|
||||
if (!ignoreArmor && target.Attributes.Defence.Value > 0)
|
||||
{
|
||||
defenceDelta = target.Attributes.Defence.Value >= damageDelta
|
||||
? damageDelta
|
||||
: target.Attributes.Defence.Value;
|
||||
damageDelta -= defenceDelta;
|
||||
}
|
||||
|
||||
target.Attributes.Defence.Value -= defenceDelta;
|
||||
target.Attributes.Health.Value -= damageDelta;
|
||||
|
||||
GameLogger.Log("FF_BATTLE",
|
||||
$"{user.Name} attacks {target.Name}: damage={damageDelta} defence={defenceDelta}",
|
||||
LogLevel.Debug);
|
||||
|
||||
return new ChangedAttributes
|
||||
{
|
||||
Result = true,
|
||||
Target = { Damage = damageDelta, Defence = -defenceDelta }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,34 @@
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a defensive action (buff/barrier). Increases the target's
|
||||
/// <see cref="CharacterAttributes.Defence"/> by the value stored in
|
||||
/// the <c>"Defence"</c> property on the action (default 4).
|
||||
/// Defence acts as a shield against incoming physical damage in the
|
||||
/// <see cref="FFDamageExecutor"/>. Registered under ID <c>"physics/defence"</c>.
|
||||
/// </summary>
|
||||
public class FFDefenceExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFDefenceExecutor";
|
||||
|
||||
/// <summary>Adds the action's "Defence" value (default 4) to the target's defence shield.</summary>
|
||||
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 } };
|
||||
}
|
||||
}
|
||||
}
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes a defensive action (buff/barrier). Increases the target's
|
||||
/// <see cref="CharacterAttributes.Defence"/> by the value stored in
|
||||
/// the <c>"Defence"</c> property on the action (default 4).
|
||||
/// Defence acts as a shield against incoming physical damage in the
|
||||
/// <see cref="FFDamageExecutor"/>. Registered under ID <c>"physics/defence"</c>.
|
||||
/// </summary>
|
||||
public class FFDefenceExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFDefenceExecutor";
|
||||
|
||||
/// <summary>Adds the action's "Defence" value (default 4) to the target's defence shield.</summary>
|
||||
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 } };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +1,37 @@
|
||||
using Cthangover.Core.Cards.StatusEffect;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies a stun status effect to the target for a configurable number of turns.
|
||||
/// Reads the turn count from the <c>"Turn"</c> property on the action (default 3).
|
||||
/// Stunned characters are skipped during turn iteration in
|
||||
/// <see cref="FFBattleCore.TryNextCharacterOrEndTurn"/> and
|
||||
/// <see cref="FFBattleCore.RunEnemyTurn"/>. Registered under ID <c>"physics/stun"</c>.
|
||||
/// </summary>
|
||||
public class FFStunExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFStunExecutor";
|
||||
|
||||
/// <summary>Adds the stun effect for the action's "Turn" count (default 3); stun-immune targets consume the points but stay un-stunned.</summary>
|
||||
public override ChangedAttributes Execute(ActionCharacter action, Character user, Character target)
|
||||
{
|
||||
if (target == null || user == null || !CheckRequiredAndUsePoint(action, user))
|
||||
return new ChangedAttributes { Result = false };
|
||||
|
||||
if (target.HasPassiveEffect("StunImmune"))
|
||||
return new ChangedAttributes { Result = true };
|
||||
|
||||
var turns = action.GetInt("Turn", 3);
|
||||
StatusEffectService.Of(target).Add("effect/physics/stun", turns);
|
||||
GameLogger.Log("FF_BATTLE",
|
||||
$"{user.Name} stuns {target.Name} for {turns} turns",
|
||||
LogLevel.Debug);
|
||||
|
||||
return new ChangedAttributes { Result = true };
|
||||
}
|
||||
}
|
||||
}
|
||||
using Cthangover.Core.Cards.StatusEffect;
|
||||
using Cthangover.Core.Characters;
|
||||
using Cthangover.Core.Utils;
|
||||
|
||||
namespace Cthangover.FFBattle.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Applies a stun status effect to the target for a configurable number of turns.
|
||||
/// Reads the turn count from the <c>"Turn"</c> property on the action (default 3).
|
||||
/// Stunned characters are skipped during turn iteration in
|
||||
/// <see cref="FFBattleCore.TryNextCharacterOrEndTurn"/> and
|
||||
/// <see cref="FFBattleCore.RunEnemyTurn"/>. Registered under ID <c>"physics/stun"</c>.
|
||||
/// </summary>
|
||||
public class FFStunExecutor : ActionBase
|
||||
{
|
||||
/// <summary>Hub registry key for this executor.</summary>
|
||||
public override string ID => "FFStunExecutor";
|
||||
|
||||
/// <summary>Adds the stun effect for the action's "Turn" count (default 3); stun-immune targets consume the points but stay un-stunned.</summary>
|
||||
public override ChangedAttributes Execute(ActionCharacter action, Character user, Character target)
|
||||
{
|
||||
if (target == null || user == null || !CheckRequiredAndUsePoint(action, user))
|
||||
return new ChangedAttributes { Result = false };
|
||||
|
||||
if (target.HasPassiveEffect("StunImmune"))
|
||||
return new ChangedAttributes { Result = true };
|
||||
|
||||
var turns = action.GetInt("Turn", 3);
|
||||
StatusEffectService.Of(target).Add("effect/physics/stun", turns);
|
||||
GameLogger.Log("FF_BATTLE",
|
||||
$"{user.Name} stuns {target.Name} for {turns} turns",
|
||||
LogLevel.Debug);
|
||||
|
||||
return new ChangedAttributes { Result = true };
|
||||
}
|
||||
}
|
||||
}
|
||||
+1151
-1151
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user