BT18_087.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_087 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Security Effect
  12. if (timing == EffectTiming.SecuritySkill)
  13. {
  14. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  15. }
  16. #endregion
  17. #region Start of Your Turn
  18. if (timing == EffectTiming.OnStartTurn)
  19. {
  20. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  21. }
  22. #endregion
  23. #region All Turns
  24. if (timing == EffectTiming.OnLoseSecurity)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Delete 1 of your opponent's Digimon with 4000 DP or less", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[All Turns] When an opponent's security card is removed, by suspending this Tamer, delete 1 of your opponent's Digimon with 4000 DP or less.";
  33. }
  34. bool CanSelectPermanentCondition(Permanent permanent)
  35. {
  36. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  37. {
  38. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  39. {
  40. return true;
  41. }
  42. }
  43. return false;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  73. selectPermanentEffect.SetUp(
  74. selectPlayer: card.Owner,
  75. canTargetCondition: CanSelectPermanentCondition,
  76. canTargetCondition_ByPreSelecetedList: null,
  77. canEndSelectCondition: null,
  78. maxCount: 1,
  79. canNoSelect: false,
  80. canEndNotMax: false,
  81. selectPermanentCoroutine: null,
  82. afterSelectPermanentCoroutine: null,
  83. mode: SelectPermanentEffect.Mode.Destroy,
  84. cardEffect: activateClass);
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. }
  87. }
  88. }
  89. #endregion
  90. return cardEffects;
  91. }
  92. }
  93. }