BT2_099.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 BT2_099 : 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.None)
  14. {
  15. int count()
  16. {
  17. return card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardColors.Contains(CardColor.Yellow) && permanent.IsTamer);
  18. }
  19. ChangeCostClass changeCostClass = new ChangeCostClass();
  20. changeCostClass.SetUpICardEffect($"Play Cost -", CanUseCondition, card);
  21. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => false);
  22. cardEffects.Add(changeCostClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (card.Owner.HandCards.Contains(card))
  26. {
  27. if (count() >= 1)
  28. {
  29. changeCostClass.SetEffectName($"Play Cost -{count()}");
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  36. {
  37. if (CardSourceCondition(cardSource))
  38. {
  39. if (RootCondition(root))
  40. {
  41. if (PermanentsCondition(targetPermanents))
  42. {
  43. Cost -= count();
  44. }
  45. }
  46. }
  47. return Cost;
  48. }
  49. bool PermanentsCondition(List<Permanent> targetPermanents)
  50. {
  51. return true;
  52. }
  53. bool CardSourceCondition(CardSource cardSource)
  54. {
  55. return cardSource == card;
  56. }
  57. bool RootCondition(SelectCardEffect.Root root)
  58. {
  59. return true;
  60. }
  61. bool isUpDown()
  62. {
  63. return true;
  64. }
  65. }
  66. if (timing == EffectTiming.OptionSkill)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  70. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[Main] 1 of your opponent's Digimon gets -12000 DP for the turn.";
  75. }
  76. bool CanSelectPermanentCondition(Permanent permanent)
  77. {
  78. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  83. }
  84. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  85. {
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  87. {
  88. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectPermanentCondition,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: maxCount,
  96. canNoSelect: false,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -12000.", "The opponent is selecting 1 Digimon that will get DP -12000.");
  103. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  104. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -12000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  107. }
  108. }
  109. }
  110. }
  111. return cardEffects;
  112. }
  113. }