P_136.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine.XR;
  4. namespace DCGO.CardEffects.P
  5. {
  6. public class P_136 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Play 1 [Shoemon] from your hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] You may play 1 [Shoemon] from your hand without paying the cost.";
  21. }
  22. bool SelectShoemon(CardSource cardSource)
  23. {
  24. if (cardSource.CardNames.Contains("Shoemon"))
  25. {
  26. if (CardEffectCommons.CanPlayAsNewPermanent(
  27. cardSource: cardSource,
  28. payCost: false,
  29. cardEffect: activateClass,
  30. isBreedingArea: false))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionOwnersHand(card, SelectShoemon))
  46. {
  47. return true;
  48. }
  49. }
  50. return true;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  55. selectHandEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: SelectShoemon,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: 1,
  61. canNoSelect: true,
  62. canEndNotMax: false,
  63. isShowOpponent: true,
  64. selectCardCoroutine: null,
  65. afterSelectCardCoroutine: PlaySelectedCard,
  66. mode: SelectHandEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  69. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  70. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  71. IEnumerator PlaySelectedCard(List<CardSource> selectedCards)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  74. cardSources: selectedCards,
  75. activateClass: activateClass,
  76. payCost: false,
  77. isTapped: false,
  78. root: SelectCardEffect.Root.Hand,
  79. activateETB: true));
  80. }
  81. }
  82. }
  83. #endregion
  84. #region Your Turn - When Digivolving
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  90. activateClass.SetHashString("Digivoles_P_136");
  91. cardEffects.Add(activateClass);
  92. string EffectDiscription()
  93. {
  94. return "[Your Turn][Once Per Turn] When one of your Digimon digivolves into a Digimon with the[Puppet] trait, by suspending this Tamer, gain 1 memory.";
  95. }
  96. bool IsDigmonDigivolve(Permanent permanent)
  97. {
  98. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  99. {
  100. if (permanent.TopCard.ContainsTraits("Puppet"))
  101. {
  102. return true;
  103. }
  104. }
  105. return false;
  106. }
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. return CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, IsDigmonDigivolve);
  111. return false;
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.IsExistOnBattleArea(card))
  116. {
  117. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  118. {
  119. return true;
  120. }
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  127. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  128. }
  129. }
  130. #endregion
  131. #region Security Effect
  132. if (timing == EffectTiming.SecuritySkill)
  133. {
  134. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }