BT19_088.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT19
  6. {
  7. public class BT19_088 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Your Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.IsExistOnBattleArea(card) && CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleArea(card) && card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1 && card.Owner.CanAddMemory(activateClass);
  30. }
  31. IEnumerator ActivateCoroutine(Hashtable hashtable)
  32. {
  33. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  34. }
  35. }
  36. #endregion
  37. #region Main
  38. if (timing == EffectTiming.OnDeclaration)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Suspend this tamer to digivolve from trash or hand", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[Main] If you have 20 or more cards in your trash, by suspending this Tamer, 1 of your [Impmon] may digivolve into [Beelzemon] in the hand or trash for a digivolution cost of 4, ignoring its digivolution requirements.";
  47. }
  48. bool CanSelectOwnPermanentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  51. permanent.TopCard.EqualsCardName("Impmon");
  52. }
  53. bool CanUseCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (card.Owner.TrashCards.Count >= 20)
  58. {
  59. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnPermanentCondition))
  70. {
  71. Permanent selectedPermanent = null;
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectOwnPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: SelectPermanentCoroutine,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Custom,
  84. cardEffect: activateClass);
  85. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.",
  86. "The opponent is selecting 1 Digimon that will digivolve.");
  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. bool CanSelectCardCondition(CardSource cardSource)
  96. {
  97. return cardSource.EqualsCardName("Beelzemon") && cardSource.CanPlayCardTargetFrame(selectedPermanent.PermanentFrame, false, activateClass);
  98. }
  99. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  100. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  101. if (canSelectHand || canSelectTrash)
  102. {
  103. if (canSelectHand && canSelectTrash)
  104. {
  105. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
  106. {
  107. new(message: "From hand", value: true, spriteIndex: 0),
  108. new(message: "From trash", value: false, spriteIndex: 1),
  109. };
  110. string selectPlayerMessage = "From which area do you digivolve?";
  111. string notSelectPlayerMessage = "The opponent is choosing from which area to digivolve.";
  112. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  113. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  114. notSelectPlayerMessage: notSelectPlayerMessage);
  115. }
  116. else
  117. {
  118. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  119. }
  120. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  121. .WaitForEndSelect());
  122. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  124. targetPermanent: selectedPermanent,
  125. cardCondition: CanSelectCardCondition,
  126. payCost: false,
  127. reduceCostTuple: null,
  128. fixedCostTuple: null,
  129. ignoreDigivolutionRequirementFixedCost: 4,
  130. isHand: fromHand,
  131. activateClass: activateClass,
  132. successProcess: null));
  133. }
  134. }
  135. }
  136. }
  137. }
  138. #endregion
  139. #region Security
  140. if (timing == EffectTiming.SecuritySkill)
  141. {
  142. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  143. }
  144. #endregion
  145. return cardEffects;
  146. }
  147. }
  148. }