更新
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Card;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
@@ -12,9 +13,32 @@ namespace Continentis.MainGame.Character
|
||||
public int currentAction;
|
||||
public List<ActionRecord> actionRecords;
|
||||
|
||||
/// <summary>
|
||||
/// 记录角色本回合被攻击的次数(含闪避)。
|
||||
/// 每次 onGetAttacked 触发时自增,每次 DispatchRoundStart 时归零。
|
||||
/// 可被卡牌(如"不屈")用于判断"本回合是否被攻击过"。
|
||||
/// </summary>
|
||||
public int attacksReceivedThisRound;
|
||||
|
||||
public RecordSubmodule(CharacterBase owner) : base(owner)
|
||||
{
|
||||
actionRecords = new List<ActionRecord>();
|
||||
|
||||
// 自动挂钩:每次被攻击时计数
|
||||
owner.eventSubmodule.onGetAttacked.InsertByPriority(
|
||||
"RecordSubmodule_AttackCount",
|
||||
new PrioritizedAction<CharacterBase, AttackResult>((attacker, result) =>
|
||||
{
|
||||
attacksReceivedThisRound++;
|
||||
}));
|
||||
|
||||
// 自动挂钩:回合开始时重计
|
||||
owner.eventSubmodule.onRoundStart.InsertByPriority(
|
||||
"RecordSubmodule_ResetAttackCount",
|
||||
new PrioritizedAction(() =>
|
||||
{
|
||||
attacksReceivedThisRound = 0;
|
||||
}));
|
||||
}
|
||||
|
||||
public void SetAction(int round, int actionIndex)
|
||||
@@ -23,6 +47,11 @@ namespace Continentis.MainGame.Character
|
||||
currentAction = actionIndex;
|
||||
actionRecords.Add(new ActionRecord(round, actionIndex, new List<CardInstance>()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回本回合是否已被攻击过至少一次。
|
||||
/// </summary>
|
||||
public bool WasAttackedThisRound => attacksReceivedThisRound > 0;
|
||||
}
|
||||
|
||||
public partial class RecordSubmodule
|
||||
|
||||
Reference in New Issue
Block a user