BT3_031.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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_031 : 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 Condition()
  16. {
  17. return card.Owner.HandCards.Contains(card);
  18. }
  19. bool PermanentCondition(Permanent targetPermanent)
  20. {
  21. if (targetPermanent != null)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card))
  24. {
  25. if (targetPermanent.TopCard.CardNames.Contains("Paildramon"))
  26. {
  27. return true;
  28. }
  29. if (targetPermanent.TopCard.CardNames.Contains("Dinobeemon"))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CardSourceCondition(CardSource cardSource)
  38. {
  39. return cardSource == card && cardSource.Owner.HandCards.Contains(cardSource);
  40. }
  41. bool RootCondition(SelectCardEffect.Root root)
  42. {
  43. return root == SelectCardEffect.Root.Hand;
  44. }
  45. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  46. changeValue: -2,
  47. permanentCondition: PermanentCondition,
  48. cardCondition: CardSourceCondition,
  49. rootCondition: RootCondition,
  50. isInheritedEffect: false,
  51. card: card,
  52. condition: Condition,
  53. setFixedCost: false));
  54. }
  55. if (timing == EffectTiming.None)
  56. {
  57. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  58. }
  59. if (timing == EffectTiming.OnEnterFieldAnyone)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("Unsuspend all your Digimon with Jamming", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[When Digivolving] Unsuspend all of your Digimon with <Jamming>.";
  68. }
  69. bool CanSelectPermanentCondition(Permanent permanent)
  70. {
  71. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  72. {
  73. if (permanent.HasJamming)
  74. {
  75. if (permanent.IsSuspended)
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. return false;
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  86. }
  87. bool CanActivateCondition(Hashtable hashtable)
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. return true;
  94. }
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. if (isExistOnField(card))
  101. {
  102. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  103. {
  104. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  105. {
  106. List<Permanent> unsuspendPermanetns = new List<Permanent>();
  107. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  108. {
  109. if (CanSelectPermanentCondition(permanent))
  110. {
  111. unsuspendPermanetns.Add(permanent);
  112. }
  113. }
  114. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(unsuspendPermanetns, activateClass).Unsuspend());
  115. }
  116. }
  117. }
  118. }
  119. }
  120. return cardEffects;
  121. }
  122. }