BT18_003.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_003 : 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.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("DP -2000 when yellow tamer in play", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("MinusDP_BT18-003");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking] [Once Per Turn] If you have a yellow Tamer, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool IsYellowTamer(Permanent permanent)
  28. {
  29. return permanent.IsTamer &&
  30. permanent.TopCard.CardColors.Contains(CardColor.Yellow);
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  41. {
  42. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsYellowTamer))
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: maxCount,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.",
  65. "The opponent is selecting 1 Digimon that will get DP -2000.");
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(
  70. CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000,
  71. effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  72. }
  73. }
  74. }
  75. return cardEffects;
  76. }
  77. }
  78. }