BT15_036.cs 11 KB

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