BT12_048.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_048 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasSaveText && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Place Tamer cards on the bottom of deck from hand to draw", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] By revealing up to 3 Tamer cards from your hand and placing all of the revealed cards at the bottom of your deck in any order, <Draw 1> for each card placed.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (cardSource != null)
  33. {
  34. if (cardSource.Owner == card.Owner)
  35. {
  36. if (cardSource.IsTamer)
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.HandCards.Count >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (isExistOnField(card))
  62. {
  63. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  64. {
  65. int libraryBottomCount = 0;
  66. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  67. {
  68. int maxCount = Math.Min(3, card.Owner.HandCards.Count(CanSelectCardCondition));
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectCardCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: CanEndSelectCondition,
  75. maxCount: maxCount,
  76. canNoSelect: true,
  77. canEndNotMax: true,
  78. isShowOpponent: true,
  79. selectCardCoroutine: null,
  80. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  81. mode: SelectHandEffect.Mode.PutLibraryBottom,
  82. cardEffect: activateClass);
  83. yield return StartCoroutine(selectHandEffect.Activate());
  84. bool CanEndSelectCondition(List<CardSource> cardSources)
  85. {
  86. if (maxCount >= 1)
  87. {
  88. if (cardSources.Count <= 0)
  89. {
  90. return false;
  91. }
  92. }
  93. return true;
  94. }
  95. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  96. {
  97. if (cardSources.Count >= 1)
  98. {
  99. libraryBottomCount = cardSources.Count;
  100. }
  101. yield return null;
  102. }
  103. }
  104. if (libraryBottomCount >= 1)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, libraryBottomCount, activateClass).Draw());
  107. }
  108. }
  109. }
  110. }
  111. }
  112. if (timing == EffectTiming.OnDestroyedAnyone)
  113. {
  114. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  115. }
  116. if (timing == EffectTiming.None)
  117. {
  118. bool Condition()
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (CardEffectCommons.IsOwnerTurn(card))
  123. {
  124. if (card.PermanentOfThisCard().TopCard.HasSaveText)
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. return false;
  131. }
  132. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  133. }
  134. if (timing == EffectTiming.None)
  135. {
  136. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  137. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  138. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  139. addDigiXrosConditionClass.SetNotShowUI(true);
  140. cardEffects.Add(addDigiXrosConditionClass);
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return true;
  144. }
  145. DigiXrosCondition GetDigiXros(CardSource cardSource)
  146. {
  147. if (cardSource == card)
  148. {
  149. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Digimon card with <Save> in text");
  150. bool CanSelectCardCondition(CardSource cardSource)
  151. {
  152. if (cardSource != null)
  153. {
  154. if (cardSource.Owner == card.Owner)
  155. {
  156. if (cardSource.IsDigimon)
  157. {
  158. if (cardSource.HasSaveText)
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. }
  165. return false;
  166. }
  167. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  168. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  169. return digiXrosCondition;
  170. }
  171. return null;
  172. }
  173. }
  174. return cardEffects;
  175. }
  176. }
  177. }