BT25_016.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // GrapLeomon
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alt Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.HasTSTraits;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 4, permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Shared OP/WD
  22. string SharedEffectName = "1 of your Digimon gains +3K DP, then 1 of your Digimon may attack";
  23. CardEffectFactory.ActivateClassesForSharedEffects
  24. (ref cardEffects, timing, card,
  25. SharedEffectName,
  26. SharedActivateCoroutine,
  27. SharedEffectDescription,
  28. optional: false,
  29. onPlay: true,
  30. whenDigivolving: true);
  31. string SharedEffectDescription(string tag)
  32. {
  33. return $"[{tag}] 1 of your Digimon gets +3000 DP for the turn. Then, 1 of your Digimon may attack.";
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  38. }
  39. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  40. {
  41. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: 1,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: null,
  53. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  54. mode: SelectPermanentEffect.Mode.Custom,
  55. cardEffect: activateClass);
  56. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain +3000 DP", "Opponent is select 1 Digimon to gain +3000 DP");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanent)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  61. targetPermanent: permanent[0],
  62. changeValue: 3000,
  63. effectDuration: EffectDuration.UntilEachTurnEnd,
  64. activateClass: activateClass));
  65. }
  66. }
  67. bool YourDigimonThatCanAttack(Permanent permanent)
  68. {
  69. return CanSelectPermanentCondition(permanent)
  70. && permanent.CanAttack(activateClass);
  71. }
  72. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, YourDigimonThatCanAttack))
  73. {
  74. SelectPermanentEffect selectPermanentEffect =
  75. GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: YourDigimonThatCanAttack,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: 1,
  82. canNoSelect: true,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Attack,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  89. "The opponent is selecting 1 Digimon that will attack.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. }
  93. #endregion
  94. #region All Turns
  95. if (timing == EffectTiming.OnAllyAttack)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("May digivolve into [Marsmon]/[Callismon].", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  100. activateClass.SetIsSkippable(true);
  101. cardEffects.Add(activateClass);
  102. string EffectDescription()
  103. {
  104. return "[All Turns] When a Digimon with 13000 DP or more attacks, this Digimon may digivolve into [Marsmon] or [Callismon] in the hand without paying the cost.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleArea(card)
  109. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, AttackingPermanent);
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleArea(card);
  114. }
  115. bool AttackingPermanent(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
  118. && permanent.HasDP
  119. && permanent.DP >= 13000;
  120. }
  121. bool CanSelectCardCondition(CardSource cardSource)
  122. {
  123. return cardSource.EqualsCardName("Marsmon")
  124. || cardSource.EqualsCardName("Callismon");
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable hashtable)
  127. {
  128. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  129. targetPermanent: card.PermanentOfThisCard(),
  130. cardCondition: CanSelectCardCondition,
  131. payCost: false,
  132. reduceCostTuple: null,
  133. fixedCostTuple: null,
  134. ignoreDigivolutionRequirementFixedCost: -1,
  135. isHand: true,
  136. activateClass: activateClass,
  137. successProcess: null));
  138. }
  139. }
  140. #endregion
  141. #region Inherited Security A. +1
  142. if (timing == EffectTiming.None) cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: null));
  143. #endregion
  144. return cardEffects;
  145. }
  146. }
  147. }