BT21_067.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT21_067 Garurumon
  4. namespace DCGO.CardEffects.BT21
  5. {
  6. public class BT21_067 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution condition
  12. if(timing == EffectTiming.None)
  13. {
  14. bool Condition(Permanent permanent)
  15. {
  16. return (permanent.TopCard.ContainsCardName("Gabumon") || permanent.TopCard.EqualsTraits("ADVENTURE")) && permanent.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 2, false, card, 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 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("ADVENTURE") && card.IsDigimon;
  35. }
  36. #endregion
  37. #region On Play
  38. if(timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Return adventure 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 [ADVENTURE] 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 adventure 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 [ADVENTURE] 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 Inherit - When Attacking
  116. if (timing == EffectTiming.OnAllyAttack)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  121. activateClass.SetIsInheritedEffect(true);
  122. activateClass.SetHashString("Draw_BT21_067");
  123. cardEffects.Add(activateClass);
  124. string EffectDiscription()
  125. {
  126. return "[When Attacking] [Once Per Turn] <Draw 1> and trash 1 card in your hand.";
  127. }
  128. bool CanUseCondition(Hashtable hashtable)
  129. {
  130. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  131. }
  132. bool CanActivateCondition(Hashtable hashtable)
  133. {
  134. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  135. {
  136. return true;
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  143. if (card.Owner.HandCards.Count >= 1)
  144. {
  145. int discardCount = 1;
  146. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  147. selectHandEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: (cardSource) => true,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: discardCount,
  153. canNoSelect: false,
  154. canEndNotMax: false,
  155. isShowOpponent: true,
  156. selectCardCoroutine: null,
  157. afterSelectCardCoroutine: null,
  158. mode: SelectHandEffect.Mode.Discard,
  159. cardEffect: activateClass);
  160. yield return StartCoroutine(selectHandEffect.Activate());
  161. }
  162. }
  163. }
  164. #endregion
  165. return cardEffects;
  166. }
  167. }
  168. }