BT2_078.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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 BT2_078 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Delete your another Digimon to unsuspend this Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. activateClass.SetHashString("Unsuspend_BT2_078");
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Attacking][Once Per Turn] You may delete 1 of your other Digimon to unsuspend this Digimon.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent != card.PermanentOfThisCard())
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = Math.Min(1, card.Owner.GetBattleAreaDigimons().Count(CanSelectPermanentCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: true,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  72. {
  73. Permanent thisCardPermanent = card.PermanentOfThisCard();
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent },
  75. activateClass: activateClass,
  76. successProcess: permanents => SuccessProcess(),
  77. failureProcess: null));
  78. IEnumerator SuccessProcess()
  79. {
  80. if (thisCardPermanent.TopCard != null)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { thisCardPermanent }, activateClass).Unsuspend());
  83. }
  84. }
  85. }
  86. }
  87. }
  88. }
  89. return cardEffects;
  90. }
  91. }