EX4_048.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX4
  5. {
  6. public class EX4_048 : 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. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  14. changeCardNamesClass.SetUpICardEffect("Also treated as having [Greymon] in its name", CanUseCondition, card);
  15. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  16. cardEffects.Add(changeCardNamesClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. return true;
  20. }
  21. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  22. {
  23. if (cardSource == card)
  24. {
  25. CardNames.Add("Greymon_EX4_048");
  26. }
  27. return CardNames;
  28. }
  29. }
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Delete 1 Digimon with 13 or more cost, or trash the top card of opponent's security", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[When Digivolving] Delete 1 of your opponent's Digimon with a play cost of 13 or more. If no Digimon was deleted by this effect, trash the top card of your opponent's security stack.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  43. {
  44. if (permanent.TopCard.GetCostItself >= 13)
  45. {
  46. if (permanent.TopCard.HasPlayCost)
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (isExistOnField(card))
  61. {
  62. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. return true;
  67. }
  68. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  77. {
  78. if (isExistOnField(card))
  79. {
  80. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  81. {
  82. List<Permanent> selectedPermanents = new List<Permanent>();
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: null,
  96. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  97. mode: SelectPermanentEffect.Mode.Destroy,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  101. {
  102. foreach (Permanent permanent in permanents)
  103. {
  104. selectedPermanents.Add(permanent);
  105. }
  106. yield return null;
  107. }
  108. }
  109. bool destroyed()
  110. {
  111. foreach (Permanent permanent in selectedPermanents)
  112. {
  113. if (permanent.TopCard == null)
  114. {
  115. if (permanent.willBeRemoveField)
  116. {
  117. if (permanent.DestroyingEffect == activateClass)
  118. {
  119. return true;
  120. }
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. if (!destroyed())
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  129. player: card.Owner.Enemy,
  130. destroySecurityCount: 1,
  131. cardEffect: activateClass,
  132. fromTop: true).DestroySecurity());
  133. }
  134. }
  135. }
  136. }
  137. }
  138. if (timing == EffectTiming.OnEndTurn)
  139. {
  140. ActivateClass activateClass = new ActivateClass();
  141. activateClass.SetUpICardEffect("Digivolve this Digimon into 1 card with [Gaiomon] in its name", CanUseCondition, card);
  142. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  143. cardEffects.Add(activateClass);
  144. string EffectDiscription()
  145. {
  146. return "[End of Your Turn] If you have a Tamer in play, this Digimon may digivolve into 1 card with [Gaiomon] in its name and a play cost of 13 or more in your hand, ignoring its digivolution requirements and without paying the cost.";
  147. }
  148. bool CanSelectCardCondition(CardSource cardSource)
  149. {
  150. return cardSource.ContainsCardName("Gaiomon") && cardSource.GetCostItself >= 13;
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.IsExistOnBattleArea(card))
  155. {
  156. if (CardEffectCommons.IsOwnerTurn(card))
  157. {
  158. return true;
  159. }
  160. }
  161. return false;
  162. }
  163. bool CanActivateCondition(Hashtable hashtable)
  164. {
  165. if (CardEffectCommons.IsExistOnBattleArea(card))
  166. {
  167. if (card.Owner.HandCards.Count >= 1)
  168. {
  169. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  170. {
  171. return true;
  172. }
  173. }
  174. }
  175. return false;
  176. }
  177. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  178. {
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  180. targetPermanent: card.PermanentOfThisCard(),
  181. cardCondition: CanSelectCardCondition,
  182. payCost: false,
  183. reduceCostTuple: null,
  184. fixedCostTuple: null,
  185. ignoreDigivolutionRequirementFixedCost: 0,
  186. isHand: true,
  187. activateClass: activateClass,
  188. successProcess: null));
  189. }
  190. }
  191. return cardEffects;
  192. }
  193. }
  194. }