BT10_040.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_040 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[When Digivolving] If you have 2 or fewer security cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  24. }
  25. bool CanUseCondition(Hashtable hashtable)
  26. {
  27. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (card.Owner.LibraryCards.Count >= 1)
  34. {
  35. if (card.Owner.CanAddSecurity(activateClass))
  36. {
  37. if (card.Owner.SecurityCards.Count <= 2)
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  51. }
  52. }
  53. }
  54. if (timing == EffectTiming.OnAllyAttack)
  55. {
  56. ActivateClass activateClass = new ActivateClass();
  57. activateClass.SetUpICardEffect("Opponent's 1 Digimon gets DP -5000 or get Memory +2", CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  59. activateClass.SetHashString("DP-5000Memory+1_BT10_040");
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[When Attacking][Once Per Turn] If you have 3 or more security cards, 1 of your opponent's Digimon gets -5000 DP for the turn. If you have 3 or fewer security cards, gain 2 memory.";
  64. }
  65. bool CanSelectPermanentCondition(Permanent permanent)
  66. {
  67. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.IsExistOnBattleArea(card))
  76. {
  77. return true;
  78. }
  79. return false;
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  82. {
  83. if (card.Owner.SecurityCards.Count >= 3)
  84. {
  85. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  86. {
  87. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  88. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectPermanentCondition,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: maxCount,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: SelectPermanentCoroutine,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Custom,
  100. cardEffect: activateClass);
  101. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -5000.", "The opponent is selecting 1 Digimon that will get DP -5000.");
  102. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  103. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  104. {
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -5000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  106. }
  107. }
  108. }
  109. if (card.Owner.SecurityCards.Count <= 3)
  110. {
  111. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  112. }
  113. }
  114. }
  115. return cardEffects;
  116. }
  117. }
  118. }