BT17_010.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.BT17
  5. {
  6. public class BT17_010 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region When Digivolving
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Delete 1 Digimon with 4000 DP or less, or get +3000 DP for the turn", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  17. EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return "[When Digivolving] Delete 1 of your opponent's Digimon with 4000 DP or less. If this effect didn't delete, this Digimon gets +3000 DP for the turn.";
  22. }
  23. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(4000, activateClass))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  45. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  46. {
  47. int maxCount = Math.Min(1,
  48. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  49. SelectPermanentEffect selectPermanentEffect =
  50. GManager.instance.GetComponent<SelectPermanentEffect>();
  51. selectPermanentEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectOpponentPermanentCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: maxCount,
  57. canNoSelect: false,
  58. canEndNotMax: false,
  59. selectPermanentCoroutine: null,
  60. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  61. mode: SelectPermanentEffect.Mode.Custom,
  62. cardEffect: activateClass);
  63. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  64. "The opponent is selecting 1 Digimon to delete.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  67. {
  68. deleteTargetPermanents = permanents.Clone();
  69. yield return null;
  70. }
  71. }
  72. yield return ContinuousController.instance.StartCoroutine(
  73. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  74. targetPermanents: deleteTargetPermanents, activateClass: activateClass,
  75. successProcess: null, failureProcess: FailureProcess));
  76. IEnumerator FailureProcess()
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  79. targetPermanent: card.PermanentOfThisCard(),
  80. changeValue: 3000,
  81. effectDuration: EffectDuration.UntilEachTurnEnd,
  82. activateClass: activateClass));
  83. }
  84. }
  85. }
  86. #endregion
  87. #region All Turns - ESS
  88. if (timing == EffectTiming.None)
  89. {
  90. ChangeDPDeleteEffectMaxDPClass changeDPDeleteEffectMaxDPClass = new ChangeDPDeleteEffectMaxDPClass();
  91. changeDPDeleteEffectMaxDPClass.SetUpICardEffect(
  92. "Maximum DP of DP-based deletion effects gets +2000 DP if 0 or less memory",
  93. CanUseCondition, card);
  94. changeDPDeleteEffectMaxDPClass.SetUpChangeDPDeleteEffectMaxDPClass(changeMaxDP: ChangeMaxDP);
  95. changeDPDeleteEffectMaxDPClass.SetIsInheritedEffect(true);
  96. cardEffects.Add(changeDPDeleteEffectMaxDPClass);
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. if (isExistOnField(card))
  100. {
  101. if (card.Owner.MemoryForPlayer <= 0)
  102. {
  103. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. int ChangeMaxDP(int maxDP, ICardEffect cardEffect)
  112. {
  113. if (cardEffect != null)
  114. {
  115. if (cardEffect.EffectSourceCard != null)
  116. {
  117. if (cardEffect.EffectSourceCard.Owner == card.Owner)
  118. {
  119. if (cardEffect.EffectSourceCard.PermanentOfThisCard() == card.PermanentOfThisCard())
  120. maxDP += 2000;
  121. }
  122. }
  123. }
  124. return maxDP;
  125. }
  126. }
  127. #endregion
  128. return cardEffects;
  129. }
  130. }
  131. }