EX9_060.cs 11 KB

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