EX9_010.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_010 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel3)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("DM"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 2,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null)
  32. );
  33. }
  34. #endregion
  35. #region Training
  36. if (timing == EffectTiming.OnDeclaration)
  37. {
  38. cardEffects.Add(CardEffectFactory.TrainingEffect(card: card));
  39. }
  40. #endregion
  41. #region When Digivolving
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Place 1 digimon in hand as source, to delete digimon", CanUseCondition, card);
  46. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  47. activateClass.SetHashString("DeleteDigimon_EX9_010");
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. {
  51. return "[When Digivolving][Once Per Turn] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 4000 DP or less.";
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  56. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  61. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition);
  62. }
  63. bool CanSelectHandCardCondition(CardSource cardSource)
  64. {
  65. return true;
  66. }
  67. bool CanSelectPermanentCondition(Permanent permanent)
  68. {
  69. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  70. {
  71. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable hashtable)
  79. {
  80. CardSource selectedCard = null;
  81. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  82. selectHandEffect.SetUp(
  83. selectPlayer: card.Owner,
  84. canTargetCondition: CanSelectHandCardCondition,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. maxCount: 1,
  88. canNoSelect: true,
  89. canEndNotMax: false,
  90. isShowOpponent: true,
  91. selectCardCoroutine: SelectCardCoroutine,
  92. afterSelectCardCoroutine: null,
  93. mode: SelectHandEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectHandEffect.SetUpCustomMessage("Select 1 card to place face-down on bottom of digivolution cards.",
  96. "The opponent is selecting 1 card to place face-down on bottom of digivolution cards.");
  97. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  98. yield return StartCoroutine(selectHandEffect.Activate());
  99. IEnumerator SelectCardCoroutine(CardSource cardSource)
  100. {
  101. selectedCard = cardSource;
  102. yield return null;
  103. }
  104. if (selectedCard)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  107. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  108. .AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  109. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  110. {
  111. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  112. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  113. selectPermanentEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectPermanentCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: maxCount,
  119. canNoSelect: false,
  120. canEndNotMax: false,
  121. selectPermanentCoroutine: null,
  122. afterSelectPermanentCoroutine: null,
  123. mode: SelectPermanentEffect.Mode.Destroy,
  124. cardEffect: activateClass);
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. }
  127. }
  128. }
  129. }
  130. #endregion
  131. #region When Attacking
  132. if (timing == EffectTiming.OnAllyAttack)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Place 1 digimon in hand as source, to delete digimon", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  137. activateClass.SetHashString("DeleteDigimon_EX9_010");
  138. cardEffects.Add(activateClass);
  139. string EffectDescription()
  140. {
  141. return "[When Attacking][Once Per Turn] By placing 1 card in your hand face down as this Digimon's bottom digivolution card, delete 1 of your opponent's Digimon with 4000 DP or less.";
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  150. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition);
  151. }
  152. bool CanSelectHandCardCondition(CardSource cardSource)
  153. {
  154. return true;
  155. }
  156. bool CanSelectPermanentCondition(Permanent permanent)
  157. {
  158. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  159. {
  160. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable hashtable)
  168. {
  169. CardSource selectedCard = null;
  170. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  171. selectHandEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectHandCardCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: 1,
  177. canNoSelect: true,
  178. canEndNotMax: false,
  179. isShowOpponent: true,
  180. selectCardCoroutine: SelectCardCoroutine,
  181. afterSelectCardCoroutine: null,
  182. mode: SelectHandEffect.Mode.Custom,
  183. cardEffect: activateClass);
  184. selectHandEffect.SetUpCustomMessage("Select 1 card to place face-down on bottom of digivolution cards.",
  185. "The opponent is selecting 1 card to place face-down on bottom of digivolution cards.");
  186. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  187. yield return StartCoroutine(selectHandEffect.Activate());
  188. IEnumerator SelectCardCoroutine(CardSource cardSource)
  189. {
  190. selectedCard = cardSource;
  191. yield return null;
  192. }
  193. if (selectedCard)
  194. {
  195. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  196. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  197. .AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown:true));
  198. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  199. {
  200. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  201. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  202. selectPermanentEffect.SetUp(
  203. selectPlayer: card.Owner,
  204. canTargetCondition: CanSelectPermanentCondition,
  205. canTargetCondition_ByPreSelecetedList: null,
  206. canEndSelectCondition: null,
  207. maxCount: maxCount,
  208. canNoSelect: false,
  209. canEndNotMax: false,
  210. selectPermanentCoroutine: null,
  211. afterSelectPermanentCoroutine: null,
  212. mode: SelectPermanentEffect.Mode.Destroy,
  213. cardEffect: activateClass);
  214. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  215. }
  216. }
  217. }
  218. }
  219. #endregion
  220. #region Inherit
  221. if (timing == EffectTiming.OnAllyAttack)
  222. {
  223. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: true, card: card, condition: null));
  224. }
  225. #endregion
  226. return cardEffects;
  227. }
  228. }
  229. }