EX8_065.cs 6.9 KB

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