EX4_072.cs 9.7 KB

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