BT13_046.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_046 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Gain memory +3 and reveal your 1 card from hand", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] If there're 6 or fewer total cards in both players' security stacks, gain 3 memory, and reveal 1 card in your hand. If it's yellow, place it on top of your security stack face down. If it's not, return it to the hand.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnBattleArea(card))
  28. {
  29. if (card.Owner.SecurityCards.Count + card.Owner.Enemy.SecurityCards.Count <= 6)
  30. {
  31. if (card.Owner.CanAddMemory(activateClass))
  32. {
  33. return true;
  34. }
  35. if (card.Owner.HandCards.Count >= 1)
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(3, activateClass));
  46. if (card.Owner.HandCards.Count >= 1)
  47. {
  48. int maxCount = 1;
  49. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  50. selectHandEffect.SetUp(
  51. selectPlayer: card.Owner,
  52. canTargetCondition: (cardSource) => true,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. maxCount: maxCount,
  56. canNoSelect: false,
  57. canEndNotMax: false,
  58. isShowOpponent: true,
  59. selectCardCoroutine: SelectCardCoroutine,
  60. afterSelectCardCoroutine: null,
  61. mode: SelectHandEffect.Mode.Custom,
  62. cardEffect: activateClass);
  63. selectHandEffect.SetUpCustomMessage("Select 1 card to reveal.", "The opponent is selecting 1 card to reveal.");
  64. selectHandEffect.SetUpCustomMessage_ShowCard("Revealed Card");
  65. yield return StartCoroutine(selectHandEffect.Activate());
  66. IEnumerator SelectCardCoroutine(CardSource cardSource)
  67. {
  68. if (cardSource.HasCardColor(CardColor.Yellow))
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource));
  71. }
  72. yield return null;
  73. }
  74. }
  75. }
  76. }
  77. if (timing == EffectTiming.OnEnterFieldAnyone)
  78. {
  79. ActivateClass activateClass = new ActivateClass();
  80. activateClass.SetUpICardEffect("Gain memory +3 and reveal your 1 card from hand", CanUseCondition, card);
  81. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  82. cardEffects.Add(activateClass);
  83. string EffectDiscription()
  84. {
  85. return "[When Digivolving] If there're 6 or fewer total cards in both players' security stacks, gain 3 memory, and reveal 1 card in your hand. If it's yellow, place it on top of your security stack face down. If it's not, return it to the hand.";
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  90. }
  91. bool CanActivateCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleArea(card))
  94. {
  95. if (card.Owner.SecurityCards.Count + card.Owner.Enemy.SecurityCards.Count <= 6)
  96. {
  97. if (card.Owner.CanAddMemory(activateClass))
  98. {
  99. return true;
  100. }
  101. if (card.Owner.HandCards.Count >= 1)
  102. {
  103. return true;
  104. }
  105. }
  106. }
  107. return false;
  108. }
  109. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(3, activateClass));
  112. if (card.Owner.HandCards.Count >= 1)
  113. {
  114. int maxCount = 1;
  115. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  116. selectHandEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: (cardSource) => true,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. selectCardCoroutine: SelectCardCoroutine,
  126. afterSelectCardCoroutine: null,
  127. mode: SelectHandEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. selectHandEffect.SetUpCustomMessage("Select 1 card to reveal.", "The opponent is selecting 1 card to reveal.");
  130. selectHandEffect.SetUpCustomMessage_ShowCard("Revealed Card");
  131. yield return StartCoroutine(selectHandEffect.Activate());
  132. IEnumerator SelectCardCoroutine(CardSource cardSource)
  133. {
  134. if (cardSource.HasCardColor(CardColor.Yellow))
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(cardSource));
  137. }
  138. yield return null;
  139. }
  140. }
  141. }
  142. }
  143. if (timing == EffectTiming.OnAllyAttack)
  144. {
  145. ActivateClass activateClass = new ActivateClass();
  146. activateClass.SetUpICardEffect("Trash your 1 security to unsuspend this Digimon and DP -7000", CanUseCondition, card);
  147. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  148. activateClass.SetHashString("Unsuspend_BT13_046");
  149. cardEffects.Add(activateClass);
  150. string EffectDiscription()
  151. {
  152. return "[When Attacking][Once Per Turn] By trashing the top card of your security stack, unsuspend this Digimon, and 1 of your opponent's Digimon gets -7000 DP for the turn.";
  153. }
  154. bool CanSelectPermanentCondition(Permanent permanent)
  155. {
  156. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  157. }
  158. bool CanUseCondition(Hashtable hashtable)
  159. {
  160. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  161. }
  162. bool CanActivateCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleArea(card))
  165. {
  166. if (card.Owner.SecurityCards.Count >= 1)
  167. {
  168. return true;
  169. }
  170. }
  171. return false;
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  174. {
  175. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  176. player: card.Owner,
  177. destroySecurityCount: 1,
  178. cardEffect: activateClass,
  179. fromTop: true).DestroySecurity());
  180. if (CardEffectCommons.IsExistOnBattleArea(card))
  181. {
  182. Permanent selectedPermanent = card.PermanentOfThisCard();
  183. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  184. }
  185. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  186. {
  187. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectPermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: SelectPermanentCoroutine,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Custom,
  200. cardEffect: activateClass);
  201. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -7000.", "The opponent is selecting 1 Digimon that will get DP -7000.");
  202. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  203. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  204. {
  205. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -7000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  206. }
  207. }
  208. }
  209. }
  210. return cardEffects;
  211. }
  212. }
  213. }