BT16_033.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT16
  4. {
  5. public class BT16_033 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Armor Purge
  11. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  12. {
  13. cardEffects.Add(CardEffectFactory.ArmorPurgeEffect(card: card));
  14. }
  15. #endregion
  16. #region Digivolution Condition
  17. if (timing == EffectTiming.None)
  18. {
  19. static bool PermanentCondition(Permanent targetPermanent)
  20. {
  21. if (targetPermanent.TopCard.CardNames.Contains("Hawkmon"))
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region Your Turn
  31. if (timing == EffectTiming.OnSecurityCheck)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Gain memory or recover 1.", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[Your Turn] When this Digimon checks an opponent's security, if you have 3 or more security cards, gain 1 memory. If you have 2 or fewer security cards, [Recovery +1].";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  46. {
  47. if (CardEffectCommons.IsOwnerTurn(card))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (card.Owner.SecurityCards.Count <= 2)
  60. {
  61. if (card.Owner.LibraryCards.Count >= 1)
  62. {
  63. if (card.Owner.CanAddSecurity(activateClass))
  64. {
  65. return true;
  66. }
  67. }
  68. }
  69. if (card.Owner.SecurityCards.Count >= 3)
  70. {
  71. if (card.Owner.CanAddMemory(activateClass))
  72. {
  73. return true;
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable hashtable)
  80. {
  81. if (card.Owner.SecurityCards.Count <= 2)
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  84. }
  85. if (card.Owner.SecurityCards.Count >= 3)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  88. }
  89. }
  90. }
  91. #endregion
  92. return cardEffects;
  93. }
  94. }
  95. }