BT20_070.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_070 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alt Digivolve Cost
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel3 &&
  16. (targetPermanent.TopCard.EqualsCardName("Loogamon") ||
  17. targetPermanent.TopCard.HasSeekersTraits);
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region On Play
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("By trashing 1 card, return 1 card with [SoC]/[SEEKERS] trait from trash to hand", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] By trashing 1 card in your hand, you may return 1 card with the [SoC] or [SEEKERS] trait from your trash to the hand.";
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.HasSocTraits || cardSource.HasSeekersTraits;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  46. card.Owner.HandCards.Count > 0;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. bool discarded = false;
  51. int discardCount = 1;
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: (cardSource) => true,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: discardCount,
  59. canNoSelect: true,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  64. mode: SelectHandEffect.Mode.Discard,
  65. cardEffect: activateClass);
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  68. {
  69. if (cardSources.Count >= 1)
  70. {
  71. discarded = true;
  72. yield return null;
  73. }
  74. }
  75. if (discarded)
  76. {
  77. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  78. selectCardEffect.SetUp(
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. canNoSelect: () => true,
  83. selectCardCoroutine: null,
  84. afterSelectCardCoroutine: null,
  85. message: "Select 1 card to add to your hand.",
  86. maxCount: 1,
  87. canEndNotMax: false,
  88. isShowOpponent: true,
  89. mode: SelectCardEffect.Mode.AddHand,
  90. root: SelectCardEffect.Root.Trash,
  91. customRootCardList: null,
  92. canLookReverseCard: true,
  93. selectPlayer: card.Owner,
  94. cardEffect: activateClass);
  95. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  96. }
  97. }
  98. }
  99. #endregion
  100. #region When Digivolving
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("By trashing 1 card, return 1 card with [SoC]/[SEEKERS] trait from trash to hand", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[When Digivolving] By trashing 1 card in your hand, you may return 1 card with the [SoC] or [SEEKERS] trait from your trash to the hand.";
  110. }
  111. bool CanSelectCardCondition(CardSource cardSource)
  112. {
  113. return cardSource.HasSocTraits || cardSource.HasSeekersTraits;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  118. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  123. card.Owner.HandCards.Count > 0;
  124. }
  125. IEnumerator ActivateCoroutine(Hashtable hashtable)
  126. {
  127. bool discarded = false;
  128. int discardCount = 1;
  129. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  130. selectHandEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: (cardSource) => true,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: discardCount,
  136. canNoSelect: true,
  137. canEndNotMax: false,
  138. isShowOpponent: true,
  139. selectCardCoroutine: null,
  140. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  141. mode: SelectHandEffect.Mode.Discard,
  142. cardEffect: activateClass);
  143. yield return StartCoroutine(selectHandEffect.Activate());
  144. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  145. {
  146. if (cardSources.Count >= 1)
  147. {
  148. discarded = true;
  149. yield return null;
  150. }
  151. }
  152. if (discarded)
  153. {
  154. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  155. selectCardEffect.SetUp(
  156. canTargetCondition: CanSelectCardCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. canNoSelect: () => true,
  160. selectCardCoroutine: null,
  161. afterSelectCardCoroutine: null,
  162. message: "Select 1 card to add to your hand.",
  163. maxCount: 1,
  164. canEndNotMax: false,
  165. isShowOpponent: true,
  166. mode: SelectCardEffect.Mode.AddHand,
  167. root: SelectCardEffect.Root.Trash,
  168. customRootCardList: null,
  169. canLookReverseCard: true,
  170. selectPlayer: card.Owner,
  171. cardEffect: activateClass);
  172. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  173. }
  174. }
  175. }
  176. #endregion
  177. #region ESS
  178. if (timing == EffectTiming.None)
  179. {
  180. bool Condition()
  181. {
  182. return CardEffectCommons.IsOwnerTurn(card);
  183. }
  184. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  185. changeValue: 2000,
  186. isInheritedEffect: true,
  187. card: card,
  188. condition: Condition));
  189. }
  190. #endregion
  191. return cardEffects;
  192. }
  193. }
  194. }