EX2_066.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_066 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  14. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  15. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  16. cardEffects.Add(ignoreColorConditionClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  20. {
  21. return true;
  22. }
  23. return false;
  24. }
  25. bool CardCondition(CardSource cardSource)
  26. {
  27. if (cardSource == card)
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. }
  34. if (timing == EffectTiming.OptionSkill)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  38. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[Main] 1 of your Digimon gains <Security Attack +1> for the turn. (This Digimon checks 1 additional security card.)";
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: SelectPermanentCoroutine,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.Custom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack +1.", "The opponent is selecting 1 Digimon that will get Security Attack +1.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  75. }
  76. }
  77. }
  78. }
  79. if (timing == EffectTiming.SecuritySkill)
  80. {
  81. ActivateClass activateClass = new ActivateClass();
  82. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck and add this card to hand", CanUseCondition, card);
  83. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  84. activateClass.SetIsSecurityEffect(true);
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[Security] Reveal the top 3 cards of your deck. Add 1 Tamer card among them to your hand. Place the remaining cards at the bottom of your deck in any order. Then, add this card to your hand.";
  89. }
  90. bool CanSelectCardCondition(CardSource cardSource)
  91. {
  92. return cardSource.IsTamer;
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  101. revealCount: 3,
  102. simplifiedSelectCardConditions:
  103. new SimplifiedSelectCardConditionClass[]
  104. {
  105. new SimplifiedSelectCardConditionClass(
  106. canTargetCondition:CanSelectCardCondition,
  107. message: "Select 1 Tamer card.",
  108. mode: SelectCardEffect.Mode.AddHand,
  109. maxCount: 1,
  110. selectCardCoroutine: null),
  111. },
  112. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  113. activateClass: activateClass
  114. ));
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  116. }
  117. }
  118. return cardEffects;
  119. }
  120. }
  121. }