2026-02-13 09:22:11 -05:00
|
|
|
using SLSUtilities.General;
|
2026-01-03 18:19:39 -05:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2026-03-20 12:07:44 -04:00
|
|
|
namespace Cielonos.MainGame.Characters.Inventory.Collections
|
2026-01-03 18:19:39 -05:00
|
|
|
{
|
|
|
|
|
public class AutomaticShield : ConsumableBase
|
|
|
|
|
{
|
|
|
|
|
public override void OnObtained()
|
|
|
|
|
{
|
|
|
|
|
base.OnObtained();
|
2026-03-20 12:07:44 -04:00
|
|
|
player.eventSm.onBeforeGetAttacked.Add("AutomaticShield", new PrioritizedAction<AttackAreaBase, AttackResult>(CheckAndEffect));
|
2026-01-03 18:19:39 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnDiscarded()
|
|
|
|
|
{
|
|
|
|
|
base.OnDiscarded();
|
|
|
|
|
player.eventSm.onBeforeGetAttacked.Remove("AutomaticShield");
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 12:07:44 -04:00
|
|
|
void CheckAndEffect(AttackAreaBase attackArea, AttackResult attackResult)
|
2026-01-03 18:19:39 -05:00
|
|
|
{
|
2026-03-20 12:07:44 -04:00
|
|
|
if (attackResult.attackValue.damage > 1f)
|
2026-01-03 18:19:39 -05:00
|
|
|
{
|
|
|
|
|
if (Use(1))
|
|
|
|
|
{
|
2026-03-20 12:07:44 -04:00
|
|
|
// 使用最新的管线标记使其伤害彻底作废:
|
|
|
|
|
attackResult.isImmune = true;
|
|
|
|
|
attackResult.attackValue.damageMultiplier = 0f;
|
|
|
|
|
|
2026-01-03 18:19:39 -05:00
|
|
|
CameraEffectManager.Instance.vignetteEffects["Shield"].mainEffect.Play();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|