EX9_028.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Nanimon
  4. namespace DCGO.CardEffects.EX9
  5. {
  6. public class EX9_028 : 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 Condition(Permanent permanent)
  15. {
  16. return permanent.TopCard.IsLevel3 && permanent.TopCard.EqualsTraits("DM");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 2, false, card, null));
  19. }
  20. #endregion
  21. #region End of Your Turn
  22. if (timing == EffectTiming.OnEndTurn)
  23. {
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect("By Placing 3 [Ver.4] digimon FD as this digimon bottom sources, digivolve into a [Ver.4] digimon in hand or trash", CanUseCondition, card);
  26. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  27. activateClass.SetHashString("Digivolve_EX9-028");
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[End of Your Turn] [Once Per Turn] By placing 3 Digimon cards with the [Ver.4] trait from your trash face down as this Digimon's bottom digivolution cards, it may digivolve into a Digimon card with the [Ver.4] trait in the hand or trash.";
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  36. CardEffectCommons.IsOwnerTurn(card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  41. CardEffectCommons.MatchConditionOwnersCardCountInTrash(card,CanSelectCardCondition) >= 3;
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.IsDigimon &&
  46. cardSource.EqualsTraits("Ver.4");
  47. }
  48. bool CanSelectCardCondition1(CardSource cardSource)
  49. {
  50. if (cardSource.EqualsTraits("Ver.4"))
  51. {
  52. if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  63. selectCardEffect.SetUp(
  64. canTargetCondition: CanSelectCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. canNoSelect: () => true,
  68. selectCardCoroutine: null,
  69. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  70. message: "Select 3 cards to add as source",
  71. maxCount: 3,
  72. canEndNotMax: true,
  73. isShowOpponent: true,
  74. mode: SelectCardEffect.Mode.Custom,
  75. root: SelectCardEffect.Root.Trash,
  76. customRootCardList: null,
  77. canLookReverseCard: true,
  78. selectPlayer: card.Owner,
  79. cardEffect: activateClass);
  80. selectCardEffect.SetUpCustomMessage("Select 3 cards to add as source.", "The opponent is selecting 3 cards to add as source.");
  81. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Cards");
  82. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  83. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  84. {
  85. selectedCards.AddRange(cardSources);
  86. yield return null;
  87. }
  88. if (selectedCards.Count == 3)
  89. {
  90. foreach (var selectedCard in selectedCards)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  93. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  94. }
  95. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition1);
  96. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1);
  97. if (canSelectHand || canSelectTrash)
  98. {
  99. if (canSelectHand && canSelectTrash)
  100. {
  101. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  102. {
  103. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  104. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  105. };
  106. string selectPlayerMessage1 = "From which area do you select a card?";
  107. string notSelectPlayerMessage1 = "The opponent is choosing from which area to select a card.";
  108. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  109. }
  110. else
  111. {
  112. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  113. }
  114. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  115. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  117. targetPermanent: card.PermanentOfThisCard(),
  118. cardCondition: CanSelectCardCondition1,
  119. payCost: true,
  120. reduceCostTuple: null,
  121. fixedCostTuple: null,
  122. ignoreDigivolutionRequirementFixedCost: -1,
  123. isHand: fromHand,
  124. activateClass: activateClass,
  125. successProcess: null));
  126. }
  127. }
  128. }
  129. }
  130. #endregion
  131. #region ESS
  132. if (timing == EffectTiming.None)
  133. {
  134. bool CardCondition(CardSource cardSource)
  135. {
  136. return cardSource.Owner == card.Owner.Enemy;
  137. }
  138. bool Condition()
  139. {
  140. if (CardEffectCommons.IsExistOnBattleArea(card))
  141. {
  142. if (CardEffectCommons.IsOwnerTurn(card))
  143. {
  144. return true;
  145. }
  146. }
  147. return false;
  148. }
  149. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  150. cardCondition: CardCondition,
  151. changeValue: -3000,
  152. isInheritedEffect: true,
  153. card: card,
  154. condition: Condition,
  155. effectName: "Opponent's Security Digimon gains DP -3000"));
  156. }
  157. #endregion
  158. return cardEffects;
  159. }
  160. }
  161. }