EX8_010.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX8
  5. {
  6. public class EX8_010 : 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 PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3)
  17. return targetPermanent.TopCard.EqualsTraits("NSo");
  18. return false;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 2,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  43. {
  44. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Destroy,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. }
  87. }
  88. #endregion
  89. #region When Digivolving
  90. if (timing == EffectTiming.OnDestroyedAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[On Deletion] Delete 1 of your opponent's Digimon with 4000 DP or less.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  103. {
  104. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  118. {
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  129. {
  130. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: null,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Destroy,
  143. cardEffect: activateClass);
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. }
  147. }
  148. #endregion
  149. #region Inherit
  150. if (timing == EffectTiming.None)
  151. {
  152. bool Condition()
  153. {
  154. if (CardEffectCommons.IsOwnerTurn(card))
  155. {
  156. return true;
  157. }
  158. return false;
  159. }
  160. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  161. changeValue: 2000,
  162. isInheritedEffect: true,
  163. card: card,
  164. condition: Condition));
  165. }
  166. #endregion
  167. return cardEffects;
  168. }
  169. }
  170. }