BT15_075.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT15
  4. {
  5. public class BT15_075 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.CardTraits.Contains("SoC"))
  16. {
  17. if (targetPermanent.TopCard.HasLevel)
  18. {
  19. if (targetPermanent.Level == 3)
  20. {
  21. return true;
  22. }
  23. }
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  28. permanentCondition: PermanentCondition,
  29. digivolutionCost: 2,
  30. ignoreDigivolutionRequirement: false,
  31. card: card,
  32. condition: null));
  33. }
  34. #endregion
  35. #region When Digivolving/When Attacking Shared
  36. string EffectSharedDiscription()
  37. {
  38. return "[When Digivolving][When Attacking] By trashing 1 card in your hand, this Digimon gets +2000 DP for the turn. If a Tamer card with the [SoC] trait is in this Digimon's digivolution cards, <Draw 1>.";
  39. }
  40. bool CanActivateSharedCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (card.Owner.HandCards.Count >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. #endregion
  52. #region When Digivolving
  53. if (timing == EffectTiming.OnEnterFieldAnyone)
  54. {
  55. ActivateClass activateClass = new ActivateClass();
  56. activateClass.SetUpICardEffect("DP +2000 and Draw 1", CanUseCondition, card);
  57. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true, EffectSharedDiscription());
  58. cardEffects.Add(activateClass);
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (card.Owner.HandCards.Count >= 1)
  66. {
  67. bool discarded = false;
  68. int discardCount = 1;
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: cardSource => true,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: discardCount,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. isShowOpponent: true,
  79. selectCardCoroutine: null,
  80. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  81. mode: SelectHandEffect.Mode.Discard,
  82. cardEffect: activateClass);
  83. yield return StartCoroutine(selectHandEffect.Activate());
  84. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  85. {
  86. if (cardSources.Count >= 1)
  87. {
  88. discarded = true;
  89. yield return null;
  90. }
  91. }
  92. if (discarded)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  95. targetPermanent: card.PermanentOfThisCard(),
  96. changeValue: 2000,
  97. effectDuration: EffectDuration.UntilEachTurnEnd,
  98. activateClass: activateClass));
  99. if (CardEffectCommons.IsExistOnBattleArea(card))
  100. {
  101. if (card.PermanentOfThisCard().DigivolutionCards.Some(cardSource => cardSource.IsTamer && cardSource.CardTraits.Contains("SoC")))
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  104. }
  105. }
  106. }
  107. }
  108. }
  109. }
  110. #endregion
  111. #region When Attack
  112. if (timing == EffectTiming.OnAllyAttack)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect("DP +2000 and Draw 1", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true, EffectSharedDiscription());
  117. cardEffects.Add(activateClass);
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  123. {
  124. if (card.Owner.HandCards.Count >= 1)
  125. {
  126. bool discarded = false;
  127. int discardCount = 1;
  128. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  129. selectHandEffect.SetUp(
  130. selectPlayer: card.Owner,
  131. canTargetCondition: cardSource => true,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. maxCount: discardCount,
  135. canNoSelect: true,
  136. canEndNotMax: false,
  137. isShowOpponent: true,
  138. selectCardCoroutine: null,
  139. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  140. mode: SelectHandEffect.Mode.Discard,
  141. cardEffect: activateClass);
  142. yield return StartCoroutine(selectHandEffect.Activate());
  143. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  144. {
  145. if (cardSources.Count >= 1)
  146. {
  147. discarded = true;
  148. yield return null;
  149. }
  150. }
  151. if (discarded)
  152. {
  153. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  154. targetPermanent: card.PermanentOfThisCard(),
  155. changeValue: 2000,
  156. effectDuration: EffectDuration.UntilEachTurnEnd,
  157. activateClass: activateClass));
  158. if (CardEffectCommons.IsExistOnBattleArea(card))
  159. {
  160. if (card.PermanentOfThisCard().DigivolutionCards.Some(cardSource => cardSource.IsTamer && cardSource.CardTraits.Contains("SoC")))
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. #endregion
  170. #region End of Attack - Inherited Effect
  171. if (timing == EffectTiming.OnEndAttack)
  172. {
  173. ActivateClass activateClass = new ActivateClass();
  174. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  175. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  176. activateClass.SetIsInheritedEffect(true);
  177. activateClass.SetHashString("Memory+1_BT15_075");
  178. cardEffects.Add(activateClass);
  179. string EffectDiscription()
  180. {
  181. return "[End of Attack] [Once Per Turn] If your opponent has 1 or more memory, gain 1 memory.";
  182. }
  183. bool CanUseCondition(Hashtable hashtable)
  184. {
  185. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  186. }
  187. bool CanActivateCondition(Hashtable hashtable)
  188. {
  189. if (CardEffectCommons.IsExistOnBattleArea(card))
  190. {
  191. if (card.Owner.Enemy.MemoryForPlayer >= 1)
  192. {
  193. return true;
  194. }
  195. }
  196. return false;
  197. }
  198. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  199. {
  200. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  201. }
  202. }
  203. #endregion
  204. return cardEffects;
  205. }
  206. }
  207. }