BT3_014.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 BT3_014 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Change original DP to 1000", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Change the original DP of 1 of your opponent's level 4 or lower Digimon to 1000 for the turn.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.Level <= 4)
  28. {
  29. if (permanent.TopCard.HasLevel)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (isExistOnField(card))
  55. {
  56. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  59. {
  60. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to change original DP.", "The opponent is selecting 1 Digimon to change original DP.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. Permanent selectedPermanent = permanent;
  79. if (selectedPermanent != null)
  80. {
  81. ChangeBaseDPClass changeDPClass = new ChangeBaseDPClass();
  82. changeDPClass.SetUpICardEffect("Origin DP is 1000", CanUseCondition1, card);
  83. changeDPClass.SetUpChangeBaseDPClass(changeDPFunc: ChangeDP, permanentCondition: permanentCondition, isUpDownFunc: _isUpDown, isMinusDPFunc: () => false);
  84. changeDPClass.SetActivatedTime(DateTime.Now);
  85. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => changeDPClass);
  86. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  89. }
  90. bool CanUseCondition1(Hashtable hashtable)
  91. {
  92. if (selectedPermanent.TopCard != null)
  93. {
  94. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  95. {
  96. return true;
  97. }
  98. }
  99. return false;
  100. }
  101. int ChangeDP(Permanent permanent, int DP)
  102. {
  103. if (permanentCondition(permanent))
  104. {
  105. DP = 1000;
  106. }
  107. return DP;
  108. }
  109. bool permanentCondition(Permanent permanent)
  110. {
  111. if (permanent != null)
  112. {
  113. if (permanent.TopCard != null)
  114. {
  115. if (permanent == selectedPermanent)
  116. {
  117. return true;
  118. }
  119. }
  120. }
  121. return false;
  122. }
  123. bool _isUpDown()
  124. {
  125. return false;
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. }
  134. if (timing == EffectTiming.None)
  135. {
  136. ChangeCardColorClass changeCardColorClass = new ChangeCardColorClass();
  137. changeCardColorClass.SetUpICardEffect($"Also treated as yellow", CanUseCondition, card);
  138. changeCardColorClass.SetUpChangeCardColorClass(ChangeCardColors: ChangeCardColors);
  139. cardEffects.Add(changeCardColorClass);
  140. bool CanUseCondition(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.IsExistOnBattleArea(card))
  143. {
  144. if (CardEffectCommons.IsOwnerTurn(card))
  145. {
  146. return true;
  147. }
  148. }
  149. return false;
  150. }
  151. List<CardColor> ChangeCardColors(CardSource cardSource, List<CardColor> CardColors)
  152. {
  153. if (cardSource == card)
  154. {
  155. CardColors.Add(CardColor.Yellow);
  156. }
  157. return CardColors;
  158. }
  159. }
  160. return cardEffects;
  161. }
  162. }