EX7_063.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_063 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Main Phase
  11. if (timing == EffectTiming.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.IsExistOnBattleArea(card) &&
  24. CardEffectCommons.IsOwnerTurn(card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleArea(card) &&
  29. card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1 &&
  30. card.Owner.CanAddMemory(activateClass);
  31. }
  32. IEnumerator ActivateCoroutine(Hashtable hashtable)
  33. {
  34. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  35. }
  36. }
  37. #endregion
  38. #region All Turns
  39. if (timing == EffectTiming.OnDestroyedAnyone)
  40. {
  41. ActivateClass activateClass = new ActivateClass();
  42. activateClass.SetUpICardEffect("Play 1 level 3 [Puppet] Digimon", CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  44. cardEffects.Add(activateClass);
  45. string EffectDescription()
  46. {
  47. return
  48. "[Your Turn] When one of your Tokens or Digimon with the [Puppet] trait is deleted, by suspending this Tamer, you may play 1 level 3 Digimon card with the [Puppet] trait from your hand without paying the cost.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleArea(card) &&
  53. CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass);
  54. }
  55. bool PermanentCondition(Permanent permanent)
  56. {
  57. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  58. (permanent.IsToken || permanent.TopCard.ContainsTraits("Puppet"));
  59. }
  60. bool IsLevel3PuppetCardCondition(CardSource cardSource)
  61. {
  62. return cardSource.IsDigimon &&
  63. cardSource.HasLevel &&
  64. cardSource.IsLevel3 &&
  65. cardSource.ContainsTraits("Puppet") &&
  66. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.IsExistOnBattleArea(card) &&
  71. CardEffectCommons.CanActivateSuspendCostEffect(card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  76. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  77. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsLevel3PuppetCardCondition))
  78. {
  79. List<CardSource> selectedCards = new List<CardSource>();
  80. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  81. selectHandEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: IsLevel3PuppetCardCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: 1,
  87. canNoSelect: true,
  88. canEndNotMax: false,
  89. isShowOpponent: true,
  90. selectCardCoroutine: SelectCardCoroutine,
  91. afterSelectCardCoroutine: null,
  92. mode: SelectHandEffect.Mode.Custom,
  93. cardEffect: activateClass);
  94. selectHandEffect.SetUpCustomMessage("Select 1 Digimon card to play.",
  95. "The opponent is selecting 1 Digimon card to play.");
  96. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  97. yield return StartCoroutine(selectHandEffect.Activate());
  98. IEnumerator SelectCardCoroutine(CardSource cardSource)
  99. {
  100. selectedCards.Add(cardSource);
  101. yield return null;
  102. }
  103. yield return ContinuousController.instance.StartCoroutine(
  104. CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass,
  105. payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  106. }
  107. }
  108. }
  109. #endregion
  110. #region Security Effect
  111. if (timing == EffectTiming.SecuritySkill)
  112. {
  113. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  114. }
  115. #endregion
  116. return cardEffects;
  117. }
  118. }
  119. }