Hawkmon_BT16_007.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class Hawkmon_BT16_007 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. # region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.CardNames.Contains("Poromon"))
  16. {
  17. return true;
  18. }
  19. return false;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 0,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null));
  27. }
  28. #endregion
  29. #region When another Digimon is Played or Evolved, Gain 1 memory
  30. if (timing is EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[Your Turn] When on of your other Digimon is played or digivolves, if that Digimon is yellow or has the [Free] trait, gain 1 memory.";
  39. }
  40. bool PermanentCondition(Permanent permanent)
  41. {
  42. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  43. {
  44. if (permanent != card.PermanentOfThisCard())
  45. {
  46. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) ||
  47. permanent.TopCard.ContainsTraits("Free"))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  60. {
  61. if (CardEffectCommons.IsOwnerTurn(card))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. if (card.Owner.CanAddMemory(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  83. }
  84. }
  85. #endregion
  86. #region inherited effect
  87. if (timing == EffectTiming.OnUseAttack)
  88. {
  89. ActivateClass activateClass = new ActivateClass();
  90. activateClass.SetUpICardEffect("Suspend 1", CanUseCondition, card);
  91. activateClass.SetIsInheritedEffect(true);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[Your Turn] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.IsExistOnBattleArea(card))
  105. {
  106. return true;
  107. }
  108. return false;
  109. }
  110. bool CanSelectPermanentCondition(Permanent permanent)
  111. {
  112. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  113. {
  114. return true;
  115. }
  116. return false;
  117. }
  118. IEnumerator ActivateCoroutine(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  121. {
  122. SelectPermanentEffect selectPermanentEffect =
  123. GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: CanSelectPermanentCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: 1,
  130. canNoSelect: false,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: null,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Tap,
  135. cardEffect: activateClass);
  136. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  137. }
  138. }
  139. }
  140. #endregion
  141. return cardEffects;
  142. }
  143. }
  144. }