BT19_016.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_016 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region On Play, On Deletion Shared
  11. bool IsOwnTamerCondition(Permanent permanent)
  12. {
  13. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  14. permanent.IsTamer;
  15. }
  16. bool HasBlueFlareTraitCondition(CardSource cardSource)
  17. {
  18. return cardSource.IsDigimon && cardSource.EqualsTraits("Blue Flare");
  19. }
  20. #endregion
  21. #region On Play
  22. if (timing == EffectTiming.OnEnterFieldAnyone)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Place 1 [Blue Flare] card under 1 of your Tamers to <Draw 1>", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  27. cardEffects.Add(activateClass);
  28. string EffectDescription()
  29. {
  30. return
  31. "[On Play] By placing 1 [Blue Flare] trait Digimon card from your hand under any of your Tamers, <Draw 1>.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  40. CardEffectCommons.HasMatchConditionOwnersHand(card, HasBlueFlareTraitCondition) &&
  41. CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. List<CardSource> selectedCards = new List<CardSource>();
  46. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  47. selectHandEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: HasBlueFlareTraitCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: 1,
  53. canNoSelect: true,
  54. canEndNotMax: false,
  55. isShowOpponent: true,
  56. selectCardCoroutine: SelectCardCoroutine,
  57. afterSelectCardCoroutine: null,
  58. mode: SelectHandEffect.Mode.Custom,
  59. cardEffect: activateClass);
  60. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  61. "The opponent is selecting 1 card to play.");
  62. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  63. yield return StartCoroutine(selectHandEffect.Activate());
  64. IEnumerator SelectCardCoroutine(CardSource cardSource)
  65. {
  66. selectedCards.Add(cardSource);
  67. yield return null;
  68. }
  69. if (selectedCards.Count >= 1)
  70. {
  71. Permanent selectedPermanent = null;
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: IsOwnTamerCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: true,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  86. "The opponent is selecting 1 Tamer to place the chosen card under.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  89. {
  90. selectedPermanent = permanent;
  91. yield return null;
  92. }
  93. if (selectedPermanent != null)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(
  96. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  97. yield return ContinuousController.instance.StartCoroutine(
  98. new DrawClass(card.Owner, 1, activateClass).Draw());
  99. }
  100. }
  101. }
  102. }
  103. #endregion
  104. #region On Deletion
  105. if (timing == EffectTiming.OnDestroyedAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Place 1 [Blue Flare] card from hand under 1 of your Tamers to <Draw 1>", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  110. cardEffects.Add(activateClass);
  111. string EffectDescription()
  112. {
  113. return
  114. "[On Deletion] By placing 1 [Blue Flare] trait Digimon card from your hand under any of your Tamers, <Draw 1>.";
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  123. CardEffectCommons.HasMatchConditionOwnersHand(card, HasBlueFlareTraitCondition) &&
  124. CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition);
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable hashtable)
  127. {
  128. List<CardSource> selectedCards = new List<CardSource>();
  129. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  130. selectHandEffect.SetUp(
  131. selectPlayer: card.Owner,
  132. canTargetCondition: HasBlueFlareTraitCondition,
  133. canTargetCondition_ByPreSelecetedList: null,
  134. canEndSelectCondition: null,
  135. maxCount: 1,
  136. canNoSelect: true,
  137. canEndNotMax: false,
  138. isShowOpponent: true,
  139. selectCardCoroutine: SelectCardCoroutine,
  140. afterSelectCardCoroutine: null,
  141. mode: SelectHandEffect.Mode.Custom,
  142. cardEffect: activateClass);
  143. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  144. "The opponent is selecting 1 card to place under a tamer.");
  145. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  146. yield return StartCoroutine(selectHandEffect.Activate());
  147. IEnumerator SelectCardCoroutine(CardSource cardSource)
  148. {
  149. selectedCards.Add(cardSource);
  150. yield return null;
  151. }
  152. if (selectedCards.Count >= 1)
  153. {
  154. Permanent selectedPermanent = null;
  155. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  156. selectPermanentEffect.SetUp(
  157. selectPlayer: card.Owner,
  158. canTargetCondition: IsOwnTamerCondition,
  159. canTargetCondition_ByPreSelecetedList: null,
  160. canEndSelectCondition: null,
  161. maxCount: 1,
  162. canNoSelect: true,
  163. canEndNotMax: false,
  164. selectPermanentCoroutine: SelectPermanentCoroutine,
  165. afterSelectPermanentCoroutine: null,
  166. mode: SelectPermanentEffect.Mode.Custom,
  167. cardEffect: activateClass);
  168. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  169. "The opponent is selecting 1 Tamer to place the chosen card under.");
  170. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  171. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  172. {
  173. selectedPermanent = permanent;
  174. yield return null;
  175. }
  176. if (selectedPermanent != null)
  177. {
  178. yield return ContinuousController.instance.StartCoroutine(
  179. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  180. yield return ContinuousController.instance.StartCoroutine(
  181. new DrawClass(card.Owner, 1, activateClass).Draw());
  182. }
  183. }
  184. }
  185. }
  186. #endregion
  187. return cardEffects;
  188. }
  189. }
  190. }