BT22_093.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using DCGO.CardEntities;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Ami Aiba
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_093 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOwnerTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  39. {
  40. if (card.Owner.CanAddMemory(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  51. }
  52. }
  53. #endregion
  54. #region Your Turn
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. Permanent DigivolvingDigimon = null;
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Digivolve into a [CS] Digimon", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  61. cardEffects.Add(activateClass);
  62. string EffectDiscription()
  63. {
  64. return "[Your Turn] When any of your Digimon digivolve into a Digimon with the [CS] trait, if it has a digivolution card with the same level as the digivolved Digimon, by suspending this Tamer, that Digimon may digivolve into a Digimon card with the [CS] trait in the hand without paying the cost.";
  65. }
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.IsExistOnField(card) &&
  69. CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, DigivolvingCondition);
  70. }
  71. bool CanActivateCondition(Hashtable hashtable)
  72. {
  73. if (DigivolvingDigimon != null)
  74. {
  75. if (!DigivolvingCondition(DigivolvingDigimon))
  76. return false;
  77. }
  78. return CardEffectCommons.IsExistOnField(card)
  79. && CardEffectCommons.IsOwnerTurn(card)
  80. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  81. }
  82. bool DigivolvingCondition(Permanent permanent)
  83. {
  84. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  85. {
  86. if (permanent.TopCard.HasCSTraits)
  87. {
  88. if (permanent.DigivolutionCards.Filter(x => x.HasLevel && x.Level == permanent.Level).Count >= 1)
  89. {
  90. DigivolvingDigimon = permanent;
  91. return true;
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanSelectCardCondition(CardSource cardSource)
  98. {
  99. if (cardSource.IsDigimon && cardSource.HasCSTraits)
  100. {
  101. if (cardSource.CanPlayCardTargetFrame(DigivolvingDigimon.PermanentFrame, true, activateClass))
  102. {
  103. return true;
  104. }
  105. }
  106. return false;
  107. }
  108. IEnumerator ActivateCoroutine(Hashtable hashtable)
  109. {
  110. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  111. new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  112. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  115. targetPermanent: DigivolvingDigimon,
  116. cardCondition: CanSelectCardCondition,
  117. payCost: false,
  118. reduceCostTuple: null,
  119. fixedCostTuple: null,
  120. ignoreDigivolutionRequirementFixedCost: -1,
  121. isHand: true,
  122. activateClass: activateClass,
  123. successProcess: null));
  124. }
  125. }
  126. }
  127. #endregion
  128. #region Security
  129. if (timing == EffectTiming.SecuritySkill)
  130. {
  131. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  132. }
  133. #endregion
  134. return cardEffects;
  135. }
  136. }
  137. }