EX12_069.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Virus Busters
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_069 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Use Req
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  15. bool CardCondition(CardSource cardSource)
  16. {
  17. return cardSource.EqualsTraits("VB");
  18. }
  19. }
  20. #endregion
  21. #region Your Turn Security
  22. if (timing == EffectTiming.OnAllyAttack)
  23. {
  24. int AttackingLevel = 0;
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("May play same level as attacker [VB] for 3 less", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  28. cardEffects.Add(activateClass);
  29. string EffectDescription()
  30. => "[Security] [Your Turn] [Once Per Turn] When one of your level 4 or higher [VB] trait Digimon attacks, you may play 1 [VB] trait Digimon card of the same level from your hand with the cost reduced by 3.";
  31. bool CanUseCondition(Hashtable hashtable)
  32. => CardEffectCommons.IsExistInSecurity(card, false)
  33. && CardEffectCommons.IsOwnerTurn(card)
  34. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. Permanent attackingPermanent = CardEffectCommons.GetAttackerFromHashtable(hashtable);
  38. AttackingLevel = attackingPermanent.Level;
  39. return CardEffectCommons.IsExistInSecurity(card, false)
  40. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  41. }
  42. bool PermanentCondition(Permanent permanent)
  43. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  44. && permanent.TopCard.HasLevel
  45. && permanent.TopCard.Level >= 4
  46. && permanent.TopCard.EqualsTraits("VB");
  47. bool CanSelectCardCondition(CardSource cardSource)
  48. => cardSource.EqualsTraits("VB")
  49. && cardSource.HasLevel
  50. && cardSource.Level == AttackingLevel
  51. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, true, activateClass, fixedCost: cardSource.GetCostItself - 3);
  52. IEnumerator ActivateCoroutine(Hashtable hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  55. canTargetCondition: CanSelectCardCondition,
  56. SelectCardEffect.Root.Hand,
  57. activateClass,
  58. payCost: true,
  59. reduceCostTuple: (3, null)
  60. ));
  61. }
  62. }
  63. #endregion
  64. #region Main Effect
  65. if (timing == EffectTiming.OptionSkill)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("Replace your bottom sec with this face-up card", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  70. cardEffects.Add(activateClass);
  71. string EffectDescription()
  72. {
  73. return "[Main] Add your bottom security card to the hand and place this card face up as the bottom security card.";
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable hashtable)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(CardEffectFactory.ReplaceBottomSecurityWithFaceUpOptionEffect(card, activateClass));
  82. }
  83. }
  84. #endregion
  85. #region Security Effect
  86. if (timing == EffectTiming.SecuritySkill)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Play 1 lvl 5 or lower [VB] Digimon card from hand", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  91. activateClass.SetIsSecurityEffect(true);
  92. cardEffects.Add(activateClass);
  93. string EffectDescription()
  94. => "[Security] You may play 1 level 5 or lower [VB] trait Digimon card from your hand without paying the cost.";
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  98. }
  99. bool CanPlayCondition(CardSource cardSource)
  100. {
  101. return cardSource.IsDigimon
  102. && cardSource.HasLevel
  103. && cardSource.Level <= 5
  104. && cardSource.EqualsTraits("VB")
  105. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable hashtable)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  110. canTargetCondition: CanPlayCondition,
  111. SelectCardEffect.Root.Hand,
  112. activateClass,
  113. payCost: false
  114. ));
  115. }
  116. }
  117. #endregion
  118. return cardEffects;
  119. }
  120. }
  121. }