BT23_064.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Bakemon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_064 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region OP/WD Shared
  12. bool IsOwnerDigimonShared(Permanent permanent)
  13. {
  14. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  15. }
  16. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  17. {
  18. bool CanSelectLevelOpponentPermanentCondition(Permanent permanent)
  19. {
  20. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  21. permanent.IsDigimon &&
  22. permanent.TopCard.HasLevel &&
  23. permanent.Level <= 4;
  24. }
  25. Permanent selectedPermanent = null;
  26. #region Select Your Digimon
  27. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  28. selectPermanentEffect.SetUp(
  29. selectPlayer: card.Owner,
  30. canTargetCondition: IsOwnerDigimonShared,
  31. canTargetCondition_ByPreSelecetedList: null,
  32. canEndSelectCondition: null,
  33. maxCount: 1,
  34. canNoSelect: true,
  35. canEndNotMax: false,
  36. selectPermanentCoroutine: SelectPermanentCoroutine,
  37. afterSelectPermanentCoroutine: null,
  38. mode: SelectPermanentEffect.Mode.Custom,
  39. cardEffect: activateClass);
  40. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  41. {
  42. selectedPermanent = permanent;
  43. yield return null;
  44. }
  45. selectPermanentEffect.SetUpCustomMessage("Select 1 of your Digimon to delete.", "The opponent is selecting 1 of their Digimon to delete.");
  46. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  47. #endregion
  48. if (selectedPermanent != null)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(
  51. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  52. targetPermanents: new List<Permanent>() { selectedPermanent }, activateClass: activateClass,
  53. successProcess: _ => SuccessProcess(), failureProcess: null));
  54. }
  55. IEnumerator SuccessProcess()
  56. {
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectLevelOpponentPermanentCondition))
  58. {
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectLevelOpponentPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: false,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: null,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Destroy,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 of your opponents lvl 4 or lower Digimon to delete.", "The opponent is selecting 1 of your Digimon to delete.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. }
  75. }
  76. #endregion
  77. #region On Play
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("By deleting 1 of your digimon, delete 1 level 4 or lower digimon", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[On Play] By deleting 1 of your Digimon, delete 1 of your opponent's level 4 or lower Digimon.";
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  91. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  96. && CardEffectCommons.HasMatchConditionPermanent(IsOwnerDigimonShared);
  97. }
  98. }
  99. #endregion
  100. #region When Digivolving
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("By deleting 1 of your digimon, delete 1 level 4 or lower digimon", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[When Digivolving] By deleting 1 of your Digimon, delete 1 of your opponent's level 4 or lower Digimon.";
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  114. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  119. && CardEffectCommons.HasMatchConditionPermanent(IsOwnerDigimonShared);
  120. }
  121. }
  122. #endregion
  123. #region On Deletion - ESS
  124. if (timing == EffectTiming.OnDestroyedAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  128. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  129. activateClass.SetIsInheritedEffect(true);
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[On Deletion] Gain 1 memory.";
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  138. }
  139. bool CanActivateCondition(Hashtable hashtable)
  140. {
  141. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  142. }
  143. IEnumerator ActivateCoroutine(Hashtable hashtable)
  144. {
  145. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  146. }
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }