BT5_032.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 BT5_032 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash digivolution cards and gain Jamming", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking] Trash up to 2 digivolution cards from the bottom of 1 of your opponent's Digimon. Then, if your opponent has a Digimon with no digivolution cards in play, this Digimon gains <Jamming> (This Digimon can't be deleted in battles against Security Digimon) for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. return true;
  28. }
  29. return false;
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. return true;
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: SelectPermanentCoroutine,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  62. {
  63. Permanent selectedPermanent = permanent;
  64. int maxCount = Math.Min(2, permanent.DigivolutionCards.Count);
  65. SelectCountEffect selectCountEffect = GManager.instance.GetComponent<SelectCountEffect>();
  66. selectCountEffect.SetUp(
  67. SelectPlayer: card.Owner,
  68. targetPermanent: permanent,
  69. MaxCount: maxCount,
  70. CanNoSelect: false,
  71. Message: "How many digivolution cards will you trash?",
  72. Message_Enemy: "The opponent is choosing how many digivolution cards to trash.",
  73. SelectCountCoroutine: SelectCountCoroutine);
  74. yield return ContinuousController.instance.StartCoroutine(selectCountEffect.Activate());
  75. IEnumerator SelectCountCoroutine(int count)
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: count, isFromTop: false, activateClass: activateClass));
  78. }
  79. }
  80. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.HasNoDigivolutionCards))
  81. {
  82. Permanent selectedPermanent = card.PermanentOfThisCard();
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  84. }
  85. }
  86. }
  87. if (timing == EffectTiming.None)
  88. {
  89. bool AttackerCondition(Permanent attacker)
  90. {
  91. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(attacker, card))
  92. {
  93. if (attacker.HasNoDigivolutionCards)
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. bool Condition()
  101. {
  102. return CardEffectCommons.IsExistOnBattleArea(card);
  103. }
  104. cardEffects.Add(CardEffectFactory.CanNotAttackStaticEffect(attackerCondition: AttackerCondition, defenderCondition: null, isInheritedEffect: false, card: card, condition: Condition, effectName: "Opponent's Digimon without digivolution cards can't Attack"));
  105. }
  106. if (timing == EffectTiming.None)
  107. {
  108. bool DefenderCondition(Permanent attacker)
  109. {
  110. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(attacker, card))
  111. {
  112. if (attacker.HasNoDigivolutionCards)
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. bool Condition()
  120. {
  121. return CardEffectCommons.IsExistOnBattleArea(card);
  122. }
  123. cardEffects.Add(CardEffectFactory.CanNotBlockStaticEffect(attackerCondition: null, defenderCondition: DefenderCondition, isInheritedEffect: false, card: card, condition: Condition, effectName: "Opponent's Digimon without digivolution cards can't Block"));
  124. }
  125. return cardEffects;
  126. }
  127. }