BT10_101.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_101 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.None)
  16. {
  17. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  18. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  19. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  20. cardEffects.Add(ignoreColorConditionClass);
  21. bool PermanentCondition(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  24. {
  25. if (permanent.TopCard.CardNames.Contains("Pulsemon"))
  26. {
  27. return true;
  28. }
  29. if (permanent.IsDigimon && permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Pulsemon")) >= 1)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, PermanentCondition);
  39. }
  40. bool CardCondition(CardSource cardSource)
  41. {
  42. return cardSource == card;
  43. }
  44. }
  45. if (timing == EffectTiming.OptionSkill)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  49. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[Main] If you have 3 or more security cards, 1 of your opponent's Digimon gets -12000 DP for the turn. If you have 3 or fewer security cards, place 1 of your opponent's Digimon face down on top of their security stack.";
  54. }
  55. bool CanSelectPermanentCondition(Permanent permanent)
  56. {
  57. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (card.Owner.SecurityCards.Count >= 3)
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  68. {
  69. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: SelectPermanentCoroutine,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -12000.", "The opponent is selecting 1 Digimon that will get DP -12000.");
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  88. targetPermanent: permanent,
  89. changeValue: -12000,
  90. effectDuration: EffectDuration.UntilEachTurnEnd,
  91. activateClass: activateClass));
  92. }
  93. }
  94. }
  95. if (card.Owner.SecurityCards.Count <= 3)
  96. {
  97. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  98. {
  99. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  100. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  101. selectPermanentEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectPermanentCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: maxCount,
  107. canNoSelect: false,
  108. canEndNotMax: false,
  109. selectPermanentCoroutine: SelectPermanentCoroutine,
  110. afterSelectPermanentCoroutine: null,
  111. mode: SelectPermanentEffect.Mode.Custom,
  112. cardEffect: activateClass);
  113. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place to security.", "The opponent is selecting 1 Digimon to place to security.");
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  116. {
  117. Permanent selectedPermanent = permanent;
  118. if (selectedPermanent != null)
  119. {
  120. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(
  121. selectedPermanent,
  122. CardEffectCommons.CardEffectHashtable(activateClass),
  123. toTop: true).PutSecurity());
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. if (timing == EffectTiming.SecuritySkill)
  131. {
  132. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  133. card: card,
  134. cardEffects: ref cardEffects,
  135. effectName: $"DP -12000 or place opponent's Digimon to the top of security");
  136. }
  137. return cardEffects;
  138. }
  139. }
  140. }