BT19_015.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_015 : 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 8000 DP or less, or get +3000 DP and <Piercing> until the end of your opponent's turn", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  17. cardEffects.Add(activateClass);
  18. string EffectDescription()
  19. {
  20. return "[When Digivolving] Delete 1 of your opponent's Digimon with 8000 DP or less. If this effect didn't delete, this Digimon gains <Piercing> and gets +3000 DP until the end of your opponent's turn.";
  21. }
  22. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  23. {
  24. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  25. {
  26. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(8000, activateClass))
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  36. {
  37. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  51. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  52. {
  53. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  54. SelectPermanentEffect selectPermanentEffect =
  55. GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectOpponentPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: maxCount,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: null,
  65. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  71. {
  72. deleteTargetPermanents = permanents.Clone();
  73. yield return null;
  74. }
  75. }
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  77. IEnumerator FailureProcess()
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  80. targetPermanent: card.PermanentOfThisCard(),
  81. changeValue: 3000,
  82. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  83. activateClass: activateClass));
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  85. targetPermanent: card.PermanentOfThisCard(),
  86. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  87. activateClass: activateClass));
  88. }
  89. }
  90. }
  91. #endregion
  92. #region Your Turn
  93. if (timing == EffectTiming.OnDestroyedAnyone)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Gain 2 memory", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  98. activateClass.SetHashString("GainMemory_BT19_015");
  99. cardEffects.Add(activateClass);
  100. string EffectDiscription()
  101. {
  102. return "[Your Turn][Once Per Turn] When an opponent's Digimon is deleted, gain 2 memory.";
  103. }
  104. bool PermanentCondition(Permanent permanent)
  105. {
  106. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  107. }
  108. bool CanUseCondition(Hashtable hashtable)
  109. {
  110. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  111. {
  112. if (CardEffectCommons.IsOwnerTurn(card))
  113. {
  114. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  115. {
  116. return true;
  117. }
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanActivateCondition(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  125. {
  126. return true;
  127. }
  128. return false;
  129. }
  130. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  131. {
  132. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(2, activateClass));
  133. }
  134. }
  135. #endregion
  136. return cardEffects;
  137. }
  138. }
  139. }