EX11_007.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Agumon
  4. namespace DCGO.CardEffects.EX11
  5. {
  6. public class EX11_007 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Koromon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Shared WM/OP
  22. string SharedEffectName() => "1 Digimon gains <Raid> and <Piercing> for turn.";
  23. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your Digimon with [Tyrannomon] in its name or the [Reptile] or [Dinosaur] trait gains <Raid> and <Piercing> for the turn.";
  24. bool SharedCanActivateCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  27. }
  28. bool PermanentDigimonCondition(Permanent permanent)
  29. {
  30. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  31. && (permanent.TopCard.ContainsCardName("Tyrannomon")
  32. || permanent.TopCard.EqualsTraits("Reptile")
  33. || permanent.TopCard.EqualsTraits("Dinosaur"));
  34. }
  35. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  36. {
  37. if (CardEffectCommons.HasMatchConditionPermanent(PermanentDigimonCondition))
  38. {
  39. Permanent selectedPermanent = null;
  40. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  41. selectPermanentEffect.SetUp(
  42. selectPlayer: card.Owner,
  43. canTargetCondition: PermanentDigimonCondition,
  44. canTargetCondition_ByPreSelecetedList: null,
  45. canEndSelectCondition: null,
  46. maxCount: 1,
  47. canNoSelect: false,
  48. canEndNotMax: false,
  49. selectPermanentCoroutine: SelectPermanentCoroutine,
  50. afterSelectPermanentCoroutine: null,
  51. mode: SelectPermanentEffect.Mode.Custom,
  52. cardEffect: activateClass);
  53. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain effects.",
  54. "The opponent is selecting 1 Digimon that will gain effects.");
  55. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  56. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  57. {
  58. selectedPermanent = permanent;
  59. yield return null;
  60. }
  61. if (selectedPermanent != null)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRaid(
  64. targetPermanent: selectedPermanent,
  65. effectDuration: EffectDuration.UntilEachTurnEnd,
  66. activateClass: activateClass));
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  68. targetPermanent: selectedPermanent,
  69. effectDuration: EffectDuration.UntilEachTurnEnd,
  70. activateClass: activateClass));
  71. }
  72. }
  73. }
  74. #endregion
  75. #region When Moving
  76. if (timing == EffectTiming.OnMove)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  80. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("When Moving"));
  81. cardEffects.Add(activateClass);
  82. bool PermanentCondition(Permanent permanent)
  83. {
  84. return permanent == card.PermanentOfThisCard();
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  89. && CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  90. }
  91. }
  92. #endregion
  93. #region On Play
  94. if (timing == EffectTiming.OnEnterFieldAnyone)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  98. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  99. cardEffects.Add(activateClass);
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  103. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  104. }
  105. }
  106. #endregion
  107. #region All Turns - Inherited Effect
  108. if (timing == EffectTiming.None)
  109. {
  110. bool Condition()
  111. {
  112. return true;
  113. }
  114. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  115. changeValue: 1000,
  116. isInheritedEffect: true,
  117. card: card,
  118. condition: Condition));
  119. }
  120. #endregion
  121. return cardEffects;
  122. }
  123. }
  124. }