using System.Collections; using System.Collections.Generic; using System.Linq; //Abbadomon namespace DCGO.CardEffects.EX9 { public class EX9_055 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Assembly if (timing == EffectTiming.None) { AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass(); addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card); addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly); addAssemblyConditionClass.SetNotShowUI(true); cardEffects.Add(addAssemblyConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } AssemblyCondition GetAssembly(CardSource cardSource) { if (cardSource == card) { AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition); bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.EqualsCardName("Negamon")) { return true; } } } return false; } AssemblyCondition assemblyCondition = new AssemblyCondition( element: element, CanTargetCondition_ByPreSelecetedList: null, selectMessage: "4 [Negamon]", elementCount: 4, reduceCost: 6); return assemblyCondition; } return null; } } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Abbadomon Core]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] If there are 4 or more total [Negamon] in your trash and your Digimon's digivolution cards, you may play 1 [Abbadomon Core] from your hand or trash to your empty breeding area without paying the cost."; } int NegamonAmount() { int value = 0; value += CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsNegamon); foreach (Permanent perm in card.Owner.GetBattleAreaDigimons()) { value += perm.DigivolutionCards.Count(IsNegamon); } return value; } bool IsNegamon(CardSource source) { return source.EqualsCardName("Negamon"); } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.EqualsCardName("Abbadomon Core")) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Hand, isBreedingArea: true)) { return true; } if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Trash, isBreedingArea: true)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && NegamonAmount() >= 4; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1; bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition); if (canSelectHand || canSelectTrash) { if (canSelectHand && canSelectTrash) { List> selectionElements = new List>() { new SelectionElement(message: $"From hand", value : true, spriteIndex: 0), new SelectionElement(message: $"From trash", value : false, spriteIndex: 1), }; string selectPlayerMessage = "From which area do you play a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to play a card."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); } else { GManager.instance.userSelectionManager.SetBool(canSelectHand); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue; List selectedCards = new List(); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (fromHand) { int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); } else { int maxCount = 1; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); } SelectCardEffect.Root root = SelectCardEffect.Root.Hand; if (!fromHand) { root = SelectCardEffect.Root.Trash; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: root, activateETB: true, isBreedingArea: true)); } } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Abbadomon Core]", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] If there are 4 or more total [Negamon] in your trash and your Digimon's digivolution cards, you may play 1 [Abbadomon Core] from your hand or trash to your empty breeding area without paying the cost."; } int NegamonAmount() { int value = 0; value += CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsNegamon); foreach (Permanent perm in card.Owner.GetBattleAreaDigimons()) { value += perm.DigivolutionCards.Count(IsNegamon); } return value; } bool IsNegamon(CardSource source) { return source.EqualsCardName("Negamon"); } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.EqualsCardName("Abbadomon Core")) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Hand, isBreedingArea: true)) { return true; } if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass, root: SelectCardEffect.Root.Trash, isBreedingArea: true)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && NegamonAmount() >= 4; } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1; bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition); if (canSelectHand || canSelectTrash) { if (canSelectHand && canSelectTrash) { List> selectionElements = new List>() { new SelectionElement(message: $"From hand", value : true, spriteIndex: 0), new SelectionElement(message: $"From trash", value : false, spriteIndex: 1), }; string selectPlayerMessage = "From which area do you play a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to play a card."; GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage); } else { GManager.instance.userSelectionManager.SetBool(canSelectHand); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue; List selectedCards = new List(); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (fromHand) { int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); } else { int maxCount = 1; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); } SelectCardEffect.Root root = SelectCardEffect.Root.Hand; if (!fromHand) { root = SelectCardEffect.Root.Trash; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: root, activateETB: true, isBreedingArea: true)); } } } #endregion #region End of All Turns if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("By placing 1 digimon as top source, delete opponents digimon of same level", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("EOT_EX9-055"); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of All Turns] [Once Per Turn] By placing 1 level 6 or lower Digimon card with [Negamon] in its text from your trash as this Digimon's top digivolution card, delete 1 of your opponent's Digimon with the same level as the placed card."; } bool CanSelectTuckedTarget(CardSource source) { return source.IsDigimon && source.HasLevel && source.Level <= 6 && source.HasText("Negamon"); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectTuckedTarget); } IEnumerator ActivateCoroutine(Hashtable hashtable) { bool placed = false; List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectTuckedTarget, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: () => true, canEndNotMax: false, isShowOpponent: true, message:"Select 1 card to play as source", root:SelectCardEffect.Root.Trash, customRootCardList:null, selectCardCoroutine: SelectCardCoroutine, canLookReverseCard:false, afterSelectCardCoroutine: null, mode: SelectCardEffect.Mode.Custom, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage("Select 1 card to place in Digivolution cards.", "The opponent is selecting 1 card to place in Digivolution cards."); selectCardEffect.SetNotShowCard(); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count >= 1) { if (!card.PermanentOfThisCard().IsToken) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsTop(selectedCards, activateClass)); placed = true; } } if (placed) { bool CanSelectOpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.TopCard.HasLevel && permanent.TopCard.Level == selectedCards[0].Level; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentsDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectOpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Destroy, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } } } } #endregion return cardEffects; } } }