P_212.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Asuna Shiroki
  6. namespace DCGO.CardEffects.P
  7. {
  8. public class P_212 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Main Phase
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  17. }
  18. #endregion
  19. #region On Play
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Draw 1 and trash 1. if this trashed a [Three Musketeers]/[TS] card, delete 1 level 3 digimon", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] Draw 1 and trash 1 card in your hand. If this effect trashed a card with the [Three Musketeers] or [TS] trait, delete 1 of your opponent's level 3 Digimon.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.IsExistOnBattleArea(card)
  33. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  34. }
  35. bool CanActivateCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.IsExistOnBattleArea(card);
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  42. && permanent.TopCard.HasLevel && permanent.TopCard.IsLevel3;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. bool trashedTargetCard = false;
  47. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DrawAndDiscardCards(
  48. player: (card.Owner, card.Owner),
  49. drawAmount: 1,
  50. trashAmount: 1,
  51. card: card,
  52. activateClass: activateClass,
  53. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine
  54. ));
  55. IEnumerator AfterSelectPermanentCoroutine(List<CardSource> selectedCards)
  56. {
  57. if (selectedCards.Any() && selectedCards.Exists(x => x.HasThreeMusketeersTraits || x.HasTSTraits)) trashedTargetCard = true;
  58. yield return null;
  59. }
  60. if (trashedTargetCard && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  61. {
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Destroy,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. }
  79. }
  80. }
  81. #endregion
  82. #region Security
  83. if (timing == EffectTiming.SecuritySkill)
  84. {
  85. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  86. }
  87. #endregion
  88. return cardEffects;
  89. }
  90. }
  91. }