EX9_060.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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 Digiolving
  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 CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  50. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  55. card.Owner.HandCards.Count > 0;
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. CardSource selectedCard = null;
  60. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  61. selectHandEffect.SetUp(
  62. selectPlayer: card.Owner,
  63. canTargetCondition: null,
  64. canTargetCondition_ByPreSelecetedList: null,
  65. canEndSelectCondition: null,
  66. maxCount: 1,
  67. canNoSelect: true,
  68. canEndNotMax: false,
  69. isShowOpponent: true,
  70. selectCardCoroutine: SelectCardCoroutine,
  71. afterSelectCardCoroutine: null,
  72. mode: SelectHandEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectHandEffect.SetUpCustomMessage("Select 1 card to add as FD Source", "The opponent is selecting 1 card to add as FD source");
  75. selectHandEffect.SetUpCustomMessage_ShowCard("Added Card");
  76. yield return StartCoroutine(selectHandEffect.Activate());
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCard = cardSource;
  80. yield return null;
  81. }
  82. if (selectedCard != null)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  85. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  86. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  87. }
  88. }
  89. }
  90. #endregion
  91. #region When Attacking
  92. if (timing == EffectTiming.OnAllyAttack)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("Place 1 hand card FD as bottom source, Draw 1", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  97. activateClass.SetHashString("EX9_060_Draw");
  98. cardEffects.Add(activateClass);
  99. string EffectDiscription()
  100. {
  101. 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).";
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  106. }
  107. bool CanActivateCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  110. card.Owner.HandCards.Count > 0;
  111. }
  112. IEnumerator ActivateCoroutine(Hashtable hashtable)
  113. {
  114. CardSource selectedCard = null;
  115. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  116. selectHandEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: null,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: 1,
  122. canNoSelect: true,
  123. canEndNotMax: false,
  124. isShowOpponent: true,
  125. selectCardCoroutine: SelectCardCoroutine,
  126. afterSelectCardCoroutine: null,
  127. mode: SelectHandEffect.Mode.Custom,
  128. cardEffect: activateClass);
  129. selectHandEffect.SetUpCustomMessage("Select 1 card to add as FD Source", "The opponent is selecting 1 card to add as FD source");
  130. selectHandEffect.SetUpCustomMessage_ShowCard("Added Card");
  131. yield return StartCoroutine(selectHandEffect.Activate());
  132. IEnumerator SelectCardCoroutine(CardSource cardSource)
  133. {
  134. selectedCard = cardSource;
  135. yield return null;
  136. }
  137. if (selectedCard != null)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  140. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  141. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  142. }
  143. }
  144. }
  145. #endregion
  146. #region On Deletion - ESS
  147. if (timing == EffectTiming.OnDestroyedAnyone)
  148. {
  149. ActivateClass activateClass = new ActivateClass();
  150. activateClass.SetUpICardEffect("Delete 1 level 4 or lower Digimon", CanUseCondition, card);
  151. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  152. activateClass.SetIsInheritedEffect(true);
  153. cardEffects.Add(activateClass);
  154. string EffectDescription()
  155. {
  156. return "[On Deletion] Delete 1 of your opponent's level 4 or lower Digimon.";
  157. }
  158. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  159. {
  160. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) && permanent.IsDigimon && permanent.TopCard.HasLevel && permanent.Level <= 4;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.CanActivateOnDeletionInherited(hashtable, card);
  169. }
  170. IEnumerator ActivateCoroutine(Hashtable hashtable)
  171. {
  172. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  173. {
  174. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  175. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  176. selectPermanentEffect.SetUp(
  177. selectPlayer: card.Owner,
  178. canTargetCondition: CanSelectOpponentPermanentCondition,
  179. canTargetCondition_ByPreSelecetedList: null,
  180. canEndSelectCondition: null,
  181. maxCount: maxCount,
  182. canNoSelect: false,
  183. canEndNotMax: false,
  184. selectPermanentCoroutine: null,
  185. afterSelectPermanentCoroutine: null,
  186. mode: SelectPermanentEffect.Mode.Destroy,
  187. cardEffect: activateClass);
  188. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  189. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  190. }
  191. }
  192. }
  193. #endregion
  194. return cardEffects;
  195. }
  196. }
  197. }