更新
This commit is contained in:
@@ -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; //攻击者
|
||||
|
||||
Reference in New Issue
Block a user