BT10_054.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_054 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Digivolving] Suspend 1 of your opponent's Digimon.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  47. {
  48. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  49. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  50. selectPermanentEffect.SetUp(
  51. selectPlayer: card.Owner,
  52. canTargetCondition: CanSelectPermanentCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. maxCount: maxCount,
  56. canNoSelect: false,
  57. canEndNotMax: false,
  58. selectPermanentCoroutine: null,
  59. afterSelectPermanentCoroutine: null,
  60. mode: SelectPermanentEffect.Mode.Tap,
  61. cardEffect: activateClass);
  62. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  63. }
  64. }
  65. }
  66. if (timing == EffectTiming.OnEndBattle)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  71. activateClass.SetHashString("Unsuspend_BT10_054");
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[Your Turn][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, unsuspend this Digimon.";
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. if (CardEffectCommons.IsOwnerTurn(card))
  82. {
  83. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  84. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  85. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable, winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false))
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. return true;
  98. }
  99. return false;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. Permanent selectedPermanent = card.PermanentOfThisCard();
  104. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  105. }
  106. }
  107. if (timing == EffectTiming.OnAllyAttack)
  108. {
  109. ActivateClass activateClass = new ActivateClass();
  110. activateClass.SetUpICardEffect("Memory -2", CanUseCondition, card);
  111. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  112. cardEffects.Add(activateClass);
  113. string EffectDiscription()
  114. {
  115. return "[When Attacking] If you don't have a Tamer in play, lose 2 memory.";
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  120. }
  121. bool CanActivateCondition(Hashtable hashtable)
  122. {
  123. if (CardEffectCommons.IsExistOnBattleArea(card))
  124. {
  125. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.IsTamer) == 0)
  126. {
  127. return true;
  128. }
  129. }
  130. return false;
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(-2, activateClass));
  135. }
  136. }
  137. return cardEffects;
  138. }
  139. }
  140. }