BT12_065.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT12
  5. {
  6. public class BT12_065 : 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.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Mercurymon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 1, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.None)
  20. {
  21. bool Condition()
  22. {
  23. return card.Owner.HandCards.Contains(card);
  24. }
  25. bool PermanentCondition(Permanent targetPermanent)
  26. {
  27. return targetPermanent.TopCard.CardColors.Contains(CardColor.Black) && targetPermanent.IsTamer;
  28. }
  29. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: Condition));
  30. }
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Opponent's 1 Digimon get effects", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[When Digivolving] Until the end of your opponent's turn, 1 of your opponent's Digimon gains \"[Start of Your Main Phase] Attack with this Digimon.\"";
  40. }
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. if (CardEffectCommons.IsExistOnBattleArea(card))
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. return true;
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. if (isExistOnField(card))
  63. {
  64. Permanent selectedPermanent = null;
  65. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. selectedPermanent = permanent;
  88. yield return null;
  89. }
  90. if (selectedPermanent != null)
  91. {
  92. ActivateClass activateClass1 = new ActivateClass();
  93. activateClass1.SetUpICardEffect("Attack with this Digimon", CanUseCondition1, selectedPermanent.TopCard);
  94. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  95. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  96. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  97. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  100. }
  101. string EffectDiscription1()
  102. {
  103. return "[Start of Your Main Phase] Attack with this Digimon.";
  104. }
  105. bool CanUseCondition1(Hashtable hashtable1)
  106. {
  107. if (selectedPermanent.TopCard != null)
  108. {
  109. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  110. {
  111. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. return false;
  118. }
  119. bool CanActivateCondition1(Hashtable hashtable1)
  120. {
  121. if (selectedPermanent.TopCard != null)
  122. {
  123. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  124. {
  125. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  126. {
  127. if (selectedPermanent.CanAttack(activateClass1))
  128. {
  129. return true;
  130. }
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  137. {
  138. if (selectedPermanent.TopCard != null)
  139. {
  140. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  141. {
  142. if (selectedPermanent.CanAttack(activateClass1))
  143. {
  144. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  145. selectAttackEffect.SetUp(
  146. attacker: selectedPermanent,
  147. canAttackPlayerCondition: () => true,
  148. defenderCondition: (permanent) => true,
  149. cardEffect: activateClass1);
  150. selectAttackEffect.SetCanNotSelectNotAttack();
  151. Hashtable hashtable = new Hashtable();
  152. hashtable.Add("CardEffect", activateClass1);
  153. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  154. }
  155. }
  156. }
  157. }
  158. ICardEffect GetCardEffect(EffectTiming _timing)
  159. {
  160. if (_timing == EffectTiming.OnStartMainPhase)
  161. {
  162. return activateClass1;
  163. }
  164. return null;
  165. }
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. return cardEffects;
  173. }
  174. }
  175. }