ST15_15.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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. public class ST15_15 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (card.Owner.GetBattleAreaPermanents().Count(permanent =>
  22. permanent.TopCard.ContainsCardName("Tai Kamiya") && permanent.IsTamer) >= 1)
  23. {
  24. return true;
  25. }
  26. return false;
  27. }
  28. bool CardCondition(CardSource cardSource)
  29. {
  30. if (cardSource == card)
  31. {
  32. return true;
  33. }
  34. return false;
  35. }
  36. }
  37. if (timing == EffectTiming.OptionSkill)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  41. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[Main] Unsuspend 1 of your Digimon. Then, 1 of your Digimon with [Greymon] in its name isn't affected by the effects of your opponent's Digimon until the end of your opponent's turn.";
  46. }
  47. bool CanSelectPermanentCondition(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  50. }
  51. bool CanSelectPermanentCondition1(Permanent permanent)
  52. {
  53. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  54. {
  55. if (permanent.TopCard.HasGreymonName)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  69. {
  70. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  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: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.UnTap,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  87. {
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectPermanentCondition1,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain effect.", "The opponent is selecting 1 Digimon that will gain effect.");
  103. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  104. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  105. {
  106. Permanent selectedPermanent = permanent;
  107. if (selectedPermanent != null)
  108. {
  109. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  110. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effect", CanUseCondition1, card);
  111. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  112. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  113. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  114. bool CanUseCondition1(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  117. }
  118. bool CardCondition(CardSource cardSource)
  119. {
  120. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  121. {
  122. if (cardSource == selectedPermanent.TopCard)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. bool SkillCondition(ICardEffect cardEffect)
  130. {
  131. if (cardEffect != null)
  132. {
  133. if (cardEffect.EffectSourceCard != null)
  134. {
  135. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  136. {
  137. if (cardEffect.IsDigimonEffect)
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. }
  144. return false;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. }
  151. if (timing == EffectTiming.SecuritySkill)
  152. {
  153. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  154. card: card,
  155. cardEffects: ref cardEffects,
  156. effectName: $"Unsuspend 1 Digimon and your 1 Digimon gains effect");
  157. }
  158. return cardEffects;
  159. }
  160. }