BT16_082.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_082 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnMove)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Hatch and reveal top 3 and add a Tamer or Digimon to hand.", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Your Turn] [Once Per Turn] When one of your Digimon moves from the breeding area to the battle area, reveal the top 3 cards of your deck. Add 1 Digimon or Tamer card among them to your hand. Return the rest to the bottom of the deck. and you may hatch in your breeding area.";
  19. }
  20. bool PermanentCondition(Permanent permanent)
  21. {
  22. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  23. }
  24. bool CanSelectCardCondition(CardSource card)
  25. {
  26. if (card.IsDigimon || card.IsTamer)
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.IsOwnerTurn(card))
  37. {
  38. if (CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. List<CardSource> selectedCards = new List<CardSource>();
  57. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
  58. revealCount: 3,
  59. selectCardConditions:
  60. new SelectCardConditionClass[]
  61. {
  62. new SelectCardConditionClass(
  63. canTargetCondition:CanSelectCardCondition,
  64. canTargetCondition_ByPreSelecetedList:null,
  65. canEndSelectCondition:null,
  66. canNoSelect:false,
  67. selectCardCoroutine: null,
  68. message: "Select 1 Digimon or Tamer card.",
  69. maxCount: 1,
  70. canEndNotMax:false,
  71. mode: SelectCardEffect.Mode.AddHand
  72. ),
  73. },
  74. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  75. activateClass: activateClass,
  76. canNoAction: false));
  77. if (card.Owner.CanHatch)
  78. {
  79. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  80. {
  81. new SelectionElement<bool>(message: $"Hatch", value : true, spriteIndex: 0),
  82. new SelectionElement<bool>(message: $"Not hatch", value : false, spriteIndex: 1),
  83. };
  84. string selectPlayerMessage = "Will you hatch in Breeding Area?";
  85. string notSelectPlayerMessage = "The opponent is selecting whether to hatch in Breeding Area.";
  86. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  87. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  88. bool doHatch = GManager.instance.userSelectionManager.SelectedBoolValue;
  89. if (doHatch)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(new HatchDigiEggClass(player: card.Owner, hashtable: CardEffectCommons.CardEffectHashtable(activateClass)).Hatch());
  92. }
  93. }
  94. }
  95. }
  96. return cardEffects;
  97. }
  98. }
  99. }