Files
Continentis/Assets/Mods/Basic/Cards/Scripts/Cleric/ChainBlessing.cs
2025-11-13 00:58:50 -06:00

54 lines
1.9 KiB
C#

using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using Continentis.MainGame.Commands;
using SLSFramework.General;
using System.Collections.Generic;
using UnityEngine;
namespace Continentis.Mods.Basic.Cards.Cleric
{
public class ChainBlessing : CardLogicBase
{
protected override void SetUpLogicComponents()
{
AddLogicComponent<CardLogicComponent_GenerateCards>();
}
protected override List<CommandBase> PlayEffect(List<CharacterBase> targetList)
{
CommandGroup mainGroup = new CommandGroup(ExecutionMode.Sequential);
mainGroup.AddCommand(new Cmd_PlayAnimation(user.characterView, "Skill"));
mainGroup.AddCommand(new Cmd_Function(() =>
{
//Get powe cards in hand
var powerCards = new List<CardInstance>();
foreach (var card in user.deckSubmodule.HandPile)
{
if (card.cardLogic.contentSubmodule.cardType == MainGame.Card.CardType.Power)
{
powerCards.Add(card);
}
}
if (powerCards.TryGetRandom(out CardInstance randomPowerCard))
{
var copyCount = GetAttribute("CopyCount");
for (int i = 0; i < copyCount; i++)
{
CardInstance newCard = CardInstance.GenerateCardInstance(randomPowerCard.cardLogic, user, "Hand");
newCard.cardLogic.SetAttribute("StaminaCost", 0);
newCard.GenerateHandCardView("Hand");
}
}
else
{
Debug.LogWarning("ChainBlessing: No other power cards in hand to copy.");
}
}));
return new List<CommandBase> { mainGroup };
}
}
}