BT24_035.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using Photon.Pun;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using UnityEngine;
  7. // Gatomon
  8. namespace DCGO.CardEffects.BT24
  9. {
  10. public class BT24_035 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region Alternative Digivolution Condition
  16. if (timing == EffectTiming.None)
  17. {
  18. bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.HasTSTraits;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 2, false, card, null));
  23. }
  24. #endregion
  25. #region Shared OP / WD
  26. string SharedEffectName() => "Give -3k DP, then if its your turn, you may DNA";
  27. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon gets -3000 DP for the turn. Then, if it's your turn, 2 of your Digimon may DNA digivolve into [Silphymon] in the hand.";
  28. bool CanSelectPermanentCondition(Permanent permanent)
  29. {
  30. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  31. }
  32. bool CanSelectDNACardCondition(CardSource cardSource)
  33. {
  34. return cardSource.CanPlayJogress(true) &&
  35. cardSource.EqualsCardName("Silphymon");
  36. }
  37. bool SharedCanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  40. }
  41. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermanentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: 1,
  52. canNoSelect: false,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: SelectPermanentCoroutine,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Custom,
  57. cardEffect: activateClass);
  58. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -3000, maxCount: 1));
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  63. targetPermanent: permanent,
  64. changeValue: -3000,
  65. effectDuration: EffectDuration.UntilEachTurnEnd,
  66. activateClass: activateClass));
  67. }
  68. }
  69. if (CardEffectCommons.IsOwnerTurn(card))
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(
  72. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  73. CanSelectDNACardCondition,
  74. payCost: true,
  75. isHand: true,
  76. activateClass
  77. ));
  78. }
  79. }
  80. #endregion
  81. #region On Play
  82. if (timing == EffectTiming.OnEnterFieldAnyone)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  86. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  87. cardEffects.Add(activateClass);
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  91. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  92. }
  93. }
  94. #endregion
  95. #region When Digivolving
  96. if (timing == EffectTiming.OnEnterFieldAnyone)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  100. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  101. cardEffects.Add(activateClass);
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  105. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  106. }
  107. }
  108. #endregion
  109. #region ESS Barrier
  110. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  111. {
  112. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  113. }
  114. #endregion
  115. return cardEffects;
  116. }
  117. }
  118. }