BT24_085.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Dan Yuki & Kanan Yuki
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_085 : 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("Use a [TS] Option that costs less than your opponent's memory, 1 [TS] Digimon 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, you may use 1 [TS] trait Option card with as high or lower a use cost as your opponent's memory from your hand without paying the cost. Then, 1 of your Digimon with the [TS] trait 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. && card.Owner.MemoryForPlayer <= 0;
  54. }
  55. bool CanSelectCardCondition(CardSource cardSource)
  56. {
  57. return cardSource.IsOption
  58. && cardSource.HasTSTraits
  59. && !cardSource.CanNotPlayThisOption
  60. && cardSource.GetCostItself <= card.Owner.Enemy.MemoryForPlayer;
  61. }
  62. bool CanSelectPermanentCondition(Permanent permanent)
  63. {
  64. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  65. && permanent.TopCard.HasTSTraits
  66. && permanent.CanAttack(activateClass);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent> { card.PermanentOfThisCard() }, _hashtable).Tap());
  71. if (card.PermanentOfThisCard().IsSuspended)
  72. {
  73. #region use option
  74. List<CardSource> selectedCards = new List<CardSource>();
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectHandEffect.SetUpCustomMessage("Select 1 option card to use.", "The opponent is selecting 1 option card to use.");
  91. selectHandEffect.SetUpCustomMessage_ShowCard("Used Card");
  92. yield return StartCoroutine(selectHandEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCards.Add(cardSource);
  96. yield return null;
  97. }
  98. yield return ContinuousController.instance.StartCoroutine(
  99. CardEffectCommons.PlayOptionCards(
  100. cardSources: selectedCards,
  101. activateClass: activateClass,
  102. payCost: false,
  103. root: SelectCardEffect.Root.Hand));
  104. #endregion
  105. #region Digimon attacks
  106. Permanent selectedPermanent = null;
  107. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  108. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  109. selectPermanentEffect.SetUp(
  110. selectPlayer: card.Owner,
  111. canTargetCondition: CanSelectPermanentCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. maxCount: maxCount1,
  115. canNoSelect: true,
  116. canEndNotMax: false,
  117. selectPermanentCoroutine: SelectPermanentCoroutine,
  118. afterSelectPermanentCoroutine: null,
  119. mode: SelectPermanentEffect.Mode.Custom,
  120. cardEffect: activateClass);
  121. selectPermanentEffect.SetUpCustomMessage(
  122. "Select 1 Digimon that will attack.",
  123. "The opponent is selecting 1 Digimon that will attack.");
  124. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  125. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  126. {
  127. selectedPermanent = permanent;
  128. yield return null;
  129. }
  130. if (selectedPermanent != null)
  131. {
  132. if (selectedPermanent.CanAttack(activateClass))
  133. {
  134. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  135. selectAttackEffect.SetUp(
  136. attacker: selectedPermanent,
  137. canAttackPlayerCondition: () => true,
  138. defenderCondition: _ => true,
  139. cardEffect: activateClass);
  140. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  141. }
  142. }
  143. #endregion
  144. }
  145. }
  146. }
  147. #endregion
  148. #region Security
  149. if (timing == EffectTiming.SecuritySkill)
  150. {
  151. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  152. }
  153. #endregion
  154. return cardEffects;
  155. }
  156. }
  157. }