BT13_077.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_077 : 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. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  14. }
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("This Digimon becomes immune to opponent's effects", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] Until the end of your opponent's turn, this Digimon isn't affected by the effects of your opponent's Digimon.";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. return true;
  34. }
  35. return false;
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  38. {
  39. Permanent selectedPermanent = card.PermanentOfThisCard();
  40. if (selectedPermanent != null)
  41. {
  42. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  43. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effect", CanUseCondition1, card);
  44. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  45. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  46. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  47. bool CanUseCondition1(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  50. }
  51. bool CardCondition(CardSource cardSource)
  52. {
  53. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  54. {
  55. if (cardSource == selectedPermanent.TopCard)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool SkillCondition(ICardEffect cardEffect)
  63. {
  64. if (cardEffect != null)
  65. {
  66. if (cardEffect.EffectSourceCard != null)
  67. {
  68. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  69. {
  70. if (cardEffect.IsDigimonEffect)
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. }
  80. }
  81. }
  82. if (timing == EffectTiming.OnEnterFieldAnyone)
  83. {
  84. ActivateClass activateClass = new ActivateClass();
  85. activateClass.SetUpICardEffect("This Digimon becomes immune to opponent's effects", CanUseCondition, card);
  86. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  87. cardEffects.Add(activateClass);
  88. string EffectDiscription()
  89. {
  90. return "[When Digivolving] Until the end of your opponent's turn, this Digimon isn't affected by the effects of your opponent's Digimon.";
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. return true;
  101. }
  102. return false;
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  105. {
  106. Permanent selectedPermanent = card.PermanentOfThisCard();
  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. if (timing == EffectTiming.OnEndTurn)
  150. {
  151. ActivateClass activateClass = new ActivateClass();
  152. activateClass.SetUpICardEffect("Opponent's 1 Digimon attacks", CanUseCondition, card);
  153. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  154. cardEffects.Add(activateClass);
  155. string EffectDiscription()
  156. {
  157. return "[End of Opponent's Turn] Choose 1 of your opponent's Digimon. Your opponent attacks with the chosen Digimon.";
  158. }
  159. bool CanSelectPermanentCondition(Permanent permanent)
  160. {
  161. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  162. }
  163. bool CanUseCondition(Hashtable hashtable)
  164. {
  165. if (CardEffectCommons.IsExistOnBattleArea(card))
  166. {
  167. if (CardEffectCommons.IsOpponentTurn(card))
  168. {
  169. return true;
  170. }
  171. }
  172. return false;
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  179. {
  180. if (!GManager.instance.attackProcess.IsAttacking)
  181. {
  182. return true;
  183. }
  184. }
  185. }
  186. return false;
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  189. {
  190. Permanent selectedPermanent = null;
  191. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  192. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  193. selectPermanentEffect.SetUp(
  194. selectPlayer: card.Owner,
  195. canTargetCondition: CanSelectPermanentCondition,
  196. canTargetCondition_ByPreSelecetedList: null,
  197. canEndSelectCondition: null,
  198. maxCount: maxCount,
  199. canNoSelect: true,
  200. canEndNotMax: false,
  201. selectPermanentCoroutine: SelectPermanentCoroutine,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Custom,
  204. cardEffect: activateClass);
  205. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  206. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  207. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  208. {
  209. selectedPermanent = permanent;
  210. yield return null;
  211. }
  212. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(selectedPermanent, card))
  213. {
  214. if (selectedPermanent.CanAttack(activateClass))
  215. {
  216. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  217. selectAttackEffect.SetUp(
  218. attacker: selectedPermanent,
  219. canAttackPlayerCondition: () => true,
  220. defenderCondition: (permanent) => true,
  221. cardEffect: activateClass);
  222. selectAttackEffect.SetCanNotSelectNotAttack();
  223. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  224. }
  225. }
  226. }
  227. }
  228. return cardEffects;
  229. }
  230. }
  231. }