EX10_007.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Greymon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_007 : 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.IsLevel3 && targetPermanent.TopCard.ContainsCardName("Agumon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Raid
  23. if (timing == EffectTiming.OnAllyAttack)
  24. {
  25. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region OP/WD Shared
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
  32. && permanent.IsDigimon;
  33. }
  34. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  35. {
  36. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  37. {
  38. Permanent selectedPermanment = null;
  39. #region Select Permanent
  40. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  41. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  42. selectPermanentEffect.SetUp(
  43. selectPlayer: card.Owner,
  44. canTargetCondition: CanSelectPermanentCondition,
  45. canTargetCondition_ByPreSelecetedList: null,
  46. canEndSelectCondition: null,
  47. maxCount: maxCount,
  48. canNoSelect: false,
  49. canEndNotMax: false,
  50. selectPermanentCoroutine: SelectPermanentCoroutine,
  51. afterSelectPermanentCoroutine: null,
  52. mode: SelectPermanentEffect.Mode.Custom,
  53. cardEffect: activateClass);
  54. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  55. {
  56. selectedPermanment = permanent;
  57. yield return null;
  58. }
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain 3K DP", "The opponent is selecting 1 Digimon to gain 3K DP");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. #endregion
  62. if (selectedPermanment != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  63. targetPermanent: selectedPermanment,
  64. changeValue: 3000,
  65. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  66. activateClass: activateClass));
  67. }
  68. }
  69. #endregion
  70. #region On Play
  71. if (timing == EffectTiming.OnEnterFieldAnyone)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect("1 digimon gains 3K DP", CanUseCondition, card);
  75. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  76. cardEffects.Add(activateClass);
  77. string EffectDiscription()
  78. {
  79. return "[On Play] 1 Digimon gets +3000 DP until your opponent's turn ends.";
  80. }
  81. bool CanUseCondition(Hashtable hashtable)
  82. {
  83. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  84. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  85. }
  86. bool CanActivateCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  89. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  90. }
  91. }
  92. #endregion
  93. #region When Digivolving
  94. if (timing == EffectTiming.OnEnterFieldAnyone)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("1 digimon gains 3K DP", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. {
  102. return "[When Digivolving] 1 Digimon gets +3000 DP until your opponent's turn ends.";
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  107. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  112. && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  113. }
  114. }
  115. #endregion
  116. #region ESS
  117. if (timing == EffectTiming.None)
  118. {
  119. bool Condition()
  120. {
  121. return CardEffectCommons.IsExistOnBattleArea(card);
  122. }
  123. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }