using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Linq; using Photon; using System; using Photon.Pun; namespace DCGO.CardEffects.ST17 { public class ST17_11 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Option Skill 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] Reveal the top 3 cards of your deck. Add 1 green Digimon card and 1 green Tamer card from among them to your hand. Place the remaining cards at the bottom of your deck in any order. Then, place this card in your battle area."; } bool CanSelectDigimonCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (cardSource.HasCardColor(CardColor.Green)) { return true; } } return false; } bool CanSelectTamerCondition(CardSource cardSource) { if(cardSource.IsTamer) { if (cardSource.HasCardColor(CardColor.Green)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { List selectedCards = new List(); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect( revealCount: 3, selectCardConditions: new SelectCardConditionClass[] { new SelectCardConditionClass( canTargetCondition:CanSelectDigimonCondition, canTargetCondition_ByPreSelecetedList:null, canEndSelectCondition:null, canNoSelect:false, selectCardCoroutine: null, message: "Select 1 Green Digimon card.", maxCount: 1, canEndNotMax:false, mode: SelectCardEffect.Mode.AddHand ), new SelectCardConditionClass( canTargetCondition:CanSelectTamerCondition, canTargetCondition_ByPreSelecetedList:null, canEndSelectCondition:null, canNoSelect:false, selectCardCoroutine: null, message: "Select 1 Green Tamer card.", maxCount: 1, canEndNotMax:false, mode: SelectCardEffect.Mode.AddHand ), }, remainingCardsPlace: RemainingCardsPlace.DeckBottom, activateClass: activateClass, canNoAction: false)); yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass)); } } #endregion #region Delay Effect if (timing == EffectTiming.OnDeclaration) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Play 1 [Terriermon] or [Lopmon]", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Main] You may play 1 [Terriermon] or [Lopmon] from you hand without paying the cost."; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanDeclareOptionDelayEffect(card); } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.IsDigimon) { if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass)) { if (cardSource.CardNames.Contains("Terriermon")) { return true; } if (cardSource.CardNames.Contains("Lopmon")) { return true; } } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { bool deleted = false; yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null)); IEnumerator SuccessProcess() { deleted = true; yield return null; } if (deleted) { if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1) { List selectedCards = new List(); int maxCount = 1; SelectHandEffect selectHandEffect = GManager.instance.GetComponent(); selectHandEffect.SetUp( selectPlayer: card.Owner, canTargetCondition: CanSelectCardCondition, canTargetCondition_ByPreSelecetedList: null, canEndSelectCondition: null, maxCount: maxCount, canNoSelect: true, canEndNotMax: false, isShowOpponent: true, selectCardCoroutine: SelectCardCoroutine, afterSelectCardCoroutine: null, mode: SelectHandEffect.Mode.Custom, cardEffect: activateClass); selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play."); selectHandEffect.SetUpCustomMessage_ShowCard("Played Card"); yield return StartCoroutine(selectHandEffect.Activate()); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards( cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true)); } } } } #endregion #region Security Skill if (timing == EffectTiming.SecuritySkill) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect($"Suspend 2 Digimon", CanUseCondition, card); activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription()); activateClass.SetIsSecurityEffect(true); cardEffects.Add(activateClass); string EffectDiscription() { return "[Security] Suspend 2 of your opponent's Digimon. Then, place this card in the battle area."; } bool CanSelectPermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)) { if (permanent.CanSelectBySkill(activateClass)) { return true; } } return false; } bool CanUseCondition(Hashtable hashtable) { return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card); } IEnumerator ActivateCoroutine(Hashtable _hashtable) { if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition)) { int maxCount = Math.Min(2, 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.Tap, cardEffect: activateClass); yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate()); } yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards( card: card, cardEffect: activateClass)); } } #endregion return cardEffects; } } }