BT15_053.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_053 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase/ When Digivolving Shared
  12. string EffectDiscription()
  13. {
  14. return "[Start of Your Main Phase] [When Digivolving] Suspend 1 of your opponent's Digimon. 1 of your Digimon gains <Piercing> for the turn.";
  15. }
  16. bool CanSelectPermanentCondition(Permanent permanent)
  17. {
  18. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  19. }
  20. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  23. }
  24. bool CanActivateCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleArea(card);
  27. }
  28. #endregion
  29. #region Start of Your Main Phase
  30. if (timing == EffectTiming.OnStartMainPhase)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Suspend 1 Digimon and your 1 Digimon gains Pierce", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.IsOwnerTurn(card))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  50. {
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: null,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Tap,
  64. cardEffect: activateClass);
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. }
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnerPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectOwnerPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage(
  84. "Select 1 Digimon that will gain Pierce.",
  85. "The opponent is selecting 1 Digimon that will gain Pierce.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  90. targetPermanent: permanent,
  91. effectDuration: EffectDuration.UntilEachTurnEnd,
  92. activateClass: activateClass));
  93. }
  94. }
  95. }
  96. }
  97. #endregion
  98. #region When Digivolving
  99. if (timing == EffectTiming.OnEnterFieldAnyone)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("Suspend 1 Digimon and your 1 Digimon gains Pierce", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  104. cardEffects.Add(activateClass);
  105. bool CanUseCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  117. {
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  119. {
  120. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  121. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: maxCount,
  128. canNoSelect: false,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: null,
  131. afterSelectPermanentCoroutine: null,
  132. mode: SelectPermanentEffect.Mode.Tap,
  133. cardEffect: activateClass);
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. }
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  137. {
  138. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnerPermanentCondition));
  139. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  140. selectPermanentEffect.SetUp(
  141. selectPlayer: card.Owner,
  142. canTargetCondition: CanSelectOwnerPermanentCondition,
  143. canTargetCondition_ByPreSelecetedList: null,
  144. canEndSelectCondition: null,
  145. maxCount: maxCount,
  146. canNoSelect: false,
  147. canEndNotMax: false,
  148. selectPermanentCoroutine: SelectPermanentCoroutine,
  149. afterSelectPermanentCoroutine: null,
  150. mode: SelectPermanentEffect.Mode.Custom,
  151. cardEffect: activateClass);
  152. selectPermanentEffect.SetUpCustomMessage(
  153. "Select 1 Digimon that will gain Pierce.",
  154. "The opponent is selecting 1 Digimon that will gain Pierce.");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  157. {
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  159. targetPermanent: permanent,
  160. effectDuration: EffectDuration.UntilEachTurnEnd,
  161. activateClass: activateClass));
  162. }
  163. }
  164. }
  165. }
  166. #endregion
  167. #region All Turns
  168. if (timing == EffectTiming.None)
  169. {
  170. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  171. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects", CanUseCondition, card);
  172. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  173. cardEffects.Add(canNotAffectedClass);
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. if (card.PermanentOfThisCard().IsSuspended)
  179. {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. bool CardCondition(CardSource cardSource)
  186. {
  187. if (cardSource == card)
  188. {
  189. if (CardEffectCommons.IsExistOnBattleArea(card))
  190. {
  191. if (cardSource == card.PermanentOfThisCard().TopCard)
  192. {
  193. return true;
  194. }
  195. }
  196. }
  197. return false;
  198. }
  199. bool SkillCondition(ICardEffect cardEffect)
  200. {
  201. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  202. {
  203. if (cardEffect.IsDigimonEffect)
  204. {
  205. return true;
  206. }
  207. }
  208. return false;
  209. }
  210. }
  211. #endregion
  212. return cardEffects;
  213. }
  214. }
  215. }