BT3_112.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 BT3_112 : 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("De-Digivolve 1 and delete opponent's all Digimon with 5000 DP or less", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Trigger <De-Digivolve 1> on all of your opponent's Digimon. (Trash a card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.) Then, delete all of your opponent's Digimon with 5000 DP or less.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(5000, activateClass))
  28. {
  29. if (permanent.CanBeDestroyedBySkill(activateClass))
  30. {
  31. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  58. {
  59. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(permanent, 1, activateClass).Degeneration());
  62. }
  63. }
  64. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Where(CanSelectPermanentCondition).ToList();
  65. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  66. }
  67. }
  68. if (timing == EffectTiming.OnAllyAttack)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("This Digimon gains unblockable", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[When Attacking] You may make this Digimon unblockable for the turn by returning one of its level 6 digivolution cards to your hand.";
  77. }
  78. bool CanSelectCardCondition(CardSource cardSource)
  79. {
  80. if (cardSource != null)
  81. {
  82. if (cardSource.IsDigimon)
  83. {
  84. if (cardSource.Level == 6)
  85. {
  86. if (cardSource.Owner == card.Owner)
  87. {
  88. if (cardSource.HasLevel)
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. }
  95. }
  96. return false;
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleArea(card))
  105. {
  106. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  107. {
  108. return true;
  109. }
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (isExistOnField(card))
  116. {
  117. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  118. {
  119. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => CanSelectCardCondition(cardSource)) >= 1)
  120. {
  121. int maxCount = Math.Min(1, card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  122. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  123. selectCardEffect.SetUp(
  124. canTargetCondition: CanSelectCardCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. canNoSelect: () => false,
  128. selectCardCoroutine: null,
  129. afterSelectCardCoroutine: null,
  130. message: "Select 1 card to add to your hand.",
  131. maxCount: maxCount,
  132. canEndNotMax: false,
  133. isShowOpponent: true,
  134. mode: SelectCardEffect.Mode.AddHand,
  135. root: SelectCardEffect.Root.Custom,
  136. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  137. canLookReverseCard: true,
  138. selectPlayer: card.Owner,
  139. cardEffect: activateClass);
  140. yield return StartCoroutine(selectCardEffect.Activate());
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeBlocked(targetPermanent: card.PermanentOfThisCard(), defenderCondition: null, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass, effectName: "Unblockable"));
  142. }
  143. }
  144. }
  145. }
  146. }
  147. return cardEffects;
  148. }
  149. }