BT8_098.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 BT8_098 : 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.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Trash the bottom digivolution card of all of your opponent's Digimon. Then, up to 3 of your opponent's Digimon with no digivolution cards can't attack or block until the end of your opponent's next turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  28. {
  29. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectPermanentCondition1(Permanent permanent)
  38. {
  39. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  40. {
  41. if (permanent.HasNoDigivolutionCards)
  42. {
  43. if (permanent.CanSelectBySkill(activateClass))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanUseCondition(Hashtable hashtable)
  52. {
  53. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  60. {
  61. if (CanSelectPermanentCondition(selectedPermanent))
  62. {
  63. if (selectedPermanent != null)
  64. {
  65. if (selectedPermanent.DigivolutionCards.Count >= 1)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: false, activateClass: activateClass));
  68. }
  69. }
  70. }
  71. }
  72. }
  73. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  74. {
  75. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition1,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: CanEndSelectCondition,
  82. maxCount: maxCount,
  83. canNoSelect: false,
  84. canEndNotMax: true,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select Digimon that will get effects.", "The opponent is selecting Digimon that will get effects.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. bool CanEndSelectCondition(List<Permanent> permanents)
  92. {
  93. if (CardEffectCommons.HasNoElement(permanents))
  94. {
  95. return false;
  96. }
  97. return true;
  98. }
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. Permanent selectedPermanent = permanent;
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(targetPermanent: selectedPermanent, attackerCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Block"));
  104. }
  105. }
  106. }
  107. }
  108. if (timing == EffectTiming.SecuritySkill)
  109. {
  110. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash digivolution cards and opponent's Digimon can't Attack or Block");
  111. }
  112. return cardEffects;
  113. }
  114. }