using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT8_024 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.BeforePayCost) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetHashString("Recovery1_BT8_024"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn] When this Digimon would digivolve, if you have 3 or fewer security cards, . (Place the top card of your deck on top of your security stack.)"; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenPermanentWouldDigivolveOfCard(hashtable, null, card)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.LibraryCards.Count >= 1) { if (card.Owner.SecurityCards.Count <= 3) { if (card.Owner.CanAddSecurity(activateClass)) { return true; } } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery()); yield return new WaitForSeconds(0.4f); } } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 level 3 Digimon to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsInheritedEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking] If you have 3 or more security cards, return 1 of your opponent's level 3 Digimon to its owner's hand."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.Level == 3) { if (permanent.TopCard.HasLevel) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { if (card.Owner.SecurityCards.Count >= 3) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Bounce, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } return cardEffects; } }