48 lines
1.7 KiB
C#
48 lines
1.7 KiB
C#
|
|
using System.Text;
|
||
|
|
using Cielonos.MainGame.Characters;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace Cielonos.MainGame
|
||
|
|
{
|
||
|
|
public static partial class Attack
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 攻击上下文:在伤害结算前传递,允许订阅者修改攻击参数和前置决策标记。
|
||
|
|
/// </summary>
|
||
|
|
public class Context
|
||
|
|
{
|
||
|
|
public CharacterBase attacker;
|
||
|
|
public CharacterBase target;
|
||
|
|
public Vector3 hitPosition;
|
||
|
|
public string spamGroupID;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 可修改的攻击值。订阅者可在结算前调整 damageMultiplier、additionalFlatDamage 等。
|
||
|
|
/// </summary>
|
||
|
|
public Value value;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 前置否决标记:设为 true 会跳过伤害结算,让攻击无效化。
|
||
|
|
/// </summary>
|
||
|
|
public bool isDenied;
|
||
|
|
|
||
|
|
public Context(CharacterBase attacker, CharacterBase target,
|
||
|
|
string spamGroupMainPart, Vector3 hitPosition = default)
|
||
|
|
{
|
||
|
|
this.attacker = attacker;
|
||
|
|
this.target = target;
|
||
|
|
|
||
|
|
StringBuilder fullIDBuilder = new StringBuilder();
|
||
|
|
fullIDBuilder.Append(attacker is null ? "Null" : attacker.GetInstanceID().ToString());
|
||
|
|
fullIDBuilder.Append("_");
|
||
|
|
fullIDBuilder.Append(spamGroupMainPart);
|
||
|
|
fullIDBuilder.Append("_");
|
||
|
|
fullIDBuilder.Append(target is null ? "Null" : target.GetInstanceID().ToString());
|
||
|
|
|
||
|
|
this.spamGroupID = fullIDBuilder.ToString();
|
||
|
|
this.hitPosition = hitPosition;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|