BT8_100.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT8_100 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  18. {
  19. if (permanent.TopCard.CardColors.Count >= 2 || permanent.DigivolutionCards.Some((cardSource) => cardSource.CardColors.Count >= 2))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. int minusDP()
  27. {
  28. int minusDP = 3000;
  29. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  30. {
  31. minusDP = 6000;
  32. }
  33. return minusDP;
  34. }
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  37. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[Main] 1 of your opponent's Digimon gets -3000 DP for the turn. If you have a Digimon in play with 2 or more colors, or with 2 or more colors in one of its digivolution cards, 1 of your opponent's Digimon gets -6000 DP instead.";
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: SelectPermanentCoroutine,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.Custom,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage(
  70. $"Select 1 Digimon that will get DP -{minusDP()}.",
  71. $"The opponent is selecting 1 Digimon that will get DP -{minusDP()}.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. int _minusDP = minusDP();
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  77. targetPermanent: permanent,
  78. changeValue: -_minusDP,
  79. effectDuration: EffectDuration.UntilEachTurnEnd,
  80. activateClass: activateClass));
  81. }
  82. }
  83. }
  84. }
  85. if (timing == EffectTiming.SecuritySkill)
  86. {
  87. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Reduce DP");
  88. }
  89. return cardEffects;
  90. }
  91. }