EX11_048.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Ghostmon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_048 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Shared WM/OP
  13. string SharedEffectName() => "1 [Ghost] trait Digimon gains <Retaliation> until end of opponent's turn.";
  14. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your Digimon with [Ghost] trait gains <Retaliation> until your opponent's turn ends.";
  15. bool SharedCanActivateCondition(Hashtable hashtable)
  16. {
  17. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  18. }
  19. bool CanSelectPermanentCondition(Permanent permanent)
  20. {
  21. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  22. && permanent.TopCard.EqualsTraits("Ghost");
  23. }
  24. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  25. {
  26. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  27. {
  28. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  29. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  30. selectPermanentEffect.SetUp(
  31. selectPlayer: card.Owner,
  32. canTargetCondition: CanSelectPermanentCondition,
  33. canTargetCondition_ByPreSelecetedList: null,
  34. canEndSelectCondition: null,
  35. maxCount: maxCount,
  36. canNoSelect: false,
  37. canEndNotMax: false,
  38. selectPermanentCoroutine: SelectPermanentCoroutine,
  39. afterSelectPermanentCoroutine: null,
  40. mode: SelectPermanentEffect.Mode.Custom,
  41. cardEffect: activateClass);
  42. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain <Retaliation>.", "The opponent is selecting 1 Digimon that will gain <Retaliation>.");
  43. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  44. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRetaliation(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  47. }
  48. }
  49. }
  50. #endregion
  51. #region When Moving
  52. if (timing == EffectTiming.OnMove)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  56. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("When Moving"));
  57. cardEffects.Add(activateClass);
  58. bool PermanentCondition(Permanent permanent)
  59. {
  60. return permanent == card.PermanentOfThisCard();
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  65. && CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  66. }
  67. }
  68. #endregion
  69. #region On Play
  70. if (timing == EffectTiming.OnEnterFieldAnyone)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  74. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  75. cardEffects.Add(activateClass);
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  79. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  80. }
  81. }
  82. #endregion
  83. #region Inherited Effect - On Deletion
  84. if (timing == EffectTiming.OnDestroyedAnyone)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  89. activateClass.SetIsInheritedEffect(true);
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[On Deletion] Gain 1 memory.";
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  102. }
  103. IEnumerator ActivateCoroutine(Hashtable hashtable)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  106. }
  107. }
  108. #endregion
  109. return cardEffects;
  110. }
  111. }
  112. }