BT10_024.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_024 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  16. {
  17. cardEffects.Add(CardEffectFactory.MaterialSaveEffect(card: card, materialSaveCount: 2));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("This Digimon gains Rush and opponent's Digimon can't attack and block", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[On Play] This Digimon gains <Rush> for the turn. Then, if DigiXrosing, 3 of your opponent's Digimon with digivolution cards less than or equal to this Digimon's digivolution cards can't attack or block until the end of your opponent's turn.";
  28. }
  29. bool CanSelectPermanentCondition(Permanent permanent)
  30. {
  31. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count)
  36. {
  37. if (permanent.CanSelectBySkill(activateClass))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. return true;
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  61. targetPermanent: card.PermanentOfThisCard(),
  62. effectDuration: EffectDuration.UntilEachTurnEnd,
  63. activateClass: activateClass));
  64. if (CardEffectCommons.IsDijiXros(_hashtable, card, (digixrosCount) => digixrosCount >= 1))
  65. {
  66. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  67. {
  68. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  69. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  70. selectPermanentEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: CanSelectPermanentCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: false,
  77. canEndNotMax: false,
  78. selectPermanentCoroutine: SelectPermanentCoroutine,
  79. afterSelectPermanentCoroutine: null,
  80. mode: SelectPermanentEffect.Mode.Custom,
  81. cardEffect: activateClass);
  82. selectPermanentEffect.SetUpCustomMessage("Select Digimon that will get effects.", "The opponent is selecting Digimon that will get effects.");
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  85. {
  86. Permanent selectedPermanent = permanent;
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(targetPermanent: selectedPermanent, defenderCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Attack"));
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBlock(targetPermanent: selectedPermanent, attackerCondition: null, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass, effectName: "Can't Block"));
  89. }
  90. }
  91. }
  92. }
  93. }
  94. if (timing == EffectTiming.None)
  95. {
  96. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  97. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  98. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  99. addDigiXrosConditionClass.SetNotShowUI(true);
  100. cardEffects.Add(addDigiXrosConditionClass);
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return true;
  104. }
  105. DigiXrosCondition GetDigiXros(CardSource cardSource)
  106. {
  107. if (cardSource == card)
  108. {
  109. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Greymon");
  110. bool CanSelectCardCondition(CardSource cardSource)
  111. {
  112. if (cardSource != null)
  113. {
  114. if (cardSource.Owner == card.Owner)
  115. {
  116. if (cardSource.IsDigimon)
  117. {
  118. if (cardSource.CardNames_DigiXros.Contains("Greymon"))
  119. {
  120. return true;
  121. }
  122. }
  123. }
  124. }
  125. return false;
  126. }
  127. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "MailBirdramon");
  128. bool CanSelectCardCondition1(CardSource cardSource)
  129. {
  130. if (cardSource != null)
  131. {
  132. if (cardSource.Owner == card.Owner)
  133. {
  134. if (cardSource.IsDigimon)
  135. {
  136. if (cardSource.CardNames_DigiXros.Contains("MailBirdramon"))
  137. {
  138. return true;
  139. }
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  146. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  147. return digiXrosCondition;
  148. }
  149. return null;
  150. }
  151. }
  152. return cardEffects;
  153. }
  154. }
  155. }