BT10_034.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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_034 : 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. bool PermanentCondition(Permanent targetPermanent)
  18. {
  19. return (targetPermanent.TopCard.CardTraits.Contains("Xros Heart") || targetPermanent.TopCard.CardTraits.Contains("XrosHeart")) && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("DP -3000", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] If you have another Digimon or Tamer with [Xros Heart] in its traits in play, 1 of your opponent's Digimon gets -3000 DP until the end of your opponent's turn.";
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  46. {
  47. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => (permanent.IsDigimon || permanent.IsTamer) && (permanent.TopCard.CardTraits.Contains("Xros Heart") || permanent.TopCard.CardTraits.Contains("XrosHeart")) && permanent != card.PermanentOfThisCard()))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: maxCount,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -3000.", "The opponent is selecting 1 Digimon that will get DP -3000.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  76. }
  77. }
  78. }
  79. if (timing == EffectTiming.OnDestroyedAnyone)
  80. {
  81. cardEffects.Add(CardEffectFactory.SaveEffect(card: card));
  82. }
  83. if (timing == EffectTiming.None)
  84. {
  85. bool CardCondition(CardSource cardSource)
  86. {
  87. return cardSource.Owner == card.Owner.Enemy;
  88. }
  89. bool Condition()
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. if (CardEffectCommons.IsOwnerTurn(card))
  94. {
  95. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Shoutmon"))
  96. {
  97. return true;
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  104. cardCondition: CardCondition,
  105. changeValue: -2000,
  106. isInheritedEffect: true,
  107. card: card,
  108. condition: Condition,
  109. effectName: "Opponent's Security Digimon gains DP -2000"));
  110. }
  111. return cardEffects;
  112. }
  113. }
  114. }