EX12_016.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // MetalGreymon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Greymon")
  17. || targetPermanent.TopCard.EqualsTraits("ME")
  18. || targetPermanent.TopCard.EqualsTraits("VB");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 4)
  27. );
  28. }
  29. #endregion
  30. #region Decode
  31. if (timing == EffectTiming.WhenRemoveField)
  32. {
  33. bool SourceCondition(CardSource cardSource)
  34. {
  35. return cardSource.IsDigimon
  36. && cardSource.HasLevel
  37. && cardSource.Level <= 4
  38. && (cardSource.ContainsCardName("Agumon")
  39. || cardSource.ContainsCardName("Greymon")
  40. || cardSource.EqualsTraits("ME")
  41. || cardSource.EqualsTraits("VB"));
  42. }
  43. string[] decodeStrings = { "(Lv.4 or lower w/[Agumon]/[Greymon] in name or w/[ME]/[VB] trait)", "Level 4 or lower Digimon card with [Agumon]/[Greymon] in name or [ME]/[VB] trait" };
  44. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  45. }
  46. #endregion
  47. #region Shared OP/WD
  48. string SharedEffectName = "Delete 1 enemy 6K DP or lower Digimon, then taunt 1 enemy Digimon";
  49. CardEffectFactory.ActivateClassesForSharedEffects
  50. (ref cardEffects, timing, card,
  51. SharedEffectName,
  52. SharedActivateCoroutine,
  53. SharedEffectDescription,
  54. optional: false,
  55. onPlay: true,
  56. whenDigivolving: true);
  57. string SharedEffectDescription(string tag)
  58. {
  59. return $"[{tag}] Delete 1 of your opponent's Digimon with 6000 DP or less. Then, give 1 of their Digimon \"[Start of Your Main Phase] This Digimon attacks.\" until their turn ends.";
  60. }
  61. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  62. {
  63. bool CanSelectPermanentCondition1(Permanent permanent)
  64. {
  65. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  66. && permanent.HasDP
  67. && permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass);
  68. }
  69. bool CanSelectPermanentCondition2(Permanent permanent)
  70. {
  71. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  72. }
  73. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  74. {
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition1,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: 1,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Destroy,
  87. cardEffect: activateClass);
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. }
  90. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  91. {
  92. Permanent selectedPermanment = null;
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition2,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: 1,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. selectedPermanment = permanent;
  109. yield return null;
  110. }
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain [Start of Your Main Phase] This Digimon attacks", "The opponent is selecting 1 Digimon to gain [Start of Your Main Phase] This Digimon attacks");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. if (selectedPermanment != null)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.StartOfMainAttack(
  116. targetPermanent: selectedPermanment,
  117. cardEffect: activateClass));
  118. }
  119. }
  120. }
  121. #endregion
  122. #region Assembly
  123. if (timing == EffectTiming.None)
  124. {
  125. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  126. addAssemblyConditionClass.SetUpICardEffect("Assembly", CanUseCondition, card);
  127. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  128. addAssemblyConditionClass.SetNotShowUI(true);
  129. cardEffects.Add(addAssemblyConditionClass);
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return true;
  133. }
  134. AssemblyCondition GetAssembly(CardSource cardSource)
  135. {
  136. if (cardSource == card)
  137. {
  138. AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
  139. bool CanSelectCardCondition(CardSource cardSource)
  140. {
  141. return cardSource.HasLevel
  142. && cardSource.Level <= 4
  143. && (cardSource.ContainsCardName("Agumon")
  144. || cardSource.ContainsCardName("Greymon")
  145. || cardSource.EqualsTraits("ME")
  146. || cardSource.EqualsTraits("VB"));
  147. }
  148. AssemblyCondition assemblyCondition = new AssemblyCondition(
  149. element: element,
  150. CanTargetCondition_ByPreSelecetedList: null,
  151. selectMessage: "Lv.4 or lower w/[Agumon]/[Greymon] in name or w/[ME]/[VB] trait",
  152. elementCount: 1,
  153. reduceCost: 2);
  154. return assemblyCondition;
  155. }
  156. return null;
  157. }
  158. }
  159. #endregion
  160. #region Inherited
  161. if (timing == EffectTiming.WhenRemoveField)
  162. {
  163. bool SourceCondition(CardSource cardSource)
  164. {
  165. return cardSource.IsDigimon
  166. && cardSource.HasLevel
  167. && cardSource.Level <= 4
  168. && (cardSource.ContainsCardName("Agumon")
  169. || cardSource.ContainsCardName("Greymon")
  170. || cardSource.EqualsTraits("ME")
  171. || cardSource.EqualsTraits("VB"));
  172. }
  173. string[] decodeStrings = { "(Lv.4 or lower w/[Agumon]/[Greymon] in name or w/[ME]/[VB] trait)", "Level 4 or lower Digimon card with [Agumon]/[Greymon] in name or [ME]/[VB] trait" };
  174. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: true, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  175. }
  176. #endregion
  177. return cardEffects;
  178. }
  179. }
  180. }