BT15_051.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_051 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. //Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Lillymon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #region When Digivolving
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Memory +1 and Draw", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  32. cardEffects.Add(activateClass);
  33. string EffectDiscription()
  34. {
  35. return "[When Digivolving] If there's a suspended Digimon, gain 1 memory. If [Lillymon] or [X Antibody] in this Digimon's digivolution cards, <Draw 1> for each of your opponent's suspended Digimon.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool PermanentCondition(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  44. {
  45. if (permanent.IsDigimon)
  46. {
  47. if (permanent.IsSuspended)
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. bool IsSuspendedCondition(Permanent permanent)
  54. {
  55. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  56. {
  57. if (permanent.IsSuspended)
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  69. {
  70. if (card.Owner.CanAddMemory(activateClass))
  71. {
  72. return true;
  73. }
  74. }
  75. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Lillymon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  76. {
  77. if (CardEffectCommons.HasMatchConditionPermanent(IsSuspendedCondition))
  78. {
  79. if (card.Owner.LibraryCards.Count >= 1)
  80. {
  81. return true;
  82. }
  83. }
  84. }
  85. }
  86. return false;
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  89. {
  90. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  93. }
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Lillymon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  97. {
  98. if (CardEffectCommons.HasMatchConditionPermanent(IsSuspendedCondition))
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(new DrawClass(
  101. card.Owner,
  102. CardEffectCommons.MatchConditionPermanentCount(IsSuspendedCondition),
  103. activateClass).Draw());
  104. }
  105. }
  106. }
  107. }
  108. }
  109. #endregion
  110. #region Inherited Effect
  111. if (timing == EffectTiming.None)
  112. {
  113. int count()
  114. {
  115. return card.Owner.Enemy.GetBattleAreaDigimons().Count(permanent => permanent.IsSuspended);
  116. }
  117. bool Condition()
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (CardEffectCommons.IsOwnerTurn(card))
  122. {
  123. if (count() >= 1)
  124. {
  125. return true;
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  132. changeValue: () => 1000 * count(),
  133. isInheritedEffect: true,
  134. card: card,
  135. condition: Condition));
  136. }
  137. #endregion
  138. return cardEffects;
  139. }
  140. }
  141. }