EX9_012.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX9
  4. {
  5. public class EX9_012 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. //[MetalGreymon]: Cost 1
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("MetalGreymon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. //Lv.4 w/[Greymon] in name or w/[ADVENTURE] trait: Cost 3
  21. if (timing == EffectTiming.None)
  22. {
  23. static bool PermanentCondition(Permanent targetPermanent)
  24. {
  25. return (targetPermanent.TopCard.HasGreymonName || targetPermanent.TopCard.HasAdventureTraits) && targetPermanent.TopCard.IsLevel4;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region On Play
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Delete 1 Digimon with 8000 DP or less", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Play] Delete 1 of your opponent's Digimon with 8000 DP or less.";
  40. }
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  70. {
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Destroy,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Delete 1 Digimon with 8000 DP or less", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] Delete 1 of your opponent's Digimon with 8000 DP or less.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  118. {
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  129. {
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectPermanentCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: 1,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: null,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Destroy,
  142. cardEffect: activateClass);
  143. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  144. }
  145. }
  146. }
  147. #endregion
  148. #region Your Turn
  149. if (timing == EffectTiming.OnEnterFieldAnyone)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Digivolve into a Digimon with [Greymon] in name", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  154. cardEffects.Add(activateClass);
  155. string EffectDiscription()
  156. {
  157. return "[Your Turn] When any of your Digimon or Tamers with [Garurumon] or [Tai Kamiya] in their names are played or any of your Digimon digivolve into a Digimon with [Garurumon] in its name, this Digimon may digivolve into a Digimon card with [Greymon] in its name in the hand without paying the cost.";
  158. }
  159. bool PlayedRequirement(Permanent permanent)
  160. {
  161. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  162. !permanent.IsOption &&
  163. (permanent.TopCard.HasGarurumonName || permanent.TopCard.ContainsCardName("Tai Kamiya"));
  164. }
  165. bool DigivolveRequirement(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  168. !permanent.IsOption &&
  169. permanent.TopCard.HasGarurumonName;
  170. }
  171. bool CanSelectCardCondition(CardSource cardSource)
  172. {
  173. return cardSource.IsDigimon && cardSource.HasGreymonName;
  174. }
  175. bool CanUseCondition(Hashtable hashtable)
  176. {
  177. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  178. CardEffectCommons.IsOwnerTurn(card) &&
  179. (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedRequirement) ||
  180. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, DigivolveRequirement));
  181. }
  182. bool CanActivateCondition(Hashtable hashtable)
  183. {
  184. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  185. }
  186. IEnumerator ActivateCoroutine(Hashtable hashtable)
  187. {
  188. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  189. targetPermanent: card.PermanentOfThisCard(),
  190. cardCondition: CanSelectCardCondition,
  191. payCost: false,
  192. reduceCostTuple: null,
  193. fixedCostTuple: null,
  194. ignoreDigivolutionRequirementFixedCost: -1,
  195. isHand: true,
  196. activateClass: activateClass,
  197. successProcess: null));
  198. }
  199. }
  200. #endregion
  201. #region Your Turn - ESS
  202. if (timing == EffectTiming.None)
  203. {
  204. bool Condition()
  205. {
  206. if (CardEffectCommons.IsOwnerTurn(card))
  207. {
  208. return true;
  209. }
  210. return false;
  211. }
  212. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  213. changeValue: 4000,
  214. isInheritedEffect: true,
  215. card: card,
  216. condition: Condition));
  217. }
  218. #endregion
  219. return cardEffects;
  220. }
  221. }
  222. }