| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- // Firamon
- namespace DCGO.CardEffects.BT25
- {
- public class BT25_013 : CEntity_Effect
- {
- public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
- {
- List<ICardEffect> cardEffects = new List<ICardEffect>();
- #region Alt Digivolution Condition
- if (timing == EffectTiming.None)
- {
- static bool PermanentCondition(Permanent targetPermanent)
- {
- return targetPermanent.TopCard.HasTSTraits;
- }
- cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
- }
- #endregion
- #region Shared OP/WD
- string SharedEffectName = "May trash 1 card to recover 1 red or blue [Iliad] trait Digimon card from trash";
- CardEffectFactory.ActivateClassesForSharedEffects
- (ref cardEffects, timing, card,
- SharedEffectName,
- SharedActivateCoroutine,
- SharedEffectDescription,
- optional: false,
- isSkippable: true,
- onPlay: true,
- whenDigivolving: true);
- string SharedEffectDescription(string tag)
- {
- return $"[{tag}] By trashing 1 card in your hand, you may return 1 red or blue [Iliad] trait Digimon card from your trash to the hand.";
- }
- IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
- {
- if (card.Owner.HandCards.Count >= 1)
- {
- SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
- selectHandEffect.SetUp(
- selectPlayer: card.Owner,
- canTargetCondition: _ => true,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- maxCount: 1,
- canNoSelect: true,
- canEndNotMax: false,
- isShowOpponent: true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: AfterSelectCardCoroutine,
- mode: SelectHandEffect.Mode.Discard,
- cardEffect: activateClass);
- yield return StartCoroutine(selectHandEffect.Activate());
- IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
- {
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.IsDigimon
- && cardSource.HasIliadTraits
- && (cardSource.HasCardColor(CardColor.Red, isDigimonOnly: true)
- || cardSource.HasCardColor(CardColor.Blue, isDigimonOnly: true));
- }
- if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
- {
- int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
- SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
- selectCardEffect.SetUp(
- canTargetCondition: CanSelectCardCondition,
- canTargetCondition_ByPreSelecetedList: null,
- canEndSelectCondition: null,
- canNoSelect: () => true,
- selectCardCoroutine: null,
- afterSelectCardCoroutine: null,
- message: "Select 1 card to add to your hand.",
- maxCount: maxCount,
- canEndNotMax: false,
- isShowOpponent: true,
- mode: SelectCardEffect.Mode.AddHand,
- root: SelectCardEffect.Root.Trash,
- customRootCardList: null,
- canLookReverseCard: true,
- selectPlayer: card.Owner,
- cardEffect: activateClass);
- yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
- }
- }
- }
- }
- #endregion
- #region Your Turn
- if (timing == EffectTiming.OnEnterFieldAnyone)
- {
- ActivateClass activateClass = new ActivateClass();
- activateClass.SetUpICardEffect("Digivolve into [Flaremon] in hand for 1 less", CanUseCondition, card);
- activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
- activateClass.SetIsSkippable(true);
- cardEffects.Add(activateClass);
- string EffectDescription() => "[Your Turn] When your Digimon are played or digivolve, if any of them are blue, this Digimon may digivolve into [Flaremon] in the hand with the cost reduced by 1.";
- bool CanUseCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.IsOwnerTurn(card)
- && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)
- || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition));
- }
- bool CanActivateCondition(Hashtable hashtable)
- {
- return CardEffectCommons.IsExistOnBattleArea(card)
- && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition)
- && HasValidColor(hashtable);
- }
- bool HasValidColor(Hashtable hashtable)
- {
- List<Hashtable> hashtables = CardEffectCommons.GetHashtablesFromHashtable(hashtable);
- return hashtables.Map(CardEffectCommons.GetPermanentFromHashtable).Any(HasCorrectColorPermanent);
- }
- bool HasCorrectColorPermanent(Permanent permanent)
- {
- return PermanentCondition(permanent)
- && permanent.TopCard.CardColors.Contains(CardColor.Blue);
- }
- bool PermanentCondition(Permanent permanent)
- {
- return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
- }
- bool CanSelectCardCondition(CardSource cardSource)
- {
- return cardSource.EqualsCardName("Flaremon");
- }
- IEnumerator ActivateCoroutine(Hashtable hashtable)
- {
- yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
- targetPermanent: card.PermanentOfThisCard(),
- cardCondition: CanSelectCardCondition,
- payCost: true,
- reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
- fixedCostTuple: null,
- ignoreDigivolutionRequirementFixedCost: -1,
- isHand: true,
- activateClass: activateClass,
- successProcess: null));
- }
- }
- #endregion
- #region Inherit
- if (timing == EffectTiming.None)
- {
- bool Condition()
- {
- return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
- && CardEffectCommons.IsOwnerTurn(card);
- }
- cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
- changeValue: 2000,
- isInheritedEffect: true,
- card: card,
- condition: Condition));
- }
- #endregion
- return cardEffects;
- }
- }
- }
|