BT12_090.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT12
  4. {
  5. public class BT12_090 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnStartMainPhase)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Start of Your Main Phase] If you have a Digimon with a [Free] trait or a Tamer with [Ken Ichijoji] in its name in play, gain 1 memory.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. if (CardEffectCommons.IsOwnerTurn(card))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (card.Owner.CanAddMemory(activateClass))
  36. {
  37. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardTraits.Contains("Free")))
  38. {
  39. return true;
  40. }
  41. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer && permanent.TopCard.ContainsCardName("Ken Ichijoji")))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  52. }
  53. }
  54. if (timing == EffectTiming.OnAllyAttack)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Digivolve your Digimon into a Digimon card with [Imperialdramon] in its name", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  59. cardEffects.Add(activateClass);
  60. string EffectDiscription()
  61. {
  62. return "[Your Turn] If one of your 2-color blue and green Digimon attacks, by suspending this Tamer, digivolve that Digimon into a Digimon card with [Imperialdramon] in its name in your hand for its cost.";
  63. }
  64. bool CanSelectCardCondition(CardSource cardSource)
  65. {
  66. return cardSource.IsDigimon && cardSource.ContainsCardName("Imperialdramon");
  67. }
  68. bool PermanentCondition(Permanent permanent)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  71. {
  72. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  73. {
  74. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  75. {
  76. if (permanent.TopCard.CardColors.Count == 2)
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. bool CanUseCondition(Hashtable hashtable)
  86. {
  87. if (CardEffectCommons.IsExistOnBattleArea(card))
  88. {
  89. if (CardEffectCommons.IsOwnerTurn(card))
  90. {
  91. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  92. {
  93. return true;
  94. }
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanActivateCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  104. {
  105. return true;
  106. }
  107. }
  108. return false;
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  114. targetPermanent: GManager.instance.attackProcess.AttackingPermanent,
  115. cardCondition: CanSelectCardCondition,
  116. payCost: true,
  117. reduceCostTuple: null,
  118. fixedCostTuple: null,
  119. ignoreDigivolutionRequirementFixedCost: -1,
  120. isHand: true,
  121. activateClass: activateClass,
  122. successProcess: null));
  123. }
  124. }
  125. if (timing == EffectTiming.SecuritySkill)
  126. {
  127. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  128. }
  129. return cardEffects;
  130. }
  131. }
  132. }