BT19_041.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_041 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash your top security, one of you Digimon gets Blocker and +6000DP", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] By trashing the top card of your security stack, 1 of your Digimon gains <Blocker> and gets +6000 DP until the end of your opponent's turn.";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  32. {
  33. if (card.Owner.SecurityCards.Count >= 1)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  43. player: card.Owner,
  44. destroySecurityCount: 1,
  45. cardEffect: activateClass,
  46. fromTop: true).DestroySecurity());
  47. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  48. {
  49. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  50. selectPermanentEffect.SetUp(
  51. selectPlayer: card.Owner,
  52. canTargetCondition: CanSelectPermanentCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. maxCount: 1,
  56. canNoSelect: false,
  57. canEndNotMax: false,
  58. selectPermanentCoroutine: SelectPermanentCoroutine,
  59. afterSelectPermanentCoroutine: null,
  60. mode: SelectPermanentEffect.Mode.Custom,
  61. cardEffect: activateClass);
  62. selectPermanentEffect.SetUpCustomMessage(
  63. "Select 1 Digimon that will get Blocker and DP +6000.",
  64. "The opponent is selecting 1 Digimon that will get Blocker DP +6000.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  70. targetPermanent: permanent,
  71. changeValue: 6000,
  72. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  73. activateClass: activateClass));
  74. }
  75. }
  76. }
  77. }
  78. #endregion
  79. #region When Digivolving
  80. if (timing == EffectTiming.OnEnterFieldAnyone)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Trash your top security, one of you Digimon gets Blocker and +6000DP", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[When Digivolving] By trashing the top card of your security stack, 1 of your Digimon gains <Blocker> and gets +6000 DP until the end of your opponent's turn.";
  89. }
  90. bool CanSelectPermanentCondition(Permanent permanent)
  91. {
  92. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  97. {
  98. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. if (card.Owner.SecurityCards.Count >= 1)
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  117. {
  118. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  119. player: card.Owner,
  120. destroySecurityCount: 1,
  121. cardEffect: activateClass,
  122. fromTop: true).DestroySecurity());
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  124. {
  125. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  126. selectPermanentEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanSelectPermanentCondition,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: 1,
  132. canNoSelect: false,
  133. canEndNotMax: false,
  134. selectPermanentCoroutine: SelectPermanentCoroutine,
  135. afterSelectPermanentCoroutine: null,
  136. mode: SelectPermanentEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. selectPermanentEffect.SetUpCustomMessage(
  139. "Select 1 Digimon that will get Blocker and DP +6000.",
  140. "The opponent is selecting 1 Digimon that will get Blocker DP +6000.");
  141. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  142. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  146. targetPermanent: permanent,
  147. changeValue: 6000,
  148. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  149. activateClass: activateClass));
  150. }
  151. }
  152. }
  153. }
  154. #endregion
  155. #region All Turns
  156. if (timing == EffectTiming.WhenRemoveField)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Recovery +1", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  161. activateClass.SetHashString("Recovery_Dynasmon_BT19_041");
  162. cardEffects.Add(activateClass);
  163. string EffectDiscription()
  164. {
  165. return "[All Turns][Once Per Turn] When this Digimon would leave the battle area, if you have 2 or fewer security cards, <Recovery +1>.";
  166. }
  167. bool CanUseCondition(Hashtable hashtable)
  168. {
  169. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  170. {
  171. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  172. {
  173. return true;
  174. }
  175. }
  176. return false;
  177. }
  178. bool CanActivateCondition(Hashtable hashtable)
  179. {
  180. if (card.Owner.SecurityCards.Count <= 2)
  181. {
  182. return true;
  183. }
  184. return false;
  185. }
  186. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  187. {
  188. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  189. }
  190. }
  191. #endregion
  192. return cardEffects;
  193. }
  194. }
  195. }