BT17_030.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_030 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Bibimon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Start of Main Phase
  22. if (timing == EffectTiming.OnStartMainPhase)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("Place cards under this Digimon's digivolution cards to either gain a memory or Recovery +1.", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[Start of Your Main Phase] By placing 1 [Leon Alexander] from your hand as this Digimon's bottom digivolution card, if you have 3 or more security cards, gain 1 memory. If you have 2 or fewer security cards, Recovery +1.";
  31. }
  32. bool CanSelectCardCondition(CardSource cardSource)
  33. {
  34. if (cardSource.CardNames.Contains("Leon Alexander") || cardSource.CardNames.Contains("LeonAlexander"))
  35. {
  36. return true;
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.IsOwnerTurn(card))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  65. if (canSelectHand)
  66. {
  67. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  68. }
  69. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  70. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  71. List<CardSource> selectedCards = new List<CardSource>();
  72. IEnumerator SelectCardCoroutine(CardSource cardSource)
  73. {
  74. selectedCards.Add(cardSource);
  75. yield return null;
  76. }
  77. if (fromHand)
  78. {
  79. int maxCount = 1;
  80. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  81. selectHandEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. selectCardCoroutine: SelectCardCoroutine,
  91. afterSelectCardCoroutine: null,
  92. mode: SelectHandEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  95. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  96. yield return StartCoroutine(selectHandEffect.Activate());
  97. }
  98. if (selectedCards.Count >= 1)
  99. {
  100. if (card.Owner.SecurityCards.Count >= 3)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  103. }
  104. if (card.Owner.SecurityCards.Count <= 2)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  107. }
  108. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  109. }
  110. }
  111. }
  112. #endregion
  113. #region Inherit
  114. if (timing == EffectTiming.None)
  115. {
  116. bool Condition()
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (card.PermanentOfThisCard().TopCard.HasText("Pulsemon"))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  128. }
  129. #endregion
  130. return cardEffects;
  131. }
  132. }
  133. }