BT19_044.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_044 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] If you have a [Henry Wong] or [Calumon], gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. if (CardEffectCommons.IsExistOnBattleArea(card))
  25. {
  26. if (CardEffectCommons.IsOwnerTurn(card))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleArea(card))
  36. {
  37. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.EqualsCardName("Henry Wong") || permanent.TopCard.EqualsCardName("Calumon")))
  38. {
  39. if (card.Owner.CanAddMemory(activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  50. }
  51. }
  52. #endregion
  53. #region Inherit - When Attacking
  54. if (timing == EffectTiming.OnAllyAttack)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Suspend 1 opponent Digimon", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  59. activateClass.SetHashString("Suspend1_BT19_044");
  60. activateClass.SetIsInheritedEffect(true);
  61. cardEffects.Add(activateClass);
  62. string EffectDiscription()
  63. {
  64. return "[When Attacking] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  65. }
  66. bool CanSelectPermanentCondition(Permanent permanent)
  67. {
  68. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  69. {
  70. if (permanent.IsDigimon)
  71. {
  72. return true;
  73. }
  74. }
  75. return false;
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  80. }
  81. bool CanActivateCondition(Hashtable hashtable)
  82. {
  83. if (CardEffectCommons.IsExistOnBattleArea(card))
  84. {
  85. return true;
  86. }
  87. return false;
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  90. {
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  92. {
  93. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  94. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition: CanSelectPermanentCondition,
  98. canTargetCondition_ByPreSelecetedList: null,
  99. canEndSelectCondition: null,
  100. maxCount: maxCount,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: null,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.Tap,
  106. cardEffect: activateClass);
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. }
  109. }
  110. }
  111. #endregion
  112. return cardEffects;
  113. }
  114. }
  115. }