using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace DCGO.CardEffects.BT16 { public class BT16_051 : CEntity_Effect { public override List CardEffects(EffectTiming timing, CardSource card) { List cardEffects = new List(); #region Alternate Digivolution Requirement if (timing == EffectTiming.None) { static bool PermanentCondition(Permanent targetPermanent) { return targetPermanent.TopCard.CardNames.Contains("Dorimon"); } cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null)); } #endregion #region Start of Main Phase if (timing == EffectTiming.OnStartMainPhase) { ActivateClass activateClass = new ActivateClass(); activateClass.SetUpICardEffect("Place cards under this Digimon's digivolution cards to make this Digimon unable to leave the battle area except by battle until the end of your opponent's turn.", CanUseCondition, card); activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription()); cardEffects.Add(activateClass); string EffectDiscription() { return "[Start of Your Main Phase] By placing 1 [Kosuke Kisakata] from your hand as this Digimon's bottom digivolution card, this Digimon can't leave the battle area other than by deletion until the end of your opponent's turn."; } bool CanSelectCardCondition(CardSource cardSource) { if (cardSource.CardNames.Contains("Kosuke Kisakata")) { return true; } if (cardSource.CardNames.Contains("KosukeKisakata")) { return true; } return false; } bool CanUseCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (CardEffectCommons.IsOwnerTurn(card)) { return true; } } return false; } //Check if Xu is in hand bool CanActivateCondition(Hashtable hashtable) { if (CardEffectCommons.IsExistOnBattleArea(card)) { if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1) { return true; } } return false; } IEnumerator ActivateCoroutine(Hashtable _hashtable) { bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1; if (canSelectHand) { GManager.instance.userSelectionManager.SetBool(canSelectHand); } yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect()); bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue; List selectedCards = new List(); IEnumerator SelectCardCoroutine(CardSource cardSource) { selectedCards.Add(cardSource); yield return null; } if (fromHand) { 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 place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards."); selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card"); yield return StartCoroutine(selectHandEffect.Activate()); } if (selectedCards.Count >= 1) { Permanent selectedPermanent = card.PermanentOfThisCard(); if (selectedPermanent != null) { CanNotBeRemovedClass canNotBeRemovedClass = new CanNotBeRemovedClass(); canNotBeRemovedClass.SetUpICardEffect("Can't leave battle area except by deletion", CanUseProtectionCondition, card); canNotBeRemovedClass.SetUpCanNotBeRemovedClass(permanentCondition: PermanentCondition); selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotBeRemovedClass); yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent().CreateBuffEffect(selectedPermanent)); bool CanUseProtectionCondition(Hashtable hashtable) { return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent); } bool PermanentCondition(Permanent permanent) { if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent)) { if (permanent == selectedPermanent) { return true; } } return false; } } yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass)); } } } #endregion #region Inherited Effect if (timing == EffectTiming.None) { cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect>( changeValue: () => 1000, isInheritedEffect: true, card: card, condition: null)); } #endregion return cardEffects; } } }