EX4_072.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX4
  6. {
  7. public class EX4_072 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  15. changeCardNamesClass.SetUpICardEffect("Also treated as having [Plug-In] in its name", CanUseCondition, card);
  16. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  17. cardEffects.Add(changeCardNamesClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  23. {
  24. if (cardSource == card)
  25. {
  26. CardNames.Add("Plug-In_EX4_072");
  27. }
  28. return CardNames;
  29. }
  30. }
  31. if (timing == EffectTiming.None)
  32. {
  33. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  34. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  35. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  36. cardEffects.Add(ignoreColorConditionClass);
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  40. {
  41. return true;
  42. }
  43. return false;
  44. }
  45. bool CardCondition(CardSource cardSource)
  46. {
  47. if (cardSource == card)
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. }
  54. if (timing == EffectTiming.OptionSkill)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  58. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  59. cardEffects.Add(activateClass);
  60. string EffectDiscription()
  61. {
  62. return "[Main] Choose 1 of your level 6 Digimon. Ignoring digivolution requirements and without paying the cost, it may digivolve into a level 6 Digimon card in your hand with a different name that includes the chosen Digimon's name.";
  63. }
  64. bool CanSelectPermanentCondition(Permanent permanent)
  65. {
  66. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  67. {
  68. if (permanent.TopCard.HasLevel && permanent.Level == 6)
  69. {
  70. foreach (CardSource cardSource in card.Owner.HandCards)
  71. {
  72. if (CanSelectCardCondition(cardSource, permanent))
  73. {
  74. if (!cardSource.CanNotEvolve(permanent))
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. }
  81. }
  82. return false;
  83. }
  84. bool CanSelectCardCondition(CardSource cardSource, Permanent permanent)
  85. {
  86. if (permanent.TopCard.CardNames.Count((cardName) => cardSource.ContainsCardName(cardName)) >= 1)
  87. {
  88. if (permanent.TopCard.CardNames.Count((cardName) => cardSource.CardNames.Contains(cardName)) == 0)
  89. {
  90. if (cardSource.HasLevel && cardSource.Level == 6)
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. return false;
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  103. {
  104. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  105. {
  106. Permanent selectedPermanent = null;
  107. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  108. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  109. selectPermanentEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: CanSelectPermanentCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: maxCount,
  115. canNoSelect: true,
  116. canEndNotMax: false,
  117. selectPermanentCoroutine: SelectPermanentCoroutine,
  118. afterSelectPermanentCoroutine: null,
  119. mode: SelectPermanentEffect.Mode.Custom,
  120. cardEffect: activateClass);
  121. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  123. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  124. {
  125. selectedPermanent = permanent;
  126. yield return null;
  127. }
  128. if (selectedPermanent != null)
  129. {
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  131. targetPermanent: selectedPermanent,
  132. cardCondition: (cardSource) => CanSelectCardCondition(cardSource, selectedPermanent),
  133. payCost: false,
  134. reduceCostTuple: null,
  135. fixedCostTuple: null,
  136. ignoreDigivolutionRequirementFixedCost: 0,
  137. isHand: true,
  138. activateClass: activateClass,
  139. successProcess: null));
  140. }
  141. }
  142. }
  143. }
  144. if (timing == EffectTiming.SecuritySkill)
  145. {
  146. ActivateClass activateClass = new ActivateClass();
  147. activateClass.SetUpICardEffect($"Return 1 card from trash to hand and add this card to hand", CanUseCondition, card);
  148. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  149. activateClass.SetIsSecurityEffect(true);
  150. cardEffects.Add(activateClass);
  151. string EffectDiscription()
  152. {
  153. return "[Security] Return 1 Digimon card from your trash to your hand, and add this card to your hand.";
  154. }
  155. bool CanSelectCardCondition(CardSource cardSource)
  156. {
  157. if (cardSource != null)
  158. {
  159. if (cardSource.IsDigimon)
  160. {
  161. if (cardSource.Owner == card.Owner)
  162. {
  163. return true;
  164. }
  165. }
  166. }
  167. return false;
  168. }
  169. bool CanUseCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  174. {
  175. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  176. {
  177. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  178. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  179. selectCardEffect.SetUp(
  180. canTargetCondition: CanSelectCardCondition,
  181. canTargetCondition_ByPreSelecetedList: null,
  182. canEndSelectCondition: null,
  183. canNoSelect: () => false,
  184. selectCardCoroutine: null,
  185. afterSelectCardCoroutine: null,
  186. message: "Select 1 card to add to your hand.",
  187. maxCount: maxCount,
  188. canEndNotMax: false,
  189. isShowOpponent: true,
  190. mode: SelectCardEffect.Mode.AddHand,
  191. root: SelectCardEffect.Root.Trash,
  192. customRootCardList: null,
  193. canLookReverseCard: true,
  194. selectPlayer: card.Owner,
  195. cardEffect: activateClass);
  196. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  197. }
  198. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  199. }
  200. }
  201. return cardEffects;
  202. }
  203. }
  204. }