BT13_105.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_105 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Return 1 of your opponent's Digimon to the hand. Then, gain 1 memory for every 4 cards in your opponent's hand.";
  20. }
  21. int count()
  22. {
  23. return card.Owner.Enemy.HandCards.Count / 4;
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  32. }
  33. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  34. {
  35. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  36. {
  37. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  38. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  39. selectPermanentEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: CanSelectPermanentCondition,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: maxCount,
  45. canNoSelect: false,
  46. canEndNotMax: false,
  47. selectPermanentCoroutine: null,
  48. afterSelectPermanentCoroutine: null,
  49. mode: SelectPermanentEffect.Mode.Bounce,
  50. cardEffect: activateClass);
  51. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  52. }
  53. if (count() >= 1)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(count(), activateClass));
  56. }
  57. }
  58. }
  59. if (timing == EffectTiming.SecuritySkill)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect($"Return 1 Digimon to hand", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  64. activateClass.SetIsSecurityEffect(true);
  65. cardEffects.Add(activateClass);
  66. string EffectDiscription()
  67. {
  68. return "[Security] Return 1 of your opponent's Digimon to the hand.";
  69. }
  70. bool CanSelectPermanentCondition(Permanent permanent)
  71. {
  72. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  73. }
  74. bool CanUseCondition(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  77. }
  78. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  79. {
  80. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  81. {
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: null,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Bounce,
  95. cardEffect: activateClass);
  96. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  97. }
  98. }
  99. }
  100. return cardEffects;
  101. }
  102. }
  103. }