BT15_038.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_038 : 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.OnCounterTiming)
  12. {
  13. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  14. }
  15. #region On Play
  16. if (timing == EffectTiming.OnEnterFieldAnyone)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect("Trash the top card of your security so that opponent's 1 Digimon gains DP -6000", CanUseCondition, card);
  20. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[On Play] By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  25. }
  26. bool CanSelectPermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.SecurityCards.Count >= 1)
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (card.Owner.SecurityCards.Count >= 1)
  48. {
  49. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  50. {
  51. new SelectionElement<bool>(message: $"Security Top", value : true, spriteIndex: 0),
  52. new SelectionElement<bool>(message: $"Security Bottom", value : false, spriteIndex: 1),
  53. };
  54. string selectPlayerMessage = "Which will you trash the top or bottom card of the security?";
  55. string notSelectPlayerMessage = "The opponent is selecting whether to trash the top or bottom card of security.";
  56. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  57. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  58. bool fromTop = GManager.instance.userSelectionManager.SelectedBoolValue;
  59. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  60. card.Owner,
  61. 1,
  62. activateClass,
  63. fromTop).DestroySecurity());
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectPermanentEffect.SetUpCustomMessage(
  81. "Select 1 Digimon that will get DP -6000.",
  82. "The opponent is selecting 1 Digimon that will get DP -6000.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  87. targetPermanent: permanent,
  88. changeValue: -6000,
  89. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  90. activateClass: activateClass));
  91. }
  92. }
  93. }
  94. }
  95. }
  96. #endregion
  97. #region When Digivolving
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect("Trash the top card of your security so that opponent's 1 Digimon gains DP -6000", CanUseCondition, card);
  102. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  103. cardEffects.Add(activateClass);
  104. string EffectDiscription()
  105. {
  106. return "[On Play] By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -6000 DP until the end of your opponent's turn.";
  107. }
  108. bool CanSelectPermanentCondition(Permanent permanent)
  109. {
  110. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (card.Owner.SecurityCards.Count >= 1)
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  128. {
  129. if (card.Owner.SecurityCards.Count >= 1)
  130. {
  131. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  132. {
  133. new SelectionElement<bool>(message: $"Security Top", value : true, spriteIndex: 0),
  134. new SelectionElement<bool>(message: $"Security Bottom", value : false, spriteIndex: 1),
  135. };
  136. string selectPlayerMessage = "Which will you trash the top or bottom card of the security?";
  137. string notSelectPlayerMessage = "The opponent is selecting whether to trash the top or bottom card of security.";
  138. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  139. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  140. bool fromTop = GManager.instance.userSelectionManager.SelectedBoolValue;
  141. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  142. card.Owner,
  143. 1,
  144. activateClass,
  145. fromTop).DestroySecurity());
  146. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  147. {
  148. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  149. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  150. selectPermanentEffect.SetUp(
  151. selectPlayer: card.Owner,
  152. canTargetCondition: CanSelectPermanentCondition,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: null,
  155. maxCount: maxCount,
  156. canNoSelect: false,
  157. canEndNotMax: false,
  158. selectPermanentCoroutine: SelectPermanentCoroutine,
  159. afterSelectPermanentCoroutine: null,
  160. mode: SelectPermanentEffect.Mode.Custom,
  161. cardEffect: activateClass);
  162. selectPermanentEffect.SetUpCustomMessage(
  163. "Select 1 Digimon that will get DP -6000.",
  164. "The opponent is selecting 1 Digimon that will get DP -6000.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  167. {
  168. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  169. targetPermanent: permanent,
  170. changeValue: -6000,
  171. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  172. activateClass: activateClass));
  173. }
  174. }
  175. }
  176. }
  177. }
  178. #endregion
  179. #region All Turns
  180. if (timing == EffectTiming.OnLoseSecurity)
  181. {
  182. ActivateClass activateClass = new ActivateClass();
  183. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  184. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  185. activateClass.SetHashString("Recovery1_BT15_038");
  186. cardEffects.Add(activateClass);
  187. string EffectDiscription()
  188. {
  189. return "[All Turns][Once Per Turn] When a card is removed from your security stack, if you have 3 or fewer security cards, trigger <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  190. }
  191. bool CanUseCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnBattleArea(card))
  194. {
  195. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. bool CanActivateCondition(Hashtable hashtable)
  203. {
  204. if (CardEffectCommons.IsExistOnBattleArea(card))
  205. {
  206. if (card.Owner.SecurityCards.Count <= 3)
  207. {
  208. return true;
  209. }
  210. }
  211. return false;
  212. }
  213. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  214. {
  215. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  216. }
  217. }
  218. #endregion
  219. return cardEffects;
  220. }
  221. }
  222. }