BT17_033.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_033 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Attacking
  12. if (timing == EffectTiming.OnAllyAttack)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Suspend one tamer to gain +3000 DP", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Attacking] By suspending 1 of your yellow Tamers, this Digimon gets +3000 DP for the turn.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  25. {
  26. if (permanent.IsTamer && permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. Permanent selectedPermanent = null;
  51. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  54. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  55. selectPermanentEffect.SetUp(
  56. selectPlayer: card.Owner,
  57. canTargetCondition: CanSelectPermanentCondition,
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. maxCount: maxCount,
  61. canNoSelect: true,
  62. canEndNotMax: false,
  63. selectPermanentCoroutine: SelectPermanentCoroutine,
  64. afterSelectPermanentCoroutine: null,
  65. mode: SelectPermanentEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectPermanentEffect.SetUpCustomMessage("Select 1 your Yellow Tamers to suspend.", "The opponent is selecting 1 Yellow Tamer to suspend.");
  68. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  69. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  70. {
  71. selectedPermanent = permanent;
  72. yield return null;
  73. }
  74. }
  75. if (selectedPermanent != null)
  76. {
  77. if (selectedPermanent.TopCard != null)
  78. {
  79. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  80. {
  81. if (!selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  82. {
  83. Permanent suspendTargetPermanent = selectedPermanent;
  84. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { suspendTargetPermanent }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  85. if (suspendTargetPermanent.TopCard != null)
  86. {
  87. if (suspendTargetPermanent.IsSuspended)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  90. }
  91. }
  92. }
  93. }
  94. }
  95. }
  96. }
  97. }
  98. #endregion
  99. #region Inherit
  100. if (timing == EffectTiming.None)
  101. {
  102. bool CardCondition(CardSource cardSource)
  103. {
  104. return cardSource.Owner == card.Owner.Enemy;
  105. }
  106. bool Condition()
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.IsOwnerTurn(card))
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  118. cardCondition: CardCondition,
  119. changeValue: -3000,
  120. isInheritedEffect: true,
  121. card: card,
  122. condition: Condition,
  123. effectName: "Opponent's Security Digimon gains DP -3000"));
  124. }
  125. #endregion
  126. return cardEffects;
  127. }
  128. }
  129. }