using Photon.Pun; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; // Gabumon namespace DCGO.CardEffects.BT22 { public class BT22_017 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternative Digivolution Condition if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Tsunomon") || (targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.HasCSTraits); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null) ); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Reveal top 3, Add 1 card with [Omnimon] in text and 1 other with [CS] trait to hand.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Omnimon] in its text and 1 card with the [CS] trait among them to the hand. Return the rest to the bottom of the deck."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool SelectOmnimonInText(CardSource source) { return source.HasText("Omnimon"); } bool SelectCS(CardSource source) { return source.HasCSTraits; } IEnumerator ActivateCoroutine(Hashtable hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect( revealCount: 3, simplifiedSelectCardConditions: new SimplifiedSelectCardConditionClass[] { new SimplifiedSelectCardConditionClass( canTargetCondition:SelectOmnimonInText, message: "Select 1 [Omnimon] in text to add to hand.", mode: SelectCardEffect.Mode.AddHand, maxCount: 1, selectCardCoroutine: null), new SimplifiedSelectCardConditionClass( canTargetCondition:SelectCS, message: "Select 1 card with [CS] trait to add to hand.", mode: SelectCardEffect.Mode.AddHand, maxCount: 1, selectCardCoroutine: null), }, remainingCardsPlace: RemainingCardsPlace.DeckBottom, activateClass: activateClass)); } } #endregion #region ESS if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Your Turn] This Digimon and any of your other Digimon may DNA digivolve into a Digimon card in the hand."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.IsDigimon) { if (cardSource.Owner == card.Owner) { if (cardSource.CanPlayJogress(true)) { if (isExistOnField(card)) { if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true)) { return true; } } } } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleAreaDigimon(card)) { return true; } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (card.Owner.HandCards.Count >= 1) { if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard())) { return true; } } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (isExistOnField(card)) { yield return ContinuousController.instance.StartCoroutine( CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard( CanSelectCardCondition, payCost: true, isHand: true, activateClass, permanentConditions: new Func[] { (permanent) => permanent == card.PermanentOfThisCard() } )); } } } #endregion return cardEffects; } } }