BT16_051.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT16
  6. {
  7. public class BT16_051 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Dorimon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Start of Main Phase
  23. if (timing == EffectTiming.OnStartMainPhase)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. 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);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. 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.";
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. if (cardSource.CardNames.Contains("Kosuke Kisakata"))
  36. {
  37. return true;
  38. }
  39. if (cardSource.CardNames.Contains("KosukeKisakata"))
  40. {
  41. return true;
  42. }
  43. return false;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.IsOwnerTurn(card))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. //Check if Xu is in hand
  57. bool CanActivateCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleArea(card))
  60. {
  61. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  71. if (canSelectHand)
  72. {
  73. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  76. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  77. List<CardSource> selectedCards = new List<CardSource>();
  78. IEnumerator SelectCardCoroutine(CardSource cardSource)
  79. {
  80. selectedCards.Add(cardSource);
  81. yield return null;
  82. }
  83. if (fromHand)
  84. {
  85. int maxCount = 1;
  86. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  87. selectHandEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectCardCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: true,
  94. canEndNotMax: false,
  95. isShowOpponent: true,
  96. selectCardCoroutine: SelectCardCoroutine,
  97. afterSelectCardCoroutine: null,
  98. mode: SelectHandEffect.Mode.Custom,
  99. cardEffect: activateClass);
  100. 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.");
  101. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  102. yield return StartCoroutine(selectHandEffect.Activate());
  103. }
  104. if (selectedCards.Count >= 1)
  105. {
  106. Permanent selectedPermanent = card.PermanentOfThisCard();
  107. if (selectedPermanent != null)
  108. {
  109. CanNotBeRemovedClass canNotBeRemovedClass = new CanNotBeRemovedClass();
  110. canNotBeRemovedClass.SetUpICardEffect("Can't leave battle area except by deletion", CanUseProtectionCondition, card);
  111. canNotBeRemovedClass.SetUpCanNotBeRemovedClass(permanentCondition: PermanentCondition);
  112. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotBeRemovedClass);
  113. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  114. bool CanUseProtectionCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  117. }
  118. bool PermanentCondition(Permanent permanent)
  119. {
  120. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  121. {
  122. if (permanent == selectedPermanent)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. }
  130. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  131. }
  132. }
  133. }
  134. #endregion
  135. #region Inherited Effect
  136. if (timing == EffectTiming.None)
  137. {
  138. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  139. changeValue: () => 1000,
  140. isInheritedEffect: true,
  141. card: card,
  142. condition: null));
  143. }
  144. #endregion
  145. return cardEffects;
  146. }
  147. }
  148. }