BT22_083.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Yuuko Kamishiro
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_083 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Security
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  16. }
  17. #endregion
  18. #region Start of Main Phase
  19. if (timing == EffectTiming.OnStartMainPhase)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (CardEffectCommons.IsOwnerTurn(card))
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  45. {
  46. if (card.Owner.CanAddMemory(activateClass))
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  57. }
  58. }
  59. #endregion
  60. #region All Turns
  61. if (timing == EffectTiming.OnAttackTargetChanged)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Suspend tamer, give 1 digimon with [Greymon] in name or [CS] trait effect immunity & 3K DP", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  66. cardEffects.Add(activateClass);
  67. string EffectDiscription()
  68. {
  69. return "[All Turns] When attack targets change, by suspending this Tamer, for the turn, your opponent's Digimon's effects don't affect 1 of your Digimon with [Greymon] in its name or the [CS] trait and it gets +3000 DP.";
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.IsExistOnField(card) &&
  74. CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true);
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnField(card)
  79. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  80. }
  81. bool CanSelectPermanentCondition(Permanent permanent)
  82. {
  83. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  84. && (permanent.TopCard.ContainsCardName("Greymon") || permanent.TopCard.HasCSTraits);
  85. }
  86. IEnumerator ActivateCoroutine(Hashtable hashtable)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent> { card.PermanentOfThisCard() }, hashtable).Tap());
  89. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  90. {
  91. Permanent selectedPermanent = null;
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: false,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. selectedPermanent = permanent;
  109. yield return null;
  110. }
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain effect immunity & 3K DP.", "The opponent is selecting 1 Digimon gain effect immunity & 3K DP.");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. if (selectedPermanent != null)
  114. {
  115. #region Give Digimon Effect Immunity
  116. bool CanUseCondition1(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  119. }
  120. bool CardCondition(CardSource cardSource)
  121. {
  122. if (cardSource == selectedPermanent.TopCard)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleAreaDigimon(selectedPermanent.TopCard))
  125. {
  126. if (cardSource == selectedPermanent.TopCard)
  127. {
  128. return true;
  129. }
  130. }
  131. }
  132. return false;
  133. }
  134. bool SkillCondition(ICardEffect cardEffect)
  135. {
  136. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  137. {
  138. if (cardEffect.IsDigimonEffect)
  139. {
  140. return true;
  141. }
  142. if (cardEffect.IsDigimonEffect && cardEffect.IsSecurityEffect)
  143. {
  144. return true;
  145. }
  146. }
  147. return false;
  148. }
  149. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  150. canNotAffectedClass.SetUpICardEffect("Not affected by opponent's Digimon's effects", CanUseCondition1, card);
  151. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  152. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => canNotAffectedClass);
  153. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  154. #endregion
  155. #region Give Digimon +3000 DP
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP
  157. (
  158. selectedPermanent,
  159. +3000,
  160. EffectDuration.UntilEachTurnEnd,
  161. activateClass
  162. ));
  163. #endregion
  164. }
  165. }
  166. }
  167. }
  168. #endregion
  169. #region ESS
  170. if (timing == EffectTiming.OnAttackTargetChanged)
  171. {
  172. ActivateClass activateClass = new ActivateClass();
  173. activateClass.SetUpICardEffect("give 1 digimon 3K DP", CanUseCondition, card);
  174. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  175. activateClass.SetIsInheritedEffect(true);
  176. activateClass.SetHashString("BT22_083_Give3KDP");
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "[All Turns] [Once Per Turn] When attack targets change, if this Digimon is [Eater Eve], 1 of your Digimon gets +3000 DP for the turn";
  181. }
  182. bool CanUseCondition(Hashtable hashtable)
  183. {
  184. return CardEffectCommons.IsExistOnBattleArea(card)
  185. && CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true);
  186. }
  187. bool CanActivateCondition(Hashtable hashtable)
  188. {
  189. return CardEffectCommons.IsExistOnBattleArea(card)
  190. && card.PermanentOfThisCard().TopCard.EqualsCardName("Eater Eve");
  191. }
  192. bool CanSelectPermanentCondition(Permanent permanent)
  193. {
  194. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  195. }
  196. IEnumerator ActivateCoroutine(Hashtable hashtable)
  197. {
  198. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  199. {
  200. Permanent selectedPermanent = null;
  201. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  202. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  203. selectPermanentEffect.SetUp(
  204. selectPlayer: card.Owner,
  205. canTargetCondition: CanSelectPermanentCondition,
  206. canTargetCondition_ByPreSelecetedList: null,
  207. canEndSelectCondition: null,
  208. maxCount: maxCount,
  209. canNoSelect: false,
  210. canEndNotMax: false,
  211. selectPermanentCoroutine: SelectPermanentCoroutine,
  212. afterSelectPermanentCoroutine: null,
  213. mode: SelectPermanentEffect.Mode.Custom,
  214. cardEffect: activateClass);
  215. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  216. {
  217. selectedPermanent = permanent;
  218. yield return null;
  219. }
  220. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain 3K DP.", "The opponent is selecting 1 Digimon gain 3K DP.");
  221. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  222. if (selectedPermanent != null)
  223. {
  224. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP
  225. (
  226. selectedPermanent,
  227. +3000,
  228. EffectDuration.UntilEachTurnEnd,
  229. activateClass
  230. ));
  231. }
  232. }
  233. }
  234. }
  235. #endregion
  236. return cardEffects;
  237. }
  238. }
  239. }