更新
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Card;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using Continentis.MainGame.Commands;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
|
||||
@@ -2,7 +2,7 @@ using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using UnityEngine.Events;
|
||||
using SoftCircuits.Collections;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
{
|
||||
@@ -18,6 +18,9 @@ namespace Continentis.MainGame.Character
|
||||
public OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>> onFinishAttack; //完成攻击时,参数为被攻击目标和对应的攻击结果
|
||||
public OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>> onGetAttacked; //被攻击时,参数为攻击者和攻击结果
|
||||
|
||||
/// <summary> 在 Block/Shield/Health 计算之前触发,Buff 可修改 damage 或设置 isCancelled = true 来免疫本次伤害。</summary>
|
||||
public OrderedDictionary<string, PrioritizedAction<IncomingDamageModifier>> onBeforeReceiveDamage;
|
||||
|
||||
public OrderedDictionary<string, PrioritizedAction> onActionStart; //每次行动开始时
|
||||
public OrderedDictionary<string, PrioritizedAction> onActionEnd; //每次行动结束时
|
||||
|
||||
@@ -41,6 +44,7 @@ namespace Continentis.MainGame.Character
|
||||
onStartAttack = new OrderedDictionary<string, PrioritizedAction<CharacterBase>>();
|
||||
onFinishAttack = new OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>>();
|
||||
onGetAttacked = new OrderedDictionary<string, PrioritizedAction<CharacterBase, AttackResult>>();
|
||||
onBeforeReceiveDamage = new OrderedDictionary<string, PrioritizedAction<IncomingDamageModifier>>();
|
||||
|
||||
onBeforePlayCard = new OrderedDictionary<string, PrioritizedAction<CardInstance, List<CharacterBase>>>();
|
||||
onAfterPlayCard = new OrderedDictionary<string, PrioritizedAction<CardInstance, List<CharacterBase>>>();
|
||||
@@ -60,12 +64,12 @@ namespace Continentis.MainGame.Character
|
||||
|
||||
onActionStart.InsertByPriority("DefenseReset", new PrioritizedAction(() =>
|
||||
{
|
||||
if (owner.GetAttribute("KeepBlockOnActionStart") <= 0)
|
||||
if (owner.GetAttribute("KeepBlockOnRoundFirstActionStart") <= 0)
|
||||
{
|
||||
owner.SetAttribute("Block", 0);
|
||||
}
|
||||
|
||||
if (owner.GetAttribute("KeepDodgeOnActionStart") <= 0)
|
||||
if (owner.GetAttribute("KeepDodgeOnRoundFirstActionStart") <= 0)
|
||||
{
|
||||
owner.SetAttribute("Dodge", 0);
|
||||
}
|
||||
@@ -84,6 +88,24 @@ namespace Continentis.MainGame.Character
|
||||
|
||||
namespace Continentis.MainGame.Character
|
||||
{
|
||||
/// <summary>
|
||||
/// 伤害前置修改器:在伤害实际作用于 Health 之前,供 Buff 修改或取消伤害。
|
||||
/// 若 <see cref="isCancelled"/> 为 true,伤害将被完全吸收(不扣血、不经过 Block/Shield)。
|
||||
/// </summary>
|
||||
public class IncomingDamageModifier
|
||||
{
|
||||
public int damage;
|
||||
public bool isCancelled;
|
||||
public AttackContext context;
|
||||
|
||||
public IncomingDamageModifier(int damage, AttackContext context)
|
||||
{
|
||||
this.damage = damage;
|
||||
this.isCancelled = false;
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
|
||||
public class AttackResult
|
||||
{
|
||||
public CharacterBase attacker; //攻击者
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Continentis.MainGame.Card;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using SoftCircuits.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
@@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Continentis.MainGame.Card;
|
||||
using SLSFramework.General;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace Continentis.MainGame.Character
|
||||
//中性状态
|
||||
Taunt = 2000, //嘲讽
|
||||
Protected = 2001, //被保护
|
||||
Provoked = 2002, //被挑衅
|
||||
}
|
||||
|
||||
public partial class StatusSubmodule : SubmoduleBase<CharacterBase>
|
||||
@@ -26,6 +27,12 @@ namespace Continentis.MainGame.Character
|
||||
public Dictionary<StatusType, int> currentStatus;
|
||||
public bool isDead;
|
||||
|
||||
/// <summary>
|
||||
/// 挑衅者列表:当该角色处于 Provoked 状态时,只能攻击此列表中的角色。
|
||||
/// 由 Provoked Buff 负责维护(添加/移除)。
|
||||
/// </summary>
|
||||
public List<CharacterBase> provokers;
|
||||
|
||||
public StatusSubmodule(CharacterBase character) : base(character)
|
||||
{
|
||||
currentStatus = new Dictionary<StatusType, int>();
|
||||
@@ -35,6 +42,7 @@ namespace Continentis.MainGame.Character
|
||||
}
|
||||
|
||||
isDead = false;
|
||||
provokers = new List<CharacterBase>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user