Files
Continentis/Assets/Mods/Basic/Cards/Scripts/Cleric/ChainBlessing.cs
SoulliesOfficial d09b58fd80 架构大更
2026-03-20 11:56:50 -04:00

50 lines
1.7 KiB
C#

using System.Collections.Generic;
using Continentis.MainGame.Card;
using Continentis.MainGame.Character;
using Continentis.MainGame.Commands;
using SLSFramework.General;
using UnityEngine;
namespace Continentis.Mods.Basic.Cards.Cleric
{
public class ChainBlessing : CardLogicBase
{
public override void SetUpLogicComponents()
{
AddLogicComponent<CardLogicComponent_GenerateCards>();
}
public override CommandGroup PlayEffect(List<CharacterBase> targetList)
{
return Cmd.Sequential(
new Cmd_PlayAnimation(user.characterView, "Skill"),
Cmd.Do(() =>
{
var powerCards = new List<CardInstance>();
foreach (var card in user.deckSubmodule.HandPile)
{
if (card.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, user, "Hand");
newCard.cardLogic.SetAttribute("StaminaCost", 0);
newCard.GenerateHandCardView("Hand");
}
}
else
{
Debug.LogWarning("ChainBlessing: No power cards in hand to copy.");
}
})
);
}
}
}