BT6_015.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 BT6_015 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 Digimon with [Sistermon] in its name from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] You may play 1 Digimon card with [Sistermon] in its name from your hand without paying its memory cost.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (cardSource.ContainsCardName("Sistermon"))
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.HandCards.Count >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  55. {
  56. List<CardSource> selectedCards = new List<CardSource>();
  57. int maxCount = 1;
  58. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  59. selectHandEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectCardCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. selectCardCoroutine: SelectCardCoroutine,
  69. afterSelectCardCoroutine: null,
  70. mode: SelectHandEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  73. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  81. }
  82. }
  83. }
  84. if (timing == EffectTiming.OnAllyAttack)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. activateClass.SetHashString("Unsuspend_BT6_015");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[When Attacking][Once Per Turn] If you have a Digimon with [Sistermon] in its name in play, unsuspend this Digimon.";
  95. }
  96. bool CanUseCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleArea(card))
  103. {
  104. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Sistermon")))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  112. {
  113. Permanent selectedPermanent = card.PermanentOfThisCard();
  114. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  115. }
  116. }
  117. return cardEffects;
  118. }
  119. }