using System.Collections; using System.Collections.Generic; using System.Linq; // Galacticmon namespace DCGO.CardEffects.EX11 { public class EX11_046 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alt Digivolution Conditions if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) =>targetPermanent.TopCard.EqualsCardName("Snatchmon"); cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 9, ignoreDigivolutionRequirement: false, card: card, condition: null)); } if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) => targetPermanent.TopCard.EqualsCardName("Galacticmon"); cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Shared OP / WD string SharedEffectName = "Choose 1 Highest Cost Opponent's Digimon, delete the rest. If 4+ Vemmon, gain Blocker and immunity."; CardEffectFactory.ActivateClassesForSharedEffects (ref cardEffects, timing, card, SharedEffectName, SharedActivateCoroutine, SharedEffectDescription, optional: false, onPlay: true, whenDigivolving: true); string SharedEffectDescription(string tag) => $"[{tag}] Choose 1 of your opponent's highest play cost Digimon and delete all of their other Digimon. Then, if this Digimon has 4 or more [Vemmon] in its digivolution cards, until your opponent's turn ends, it gains and isn't affected by their effects."; bool CanSelectHighestCostCondition(Permanent permanent) => CardEffectCommons.IsMaxCost(permanent, card.Owner.Enemy, true); bool CanDeletePermanentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass) { if (CardEffectCommons.MatchConditionPermanentCount(CanSelectHighestCostCondition) == 1) { Permanent permanent = null; permanent = card.Owner.Enemy.GetBattleAreaPermanents().FirstOrDefault(CanSelectHighestCostCondition); yield return ContinuousController.instance.StartCoroutine(SelectPermanentCoroutine(permanent)); } else if (CardEffectCommons.MatchConditionPermanentCount(CanSelectHighestCostCondition) > 1) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectHighestCostCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Opponent's Digimon, you will delete all other digimon.", "Opponent is selecting 1 digimon and will delete all others."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } else if (CardEffectCommons.MatchConditionPermanentCount(CanSelectHighestCostCondition) == 0 && CardEffectCommons.HasMatchConditionPermanent(CanDeletePermanentCondition)) { yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(card.Owner.Enemy.GetBattleAreaDigimons(), CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); } IEnumerator SelectPermanentCoroutine(Permanent permanent) { if (permanent != null) { List targetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(perm => perm != permanent); yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(targetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); } } if (card.PermanentOfThisCard() != null && card.PermanentOfThisCard().DigivolutionCards.Count(cardSource => cardSource.EqualsCardName("Vemmon")) >= 4) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass)); CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass(); canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's effect", CanUseCondition1, card); canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition); card.PermanentOfThisCard().UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateBuffEffect(card.PermanentOfThisCard())); bool CanUseCondition1(Hashtable hashtable) { return card.PermanentOfThisCard().TopCard != null; } bool CardCondition(CardSource cardSource) { return card.PermanentOfThisCard().TopCard != null && card.PermanentOfThisCard().TopCard.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()) && cardSource == card.PermanentOfThisCard().TopCard; } bool SkillCondition(ICardEffect cardEffect) { return cardEffect != null && cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.Owner == card.Owner.Enemy; } } } #endregion #region End Of Opponent's Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Digivolve into Galacticmon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription()); cardEffects.Add(activateClass); string EffectDescription() => "[End of Opponent's Turn] This Digimon may digivolve into [Galacticmon] in the hand or trash, ignoring digivolution requirements and without paying the cost."; bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOpponentTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition) || CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)); } bool CanSelectCardCondition(CardSource cardSource) => cardSource.EqualsCardName("Galacticmon"); IEnumerator ActivateCoroutine(Hashtable hashtable) { bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition); 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 digivolve a card?"; string notSelectPlayerMessage = "The opponent is choosing from which area to digivolve 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; yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard( targetPermanent: card.PermanentOfThisCard(), cardCondition: CanSelectCardCondition, payCost: false, reduceCostTuple: null, fixedCostTuple: null, ignoreDigivolutionRequirementFixedCost: -1, isHand: fromHand, activateClass: activateClass, successProcess: null, ignoreRequirements: CardEffectCommons.IgnoreRequirement.All)); } } } #endregion #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) => true; AssemblyCondition GetAssembly(CardSource cardSource) { if (cardSource == card) { AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition); bool CanSelectCardCondition(CardSource cardSource) { return cardSource != null && cardSource.Owner == card.Owner && cardSource.HasText("Vemmon"); } AssemblyCondition assemblyCondition = new AssemblyCondition( element: element, CanTargetCondition_ByPreSelecetedList: null, selectMessage: "8 cards w/[Vemmon] in text", elementCount: 8, reduceCost: 6); return assemblyCondition; } return null; } } #endregion return cardEffects; } } }