BT9_031.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 BT9_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 PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("MetalGarurumon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Unsuspend this Digimon and it gets Blocker", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Unsuspend this Digimon, and it gains <Blocker> until the end of your opponent's turn. (When an opponent's Digimon attacks, you may suspend this Digimon to force the opponent to attack it instead.)";
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleArea(card);
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. Permanent selectedPermanent = card.PermanentOfThisCard();
  42. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  43. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  44. }
  45. }
  46. if (timing == EffectTiming.OnUnTappedAnyone)
  47. {
  48. ActivateClass activateClass = new ActivateClass();
  49. activateClass.SetUpICardEffect("Return opponent's all Digimon with the lowest level to hand", CanUseCondition, card);
  50. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  51. activateClass.SetHashString("Bounce_BT9_031");
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. {
  55. return "[Your Turn][Once Per Turn] When this Digimon becomes unsuspended, if [MetalGarurumon] or [X Antibody] is in its digivolution cards, return all of your opponent's Digimon with the lowest level to their owners' hands.";
  56. }
  57. bool PermanentCondition(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy);
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. if (CardEffectCommons.IsExistOnBattleArea(card))
  64. {
  65. if (CardEffectCommons.IsOwnerTurn(card))
  66. {
  67. if (CardEffectCommons.CanTriggerWhenPermanentUnsuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanActivateCondition(Hashtable hashtable)
  76. {
  77. if (CardEffectCommons.IsExistOnBattleArea(card))
  78. {
  79. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("MetalGarurumon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  87. {
  88. List<Permanent> boounceTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition);
  89. yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(boounceTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Bounce());
  90. }
  91. }
  92. return cardEffects;
  93. }
  94. }