BT12_107.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_107 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[Main] Until the end of your opponent's turn, 1 of your opponent's Digimon gains \"[Start of Your Main Phase] Attack with this Digimon.\"";
  20. }
  21. bool CanSelectPermanentCondition(Permanent permanent)
  22. {
  23. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  28. }
  29. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  30. {
  31. Permanent selectedPermanent = null;
  32. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  33. {
  34. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  35. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  36. selectPermanentEffect.SetUp(
  37. selectPlayer: card.Owner,
  38. canTargetCondition: CanSelectPermanentCondition,
  39. canTargetCondition_ByPreSelecetedList: null,
  40. canEndSelectCondition: null,
  41. maxCount: maxCount,
  42. canNoSelect: false,
  43. canEndNotMax: false,
  44. selectPermanentCoroutine: SelectPermanentCoroutine,
  45. afterSelectPermanentCoroutine: null,
  46. mode: SelectPermanentEffect.Mode.Custom,
  47. cardEffect: activateClass);
  48. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  49. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  50. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  51. {
  52. selectedPermanent = permanent;
  53. yield return null;
  54. }
  55. if (selectedPermanent != null)
  56. {
  57. ActivateClass activateClass1 = new ActivateClass();
  58. activateClass1.SetUpICardEffect("Attack with this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  59. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  60. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  61. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  62. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  65. }
  66. string EffectDiscription1()
  67. {
  68. return "[Start of Your Main Phase] Attack with this Digimon.";
  69. }
  70. bool CanUseCondition1(Hashtable hashtable1)
  71. {
  72. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  73. {
  74. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  75. {
  76. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. return false;
  83. }
  84. bool CanActivateCondition1(Hashtable hashtable1)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  87. {
  88. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  89. {
  90. if (selectedPermanent.CanAttack(activateClass1))
  91. {
  92. return true;
  93. }
  94. }
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  99. {
  100. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  101. {
  102. if (selectedPermanent.CanAttack(activateClass1))
  103. {
  104. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  105. selectAttackEffect.SetUp(
  106. attacker: selectedPermanent,
  107. canAttackPlayerCondition: () => true,
  108. defenderCondition: (permanent) => true,
  109. cardEffect: activateClass1);
  110. selectAttackEffect.SetCanNotSelectNotAttack();
  111. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  112. }
  113. }
  114. }
  115. ICardEffect GetCardEffect(EffectTiming _timing)
  116. {
  117. if (_timing == EffectTiming.OnStartMainPhase)
  118. {
  119. return activateClass1;
  120. }
  121. return null;
  122. }
  123. }
  124. }
  125. }
  126. }
  127. if (timing == EffectTiming.SecuritySkill)
  128. {
  129. ActivateClass activateClass = new ActivateClass();
  130. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  131. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  132. activateClass.SetIsSecurityEffect(true);
  133. cardEffects.Add(activateClass);
  134. string EffectDiscription()
  135. {
  136. return "[Security] Add this card to its owner's hand.";
  137. }
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  141. }
  142. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  145. }
  146. }
  147. return cardEffects;
  148. }
  149. }
  150. }