P_183.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Gaiomon
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_183 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Card Name
  14. if (timing == EffectTiming.None)
  15. {
  16. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  17. changeCardNamesClass.SetUpICardEffect("Also treated as having [Greymon]", hashtable => true, card);
  18. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  19. cardEffects.Add(changeCardNamesClass);
  20. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  21. {
  22. if (cardSource == card)
  23. {
  24. CardNames.Add("Greymon_P_183");
  25. }
  26. return CardNames;
  27. }
  28. }
  29. #endregion
  30. #region Blocker
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  34. isInheritedEffect: false,
  35. card: card,
  36. condition: null));
  37. }
  38. #endregion
  39. #region Reboot
  40. if (timing == EffectTiming.None)
  41. {
  42. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  43. }
  44. #endregion
  45. #endregion
  46. #region When Digivolving
  47. if (timing == EffectTiming.OnEnterFieldAnyone)
  48. {
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect("1 digimon gains attack on Start of your main phase", CanUseCondition, card);
  51. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. {
  55. return "[When Digivolving] Until your opponent's turn ends, 1 of your opponent's Digimon gains '[Start of Your Main Phase] This Digimon attacks.' Then, this Digimon may attack.";
  56. }
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  60. {
  61. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  71. }
  72. bool CanSelectPermanentCondition(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  79. {
  80. Permanent selectedPermanent = null;
  81. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  82. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  83. selectPermanentEffect.SetUp(
  84. selectPlayer: card.Owner,
  85. canTargetCondition: CanSelectPermanentCondition,
  86. canTargetCondition_ByPreSelecetedList: null,
  87. canEndSelectCondition: null,
  88. maxCount: maxCount,
  89. canNoSelect: false,
  90. canEndNotMax: false,
  91. selectPermanentCoroutine: SelectPermanentCoroutine,
  92. afterSelectPermanentCoroutine: null,
  93. mode: SelectPermanentEffect.Mode.Custom,
  94. cardEffect: activateClass);
  95. selectPermanentEffect.SetUpCustomMessage("Selcect 1 Digimon that will get effects.", "The opponent is selecting 1 Digimon that will get effects.");
  96. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  97. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  98. {
  99. selectedPermanent = permanent;
  100. yield return null;
  101. }
  102. if (selectedPermanent != null)
  103. {
  104. ActivateClass activateClass1 = new ActivateClass();
  105. activateClass1.SetUpICardEffect("[Start of Your Main Phase] This Digimon attacks.", CanUseCondition1, selectedPermanent.TopCard);
  106. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  107. activateClass1.SetEffectSourcePermanent(selectedPermanent);
  108. selectedPermanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  109. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  112. }
  113. string EffectDiscription1()
  114. {
  115. return "[Start of Your Main Phase] This Digimon attacks.";
  116. }
  117. bool CanUseCondition1(Hashtable hashtable1)
  118. {
  119. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  120. {
  121. if (selectedPermanent.TopCard.Owner.GetBattleAreaDigimons().Contains(selectedPermanent))
  122. {
  123. if (GManager.instance.turnStateMachine.gameContext.TurnPlayer == selectedPermanent.TopCard.Owner)
  124. {
  125. return true;
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. bool CanActivateCondition1(Hashtable hashtable1)
  132. {
  133. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  134. {
  135. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  136. {
  137. if (selectedPermanent.CanAttack(activateClass1))
  138. {
  139. return true;
  140. }
  141. }
  142. }
  143. return false;
  144. }
  145. ICardEffect GetCardEffect(EffectTiming _timing)
  146. {
  147. if (_timing == EffectTiming.OnStartMainPhase)
  148. {
  149. return activateClass1;
  150. }
  151. return null;
  152. }
  153. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  154. {
  155. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  156. {
  157. if (selectedPermanent.CanAttack(activateClass1))
  158. {
  159. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  160. selectAttackEffect.SetUp(
  161. attacker: selectedPermanent,
  162. canAttackPlayerCondition: () => true,
  163. defenderCondition: (permanent) => true,
  164. cardEffect: activateClass1);
  165. selectAttackEffect.SetCanNotSelectNotAttack();
  166. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  167. }
  168. }
  169. }
  170. }
  171. }
  172. var permanent = card.PermanentOfThisCard();
  173. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.CanAttack(activateClass))
  174. {
  175. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  176. selectAttackEffect.SetUp(
  177. attacker: permanent,
  178. canAttackPlayerCondition: () => true,
  179. defenderCondition: (permanent) => true,
  180. cardEffect: activateClass);
  181. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  182. }
  183. }
  184. }
  185. #endregion
  186. #region All Turns OPT
  187. if (timing == EffectTiming.OnAttackTargetChanged)
  188. {
  189. ActivateClass activateClass = new ActivateClass();
  190. activateClass.SetUpICardEffect("Trash top secuity card", CanUseCondition, card);
  191. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  192. activateClass.SetHashString("trashsec_P_183");
  193. cardEffects.Add(activateClass);
  194. string EffectDiscription()
  195. {
  196. return "[All Turns] [Once Per Turn] When attack targets change, trash your opponent's top security card.";
  197. }
  198. bool CanUseCondition(Hashtable hashtable)
  199. {
  200. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  201. {
  202. if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, permanent => true))
  203. {
  204. return true;
  205. }
  206. }
  207. return false;
  208. }
  209. bool CanActivateCondition(Hashtable hashtable)
  210. {
  211. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  212. }
  213. IEnumerator ActivateCoroutine(Hashtable hashtable)
  214. {
  215. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  216. player: card.Owner.Enemy,
  217. destroySecurityCount: 1,
  218. cardEffect: activateClass,
  219. fromTop: true).DestroySecurity());
  220. }
  221. }
  222. #endregion
  223. return cardEffects;
  224. }
  225. }
  226. }