BT15_071.cs 8.3 KB

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