P_139.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.P
  6. {
  7. public class P_139 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Leomon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("DP -3000", canUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool canUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -3000, maxCount: maxCount));
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  75. targetPermanent: permanent,
  76. changeValue: -3000,
  77. effectDuration: EffectDuration.UntilEachTurnEnd,
  78. activateClass: activateClass));
  79. }
  80. }
  81. }
  82. }
  83. #endregion
  84. #region When Digivolving
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("DP -3000", canUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[When Digivolving] 1 of your opponent's Digimon gets -3000 DP for the turn.";
  94. }
  95. bool CanSelectPermanentCondition(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  98. }
  99. bool canUseCondition(Hashtable hashtable)
  100. {
  101. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  102. }
  103. bool CanActivateCondition(Hashtable hashtable)
  104. {
  105. if (CardEffectCommons.IsExistOnBattleArea(card))
  106. {
  107. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  117. {
  118. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: maxCount,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: SelectPermanentCoroutine,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Custom,
  131. cardEffect: activateClass);
  132. selectPermanentEffect.SetUpCustomMessage(customMessageArray: CardEffectCommons.customPermanentMessageArray_ChangeDP(changeValue: -3000, maxCount: maxCount));
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  135. {
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  137. targetPermanent: permanent,
  138. changeValue: -3000,
  139. effectDuration: EffectDuration.UntilEachTurnEnd,
  140. activateClass: activateClass));
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. #region All Turns
  147. bool LeomonCondition()
  148. {
  149. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  150. {
  151. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Leomon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. if (timing == EffectTiming.None)
  159. {
  160. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: LeomonCondition));
  161. }
  162. if (timing == EffectTiming.OnDestroyedAnyone)
  163. {
  164. cardEffects.Add(CardEffectFactory.FortitudeSelfEffect(isInheritedEffect: false, card: card, condition: LeomonCondition));
  165. }
  166. #endregion
  167. #region Inherit
  168. if (timing == EffectTiming.OnDestroyedAnyone)
  169. {
  170. ActivateClass activateClass = new ActivateClass();
  171. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  172. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  173. activateClass.SetIsInheritedEffect(true);
  174. cardEffects.Add(activateClass);
  175. string EffectDiscription()
  176. {
  177. return "[On Deletion] <Recovery +1 (Deck)>";
  178. }
  179. bool CanUseCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  182. }
  183. bool CanActivateCondition(Hashtable hashtable)
  184. {
  185. if (CardEffectCommons.IsExistOnTrash(card))
  186. {
  187. if (card.Owner.LibraryCards.Count >= 1)
  188. {
  189. if (card.Owner.CanAddSecurity(activateClass))
  190. {
  191. return true;
  192. }
  193. }
  194. }
  195. return false;
  196. }
  197. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  198. {
  199. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  200. }
  201. }
  202. #endregion
  203. return cardEffects;
  204. }
  205. }
  206. }