BT16_066.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_066 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Digivolve Condition
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Syakomon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region Start of Main
  21. if (timing == EffectTiming.OnStartMainPhase)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Your opponent trashes a card or else you gain a memory.", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[Start of Your Main Phase] Your opponent may trash 1 Digimon card in their hand. If they don't, gain 1 memory.";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (CardEffectCommons.IsOwnerTurn(card))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleArea(card);
  45. }
  46. bool CanSelectCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.IsDigimon;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. bool discarded = false;
  53. if (card.Owner.Enemy.HandCards.Count >= 1)
  54. {
  55. int discardCount = 1;
  56. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  57. selectHandEffect.SetUp(
  58. selectPlayer: card.Owner.Enemy,
  59. canTargetCondition: CanSelectCardCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: discardCount,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. isShowOpponent: true,
  66. selectCardCoroutine: null,
  67. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  68. mode: SelectHandEffect.Mode.Discard,
  69. cardEffect: activateClass);
  70. yield return StartCoroutine(selectHandEffect.Activate());
  71. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  72. {
  73. if (cardSources.Count >= 1)
  74. {
  75. discarded = true;
  76. yield return null;
  77. }
  78. }
  79. }
  80. if (!discarded)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  83. }
  84. }
  85. }
  86. #endregion
  87. #region When Digivolving
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Your opponent trashes a card or else you gain a memory.", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[When Digivolving] Your opponent may trash 1 Digimon card in their hand. If they don't, gain 1 memory.";
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleArea(card);
  105. }
  106. bool CanSelectCardCondition(CardSource cardSource)
  107. {
  108. return cardSource.IsDigimon;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. bool discarded = false;
  113. if (card.Owner.Enemy.HandCards.Count >= 1)
  114. {
  115. int discardCount = 1;
  116. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  117. selectHandEffect.SetUp(
  118. selectPlayer: card.Owner.Enemy,
  119. canTargetCondition: CanSelectCardCondition,
  120. canTargetCondition_ByPreSelecetedList: null,
  121. canEndSelectCondition: null,
  122. maxCount: discardCount,
  123. canNoSelect: true,
  124. canEndNotMax: false,
  125. isShowOpponent: true,
  126. selectCardCoroutine: null,
  127. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  128. mode: SelectHandEffect.Mode.Discard,
  129. cardEffect: activateClass);
  130. yield return StartCoroutine(selectHandEffect.Activate());
  131. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  132. {
  133. if (cardSources.Count >= 1)
  134. {
  135. discarded = true;
  136. yield return null;
  137. }
  138. }
  139. }
  140. if (!discarded)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  143. }
  144. }
  145. }
  146. #endregion
  147. #region Inherit
  148. if (timing == EffectTiming.OnAllyAttack)
  149. {
  150. ActivateClass activateClass = new ActivateClass();
  151. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  152. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  153. activateClass.SetIsInheritedEffect(true);
  154. activateClass.SetHashString("DrawTrashBT16_066");
  155. cardEffects.Add(activateClass);
  156. string EffectDiscription()
  157. {
  158. return "[When Attacking] [Once Per Turn] Trigger <Draw 1>. (Draw 1 cards from your deck.) Then trash 1 card from your hand.";
  159. }
  160. bool CanUseCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  163. }
  164. bool CanActivateCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  167. }
  168. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  169. {
  170. if (card.Owner.LibraryCards.Count >= 1)
  171. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  172. if (card.Owner.HandCards.Count >= 1)
  173. {
  174. int discardCount = 1;
  175. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  176. selectHandEffect.SetUp(
  177. selectPlayer: card.Owner,
  178. canTargetCondition: (cardSource) => true,
  179. canTargetCondition_ByPreSelecetedList: null,
  180. canEndSelectCondition: null,
  181. maxCount: discardCount,
  182. canNoSelect: false,
  183. canEndNotMax: false,
  184. isShowOpponent: true,
  185. selectCardCoroutine: null,
  186. afterSelectCardCoroutine: null,
  187. mode: SelectHandEffect.Mode.Discard,
  188. cardEffect: activateClass);
  189. yield return StartCoroutine(selectHandEffect.Activate());
  190. }
  191. }
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }