using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT7_029 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 digivolution card and return 1 Digimon to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Bounce_BT7_029"); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving][Once Per Turn] You may return 1 card with [Hybrid] in its traits from this Digimon's digivolution cards to your hand to return 1 of your opponent's Digimon with the same level as the returned card to its owner's hand. Trash all of the digivolution cards of that Digimon."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.CardTraits.Contains("Hybrid"); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { Permanent selectedPermanent = card.PermanentOfThisCard(); if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1) { int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition)); CardSource selectedCard = null; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: "Select 1 card to add to your hand.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.AddHand, root: SelectCardEffect.Root.Custom, customRootCardList: selectedPermanent.DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { foreach (CardSource cardSource in cardSources) { selectedCard = cardSource; } yield return null; } if (selectedCard != null) { bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.Level == selectedCard.Level) { if (permanent.TopCard.HasLevel && selectedCard.HasLevel) { return true; } } } return false; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { 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()); } } } } } if (timing == EffectTiming.OnAllyAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Return 1 digivolution card and return 1 Digimon to hand", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Bounce_BT7_029"); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Attacking][Once Per Turn] You may return 1 card with [Hybrid] in its traits from this Digimon's digivolution cards to your hand to return 1 of your opponent's Digimon with the same level as the returned card to its owner's hand. Trash all of the digivolution cards of that Digimon."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.CardTraits.Contains("Hybrid"); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { Permanent selectedPermanent = card.PermanentOfThisCard(); if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1) { int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition)); CardSource selectedCard = null; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: "Select 1 card to add to your hand.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.AddHand, root: SelectCardEffect.Root.Custom, customRootCardList: selectedPermanent.DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine(List cardSources) { foreach (CardSource cardSource in cardSources) { selectedCard = cardSource; } yield return null; } if (selectedCard != null) { bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.Level == selectedCard.Level) { return true; } } return false; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { 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()); } } } } } if (timing == EffectTiming.OnAddHand) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Unsuspend 1 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Unsuspend_BT7_029"); cardEffects.Add(activateClass); string EffectDiscription() { return "[Your Turn][Once Per Turn] When an effect adds a card to your hand, you may unsuspend 1 of your Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (CardEffectCommons.CanTriggerWhenAddHand(hashtable, player => player == card.Owner, cardEffect => cardEffect != null)) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { 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.UnTap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } return cardEffects; } }