using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; public class BT9_106 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.None) { IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass(); ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card); ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition); cardEffects.Add(ignoreColorConditionClass); bool CanUseCondition(Hashtable hashtable) { if (card.Owner.GetBattleAreaDigimons().Count((permanet) => permanet.TopCard.HasXAntibodyTraits) >= 1) { return true; } return false; } bool CardCondition(CardSource cardSource) { if (cardSource == card) { return true; } return false; } } if (timing == EffectTiming.OptionSkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] Digivolve 1 of your Digimon into a Digimon card with [Dex] or [DeathX] in its name from your trash for its memory cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { List candidatePermanents = new List(); foreach (CardSource cardSource in card.Owner.TrashCards) { if (cardSource.ContainsCardName("Dex") || cardSource.ContainsCardName("DeathX")) { if (cardSource.IsDigimon) { foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons()) { if (permanent.IsDigimon) { if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass, root: SelectCardEffect.Root.Trash)) { candidatePermanents.Add(permanent); } } } } } } bool CanSelectPermanentCondition(Permanent permanent) { if (permanent != null) { if (candidatePermanents.Contains(permanent)) { return true; } } return false; } if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { Permanent selectedPermanent = null; 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: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.ContainsCardName("Dex") || cardSource.ContainsCardName("DeathX")) { if (cardSource.IsDigimon) { if (cardSource.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, true, activateClass, root: SelectCardEffect.Root.Trash)) { return true; } } } return false; } if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition)) { List selectedCards = new List(); maxCount = 1; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => false, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Select 1 card to digivolve.", 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 digivolve.", "The opponent is selecting 1 card to digivolve."); selectCardEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (selectedCards.Count >= 1) { CardSource selectedCard = selectedCards[0]; yield return ContinuousController.instance.StartCoroutine(new PlayCardClass( cardSources: new List() { selectedCard }, hashtable: CardEffectCommons.CardEffectHashtable(activateClass), payCost: true, targetPermanent: selectedPermanent, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true).PlayCard()); } } } } } } if (timing == EffectTiming.SecuritySkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsSecurityEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[Security] Add this card to its owner's hand."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass)); } } return cardEffects; } }