BT12_012.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_012 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("BurningGreymon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.None)
  20. {
  21. bool Condition()
  22. {
  23. return card.Owner.HandCards.Contains(card);
  24. }
  25. bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.CardNames.Contains("Takuya Kanbara") || targetPermanent.TopCard.CardNames.Contains("TakuyaKanbara");
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  30. }
  31. if (timing == EffectTiming.OnDestroyedAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Play 1 [Flamemon] from hand", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[On Deletion] You may play 1 [Flamemon] from your hand suspended without paying its cost.";
  40. }
  41. bool CanSelectCardCondition(CardSource cardSource)
  42. {
  43. if (cardSource.CardNames.Contains("Flamemon"))
  44. {
  45. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  59. {
  60. if (card.Owner.HandCards.Count >= 1)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  70. {
  71. List<CardSource> selectedCards = new List<CardSource>();
  72. int maxCount = 1;
  73. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  74. selectHandEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectCardCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: true,
  81. canEndNotMax: false,
  82. isShowOpponent: true,
  83. selectCardCoroutine: SelectCardCoroutine,
  84. afterSelectCardCoroutine: null,
  85. mode: SelectHandEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  88. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  89. yield return StartCoroutine(selectHandEffect.Activate());
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. selectedCards.Add(cardSource);
  93. yield return null;
  94. }
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: true, root: SelectCardEffect.Root.Hand, activateETB: true));
  96. }
  97. }
  98. }
  99. if (timing == EffectTiming.OnDestroyedAnyone)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("Play 1 [Takuya Kanbara] from hand", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  104. activateClass.SetIsInheritedEffect(true);
  105. cardEffects.Add(activateClass);
  106. string EffectDiscription()
  107. {
  108. return "[On Deletion] You may play 1 [Takuya Kanbara] from your hand without paying its cost.";
  109. }
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  113. {
  114. if (cardSource.CardNames.Contains("Takuya Kanbara"))
  115. {
  116. return true;
  117. }
  118. if (cardSource.CardNames.Contains("TakuyaKanbara"))
  119. {
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  132. {
  133. if (card.Owner.HandCards.Count >= 1)
  134. {
  135. return true;
  136. }
  137. }
  138. return false;
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  141. {
  142. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  143. {
  144. List<CardSource> selectedCards = new List<CardSource>();
  145. int maxCount = 1;
  146. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  147. selectHandEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectCardCondition,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: maxCount,
  153. canNoSelect: true,
  154. canEndNotMax: false,
  155. isShowOpponent: true,
  156. selectCardCoroutine: SelectCardCoroutine,
  157. afterSelectCardCoroutine: null,
  158. mode: SelectHandEffect.Mode.Custom,
  159. cardEffect: activateClass);
  160. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  161. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  162. yield return StartCoroutine(selectHandEffect.Activate());
  163. IEnumerator SelectCardCoroutine(CardSource cardSource)
  164. {
  165. selectedCards.Add(cardSource);
  166. yield return null;
  167. }
  168. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  169. }
  170. }
  171. }
  172. return cardEffects;
  173. }
  174. }
  175. }