BT21_070.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT21_070 Gossipmon
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_070 : 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.EqualsTraits("Stnd.");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Security
  22. if (timing == EffectTiming.SecuritySkill)
  23. {
  24. cardEffects.Add(CardEffectFactory.PlaySelfDigimonAfterBattleSecurityEffect(card: card));
  25. }
  26. #endregion
  27. #region On Play/When-Digivolving/When Linking shared
  28. bool CanActivateConditionShared(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectReturn); ;
  31. }
  32. bool CanSelectReturn(CardSource card)
  33. {
  34. return card.EqualsTraits("Appmon") && card.IsDigimon;
  35. }
  36. #endregion
  37. #region On Play
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Return Appmon trait", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  43. cardEffects.Add(activateClass);
  44. string EffectDescription()
  45. {
  46. return "[On Play] You may return 1 Digimon card with the [Appmon] trait from your trash to the hand.";
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  55. selectCardEffect.SetUp(
  56. canTargetCondition: CanSelectReturn,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. canNoSelect: () => true,
  60. selectCardCoroutine: null,
  61. afterSelectCardCoroutine: null,
  62. message: "Select 1 card to add to your hand.",
  63. maxCount: 1,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. mode: SelectCardEffect.Mode.AddHand,
  67. root: SelectCardEffect.Root.Trash,
  68. customRootCardList: null,
  69. canLookReverseCard: true,
  70. selectPlayer: card.Owner,
  71. cardEffect: activateClass);
  72. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  73. }
  74. }
  75. #endregion
  76. #region When Digivolving
  77. if (timing == EffectTiming.OnEnterFieldAnyone)
  78. {
  79. ActivateClass activateClass = new ActivateClass();
  80. activateClass.SetUpICardEffect("Return Appmon trait", CanUseCondition, card);
  81. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  82. cardEffects.Add(activateClass);
  83. string EffectDescription()
  84. {
  85. return "[When Digivolving] You may return 1 Digimon card with the [Appmon] trait from your trash to the hand.";
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  90. }
  91. IEnumerator ActivateCoroutine(Hashtable hashtable)
  92. {
  93. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  94. selectCardEffect.SetUp(
  95. canTargetCondition: CanSelectReturn,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: null,
  98. canNoSelect: () => true,
  99. selectCardCoroutine: null,
  100. afterSelectCardCoroutine: null,
  101. message: "Select 1 card to add to your hand.",
  102. maxCount: 1,
  103. canEndNotMax: false,
  104. isShowOpponent: true,
  105. mode: SelectCardEffect.Mode.AddHand,
  106. root: SelectCardEffect.Root.Trash,
  107. customRootCardList: null,
  108. canLookReverseCard: true,
  109. selectPlayer: card.Owner,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  112. }
  113. }
  114. #endregion
  115. #region Linking
  116. if (timing == EffectTiming.OnDeclaration)
  117. {
  118. cardEffects.Add(CardEffectFactory.LinkEffect(card));
  119. }
  120. #endregion
  121. #region Link condition
  122. if (timing == EffectTiming.None)
  123. {
  124. bool PermanentCondition(Permanent permanent)
  125. {
  126. return permanent.TopCard.HasAppmonTraits;
  127. }
  128. cardEffects.Add(CardEffectFactory.AddSelfLinkConditionStaticEffect(permanentCondition: PermanentCondition, linkCost: 2, card: card));
  129. }
  130. #endregion
  131. #region When Linking
  132. if (timing == EffectTiming.WhenLinked)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Return Appmon", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  137. activateClass.SetIsLinkedEffect(true);
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[When Linking] You may return 1 Digimon card with the [Appmon] trait from your trash to the hand.";
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.CanTriggerWhenLinking(hashtable, null, card);
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return isExistOnField(card) && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectReturn);
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  154. selectCardEffect.SetUp(
  155. canTargetCondition: CanSelectReturn,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. canNoSelect: () => true,
  159. selectCardCoroutine: null,
  160. afterSelectCardCoroutine: null,
  161. message: "Select 1 card to add to your hand.",
  162. maxCount: 1,
  163. canEndNotMax: false,
  164. isShowOpponent: true,
  165. mode: SelectCardEffect.Mode.AddHand,
  166. root: SelectCardEffect.Root.Trash,
  167. customRootCardList: null,
  168. canLookReverseCard: true,
  169. selectPlayer: card.Owner,
  170. cardEffect: activateClass);
  171. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  172. }
  173. }
  174. #endregion
  175. return cardEffects;
  176. }
  177. }
  178. }