BT25_078.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Gazimon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_078 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent permanent)
  15. {
  16. return permanent.TopCard.HasTSTraits || permanent.TopCard.HasText("Three Musketeers");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 0, false, card, null, level: 2));
  19. }
  20. #endregion
  21. #region Shared WM / OP
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. => cardSource.HasText("Three Musketeers");
  24. string SharedEffectName = "Reveal top 3, Add 1 card with [Three Musketeers] in text to hand or place 1 [Three Musketeers] trait as bottom digivolution card ";
  25. string SharedEffectDescription(string tag) => $"[{tag}] Reveal the top 3 cards of your deck. Among them, add 1 card with [Three Musketeers] in its text to the hand, or you may place 1 [Three Musketeers] trait card as this Digimon's bottom digivolution card. Return the rest to the bottom of the deck.";
  26. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  27. {
  28. CardSource selectedCard = null;
  29. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  30. revealCount: 3,
  31. simplifiedSelectCardConditions:
  32. new SimplifiedSelectCardConditionClass[]
  33. {
  34. new SimplifiedSelectCardConditionClass(
  35. canTargetCondition:CanSelectCardCondition,
  36. message: "Select 1 card with either [Three Musketeers] in text or in trait",
  37. mode: SelectCardEffect.Mode.Custom,
  38. maxCount: 1,
  39. selectCardCoroutine: SelectCardCoroutine),
  40. },
  41. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  42. activateClass: activateClass,
  43. canNoSelect: true
  44. ));
  45. IEnumerator SelectCardCoroutine(CardSource cardSource)
  46. {
  47. selectedCard = cardSource;
  48. yield return null;
  49. }
  50. if (selectedCard != null)
  51. {
  52. bool hasThreeMusketeersTrait = selectedCard.HasThreeMusketeersTraits;
  53. if (hasThreeMusketeersTrait)
  54. {
  55. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  56. {
  57. new SelectionElement<bool>(message: $"Add to hand", value : true, spriteIndex: 0),
  58. new SelectionElement<bool>(message: $"Place on digivolution cards", value : false, spriteIndex: 0),
  59. };
  60. string selectPlayerMessage = "Which effect will you select?";
  61. string notSelectPlayerMessage = "The opponent is choosing effects.";
  62. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  63. }
  64. else
  65. {
  66. GManager.instance.userSelectionManager.SetBool(true);
  67. }
  68. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  69. bool addToHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  70. if (addToHand)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { selectedCard }, "Cards added to hand", true, true));
  73. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { selectedCard }, false, activateClass));
  74. }
  75. else
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { selectedCard }, "Cards placed on digivolution cards", true, true));
  78. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  79. }
  80. }
  81. }
  82. CardEffectFactory.ActivateClassesForSharedEffects
  83. (ref cardEffects, timing, card,
  84. SharedEffectName,
  85. SharedActivateCoroutine,
  86. SharedEffectDescription,
  87. optional: false,
  88. maxCountPerTurn: 1,
  89. whenMoving: true,
  90. onPlay: true);
  91. #endregion
  92. #region Inheritted
  93. if (timing == EffectTiming.OnDestroyedAnyone)
  94. {
  95. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  96. }
  97. #endregion
  98. return cardEffects;
  99. }
  100. }
  101. }