BT12_043.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_043 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("RizeGreymon") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 5;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Opponent's 1 Digimon and Security Digimon reduces DP", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[When Digivolving] For each yellow or red Tamer you have in play, 1 of your opponent's Digimon and all of your opponent's Security Digimon get -3000 DP for the turn.";
  29. }
  30. bool CanSelectPermanentCondition(Permanent permanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. int count = card.Owner.GetBattleAreaPermanents().Count((permanent) => (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.CardColors.Contains(CardColor.Red)) && permanent.IsTamer);
  43. if (count >= 1)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. int count = card.Owner.GetBattleAreaPermanents().Count((permanent) =>
  53. (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.CardColors.Contains(CardColor.Red))
  54. && permanent.IsTamer);
  55. if (count >= 1)
  56. {
  57. int minusDP = 3000 * count;
  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(
  75. $"Select 1 Digimon that will get DP -{minusDP}.",
  76. $"The opponent is selecting 1 Digimon that will get DP -{minusDP}.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -minusDP, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  81. }
  82. }
  83. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeSecurityDigimonCardDPPlayerEffect(
  84. cardCondition: cardSource => cardSource.Owner == card.Owner.Enemy,
  85. changeValue: -minusDP,
  86. effectDuration: EffectDuration.UntilEachTurnEnd,
  87. activateClass: activateClass));
  88. }
  89. }
  90. }
  91. if (timing == EffectTiming.None)
  92. {
  93. bool Condition()
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. if (CardEffectCommons.IsOwnerTurn(card))
  98. {
  99. return true;
  100. }
  101. }
  102. return false;
  103. }
  104. bool PermanentCondition(Permanent permanent)
  105. {
  106. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  107. {
  108. if (permanent.TopCard.CardNames.Contains("Marcus Damon"))
  109. {
  110. return true;
  111. }
  112. if (permanent.TopCard.CardNames.Contains("MarcusDamon"))
  113. {
  114. return true;
  115. }
  116. }
  117. return false;
  118. }
  119. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  120. permanentCondition: PermanentCondition,
  121. changeValue: 3000,
  122. isInheritedEffect: false,
  123. card: card,
  124. condition: Condition,
  125. effectName: () => "Your [Marcus Damon] gains DP +3000"));
  126. }
  127. if (timing == EffectTiming.None)
  128. {
  129. bool Condition()
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. if (CardEffectCommons.IsOwnerTurn(card))
  134. {
  135. return true;
  136. }
  137. }
  138. return false;
  139. }
  140. bool PermanentCondition(Permanent permanent)
  141. {
  142. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  143. {
  144. if (permanent.TopCard.CardNames.Contains("Marcus Damon"))
  145. {
  146. return true;
  147. }
  148. if (permanent.TopCard.CardNames.Contains("MarcusDamon"))
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. cardEffects.Add(CardEffectFactory.ChangeSAttackStaticEffect(
  156. permanentCondition: PermanentCondition,
  157. changeValue: 1,
  158. isInheritedEffect: false,
  159. card: card,
  160. condition: Condition));
  161. }
  162. return cardEffects;
  163. }
  164. }
  165. }