using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.EX6 { public class EX6_062 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Partition if (timing == EffectTiming.WhenRemoveField) { List partitionConditions = new List(); partitionConditions.Add(new PartitionCondition(6, CardColor.Black, CardColor.Yellow)); partitionConditions.Add(new PartitionCondition(6, CardColor.Green, CardColor.Purple)); cardEffects.Add(CardEffectFactory.PartitionSelfEffect( isInheritedEffect: false, card: card, condition: null, cardSourceConditions: partitionConditions)); } #endregion #region DNA if (timing == EffectTiming.None) { AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass(); addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card); addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress); addJogressConditionClass.SetNotShowUI(true); cardEffects.Add(addJogressConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } JogressCondition GetJogress(CardSource cardSource) { if (cardSource == card) { bool PermanentCondition1(Permanent permanent) { if (permanent != null) { if (permanent.TopCard != null) { if (permanent.TopCard.Owner == card.Owner) { if (permanent.IsDigimon) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.CardColors.Contains(CardColor.Black)) { if (permanent.Levels_ForJogress(card).Contains(6)) { return true; } } } } } } } return false; } bool PermanentCondition2(Permanent permanent) { if (permanent != null) { if (permanent.TopCard != null) { if (permanent.TopCard.Owner == card.Owner) { if (permanent.IsDigimon) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Purple)) { if (permanent.Levels_ForJogress(card).Contains(6)) { return true; } } } } } } } return false; } JogressConditionElement[] elements = new JogressConditionElement[] { new JogressConditionElement(PermanentCondition1, "a level 6 Yellow/Black Digimon"), new JogressConditionElement(PermanentCondition2, "a level 6 Green/Purple Digimon"), }; JogressCondition jogressCondition = new JogressCondition(elements, 0); return jogressCondition; } return null; } } #endregion #region When Digivolving if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place lvl 6 cards from trash to digivolution cards", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] If DNA digivolving, you may place up to 2 level 6 cards from your trash as this Digimon's bottom digivolution cards. Then, for each of this Digimon's level 6 digivolution cards, return 1 of your opponent's Digimon to the bottom of the deck."; } bool CanSelectCardCondition(CardSource cardSource) { return (cardSource.HasLevel && cardSource.Level == 6); } bool CanSelectPermanentCondition(Permanent permanent) { return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card); } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { return true; } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsJogress(_hashtable)) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { List selectedCards = new List(); int maxCount = Math.Min(2, card.Owner.TrashCards.Count(CanSelectCardCondition)); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select level 6 cards to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).", maxCount: maxCount, canEndNotMax: true, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Trash, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards"); selectCardEffect.SetUpCustomMessage("Select cards to place on bottom of digivolution cards.", "The opponent is selecting cards to place on bottom of digivolution cards."); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass)); } } } int count = card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition); if (count >= 1) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(count, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: CanEndSelectCondition, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.PutLibraryBottom, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); bool CanEndSelectCondition(List permanents) { return (permanents.Count > 0); } } } } } #endregion #region All Turns if (timing == EffectTiming.None) { bool Condition() { int count = card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasLevel && cardSource.Level == 6); if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (count >= 4) { return true; } } } return false; } cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 3, isInheritedEffect: false, card: card, condition: Condition)); } if (timing == EffectTiming.OnDetermineDoSecurityCheck) { bool Condition() { int count = card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasLevel && cardSource.Level == 6); if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { if (count >= 4) { return true; } } } return false; } cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: Condition)); } #endregion return cardEffects; } } }