BT13_033.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_033 : 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. AddBurstDigivolutionConditionClass addBurstDigivolutionConditionClass = new AddBurstDigivolutionConditionClass();
  15. addBurstDigivolutionConditionClass.SetUpICardEffect($"Burst Digivolution", CanUseCondition, card);
  16. addBurstDigivolutionConditionClass.SetUpAddBurstDigivolutionConditionClass(getBurstDigivolutionCondition: GetBurstDigivolution);
  17. addBurstDigivolutionConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addBurstDigivolutionConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. BurstDigivolutionCondition GetBurstDigivolution(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool TamerCondition(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  30. {
  31. if (!permanent.CannotReturnToHand(null))
  32. {
  33. if (permanent.TopCard.CardNames.Contains("Thomas H. Norstein"))
  34. {
  35. return true;
  36. }
  37. if (permanent.TopCard.CardNames.Contains("ThomasH.Norstein"))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. bool DigimonCondition(Permanent permanent)
  46. {
  47. if(permanent != null)
  48. {
  49. if (permanent.TopCard != null)
  50. {
  51. if (permanent.TopCard.Owner == card.Owner)
  52. {
  53. if (permanent.TopCard.Owner.GetFieldPermanents().Contains(permanent))
  54. {
  55. if (!card.CanNotEvolve(permanent))
  56. {
  57. if (permanent.TopCard.CardNames.Contains("MirageGaogamon"))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. }
  64. }
  65. }
  66. return false;
  67. }
  68. BurstDigivolutionCondition burstDigivolutionCondition = new BurstDigivolutionCondition(
  69. tamerCondition: TamerCondition,
  70. selectTamerMessage: "1 [Thomas H. Norstein]",
  71. digimonCondition: DigimonCondition,
  72. selectDigimonMessage: "1 [MirageGaogamon]",
  73. cost: 0);
  74. return burstDigivolutionCondition;
  75. }
  76. return null;
  77. }
  78. }
  79. if (timing == EffectTiming.OnEnterFieldAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("Return 1 Digimon to hand and gain Memory", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[When Digivolving] Return 1 of your opponent's Digimon to the hand. Then, gain 1 memory for every 4 cards in your opponent's hand.";
  88. }
  89. bool CanSelectPermanentCondition(Permanent permanent)
  90. {
  91. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  92. }
  93. int count()
  94. {
  95. return card.Owner.Enemy.HandCards.Count / 4;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. if (CardEffectCommons.IsExistOnBattleArea(card))
  104. {
  105. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  106. {
  107. return true;
  108. }
  109. if (card.Owner.CanAddMemory(activateClass))
  110. {
  111. if (count() >= 1)
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  122. {
  123. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  124. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  125. selectPermanentEffect.SetUp(
  126. selectPlayer: card.Owner,
  127. canTargetCondition: CanSelectPermanentCondition,
  128. canTargetCondition_ByPreSelecetedList: null,
  129. canEndSelectCondition: null,
  130. maxCount: maxCount,
  131. canNoSelect: false,
  132. canEndNotMax: false,
  133. selectPermanentCoroutine: null,
  134. afterSelectPermanentCoroutine: null,
  135. mode: SelectPermanentEffect.Mode.Bounce,
  136. cardEffect: activateClass);
  137. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  138. }
  139. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(count(), activateClass));
  140. }
  141. }
  142. if (timing == EffectTiming.OnAllyAttack)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect("Return opponent's hand cards to the bottom of deck to unsuspend this Digimon", CanUseCondition, card);
  146. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  147. cardEffects.Add(activateClass);
  148. string EffectDiscription()
  149. {
  150. return "[When Attacking] If your opponent has 9 or more cards in their hand, by choosing cards in your opponent's hand without looking and returning them to the bottom of the deck so that 8 remain, unsuspend this Digimon.";
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  155. }
  156. bool CanActivateCondition(Hashtable hashtable)
  157. {
  158. if (CardEffectCommons.IsExistOnBattleArea(card))
  159. {
  160. if (card.Owner.Enemy.HandCards.Count >= 9)
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  168. {
  169. bool returned = false;
  170. if (card.Owner.Enemy.HandCards.Count >= 9)
  171. {
  172. int maxCount = card.Owner.Enemy.HandCards.Count - 8;
  173. if (maxCount >= 1)
  174. {
  175. if (card.Owner.isYou)
  176. {
  177. foreach (CardSource cardSource in card.Owner.Enemy.HandCards)
  178. {
  179. cardSource.SetReverse();
  180. }
  181. }
  182. card.Owner.Enemy.HandCards = RandomUtility.ShuffledDeckCards(card.Owner.Enemy.HandCards);
  183. List<CardSource> selectedCards = new List<CardSource>();
  184. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  185. selectCardEffect.SetUp(
  186. canTargetCondition: (cardSource) => true,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. canNoSelect: () => false,
  190. selectCardCoroutine: null,
  191. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  192. message: "Select cards to return to the bottom of opponent's deck.",
  193. maxCount: maxCount,
  194. canEndNotMax: false,
  195. isShowOpponent: false,
  196. mode: SelectCardEffect.Mode.Custom,
  197. root: SelectCardEffect.Root.Custom,
  198. customRootCardList: card.Owner.Enemy.HandCards,
  199. canLookReverseCard: false,
  200. selectPlayer: card.Owner,
  201. cardEffect: activateClass);
  202. selectCardEffect.SetNotShowCard();
  203. selectCardEffect.SetUseFaceDown();
  204. if (card.Owner.isYou)
  205. {
  206. selectCardEffect.SetNotAddLog();
  207. }
  208. selectCardEffect.SetUpCustomMessage(
  209. "Select cards to put on bottom of the deck.",
  210. "The opponent is selecting cards to put on bottom of the deck.");
  211. yield return StartCoroutine(selectCardEffect.Activate());
  212. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  213. {
  214. if (cardSources.Count >= 1)
  215. {
  216. returned = true;
  217. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(
  218. cardSources,
  219. notAddLog: card.Owner.isYou));
  220. foreach (CardSource cardSource in cardSources)
  221. {
  222. selectedCards.Add(cardSource);
  223. }
  224. }
  225. yield return null;
  226. }
  227. if (card.Owner.isYou)
  228. {
  229. foreach (CardSource cardSource in card.Owner.Enemy.HandCards)
  230. {
  231. cardSource.SetFace();
  232. }
  233. }
  234. else
  235. {
  236. if (returned)
  237. {
  238. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(selectedCards, "Deck Bottom Cards", true, true));
  239. }
  240. }
  241. }
  242. }
  243. if (returned)
  244. {
  245. if (CardEffectCommons.IsExistOnBattleArea(card))
  246. {
  247. Permanent selectedPermanent = card.PermanentOfThisCard();
  248. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  249. }
  250. }
  251. }
  252. }
  253. return cardEffects;
  254. }
  255. }
  256. }