BT23_074.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //Eater Legion
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_074 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Erika Mishima");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Alliance
  23. if (timing == EffectTiming.OnAllyAttack)
  24. {
  25. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Reboot
  29. if (timing == EffectTiming.None)
  30. {
  31. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play
  35. if (timing == EffectTiming.OnEnterFieldAnyone)
  36. {
  37. int maxCost = 6;
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("Play up to 6 Play cost Digimon", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[On Play] If you have [Mother Eater] in the breeding area, you may play up to 6 play cost's total worth of Digimon cards with the [Eater] trait from your hand without paying the costs.";
  45. }
  46. bool HasMother(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  49. permanent.TopCard.EqualsCardName("Mother Eater");
  50. }
  51. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource source)
  52. {
  53. int sumCost = 0;
  54. foreach (CardSource cardSource in cardSources)
  55. {
  56. sumCost += cardSource.GetCostItself;
  57. }
  58. sumCost += source.GetCostItself;
  59. if (sumCost > maxCost)
  60. {
  61. return false;
  62. }
  63. return true;
  64. }
  65. bool CanSelectCardCondition(CardSource cardSource)
  66. {
  67. return cardSource.HasEaterTraits &&
  68. cardSource.HasPlayCost &&
  69. cardSource.GetCostItself <= maxCost;
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  74. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  79. CardEffectCommons.HasMatchConditionPermanent(HasMother, true);
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable hashtable)
  82. {
  83. int maxCount = card.Owner.HandCards.Count(CanSelectCardCondition);
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: true,
  92. canEndNotMax: true,
  93. isShowOpponent: true,
  94. selectCardCoroutine: null,
  95. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. yield return StartCoroutine(selectHandEffect.Activate());
  99. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCards)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  102. cardSources: selectedCards,
  103. activateClass: activateClass,
  104. payCost: false,
  105. isTapped: false,
  106. root: SelectCardEffect.Root.Hand,
  107. activateETB: true));
  108. }
  109. }
  110. }
  111. #endregion
  112. #region When Digivolving
  113. if (timing == EffectTiming.OnEnterFieldAnyone)
  114. {
  115. int maxCost = 6;
  116. ActivateClass activateClass = new ActivateClass();
  117. activateClass.SetUpICardEffect("Play up to 6 Play cost Digimon", CanUseCondition, card);
  118. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  119. cardEffects.Add(activateClass);
  120. string EffectDiscription()
  121. {
  122. return "[When Digivolving] If you have [Mother Eater] in the breeding area, you may play up to 6 play cost's total worth of Digimon cards with the [Eater] trait from your hand without paying the costs.";
  123. }
  124. bool HasMother(Permanent permanent)
  125. {
  126. return CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card) &&
  127. permanent.TopCard.EqualsCardName("Mother Eater");
  128. }
  129. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource source)
  130. {
  131. int sumCost = 0;
  132. foreach (CardSource cardSource in cardSources)
  133. {
  134. sumCost += cardSource.GetCostItself;
  135. }
  136. sumCost += source.GetCostItself;
  137. if (sumCost > maxCost)
  138. {
  139. return false;
  140. }
  141. return true;
  142. }
  143. bool CanSelectCardCondition(CardSource cardSource)
  144. {
  145. return cardSource.HasEaterTraits &&
  146. cardSource.HasPlayCost &&
  147. cardSource.GetCostItself <= maxCost;
  148. }
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  152. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  157. CardEffectCommons.HasMatchConditionPermanent(HasMother, true);
  158. }
  159. IEnumerator ActivateCoroutine(Hashtable hashtable)
  160. {
  161. int maxCount = card.Owner.HandCards.Count(CanSelectCardCondition);
  162. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  163. selectHandEffect.SetUp(
  164. selectPlayer: card.Owner,
  165. canTargetCondition: CanSelectCardCondition,
  166. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  167. canEndSelectCondition: null,
  168. maxCount: maxCount,
  169. canNoSelect: true,
  170. canEndNotMax: true,
  171. isShowOpponent: true,
  172. selectCardCoroutine: null,
  173. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  174. mode: SelectHandEffect.Mode.Custom,
  175. cardEffect: activateClass);
  176. yield return StartCoroutine(selectHandEffect.Activate());
  177. IEnumerator AfterSelectCardCoroutine(List<CardSource> selectedCards)
  178. {
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  180. cardSources: selectedCards,
  181. activateClass: activateClass,
  182. payCost: false,
  183. isTapped: false,
  184. root: SelectCardEffect.Root.Hand,
  185. activateETB: true));
  186. }
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }