P_066.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class P_066 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.SecuritySkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less or Draw 1, and add this card to hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsSecurityEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Security] At the end of the battle, delete 1 of your opponent's Digimon with 4000 DP or less. If no Digimon was deleted by this effect, <Draw 1>. (Draw 1 card from your deck.) Then, add this card to its owner's hand.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnExecutingArea(card))
  31. {
  32. return true;
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return null;
  39. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().BuffSE);
  40. ActivateClass activateClass1 = new ActivateClass();
  41. activateClass1.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less or Draw 1, and add this card to hand", CanUseCondition1, card);
  42. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  43. card.Owner.UntilEndBattleEffects.Add(GetCardEffect1);
  44. string EffectDiscription1()
  45. {
  46. return "Delete 1 of your opponent's Digimon with 4000 DP or less. If no Digimon was deleted by this effect, <Draw 1>. (Draw 1 card from your deck.) Then, add this card to its owner's hand.";
  47. }
  48. bool CanSelectPermanentCondition(Permanent permanent)
  49. {
  50. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  51. {
  52. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition1(Hashtable hashtable)
  60. {
  61. return true;
  62. }
  63. bool CanActivateCondition1(Hashtable hashtable)
  64. {
  65. return true;
  66. }
  67. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  68. {
  69. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: false,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: null,
  83. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  89. {
  90. foreach (Permanent permanent in permanents)
  91. {
  92. deleteTargetPermanents.Add(permanent);
  93. }
  94. yield return null;
  95. }
  96. }
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  98. IEnumerator FailureProcess()
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  101. }
  102. if (card.Owner.ExecutingCards.Contains(card))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.Owner.brainStormObject.CloseBrainstrorm(card));
  105. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { card }, false, activateClass));
  106. }
  107. }
  108. ICardEffect GetCardEffect1(EffectTiming _timing)
  109. {
  110. if (_timing == EffectTiming.OnEndBattle)
  111. {
  112. return activateClass1;
  113. }
  114. return null;
  115. }
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }