BT17_008.cs 7.6 KB

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