BT17_045.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT17
  4. {
  5. public class BT17_045 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Argomon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region When Digivolving
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Play 1 Tamer", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] If you don't have [Rhythm], you may play 1 [Rhythm] from your hand without paying the cost.";
  30. }
  31. bool HasRhythmTamer(Permanent permanent)
  32. {
  33. if (permanent.IsTamer)
  34. {
  35. if (permanent.TopCard.EqualsCardName("Rhythm"))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanPlayRhythm(CardSource cardSource)
  43. {
  44. if (cardSource != null)
  45. {
  46. if (cardSource.EqualsCardName("Rhythm"))
  47. {
  48. if (cardSource.Owner == card.Owner)
  49. {
  50. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  62. {
  63. if(CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  73. {
  74. if (!CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasRhythmTamer))
  75. {
  76. if (card.Owner.HandCards.Count >= 1)
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. return false;
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable hashtable)
  85. {
  86. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  87. selectHandEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanPlayRhythm,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: 1,
  93. canNoSelect: true,
  94. canEndNotMax: false,
  95. isShowOpponent: true,
  96. selectCardCoroutine: SelectCardCoroutine,
  97. afterSelectCardCoroutine: null,
  98. mode: SelectHandEffect.Mode.Custom,
  99. cardEffect: activateClass);
  100. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  101. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  102. yield return StartCoroutine(selectHandEffect.Activate());
  103. IEnumerator SelectCardCoroutine(CardSource cardSource)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource> { cardSource }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  106. }
  107. }
  108. }
  109. #endregion
  110. #region On Deletion - ESS
  111. if (timing == EffectTiming.OnDestroyedAnyone)
  112. {
  113. ActivateClass activateClass = new ActivateClass();
  114. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  115. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  116. activateClass.SetIsInheritedEffect(true);
  117. cardEffects.Add(activateClass);
  118. string EffectDiscription()
  119. {
  120. return "[On Deletion] Gain 1 memory.";
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  129. }
  130. IEnumerator ActivateCoroutine(Hashtable hashtable)
  131. {
  132. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  133. }
  134. }
  135. #endregion
  136. return cardEffects;
  137. }
  138. }
  139. }