HerculesKabuterimonAce_EX8_044.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class HerculesKabuterimonAce_EX8_044 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsTraits("NSp");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Ace - Blast Digivolve
  29. if (timing == EffectTiming.OnCounterTiming)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play/ When Digivolving Shared
  35. bool CanSelectPermanentConditionShared(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  38. }
  39. bool CanActivateConditionShared(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Suspend 3 Digimon", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  50. cardEffects.Add(activateClass);
  51. string EffectDescription()
  52. {
  53. return
  54. "[On Play] You may suspend up to 3 Digimon. For each of your opponent's Digimon suspended by this effect, gain 1 memory.";
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentConditionShared,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared)),
  69. canNoSelect: true,
  70. canEndNotMax: true,
  71. selectPermanentCoroutine: null,
  72. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  77. {
  78. foreach (var selectedPermanent in permanents.Where(selectedPermanent =>
  79. selectedPermanent != null &&
  80. selectedPermanent.TopCard &&
  81. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  82. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend))
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(
  85. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  86. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  87. if (selectedPermanent.IsSuspended && CardEffectCommons.IsOpponentPermanent(selectedPermanent, card))
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  90. }
  91. }
  92. }
  93. }
  94. }
  95. #endregion
  96. #region When Digivolving
  97. if (timing == EffectTiming.OnEnterFieldAnyone)
  98. {
  99. ActivateClass activateClass = new ActivateClass();
  100. activateClass.SetUpICardEffect("Suspend 3 Digimon", CanUseCondition, card);
  101. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  102. cardEffects.Add(activateClass);
  103. string EffectDescription()
  104. {
  105. return
  106. "[When Digivolving] You may suspend up to 3 Digimon. For each of your opponent's Digimon suspended by this effect, gain 1 memory.";
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentConditionShared,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared)),
  121. canNoSelect: true,
  122. canEndNotMax: true,
  123. selectPermanentCoroutine: null,
  124. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  125. mode: SelectPermanentEffect.Mode.Custom,
  126. cardEffect: activateClass);
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  129. {
  130. foreach (var selectedPermanent in permanents.Where(selectedPermanent =>
  131. selectedPermanent != null &&
  132. selectedPermanent.TopCard &&
  133. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  134. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend))
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(
  137. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  138. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  139. if (selectedPermanent.IsSuspended && CardEffectCommons.IsOpponentPermanent(selectedPermanent, card))
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  142. }
  143. }
  144. }
  145. }
  146. }
  147. #endregion
  148. #region All Turns
  149. if (timing == EffectTiming.OnTappedAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Give 1 of your Digimon Piercing and +3000 DP.", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  154. activateClass.SetHashString("Buff_EX8_044");
  155. cardEffects.Add(activateClass);
  156. string EffectDescription()
  157. {
  158. return
  159. "[All Turns] (Once Per Turn) When this Digimon becomes suspended, 1 of your Digimon gains <Piercing> and gets +3000 DP until the end of your opponent's turn.";
  160. }
  161. bool CanUseCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  164. }
  165. bool CanSelectPermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  168. }
  169. bool CanActivateCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. Permanent selectedPermanent = null;
  176. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  177. selectPermanentEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectPermanentCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: 1,
  183. canNoSelect: false,
  184. canEndNotMax: false,
  185. selectPermanentCoroutine: SelectPermanentCoroutine,
  186. afterSelectPermanentCoroutine: null,
  187. mode: SelectPermanentEffect.Mode.Custom,
  188. cardEffect: activateClass);
  189. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Piercing and +3000 DP.",
  190. "The opponent is selecting 1 Digimon that will get Piercing and +3000 DP.");
  191. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  192. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  193. {
  194. selectedPermanent = permanent;
  195. yield return null;
  196. }
  197. if (selectedPermanent != null)
  198. {
  199. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  200. targetPermanent: selectedPermanent,
  201. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  202. activateClass: activateClass));
  203. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  204. targetPermanent: selectedPermanent,
  205. changeValue: 3000,
  206. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  207. activateClass: activateClass));
  208. }
  209. }
  210. }
  211. #endregion
  212. return cardEffects;
  213. }
  214. }
  215. }