P_113.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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_113 : 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.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.ContainsCardName("Tyrannomon") && targetPermanent.Level == 5 && targetPermanent.TopCard.HasLevel;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. if (timing == EffectTiming.OnCounterTiming)
  27. {
  28. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  29. }
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Suspend Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[When Digivolving] Suspend all of your opponent's Digimon with DP less or equal than this Digimon.";
  39. }
  40. bool PermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.PermanentOfThisCard().HasDP)
  47. {
  48. if (permanent.HasDP)
  49. {
  50. if (permanent.DP <= card.PermanentOfThisCard().DP)
  51. {
  52. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  53. {
  54. if (!permanent.IsSuspended)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. }
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. if (CardEffectCommons.IsExistOnBattleArea(card))
  73. {
  74. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  75. {
  76. return true;
  77. }
  78. }
  79. return false;
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  82. {
  83. List<Permanent> suspendTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition);
  84. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  85. suspendTargetPermanents,
  86. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  87. }
  88. }
  89. if (timing == EffectTiming.OnEndBattle)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  94. activateClass.SetHashString("TrashSecurity_P_113");
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[All Turns] [Once Per Turn] When an opponent's Digimon is deleted in battle, trash the top card of your opponent's security stack.";
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleArea(card))
  103. {
  104. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  105. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(
  106. hashtable: hashtable,
  107. winnerCondition: null,
  108. loserCondition: LoserCondition,
  109. isOnlyWinnerSurvive: false))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. return true;
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  127. player: card.Owner.Enemy,
  128. destroySecurityCount: 1,
  129. cardEffect: activateClass,
  130. fromTop: true).DestroySecurity());
  131. }
  132. }
  133. return cardEffects;
  134. }
  135. }