EX6_016.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_016 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] If you have a purple Digimon or Tamer, gain 1 memory.";
  21. }
  22. bool PermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  25. {
  26. if (permanent.IsTamer && permanent.TopCard.CardColors.Contains(CardColor.Purple) || permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Purple))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.IsOwnerTurn(card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition))
  49. {
  50. if (card.Owner.CanAddMemory(activateClass))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  61. }
  62. }
  63. #endregion
  64. #region Inherit
  65. if (timing == EffectTiming.OnAllyAttack)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  70. activateClass.SetIsInheritedEffect(true);
  71. activateClass.SetHashString("DP-2000_EX6_016");
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[When Attacking] [Once Per Turn] 1 of your opponent's Digimon gets -2000 DP for the turn.";
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  80. }
  81. bool CanSelectPermanentCondition(Permanent permanent)
  82. {
  83. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  84. }
  85. bool CanActivateCondition(Hashtable hashtable)
  86. {
  87. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: maxCount,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: SelectPermanentCoroutine,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  108. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  109. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  112. targetPermanent: permanent,
  113. changeValue: -2000,
  114. effectDuration: EffectDuration.UntilEachTurnEnd,
  115. activateClass: activateClass));
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. return cardEffects;
  122. }
  123. }
  124. }