Files
Continentis/Assets/Mods/Basic/Cards/Scripts/Mage/Abundant.cs
2025-11-01 06:13:58 -04:00

72 lines
2.5 KiB
C#

using System.Collections.Generic;
using Continentis.MainGame;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using Continentis.MainGame.Commands;
using Continentis.Mods.Basic.Buffs;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic
{
namespace Cards
{
public class Abundant : CardLogicBase
{
protected override void SetUpLogicComponents()
{
AddLogicComponent<CardLogicComponent_SelectHandCards>().SetCondition(SelectCondition).SetEffect(SelectEffect);
}
protected override CommandBase PlayEffect(List<CharacterBase> targetList)
{
CommandGroup mainGroup = new CommandGroup(ExecutionMode.Sequential,
new Cmd_PlayAnimation(user.characterView, "Skill"));
LogicComponent<CardLogicComponent_SelectHandCards>().AddSelectionCommands(ref mainGroup);
return mainGroup;
}
private bool SelectCondition(CardInstance card)
{
return card.cardLogic.contentSubmodule.cardType is CardType.Attack && card.cardLogic.HasKeyword("Magic");
}
private void SelectEffect(CardInstance card)
{
CreateCardBuff<Buffs.Abundant>(GetAttribute("BuffStack_Abundant")).Apply(card.cardLogic, user, this);
}
}
}
namespace Buffs
{
public class Abundant : CardCombatBuffBase
{
public Abundant(int stack)
{
Initialize(BuffType.Positive, BuffDispelLevel.Strong);
this.contentSubmodule = new ContentSubmodule(this);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, true, -1, stack);
this.attributeSubmodule = new AttributeSubmodule(this);
this.attributeSubmodule.numericChange.Add("Damage", stack);
}
public override bool OnBuffApply(out CardCombatBuffBase existingBuff)
{
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.unitedStackSubmodule.ModifyStack(this.unitedStackSubmodule.stackAmount);
int newStack = existingBuff.unitedStackSubmodule.stackAmount;
existingBuff.attributeSubmodule.numericChange["Damage"] = newStack;
return false;
}
return true;
}
}
}
}