BT14_095.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT14
  6. {
  7. public class BT14_095 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OptionSkill)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  16. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Main] 1 of your opponent's Digimon gains \"[All Turns] When this Digimon becomes suspended, lose 2 memory.\" until the end of their turn.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  29. }
  30. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  31. {
  32. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  33. {
  34. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: maxCount,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectPermanentCoroutine,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Custom,
  47. cardEffect: activateClass);
  48. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  51. {
  52. Permanent selectedPermanent = permanent;
  53. if (selectedPermanent != null)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  56. }
  57. if (selectedPermanent != null)
  58. {
  59. ActivateClass activateClass1 = new ActivateClass();
  60. activateClass1.SetUpICardEffect("Memory -2", CanUseCondition2, selectedPermanent.TopCard);
  61. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  62. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  63. CardEffectCommons.AddEffectToPermanent(
  64. targetPermanent: selectedPermanent,
  65. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  66. card: card,
  67. cardEffect: activateClass1,
  68. timing: EffectTiming.OnTappedAnyone);
  69. string EffectDiscription1()
  70. {
  71. return "[All Turns] When this Digimon becomes suspended, lose 2 memory.";
  72. }
  73. bool CanUseCondition2(Hashtable hashtable1)
  74. {
  75. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  76. {
  77. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable1, (permanent) => permanent == selectedPermanent))
  78. {
  79. return true;
  80. }
  81. }
  82. return false;
  83. }
  84. bool CanActivateCondition1(Hashtable hashtable1)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  87. {
  88. return true;
  89. }
  90. return false;
  91. }
  92. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.TopCard.Owner.AddMemory(-2, activateClass));
  95. }
  96. }
  97. }
  98. }
  99. }
  100. }
  101. if (timing == EffectTiming.SecuritySkill)
  102. {
  103. string EffectDiscription()
  104. {
  105. return "[Security] Opponent's 1 Digimon gains effect. Then, add this card to your hand.";
  106. }
  107. IEnumerator AfterMainEffect(ICardEffect activateClass)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  110. }
  111. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Opponent's 1 Digimon gains effect and add this card to hand", effectDiscription: EffectDiscription(), afterMainEffect: AfterMainEffect);
  112. }
  113. return cardEffects;
  114. }
  115. }
  116. }