BT25_086.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Dan Yuki
  5. namespace DCGO.CardEffects.BT25
  6. {
  7. public class BT25_086 : 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 Your 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, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription() => "[Start of Your Main Phase] If you have 4 or less memory, gain 1 memory.";
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.IsExistOnBattleArea(card)
  23. && CardEffectCommons.IsOwnerTurn(card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.IsExistOnBattleArea(card);
  28. }
  29. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  30. {
  31. if (card.Owner.CanAddMemory(activateClass) && card.Owner.MemoryForPlayer <= 4)
  32. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  33. }
  34. }
  35. #endregion
  36. #region End of Your Turn
  37. if (timing == EffectTiming.OnEndTurn)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("By suspend this tamer, 1 [TS] digimon gains +1k DP for each opponent memory, then it may attack", CanUseCondition, card);
  41. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  42. cardEffects.Add(activateClass);
  43. string EffectDescription() => "[End of Your Turn] By suspending this Tamer, 1 of your [TS] trait Digimon gains +1000 DP for the turn for each memory your opponent has. Then, it may attack.";
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleArea(card)
  47. && CardEffectCommons.IsOwnerTurn(card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleArea(card)
  52. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  53. }
  54. bool CanSelectPermanentCondition(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  57. && permanent.TopCard.HasTSTraits;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SuspendPeremanentAndProcessAccordingToResult(
  62. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  63. activateClass: activateClass,
  64. successProcess: SuccessProcess,
  65. failureProcess: null));
  66. IEnumerator SuccessProcess(List<Permanent> _permanents)
  67. {
  68. Permanent selectedPermanent = null;
  69. #region Select [TS] Digimon to gain DP & may attack
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. selectedPermanent = permanent;
  87. yield return null;
  88. }
  89. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will gain DP.", "The opponent is selecting 1 Digimon that will gain DP.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. #endregion
  92. if (selectedPermanent != null)
  93. {
  94. #region Gain DP
  95. int dpGain = Math.Max(0, card.Owner.Enemy.MemoryForPlayer * 1000);
  96. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  97. targetPermanent: selectedPermanent,
  98. changeValue: dpGain,
  99. effectDuration: EffectDuration.UntilEachTurnEnd,
  100. activateClass: activateClass));
  101. #endregion
  102. #region May attack
  103. if (selectedPermanent.CanAttack(activateClass))
  104. {
  105. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  106. selectAttackEffect.SetUp(
  107. attacker: selectedPermanent,
  108. canAttackPlayerCondition: () => true,
  109. defenderCondition: _ => true,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  112. }
  113. #endregion
  114. }
  115. }
  116. }
  117. }
  118. #endregion
  119. #region Security
  120. if (timing == EffectTiming.SecuritySkill)
  121. {
  122. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  123. }
  124. #endregion
  125. return cardEffects;
  126. }
  127. }
  128. }