using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class ST10_06 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); 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 (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent)) { if (permanent.TopCard.CardColors.Contains(CardColor.Yellow)) { if (permanent.Levels_ForJogress(card).Contains(5)) { 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 (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent)) { if (permanent.TopCard.CardColors.Contains(CardColor.Purple)) { if (permanent.Levels_ForJogress(card).Contains(5)) { return true; } } } } } } } return false; } JogressConditionElement[] elements = new JogressConditionElement[] { new JogressConditionElement(PermanentCondition1, "a level 5 yellow Digimon"), new JogressConditionElement(PermanentCondition2, "a level 5 purple Digimon"), }; JogressCondition jogressCondition = new JogressCondition(elements, 0); return jogressCondition; } return null; } } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Add 1 Security from trash and play 1 Digimon from security", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[When Digivolving] Place 1 yellow or purple Digimon card from your trash on top of your security stack face down. When DNA digivolving, you may search your security stack for 1 level 5 or lower Digimon card and play it without paying its memory cost. Then, shuffle your security stack."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasCardColor(CardColor.Yellow)) { return true; } if (cardSource.HasCardColor(CardColor.Purple)) { return true; } } return false; } bool CanSelectCardCondition1(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasLevel) { if (cardSource.Level <= 5) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { return true; } } } } return false; } 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 (card.Owner.CanAddSecurity(activateClass)) { if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource))) { int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource))); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 yellow or purple Digimon card to add to security.", 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 add to security.", "The opponent is selecting 1 card to add to security."); selectCardEffect.SetUpCustomMessage_ShowCard("Security Card"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count >= 1) { foreach (CardSource selectedCard in selectedCards) { yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard)); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateRecoveryEffect(selectedCard.Owner)); yield return ContinuousController.instance.StartCoroutine(new IAddSecurity(selectedCard).AddSecurity()); } } } } if (CardEffectCommons.IsJogress(_hashtable)) { if (card.Owner.SecurityCards.Count >= 1) { int maxCount = Math.Min(1, card.Owner.SecurityCards.Count(CanSelectCardCondition1)); List selectedCards = new List(); SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition1, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: AfterSelectCardCoroutine, message: "Select 1 card to play.", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Security, customRootCardList: null, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } IEnumerator AfterSelectCardCoroutine(List cardSources) { if (cardSources.Count >= 1) { yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity( player: card.Owner, refSkillInfos: ref ContinuousController.instance.nullSkillInfos, activateClass).ReduceSecurity()); } yield return null; } GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = true; yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Security, activateETB: true)); GManager.instance.turnStateMachine.gameContext.IsSecurityLooking = false; if (card.Owner.SecurityCards.Count >= 1) { ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE); card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards); } } } } } if (timing == EffectTiming.OnEnterFieldAnyone) { int maxLevel = -1; ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Delete 1 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[All Turns] When you play another Digimon using an effect, delete 1 of your opponent's Digimon whose level is less than or equal to the played Digimon's level."; } bool PermanentCondition(Permanent permanent) { return CardEffectCommons.IsOwnerPermanent(permanent, card) && permanent.IsDigimon && permanent != card.PermanentOfThisCard(); } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.TopCard.HasLevel) { if (permanent.Level <= maxLevel) { return true; } } } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition)) { if (CardEffectCommons.IsByEffect(hashtable, null)) { List permanents = CardEffectCommons.GetPlayedPermanentsFromEnterFieldHashtable( hashtable: hashtable, rootCondition: null); if (permanents != null) { List levels = permanents .Filter(permanent => permanent != null && permanent.LevelJustAfterPlayed >= 0) .Map(permanent => permanent.LevelJustAfterPlayed); if (levels.Count >= 1) { maxLevel = levels.Max(); } } return true; } } } return false; } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { int maxCount = Math.Min(1, 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()); } } return cardEffects; } }