BT5_028.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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_028 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash digivolution cards from opponent's all Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Trash the bottom digivolution card of all of your opponent's Digimon.";
  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 CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons().Clone())
  55. {
  56. if (CanSelectPermanentCondition(selectedPermanent))
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  59. targetPermanent: selectedPermanent,
  60. trashCount: 1,
  61. isFromTop: false,
  62. activateClass: activateClass));
  63. }
  64. }
  65. }
  66. }
  67. if (timing == EffectTiming.None)
  68. {
  69. bool Condition()
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. if (CardEffectCommons.IsOwnerTurn(card))
  74. {
  75. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.HasNoDigivolutionCards))
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. return false;
  82. }
  83. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  84. }
  85. return cardEffects;
  86. }
  87. }