BT19_081.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_081 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Main Phase
  11. if (timing == EffectTiming.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place 1 [Blue Flare]/[Xros Heart] card under 1 of your Tamers to gain 1 memory",
  15. CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return
  21. "[Start of Your Main Phase] By placing 1 Digimon card with the [Blue Flare]/[Xros Heart] trait from your hand under any of your Tamers, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool IsOwnTamerCondition(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  30. permanent.IsTamer;
  31. }
  32. bool HasBlueFlareXrosHeartTraitCondition(CardSource cardSource)
  33. {
  34. return cardSource.IsDigimon &&
  35. (cardSource.EqualsTraits("Blue Flare") || cardSource.EqualsTraits("Xros Heart"));
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card) &&
  40. CardEffectCommons.HasMatchConditionOwnersHand(card, HasBlueFlareXrosHeartTraitCondition);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. List<CardSource> selectedCards = new List<CardSource>();
  45. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  46. selectHandEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: HasBlueFlareXrosHeartTraitCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: true,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. selectCardCoroutine: SelectCardCoroutine,
  56. afterSelectCardCoroutine: null,
  57. mode: SelectHandEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  60. "The opponent is selecting 1 card to play.");
  61. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  62. yield return StartCoroutine(selectHandEffect.Activate());
  63. IEnumerator SelectCardCoroutine(CardSource cardSource)
  64. {
  65. selectedCards.Add(cardSource);
  66. yield return null;
  67. }
  68. if (selectedCards.Count >= 1)
  69. {
  70. Permanent selectedPermanent = null;
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: IsOwnTamerCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: true,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  85. "The opponent is selecting 1 Tamer to place the chosen card under.");
  86. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  87. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  88. {
  89. selectedPermanent = permanent;
  90. yield return null;
  91. }
  92. if (selectedPermanent != null)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(
  95. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  96. yield return ContinuousController.instance.StartCoroutine(
  97. card.Owner.AddMemory(1, activateClass));
  98. }
  99. }
  100. }
  101. }
  102. #endregion
  103. #region All Turns
  104. if (timing == EffectTiming.BeforePayCost)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  109. activateClass.SetHashString("CanSelectDigiXrosFromTamer_BT19_081");
  110. cardEffects.Add(activateClass);
  111. string EffectDescription()
  112. {
  113. return
  114. "[All Turns] When any of your [Blue Flare] trait Digimon cards with DigiXros requirements would be played, by suspending this Tamer, you may place cards from under your Tamers as digivolution cards for a DigiXros.";
  115. }
  116. bool CardCondition(CardSource cardSource)
  117. {
  118. return cardSource.Owner == card.Owner && cardSource.IsDigimon &&
  119. cardSource.EqualsTraits("Blue Flare") && cardSource.HasDigiXros;
  120. }
  121. bool CanUseCondition(Hashtable hashtable)
  122. {
  123. return CardEffectCommons.IsExistOnBattleArea(card) &&
  124. CardEffectCommons.CanTriggerWhenPermanentWouldPlay(hashtable, CardCondition) &&
  125. CardEffectCommons.IsOnly1CardPlayed(hashtable);
  126. }
  127. bool CanActivateCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.CanActivateSuspendCostEffect(card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  134. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  135. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  136. AddMaxUnderTamerCountDigiXrosClass addMaxTamerCountDigiXrosClass = new AddMaxUnderTamerCountDigiXrosClass();
  137. addMaxTamerCountDigiXrosClass.SetUpICardEffect("Can select DigiXros cards from Tamer's digivolution cards",
  138. CanUseCondition1, card);
  139. addMaxTamerCountDigiXrosClass.SetUpAddMaxUnderTamerCountDigiXrosClass(getMaxUnderTamerCount: GetCount);
  140. card.Owner.UntilCalculateFixedCostEffect.Add(_ => addMaxTamerCountDigiXrosClass);
  141. bool CanUseCondition1(Hashtable conHashtable)
  142. {
  143. return true;
  144. }
  145. int GetCount(CardSource cardSource)
  146. {
  147. if (CardSourceCondition(cardSource))
  148. {
  149. return 100;
  150. }
  151. return 0;
  152. }
  153. bool CardSourceCondition(CardSource cardSource)
  154. {
  155. if (cardSource.Owner == card.Owner)
  156. {
  157. if (cardSource.HasDigiXros)
  158. {
  159. return true;
  160. }
  161. }
  162. return false;
  163. }
  164. }
  165. }
  166. #endregion
  167. #region Security Effect
  168. if (timing == EffectTiming.SecuritySkill)
  169. {
  170. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  171. }
  172. #endregion
  173. return cardEffects;
  174. }
  175. }
  176. }