P_186.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Gallantmon
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_186 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Static Effects
  14. #region Alternative Digivolution Condition
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. if (targetPermanent.TopCard.IsLevel5)
  20. {
  21. if (targetPermanent.TopCard.ContainsCardName("WarGrowlmon"))
  22. {
  23. return true;
  24. }
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  29. permanentCondition: PermanentCondition,
  30. digivolutionCost: 3,
  31. ignoreDigivolutionRequirement: false,
  32. card: card,
  33. condition: null)
  34. );
  35. }
  36. #endregion
  37. #region Blocker
  38. if (timing == EffectTiming.None)
  39. {
  40. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  41. isInheritedEffect: false,
  42. card: card,
  43. condition: null));
  44. }
  45. #endregion
  46. #region Rush
  47. if (timing == EffectTiming.None)
  48. {
  49. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  50. }
  51. #endregion
  52. #region Reduce Play Cost
  53. if (timing == EffectTiming.None)
  54. {
  55. bool Condition()
  56. {
  57. return CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  58. }
  59. bool PermanentCondition(Permanent Permanent)
  60. {
  61. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(Permanent)
  62. && Permanent.IsDigimon
  63. && Permanent.HasDP
  64. && Permanent.DP >= 13000;
  65. }
  66. int changeCost()
  67. {
  68. return 2 * ((card.Owner.TrashCards.Count + card.Owner.Enemy.TrashCards.Count) / 5);
  69. }
  70. cardEffects.Add(CardEffectFactory.MandatorySelfPlayCostReduction<Func<int>>(changeCost, card, Condition));
  71. }
  72. #endregion
  73. #endregion
  74. #region Shared OP/WD
  75. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  76. {
  77. bool PermanentCondition(Permanent permanent)
  78. {
  79. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent))
  80. {
  81. if (permanent.DP >= 13000)
  82. {
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. Permanent selectedPermanent = null;
  89. bool permanentDeleted = false;
  90. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: PermanentCondition,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: maxCount,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: SelectPermanentCoroutine,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Custom,
  103. cardEffect: activateClass);
  104. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete", "The opponent is selecting 1 Digimon to delete.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. selectedPermanent = permanent;
  109. yield return null;
  110. }
  111. if (selectedPermanent != null)
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { selectedPermanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  114. IEnumerator SuccessProcess()
  115. {
  116. permanentDeleted = true;
  117. yield return null;
  118. }
  119. }
  120. if (!permanentDeleted)
  121. {
  122. if (card.Owner.CanAddSecurity(activateClass))
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  125. }
  126. }
  127. }
  128. #endregion
  129. #region On Play
  130. if (timing == EffectTiming.OnEnterFieldAnyone)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("Delete a digimon, if you didn't <Recovery +1 (Deck)>", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  135. cardEffects.Add(activateClass);
  136. string EffectDiscription()
  137. {
  138. return "[On Play] Delete 1 Digimon with 13000 DP or more. If this effect didn't delete, <Recovery +1 (Deck)> (Place the top card of your deck on top of your security stack).";
  139. }
  140. bool CanUseCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  143. {
  144. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  145. {
  146. return true;
  147. }
  148. }
  149. return false;
  150. }
  151. bool CanActivateCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  154. }
  155. }
  156. #endregion
  157. #region When Digivolving
  158. if (timing == EffectTiming.OnEnterFieldAnyone)
  159. {
  160. ActivateClass activateClass = new ActivateClass();
  161. activateClass.SetUpICardEffect("Delete a digimon, if you didn't <Recovery +1 (Deck)>", CanUseCondition, card);
  162. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  163. cardEffects.Add(activateClass);
  164. string EffectDiscription()
  165. {
  166. return "[When Digivolving] Delete 1 Digimon with 13000 DP or more. If this effect didn't delete, <Recovery +1 (Deck)> (Place the top card of your deck on top of your security stack).";
  167. }
  168. bool CanUseCondition(Hashtable hashtable)
  169. {
  170. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  171. {
  172. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  173. {
  174. return true;
  175. }
  176. }
  177. return false;
  178. }
  179. bool CanActivateCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  182. }
  183. }
  184. #endregion
  185. return cardEffects;
  186. }
  187. }
  188. }