using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT9_083 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.ContainsCardName("Omnimon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null)); } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete opponent's Digimon and return cards from trash to deck", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] For each card with [Mega] in their traits in this Digimon's digivolution cards, delete 1 of your opponent's Digimon. Then, place 10 cards from your opponent's trash at the bottom of their deck in any order."; } bool CanSelectCardCondition(CardSource cardSource) { return cardSource.CardTraits.Contains("Mega"); } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.CanSelectBySkill(activateClass)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } if (card.Owner.Enemy.TrashCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition), 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.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (card.Owner.Enemy.TrashCards.Count >= 1) { if (card.Owner.Enemy.TrashCards.Count == 1) { List libraryCards = card.Owner.Enemy.TrashCards.Clone(); yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(libraryCards)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(libraryCards, "Deck Bottom Cards", true, true)); } else { int maxCount = Math.Min(10, card.Owner.Enemy.TrashCards.Count); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: null, afterSelectCardCoroutine: AfterSelectCardCoroutine1, message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).", maxCount: maxCount, canEndNotMax: false, isShowOpponent: false, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: card.Owner.Enemy.TrashCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetNotShowCard(); selectCardEffect.SetNotAddLog(); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator AfterSelectCardCoroutine1(List cardSources) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().ShowCardEffect2(cardSources, "Deck Bottom Cards", true, true)); } } } } } } if (timing == EffectTiming.OnStartTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Trash the top card of this Digimon to trash the top card of opponent's security", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Start of Your Turn] Trash the top card of this Digimon. If you do, trash the top card of your opponent's security stack."; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard())) { return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { Permanent permanent = card.PermanentOfThisCard(); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateDebuffEffect(permanent)); CardSource cardSource = permanent.TopCard; yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource)); if (!cardSource.IsToken) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource)); } permanent.ShowingPermanentCard.ShowPermanentData(true); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().RemoveDigivolveRootEffect(cardSource, permanent)); yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity( player: card.Owner.Enemy, destroySecurityCount: 1, cardEffect: activateClass, fromTop: true).DestroySecurity()); } } return cardEffects; } }