using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; namespace DCGO.CardEffects.BT10 { public class BT10_009 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); if (timing == EffectTiming.WhenPermanentWouldBeDeleted) { cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 2)); } if (timing == EffectTiming.OnEnterFieldAnyone) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Draw 2", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[On Play] Trigger . (Draw 2 card from your deck.)"; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnPlay(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.LibraryCards.Count >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw()); } } if (timing == EffectTiming.OnEndAttack) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place digivolution cards from this Digimon under your Tamer to unsuspend 1 Tamer and delete this Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[End of Attack] By placing all digivolution cards from under this Digimon under 1 of your Tamers, unsuspend 1 of your Tamers, and delete this Digimon."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.IsTamer) { if (!permanent.IsToken) { return true; } } } return false; } bool CanSelectPermanentCondition1(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)) { if (permanent.IsTamer) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOnAttack(hashtable, card); } bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1) { if (card.Owner.GetBattleAreaPermanents().Some(CanSelectPermanentCondition)) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1) { if (card.Owner.GetBattleAreaPermanents().Some(CanSelectPermanentCondition)) { bool addedDigivolutionCards = false; Permanent selectedPermanent = null; int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition)); SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent(); selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, selectPermanentCoroutine: SelectPermanentCoroutine, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.Custom, cardEffect: activateClass); selectPermanentEffect.SetUpCustomMessage( "Select 1 Tamer that will get digivolution cards.", "The opponent is selecting 1 Tamer that will get digivolution cards."); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); IEnumerator SelectPermanentCoroutine(Permanent permanent) { selectedPermanent = permanent; yield return null; } if (selectedPermanent != null) { List digivolutionCards = new List(); if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1) { if (card.PermanentOfThisCard().DigivolutionCards.Count == 1) { foreach (CardSource cardSource in card.PermanentOfThisCard().DigivolutionCards) { digivolutionCards.Add(cardSource); } } else { maxCount = card.PermanentOfThisCard().DigivolutionCards.Count; SelectCardEffect selectCardEffect = GManager.instance.GetComponent(); selectCardEffect.SetUp( canTargetCondition: (cardSource) => true, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, canNoSelect: () => true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, message: "Specify the order to place the card on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).", maxCount: maxCount, canEndNotMax: false, isShowOpponent: true, mode: SelectCardEffect.Mode.Custom, root: SelectCardEffect.Root.Custom, customRootCardList: card.PermanentOfThisCard().DigivolutionCards, canLookReverseCard: true, selectPlayer: card.Owner, cardEffect: activateClass); selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards"); yield return StartCoroutine(selectCardEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { digivolutionCards.Add(cardSource); yield return null; } } } if (digivolutionCards.Count >= 1) { if (selectedPermanent != null) { yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(digivolutionCards, activateClass)); addedDigivolutionCards = true; } } } if (addedDigivolutionCards) { if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1) { maxCount = 1; selectPermanentEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectPermanentCondition1, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: false, canEndNotMax: false, selectPermanentCoroutine: null, afterSelectPermanentCoroutine: null, mode: SelectPermanentEffect.Mode.UnTap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } if (CardEffectCommons.IsExistOnBattleArea(card)) { Hashtable hashtable = new Hashtable(); hashtable.Add("CardEffect", activateClass); yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass( new List() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy()); } } } } } } } if (timing == EffectTiming.None) { AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass(); addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card); addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros); addDigiXrosConditionClass.SetNotShowUI(true); cardEffects.Add(addDigiXrosConditionClass); bool CanUseCondition(Hashtable hashtable) { return true; } DigiXrosCondition GetDigiXros(CardSource cardSource) { if (cardSource == card) { DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Shoutmon"); bool CanSelectCardCondition(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("Shoutmon")) { return true; } } } } return false; } DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "Ballistamon"); bool CanSelectCardCondition1(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("Ballistamon")) { return true; } } } } return false; } DigiXrosConditionElement element2 = new DigiXrosConditionElement(CanSelectCardCondition2, "Dorulumon"); bool CanSelectCardCondition2(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("Dorulumon")) { return true; } } } } return false; } DigiXrosConditionElement element3 = new DigiXrosConditionElement(CanSelectCardCondition3, "Starmons"); bool CanSelectCardCondition3(CardSource cardSource) { if (cardSource != null) { if (cardSource.Owner == card.Owner) { if (cardSource.IsDigimon) { if (cardSource.CardNames_DigiXros.Contains("Starmons")) { return true; } } } } return false; } List elements = new List() { element, element1, element2, element3 }; DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2); return digiXrosCondition; } return null; } } return cardEffects; } } }