BT22_021.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Shellmon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_021 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Decode
  13. if (timing == EffectTiming.WhenRemoveField)
  14. {
  15. bool SourceCondition(CardSource source)
  16. {
  17. return source.IsDigimon
  18. && source.HasLevel && source.IsLevel3
  19. && (source.ContainsTraits("Sea Animal") || source.ContainsTraits("Aqua"));
  20. }
  21. string[] decodeStrings = { "(Lv.3 w/[Aqua]/[Sea Animal] in any trait)", "Level 3 Digimon card with [Aqua] or [Sea Animal]" };
  22. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  23. }
  24. #endregion
  25. #region On Play
  26. if (timing == EffectTiming.OnEnterFieldAnyone)
  27. {
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Place 1 level 5 or lower [Aqua]/[Sea Animal] digimon from hand under any digimon", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. return "[On Play] You may place 1 level 5 or lower Digimon card with [Aqua] or [Sea Animal] in any of its traits from your hand as any of your Digimon's bottom digivolution card.";
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  43. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsValidDigimonCondition)
  44. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsValidHandCardCondition);
  45. }
  46. bool IsValidDigimonCondition(Permanent permanent)
  47. {
  48. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  49. }
  50. bool IsValidHandCardCondition(CardSource source)
  51. {
  52. return source.IsDigimon
  53. && source.HasLevel && source.Level <= 5
  54. && (source.HasSeaAnimalTraits || source.HasAquaTraits);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsValidHandCardCondition) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsValidDigimonCondition))
  59. {
  60. #region Select Hand Card
  61. CardSource selectedCard = null;
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsValidHandCardCondition));
  63. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  64. selectHandEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: IsValidHandCardCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: true,
  71. canEndNotMax: false,
  72. isShowOpponent: true,
  73. selectCardCoroutine: SelectCardCoroutine,
  74. afterSelectCardCoroutine: null,
  75. mode: SelectHandEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCard = cardSource;
  80. yield return null;
  81. }
  82. selectHandEffect.SetUpCustomMessage("Select 1 card to add as digivolution card,", "The opponent is selecting 1 card to add as digivolution card,");
  83. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  84. yield return StartCoroutine(selectHandEffect.Activate());
  85. #endregion
  86. if (selectedCard != null)
  87. {
  88. #region Select Permanent
  89. Permanent selectedPermanent = null;
  90. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsValidDigimonCondition));
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: IsValidDigimonCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: maxCount1,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: SelectPermanentCoroutine,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Custom,
  103. cardEffect: activateClass);
  104. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  105. {
  106. selectedPermanent = permanent;
  107. yield return null;
  108. }
  109. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add digivolution source.", "The opponent is selecting 1 Digimon to add digivolution source.");
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. #endregion
  112. if (selectedPermanent != null && selectedCard != null)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  115. }
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. #region When Digivolving
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Place 1 level 5 or lower [Aqua]/[Sea Animal] digimon from hand under any digimon", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[When Digivolving] You may place 1 level 5 or lower Digimon card with [Aqua] or [Sea Animal] in any of its traits from your hand as any of your Digimon's bottom digivolution card.";
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  139. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsValidDigimonCondition)
  140. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsValidHandCardCondition);
  141. }
  142. bool IsValidDigimonCondition(Permanent permanent)
  143. {
  144. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  145. }
  146. bool IsValidHandCardCondition(CardSource source)
  147. {
  148. return source.IsDigimon
  149. && source.HasLevel && source.Level <= 5
  150. && (source.HasSeaAnimalTraits || source.HasAquaTraits);
  151. }
  152. IEnumerator ActivateCoroutine(Hashtable hashtable)
  153. {
  154. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsValidHandCardCondition) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsValidDigimonCondition))
  155. {
  156. #region Select Hand Card
  157. CardSource selectedCard = null;
  158. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, IsValidHandCardCondition));
  159. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  160. selectHandEffect.SetUp(
  161. selectPlayer: card.Owner,
  162. canTargetCondition: IsValidHandCardCondition,
  163. canTargetCondition_ByPreSelecetedList: null,
  164. canEndSelectCondition: null,
  165. maxCount: maxCount,
  166. canNoSelect: true,
  167. canEndNotMax: false,
  168. isShowOpponent: true,
  169. selectCardCoroutine: SelectCardCoroutine,
  170. afterSelectCardCoroutine: null,
  171. mode: SelectHandEffect.Mode.Custom,
  172. cardEffect: activateClass);
  173. IEnumerator SelectCardCoroutine(CardSource cardSource)
  174. {
  175. selectedCard = cardSource;
  176. yield return null;
  177. }
  178. selectHandEffect.SetUpCustomMessage("Select 1 card to add as digivolution card,", "The opponent is selecting 1 card to add as digivolution card,");
  179. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  180. yield return StartCoroutine(selectHandEffect.Activate());
  181. #endregion
  182. if (selectedCard != null)
  183. {
  184. #region Select Permanent
  185. Permanent selectedPermanent = null;
  186. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsValidDigimonCondition));
  187. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  188. selectPermanentEffect.SetUp(
  189. selectPlayer: card.Owner,
  190. canTargetCondition: IsValidDigimonCondition,
  191. canTargetCondition_ByPreSelecetedList: null,
  192. canEndSelectCondition: null,
  193. maxCount: maxCount1,
  194. canNoSelect: false,
  195. canEndNotMax: false,
  196. selectPermanentCoroutine: SelectPermanentCoroutine,
  197. afterSelectPermanentCoroutine: null,
  198. mode: SelectPermanentEffect.Mode.Custom,
  199. cardEffect: activateClass);
  200. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  201. {
  202. selectedPermanent = permanent;
  203. yield return null;
  204. }
  205. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add digivolution source.", "The opponent is selecting 1 Digimon to add digivolution source.");
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. #endregion
  208. if (selectedPermanent != null && selectedCard != null)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  211. }
  212. }
  213. }
  214. }
  215. }
  216. #endregion
  217. #region ESS
  218. if (timing == EffectTiming.None)
  219. {
  220. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  221. }
  222. #endregion
  223. return cardEffects;
  224. }
  225. }
  226. }