P_132.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.P
  4. {
  5. public class P_132 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region When Digivolving
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("+2000 DP, until end of opponent's turn", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] By suspending 1 Digimon, this Digimon gets +2000 DP until the end of your opponent's turn.";
  20. }
  21. bool SelectDigimon(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable hashtable)
  34. {
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: SelectDigimon,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: 1,
  42. canNoSelect: true,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectedPermanent,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Tap,
  47. cardEffect: activateClass);
  48. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  49. IEnumerator SelectedPermanent(Permanent permanent)
  50. {
  51. if (permanent != null)
  52. {
  53. if (permanent.TopCard != null)
  54. {
  55. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  56. {
  57. if (!permanent.IsSuspended && permanent.CanSuspend)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  60. targetPermanent: card.PermanentOfThisCard(),
  61. changeValue: 2000,
  62. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  63. activateClass: activateClass));
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region Your Turn
  73. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  74. {
  75. bool HasShotoKazama(Permanent permanent)
  76. {
  77. return permanent.TopCard.CardNames.Contains("Shoto Kazama");
  78. }
  79. bool Condition()
  80. {
  81. if (CardEffectCommons.IsOwnerTurn(card))
  82. {
  83. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasShotoKazama))
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  91. isInheritedEffect: false,
  92. card: card,
  93. condition: Condition));
  94. }
  95. #endregion
  96. #region Your Turn - ESS
  97. if (timing == EffectTiming.None)
  98. {
  99. bool Condition()
  100. {
  101. if (CardEffectCommons.IsOwnerTurn(card))
  102. {
  103. return true;
  104. }
  105. return false;
  106. }
  107. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  108. changeValue: 2000,
  109. isInheritedEffect: true,
  110. card: card,
  111. condition: Condition));
  112. }
  113. #endregion
  114. return cardEffects;
  115. }
  116. }
  117. }