Files
Continentis/Assets/Mods/Basic/Characters/CombatBuffs/MarshalOfTheUnderworld/Basic_Hellfire.cs
SoulliesOfficial 1bca620966 AttackResult修改
2025-11-08 22:22:43 -05:00

48 lines
1.8 KiB
C#

using System.Collections.Generic;
using Continentis.MainGame;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Buffs
{
public sealed class Basic_Hellfire : CharacterCombatBuffBase
{
public Basic_Hellfire(int stack)
{
Initialize(BuffType.Negative, BuffDispelLevel.Strong);
this.contentSubmodule = new ContentSubmodule(this)
.AddParameterGetter("Stack", () => unitedStackSubmodule.stackAmount.ToString());
this.iconSubmodule = new IconSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
this.eventSubmodule = new EventSubmodule(this);
this.eventSubmodule.onAfterPlayCard.Add("Basic_Hellfire", new PrioritizedAction<CardInstance, List<CharacterBase>>(OnAfterPlayCard));
}
public override bool OnBuffApply(out CharacterCombatBuffBase existingBuff)
{
MainGameManager.Instance.basePrefabs.GenerateInfoText("Hellfire", attachedCharacter.characterView);
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.AddStack(this.unitedStackSubmodule.stackAmount);
return false;
}
return true;
}
private void OnAfterPlayCard(CardInstance card, List<CharacterBase> targets)
{
int reducedStack = Mathf.Max(1, Mathf.FloorToInt(unitedStackSubmodule.stackAmount * 0.2f));
sourceCharacter.Attack(attachedCharacter, reducedStack, null, true);
unitedStackSubmodule.ReduceStack(reducedStack);
iconSubmodule.Update();
}
}
}