P_024.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_024 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] If you have [Tai Kamiya] in play, you may place 1 of your [Agumon] cards at the bottom of its owner's deck to trigger <Draw 3>. (Draw 3 cards from your deck.) Trash that Digimon's digivolution cards.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  26. {
  27. if (permanent.TopCard.CardNames.Contains("Tai Kamiya"))
  28. {
  29. return true;
  30. }
  31. if (permanent.TopCard.CardNames.Contains("TaiKamiya"))
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanSelectPermanentCondition1(Permanent permanent)
  39. {
  40. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  41. {
  42. if (permanent.TopCard.CardNames.Contains("Agumon"))
  43. {
  44. return true;
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanUseCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  56. {
  57. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1) >= 1)
  58. {
  59. Permanent bouncePermanent = null;
  60. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition1));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition1,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: true,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 [Agumon] to return to the bottom of deck.", "The opponent is selecting 1 [Agumon] to return to the bottom of deck.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. bouncePermanent = permanent;
  79. yield return null;
  80. }
  81. if (bouncePermanent != null)
  82. {
  83. if (bouncePermanent.TopCard != null)
  84. {
  85. if (!bouncePermanent.TopCard.CanNotBeAffected(activateClass))
  86. {
  87. if (!bouncePermanent.CannotReturnToLibrary(activateClass))
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(new List<Permanent>() { bouncePermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).DeckBounce());
  90. if (bouncePermanent.TopCard == null && bouncePermanent.LibraryBounceEffect == activateClass)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 3, activateClass).Draw());
  93. }
  94. }
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. }
  102. if (timing == EffectTiming.SecuritySkill)
  103. {
  104. ActivateClass activateClass = new ActivateClass();
  105. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  106. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  107. activateClass.SetIsSecurityEffect(true);
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. {
  111. return "[Security] Add this card to its owner's hand.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  118. {
  119. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  120. }
  121. }
  122. return cardEffects;
  123. }
  124. }