P_070.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class P_070 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top card and add this card to hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsSecurityEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Security] At the end of the battle, reveal the top card of your deck. If it's a black Digimon card with a play cost of 4 or less, you may play it without paying its memory cost. Add the remaining cards to your hand. Then, add this card to its owner's hand.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnExecutingArea(card))
  31. {
  32. return true;
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return null;
  39. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  40. ActivateClass activateClass1 = new ActivateClass();
  41. activateClass1.SetUpICardEffect("Reveal the top card and add this card to hand", CanUseCondition1, card);
  42. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  43. card.Owner.UntilEndBattleEffects.Add(GetCardEffect1);
  44. string EffectDiscription1()
  45. {
  46. return "Reveal the top card of your deck. If it's a black Digimon card with a play cost of 4 or less, you may play it without paying its memory cost. Add the remaining cards to your hand. Then, add this card to its owner's hand.";
  47. }
  48. bool CanSelectCardCondition(CardSource cardSource)
  49. {
  50. if (cardSource.IsDigimon)
  51. {
  52. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  53. {
  54. if (cardSource.GetCostItself <= 4)
  55. {
  56. if (cardSource.HasCardColor(CardColor.Black))
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanUseCondition1(Hashtable hashtable)
  66. {
  67. return true;
  68. }
  69. bool CanActivateCondition1(Hashtable hashtable)
  70. {
  71. return true;
  72. }
  73. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  74. {
  75. RevealLibraryClass revealLibrary = new RevealLibraryClass(card.Owner, 1);
  76. yield return ContinuousController.instance.StartCoroutine(revealLibrary.RevealLibrary());
  77. List<CardSource> handCards = new List<CardSource>();
  78. foreach (CardSource cardSource in revealLibrary.RevealedCards)
  79. {
  80. CardSource selectedCard = cardSource;
  81. bool played = false;
  82. if (CanSelectCardCondition(selectedCard))
  83. {
  84. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  85. {
  86. new SelectionElement<bool>(message: $"Play", value : true, spriteIndex: 0),
  87. new SelectionElement<bool>(message: $"Not Play", value : false, spriteIndex: 1),
  88. };
  89. string selectPlayerMessage = "Will you play the revealed card?";
  90. string notSelectPlayerMessage = "The opponent is choosing whether to play the revealed card.";
  91. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  92. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  93. bool willPlay = GManager.instance.userSelectionManager.SelectedBoolValue;
  94. if (willPlay)
  95. {
  96. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: selectedCard, payCost: false, cardEffect: activateClass))
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  99. cardSources: new List<CardSource>() { selectedCard },
  100. activateClass: activateClass,
  101. payCost: false,
  102. isTapped: false,
  103. root: SelectCardEffect.Root.Library,
  104. activateETB: true
  105. ));
  106. if (CardEffectCommons.IsExistOnBattleArea(selectedCard))
  107. {
  108. played = true;
  109. }
  110. }
  111. }
  112. }
  113. if (!played)
  114. {
  115. handCards.Add(cardSource);
  116. }
  117. }
  118. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(handCards, false, activateClass));
  119. if (card.Owner.ExecutingCards.Contains(card))
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  122. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { card }, false, activateClass));
  123. }
  124. }
  125. ICardEffect GetCardEffect1(EffectTiming _timing)
  126. {
  127. if (_timing == EffectTiming.OnEndBattle)
  128. {
  129. return activateClass1;
  130. }
  131. return null;
  132. }
  133. }
  134. }
  135. return cardEffects;
  136. }
  137. }