BT5_096.cs 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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_096 : 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. int maxDP()
  16. {
  17. int maxDP = 3000;
  18. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Omnimon") || permanent.TopCard.HasGarurumonName))
  19. {
  20. maxDP = 5000;
  21. }
  22. return maxDP;
  23. }
  24. ActivateClass activateClass = new ActivateClass();
  25. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  26. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  27. cardEffects.Add(activateClass);
  28. string EffectDiscription()
  29. {
  30. return "[Main] Return all of your opponent's Digimon with 3000 DP or less to their owners' hands. If you have a Digimon in play with [Garurumon] or [Omnimon] in its name, return all of your opponent's Digimon with 5000 DP or less to their owners' hands instead. Trash all of the digivolution cards of those Digimon.";
  31. }
  32. bool CanSelectPermanentCondition(Permanent permanent)
  33. {
  34. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  35. {
  36. if (permanent.DP <= maxDP())
  37. {
  38. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  53. {
  54. List<Permanent> bouncePermanents = new List<Permanent>();
  55. foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
  56. {
  57. if (CanSelectPermanentCondition(permanent))
  58. {
  59. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  60. {
  61. bouncePermanents.Add(permanent);
  62. }
  63. }
  64. }
  65. if (bouncePermanents.Count >= 1)
  66. {
  67. Hashtable hashtable = new Hashtable();
  68. hashtable.Add("CardEffect", activateClass);
  69. yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(bouncePermanents, hashtable).Bounce());
  70. }
  71. }
  72. }
  73. }
  74. if (timing == EffectTiming.SecuritySkill)
  75. {
  76. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return opponent's Digimon to hand");
  77. }
  78. return cardEffects;
  79. }
  80. }