BT13_092.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_092 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. AddBurstDigivolutionConditionClass addBurstDigivolutionConditionClass = new AddBurstDigivolutionConditionClass();
  14. addBurstDigivolutionConditionClass.SetUpICardEffect($"Burst Digivolution", CanUseCondition, card);
  15. addBurstDigivolutionConditionClass.SetUpAddBurstDigivolutionConditionClass(getBurstDigivolutionCondition: GetBurstDigivolution);
  16. addBurstDigivolutionConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addBurstDigivolutionConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. BurstDigivolutionCondition GetBurstDigivolution(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. bool tamerCondition(Permanent permanent)
  27. {
  28. if (permanent != null)
  29. {
  30. if (permanent.TopCard != null)
  31. {
  32. if (permanent.TopCard.Owner == card.Owner)
  33. {
  34. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  35. {
  36. if (!permanent.CannotReturnToHand(null))
  37. {
  38. if (permanent.TopCard.CardNames.Contains("Keenan Crier"))
  39. {
  40. return true;
  41. }
  42. if (permanent.TopCard.CardNames.Contains("KeenanCrier"))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool digimonCondition(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent.TopCard.Owner == card.Owner)
  60. {
  61. if (permanent.TopCard.Owner.GetFieldPermanents().Contains(permanent))
  62. {
  63. if (!card.CanNotEvolve(permanent))
  64. {
  65. if (permanent.TopCard.CardNames.Contains("Ravemon"))
  66. {
  67. return true;
  68. }
  69. }
  70. }
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. BurstDigivolutionCondition burstDigivolutionCondition = new BurstDigivolutionCondition(
  77. tamerCondition: tamerCondition,
  78. selectTamerMessage: "1 [Keenan Crier]",
  79. digimonCondition: digimonCondition,
  80. selectDigimonMessage: "1 [Ravemon]",
  81. cost: 0);
  82. return burstDigivolutionCondition;
  83. }
  84. return null;
  85. }
  86. }
  87. if (timing == EffectTiming.OnEnterFieldAnyone)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Trash 1 opponent's hand and add the top card of opponent's security to hand", CanUseCondition, card);
  91. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[When Digivolving] Search your opponent's hand, and trash 1 card among it. Then, if they have 7 or fewer cards in their hand, they add the top card of their security stack to the hand.";
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. if (isExistOnField(card))
  104. {
  105. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  106. {
  107. if (card.Owner.Enemy.HandCards.Count >= 1)
  108. {
  109. return true;
  110. }
  111. if (card.Owner.Enemy.HandCards.Count <= 7)
  112. {
  113. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  114. {
  115. return true;
  116. }
  117. }
  118. }
  119. }
  120. return false;
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. if (isExistOnField(card))
  125. {
  126. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  127. {
  128. if (card.Owner.Enemy.HandCards.Count >= 1)
  129. {
  130. int maxCount = 1;
  131. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  132. selectCardEffect.SetUp(
  133. canTargetCondition: (cardSource) => true,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. canNoSelect: () => false,
  137. selectCardCoroutine: null,
  138. afterSelectCardCoroutine: null,
  139. message: "Select 1 card to trash in opponent's hand.",
  140. maxCount: maxCount,
  141. canEndNotMax: false,
  142. isShowOpponent: true,
  143. mode: SelectCardEffect.Mode.Discard,
  144. root: SelectCardEffect.Root.Custom,
  145. customRootCardList: card.Owner.Enemy.HandCards,
  146. canLookReverseCard: true,
  147. selectPlayer: card.Owner,
  148. cardEffect: activateClass);
  149. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  150. }
  151. if (card.Owner.Enemy.HandCards.Count <= 7)
  152. {
  153. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  154. {
  155. CardSource topCard = card.Owner.Enemy.SecurityCards[0];
  156. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  157. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  158. player: card.Owner.Enemy,
  159. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  160. activateClass).ReduceSecurity());
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. if (timing == EffectTiming.OnAllyAttack)
  168. {
  169. ActivateClass activateClass = new ActivateClass();
  170. activateClass.SetUpICardEffect("Return opponent's 1 card from trash to the bottom of deck to delete opponent's Digimon", CanUseCondition, card);
  171. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  172. cardEffects.Add(activateClass);
  173. string EffectDiscription()
  174. {
  175. return "[When Attacking] By returning 1 Digimon card from your opponent's trash to the bottom of the deck, delete all of your opponent's Digimon with the same name as that card.";
  176. }
  177. bool CanSelectCardCondition(CardSource cardSource)
  178. {
  179. if (cardSource != null)
  180. {
  181. if (cardSource.Owner == card.Owner.Enemy)
  182. {
  183. if (cardSource.IsDigimon)
  184. {
  185. return true;
  186. }
  187. }
  188. }
  189. return false;
  190. }
  191. bool CanUseCondition(Hashtable hashtable)
  192. {
  193. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  194. }
  195. bool CanActivateCondition(Hashtable hashtable)
  196. {
  197. if (CardEffectCommons.IsExistOnBattleArea(card))
  198. {
  199. if (card.Owner.Enemy.TrashCards.Count(CanSelectCardCondition) >= 1)
  200. {
  201. return true;
  202. }
  203. }
  204. return false;
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  207. {
  208. int maxCount = 1;
  209. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  210. selectCardEffect.SetUp(
  211. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  212. canTargetCondition_ByPreSelecetedList: null,
  213. canEndSelectCondition: null,
  214. canNoSelect: () => true,
  215. selectCardCoroutine: null,
  216. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  217. message: "Select 1 card in opponent's trash to place at the bottom of the deck.",
  218. maxCount: maxCount,
  219. canEndNotMax: false,
  220. isShowOpponent: false,
  221. mode: SelectCardEffect.Mode.Custom,
  222. root: SelectCardEffect.Root.Custom,
  223. customRootCardList: card.Owner.Enemy.TrashCards,
  224. canLookReverseCard: true,
  225. selectPlayer: card.Owner,
  226. cardEffect: activateClass);
  227. selectCardEffect.SetNotShowCard();
  228. selectCardEffect.SetNotAddLog();
  229. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  230. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  231. {
  232. if (cardSources.Count == 1)
  233. {
  234. CardSource returnedCard = cardSources[0];
  235. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  236. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(cardSources, "Deck Bottom Card", true, true));
  237. if (returnedCard != null)
  238. {
  239. List<Permanent> destroyedPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Where((permanent1) => permanent1.TopCard.HasSameCardName(returnedCard)).ToList();
  240. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyedPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  241. }
  242. }
  243. }
  244. }
  245. }
  246. return cardEffects;
  247. }
  248. }
  249. }