狗屎Minimax坏我代码
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Cielonos.MainGame.Characters;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Characters.Inventory.Collections
|
||||
{
|
||||
public class OverloadBattery : PassiveEquipmentBase
|
||||
{
|
||||
private bool _isBuffActive = false;
|
||||
|
||||
public override void OnObtained()
|
||||
{
|
||||
// 直接订阅由 OverloadSubmodule 抛出的满溢满充爆气事件
|
||||
if (overloadSm != null)
|
||||
{
|
||||
overloadSm.OnTriggered += TriggerOverloadEffect;
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerOverloadEffect()
|
||||
{
|
||||
// 挂载增伤 Buff
|
||||
_isBuffActive = true;
|
||||
|
||||
// 为下一次攻击进行截流修饰(利用上一个阶段优化提升完毕的 EventSubmodule 架构)
|
||||
Action<AttackAreaBase, CharacterBase, AttackResult> onStartAttack = OnStartAttack;
|
||||
|
||||
if (!player.eventSm.onStartAttack.ContainsKey("OverloadBattery_DamageBoost"))
|
||||
{
|
||||
player.eventSm.onStartAttack.Add("OverloadBattery_DamageBoost", onStartAttack.ToPrioritized());
|
||||
MainGameManager.BaseCollection.InfoText().Spawn(player.centerPosition, "Overload Battery Boost").SetScale(0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStartAttack(AttackAreaBase attackArea, CharacterBase target, AttackResult attackResult)
|
||||
{
|
||||
if (!_isBuffActive) return;
|
||||
|
||||
// 拦截检查:必须是重突破等级(BreakthroughType.Heavy)
|
||||
// 如果不是重攻击,我们就避让不进行任何修饰,且不消耗掉 Buff 的开启状态
|
||||
if (attackResult.attackValue.breakthroughType != BreakthroughType.Heavy) return;
|
||||
|
||||
// 最终伤害提升 50%。上个方案中我们留下了 damageMultiplier,天然完美支持翻倍操作。
|
||||
attackResult.attackValue.damageMultiplier += 0.5f;
|
||||
_isBuffActive = false;
|
||||
// “一次性”触发,修饰完毕后从玩家的攻击起手事件池里销毁自身,不沾染下一次无关的攻击。
|
||||
player.eventSm.onStartAttack.Remove("OverloadBattery_DamageBoost");
|
||||
}
|
||||
|
||||
public override void OnDiscarded()
|
||||
{
|
||||
base.OnDiscarded();
|
||||
|
||||
player.eventSm.onStartAttack.Remove("OverloadBattery_DamageBoost");
|
||||
|
||||
if (overloadSm != null)
|
||||
{
|
||||
overloadSm.OnTriggered -= TriggerOverloadEffect;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user