using System.Collections; using System.Collections.Generic; using System.Linq; //Omnimon (X Antibody) namespace DCGO.CardEffects.BT20 { public class BT20_102 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.EqualsCardName("Omnimon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect( permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Raid/Piercing/Blocker if (timing == EffectTiming.OnAllyAttack) { cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.OnDetermineDoSecurityCheck) { cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null)); } if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null)); } #endregion #region On Play if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Choose 1 of both players' Digimon, delete the rest, then bottom deck 1 opponents Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] If [Omnimon] or [X Antibody] is in this Digimon's digivolution cards, choose 1 of both players' Digimon and delete all other Digimon. Then, return 1 of your opponent's Digimon to the bottom of the deck."; } bool IsOmniOrXAntiSource() { return card.PermanentOfThisCard().DigivolutionCards.Count(source => source.EqualsCardName("Omnimon") || source.EqualsCardName("X Antibody")) > 0; } bool OpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool OwnersDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (IsOmniOrXAntiSource()) { List savedDigimon = new List(); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon)) { selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsDigimon, 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 Digimon that will not be destroyed.", "The opponent is selecting 1 Digimon that will not be destroyed."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.HasMatchConditionPermanent(OwnersDigimon)) { selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OwnersDigimon, 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 Digimon that will not be destroyed.", "The opponent is selecting 1 Digimon that will not be destroyed."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } IEnumerator SelectPermanentCoroutine(Permanent permanent) { savedDigimon.Add(permanent); yield return null; } if (savedDigimon.Count > 0) { List destroyTargetPermanents = GManager.instance.turnStateMachine.gameContext.Players .Map(player => player.GetBattleAreaDigimons()) .Flat() .Filter(permanent => !savedDigimon.Contains(permanent)); yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); } } if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be bottom decked.", "The opponent is selecting 1 Digimon that will be bottom decked."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } yield return null; } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Choose 1 of both players' Digimon, delete the rest, then bottom deck 1 opponents Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] If [Omnimon] or [X Antibody] is in this Digimon's digivolution cards, choose 1 of both players' Digimon and delete all other Digimon. Then, return 1 of your opponent's Digimon to the bottom of the deck."; } bool IsOmniOrXAntiSource() { return card.PermanentOfThisCard().DigivolutionCards.Count(source => source.EqualsCardName("Omnimon") || source.EqualsCardName("X Antibody")) > 0; } bool OpponentsDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool OwnersDigimon(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (IsOmniOrXAntiSource()) { List savedDigimon = new List(); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon)) { selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsDigimon, 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 Digimon that will not be destroyed.", "The opponent is selecting 1 Digimon that will not be destroyed."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.HasMatchConditionPermanent(OwnersDigimon)) { selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OwnersDigimon, 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 Digimon that will not be destroyed.", "The opponent is selecting 1 Digimon that will not be destroyed."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } IEnumerator SelectPermanentCoroutine(Permanent permanent) { savedDigimon.Add(permanent); yield return null; } if (savedDigimon.Count > 0) { List destroyTargetPermanents = GManager.instance.turnStateMachine.gameContext.Players .Map(player => player.GetBattleAreaDigimons()) .Flat() .Filter(permanent => !savedDigimon.Contains(permanent)); yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); } } if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimon)) { SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: OpponentsDigimon, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: 1, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will be bottom decked.", "The opponent is selecting 1 Digimon that will be bottom decked."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } yield return null; } } #endregion #region End of Your Turn if (timing == EffectTiming.OnEndTurn) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Gain Rush and attack without suspending", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription()); activateClass.SetHashString("Rush_BT20_102"); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Your Turn] [Once Per Turn] 1 of your Digimon may gain for the turn and attack without suspending."; } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card); } bool CanActivateCondition(Hashtable hashtable) { return CardEffectCommons.IsExistOnBattleAreaDigimon(card); } IEnumerator ActivateCoroutine(Hashtable hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermanent = null; SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, 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 Digimon that will gain Rush and attack.", "The opponent is selecting 1 Digimon that will gain Rush and attack."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush( targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass)); if (selectedPermanent.CanAttack(activateClass, true)) { SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent(); selectAttackEffect.SetUp( attacker: selectedPermanent, canAttackPlayerCondition: () => true, defenderCondition: (permanent) => true, cardEffect: activateClass); selectAttackEffect.SetCanNotSelectNotAttack(); selectAttackEffect.SetWithoutTap(); yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate()); } } } } } #endregion return cardEffects; } } }