BT23_061.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Ghostmon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_061 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region OP/OD Shared
  13. bool SharedGhostDigimon(Permanent permanent)
  14. {
  15. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  16. && permanent.TopCard.HasGhostTraits;
  17. }
  18. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  19. {
  20. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedGhostDigimon))
  21. {
  22. Permanent selectedPermament = null;
  23. #region Select Permanent
  24. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, SharedGhostDigimon));
  25. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  26. selectPermanentEffect.SetUp(
  27. selectPlayer: card.Owner,
  28. canTargetCondition: SharedGhostDigimon,
  29. canTargetCondition_ByPreSelecetedList: null,
  30. canEndSelectCondition: null,
  31. maxCount: maxCount,
  32. canNoSelect: false,
  33. canEndNotMax: false,
  34. selectPermanentCoroutine: SelectPermanentCoroutine,
  35. afterSelectPermanentCoroutine: null,
  36. mode: SelectPermanentEffect.Mode.Custom,
  37. cardEffect: activateClass);
  38. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  39. {
  40. selectedPermament = permanent;
  41. yield return null;
  42. }
  43. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain Blocker", "The opponent is selecting 1 Digimon to gain Blocker");
  44. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  45. #endregion
  46. if (selectedPermament != null) yield return ContinuousController.instance.StartCoroutine(
  47. CardEffectCommons.GainBlocker(selectedPermament, EffectDuration.UntilOpponentTurnEnd, activateClass));
  48. }
  49. }
  50. #endregion
  51. #region On Play
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect("1 [Ghost] digimon gain <Blocker>", CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  57. cardEffects.Add(activateClass);
  58. string EffectDiscription()
  59. {
  60. return "[On Play] 1 of your Digimon with the [Ghost] trait gains <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  65. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  70. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedGhostDigimon);
  71. }
  72. IEnumerator ActivateCoroutine(Hashtable hashtable)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  75. }
  76. }
  77. #endregion
  78. #region On Deletion
  79. if (timing == EffectTiming.OnDestroyedAnyone)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect("1 [Ghost] digimon gain <Blocker>", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  84. cardEffects.Add(activateClass);
  85. string EffectDiscription()
  86. {
  87. return "[On Deletion] 1 of your Digimon with the [Ghost] trait gains <Blocker> (At blocker timing, by suspending this Digimon, it becomes the attack target.) until your opponent's turn ends.";
  88. }
  89. bool CanUseCondition(Hashtable hashtable)
  90. {
  91. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  96. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, SharedGhostDigimon);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(SharedActivateCoroutine(hashtable, activateClass));
  101. }
  102. }
  103. #endregion
  104. #region On Deletion - ESS
  105. if (timing == EffectTiming.OnDestroyedAnyone)
  106. {
  107. ActivateClass activateClass = new ActivateClass();
  108. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  109. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  110. activateClass.SetIsInheritedEffect(true);
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[On Deletion] Gain 1 memory.";
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  119. }
  120. bool CanActivateCondition(Hashtable hashtable)
  121. {
  122. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  127. }
  128. }
  129. #endregion
  130. return cardEffects;
  131. }
  132. }
  133. }