P_197.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Patamon
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_197 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasTSTraits &&
  18. targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Start Of Your Main Phase
  24. if (timing == EffectTiming.OnStartMainPhase)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Digivolve into a [Angel]/[TS] digimon in hand", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[Start of Your Main Phase] If you have 4 or less memory, this Digimon may digivolve into a Digimon card with the [Angel] or [TS] trait in the hand without paying the cost.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  41. && CardEffectCommons.IsOwnerTurn(card)
  42. && card.Owner.MemoryForPlayer <= 4;
  43. }
  44. bool CanSelectCardCondition(CardSource cardSource)
  45. {
  46. return cardSource.IsDigimon
  47. && (cardSource.HasAngelStrictTraits || cardSource.HasTSTraits)
  48. && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  53. card.PermanentOfThisCard(),
  54. digivolvingCard => CanSelectCardCondition(digivolvingCard),
  55. payCost: false,
  56. reduceCostTuple: null,
  57. fixedCostTuple: null,
  58. ignoreDigivolutionRequirementFixedCost: -1,
  59. isHand: true,
  60. activateClass: activateClass,
  61. successProcess: null
  62. ));
  63. }
  64. }
  65. #endregion
  66. #region ESS - When Attacking
  67. if (timing == EffectTiming.OnAllyAttack)
  68. {
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("-2k DP", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  72. activateClass.SetIsInheritedEffect(true);
  73. activateClass.SetHashString("P_196_DPMinus");
  74. cardEffects.Add(activateClass);
  75. string EffectDiscription()
  76. {
  77. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.IsExistOnBattleArea(card)
  86. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  87. }
  88. bool CanSelectPermanentCondition(Permanent permanent)
  89. {
  90. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. Permanent selectedPermanent = null;
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -2K DP", "The opponent is selecting 1 Digimon that will get -2K DP");
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. selectedPermanent = permanent;
  115. yield return null;
  116. }
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  119. targetPermanent: selectedPermanent,
  120. changeValue: -2000,
  121. effectDuration: EffectDuration.UntilEachTurnEnd,
  122. activateClass: activateClass));
  123. }
  124. }
  125. }
  126. #endregion
  127. return cardEffects;
  128. }
  129. }
  130. }