EX2_060.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_060 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnStartTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  14. }
  15. if (timing == EffectTiming.OnAllyAttack)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Play 1 option with [Plug-In] in its name", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Your Turn] When you attack with a Digimon with [Renamon], [Kyubimon], [Taomon], or [Sakuyamon] in its name, you may suspend this Tamer to use 1 Option card with [Plug-In] in its name from your hand without paying its memory cost.";
  24. }
  25. bool CanSelectCardCondition(CardSource cardSource)
  26. {
  27. if (cardSource.IsOption)
  28. {
  29. if (cardSource.ContainsCardName("Plug-In"))
  30. {
  31. if (!cardSource.CanNotPlayThisOption)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. return false;
  38. }
  39. bool PermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.TopCard.ContainsCardName("Renamon"))
  44. {
  45. return true;
  46. }
  47. if (permanent.TopCard.ContainsCardName("Kyubimon"))
  48. {
  49. return true;
  50. }
  51. if (permanent.TopCard.ContainsCardName("Taomon"))
  52. {
  53. return true;
  54. }
  55. if (permanent.TopCard.ContainsCardName("Sakuyamon"))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (CardEffectCommons.IsOwnerTurn(card))
  67. {
  68. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  81. {
  82. return true;
  83. }
  84. }
  85. return false;
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  90. new List<Permanent>() { card.PermanentOfThisCard() },
  91. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  92. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  93. {
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. int maxCount = 1;
  96. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  97. selectHandEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectCardCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: true,
  104. canEndNotMax: false,
  105. isShowOpponent: true,
  106. selectCardCoroutine: SelectCardCoroutine,
  107. afterSelectCardCoroutine: null,
  108. mode: SelectHandEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  111. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  112. yield return StartCoroutine(selectHandEffect.Activate());
  113. IEnumerator SelectCardCoroutine(CardSource cardSource)
  114. {
  115. selectedCards.Add(cardSource);
  116. yield return null;
  117. }
  118. yield return ContinuousController.instance.StartCoroutine(
  119. CardEffectCommons.PlayOptionCards(
  120. cardSources: selectedCards,
  121. activateClass: activateClass,
  122. payCost: false,
  123. root: SelectCardEffect.Root.Hand
  124. )
  125. );
  126. }
  127. }
  128. }
  129. if (timing == EffectTiming.SecuritySkill)
  130. {
  131. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  132. }
  133. return cardEffects;
  134. }
  135. }
  136. }