BT14_027.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT14
  4. {
  5. public class BT14_027 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Return all level 3 Digimon to hand", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Return all level 3 Digimon to the hand.";
  19. }
  20. bool PermanentCondition(Permanent permanent)
  21. {
  22. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  23. {
  24. if (permanent.IsDigimon)
  25. {
  26. if (permanent.TopCard.HasLevel)
  27. {
  28. if (permanent.Level == 3)
  29. {
  30. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  31. {
  32. if (!permanent.CannotReturnToHand(activateClass))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  46. }
  47. bool CanActivateCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleArea(card))
  50. {
  51. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. List<Permanent> boounceTargetPermanents =
  61. GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer
  62. .Map(player => player.GetBattleAreaPermanents())
  63. .Flat()
  64. .Filter(PermanentCondition);
  65. yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(boounceTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Bounce());
  66. }
  67. }
  68. if (timing == EffectTiming.OnEnterFieldAnyone)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Return all level 3 Digimon to hand", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[When Digivolving] Return all level 3 Digimon to the hand.";
  77. }
  78. bool PermanentCondition(Permanent permanent)
  79. {
  80. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  81. {
  82. if (permanent.IsDigimon)
  83. {
  84. if (permanent.TopCard.HasLevel)
  85. {
  86. if (permanent.Level == 3)
  87. {
  88. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  89. {
  90. if (!permanent.CannotReturnToHand(activateClass))
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. }
  97. }
  98. }
  99. return false;
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  117. {
  118. List<Permanent> boounceTargetPermanents =
  119. GManager.instance.turnStateMachine.gameContext.Players_ForTurnPlayer
  120. .Map(player => player.GetBattleAreaPermanents())
  121. .Flat()
  122. .Filter(PermanentCondition);
  123. yield return ContinuousController.instance.StartCoroutine(new HandBounceClaass(boounceTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Bounce());
  124. }
  125. }
  126. return cardEffects;
  127. }
  128. }
  129. }