BT20_003.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_003 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEndTurn)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("If this has no tamers in source, you may place 1 tamer with Pulsemon in text, or Soc or SEEKERS trait as a source", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetHashString("EndOfTurn_BT20-003");
  17. activateClass.SetIsInheritedEffect(true);
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[End of Your Turn] [Once Per Turn] You may place 1 of your Tamers with [Pulsemon] in its text or the [SoC] or [SEEKERS] trait as the bottom digivolution card of this Digimon with no Tamer cards in its digivolution cards.";
  22. }
  23. bool CanSelectTamer(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  26. permanent.IsTamer &&
  27. (permanent.TopCard.HasText("Pulsemon") || permanent.TopCard.HasSocTraits || permanent.TopCard.HasSeekersTraits);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  32. {
  33. if (CardEffectCommons.IsOwnerTurn(card))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. {
  44. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectTamer))
  45. {
  46. if (card.PermanentOfThisCard().DigivolutionCards.Count(source => source.IsTamer) == 0)
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. Permanent selectedPermanent = null;
  57. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  58. {
  59. selectedPermanent = permanent;
  60. yield return null;
  61. }
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectTamer,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: 1,
  69. canNoSelect: true,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: SelectPermanentCoroutine,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. selectPermanentEffect.SetUpCustomMessage("Select 1 card to add to source", "The opponent is selecting 1 card to add to source.");
  76. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  77. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards());
  78. }
  79. }
  80. return cardEffects;
  81. }
  82. }
  83. }