BT24_052.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Keramon (X Antibody)
  4. namespace DCGO.CardEffects.BT24
  5. {
  6. public class BT24_052 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Keramon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region WM/WD Shared
  22. string SharedEffectName() => "Play Diaboromon Token";
  23. string EffectDescriptionShared(string tag) => $"[{tag}] You may play 1 [Diaboromon] Token without paying the cost. (Digimon/Cost 14/Lv.6/White/Mega/Unknown/Unidentified/3000 DP).";
  24. bool CanActivateConditionShared(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  27. }
  28. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  29. {
  30. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayDiaboromonToken(activateClass));
  31. }
  32. #endregion
  33. #region When Moving
  34. if (timing == EffectTiming.OnMove)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateConditionShared, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDescriptionShared("When Moving"));
  39. cardEffects.Add(activateClass);
  40. bool PermanentCondition(Permanent permanent)
  41. {
  42. return permanent == card.PermanentOfThisCard();
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  47. CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  48. }
  49. }
  50. #endregion
  51. #region When Digivolving
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  56. activateClass.SetUpActivateClass(CanActivateConditionShared, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, true, EffectDescriptionShared("When Digivolving"));
  57. cardEffects.Add(activateClass);
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  61. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  62. }
  63. }
  64. #endregion
  65. #region ESS
  66. if (timing == EffectTiming.WhenRemoveField)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Delete 1 of your other [Diaboromon] to prevent this Digimon from leaving", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  71. activateClass.SetHashString("Substitute_BT24_052");
  72. activateClass.SetIsInheritedEffect(true);
  73. cardEffects.Add(activateClass);
  74. string EffectDescription()
  75. {
  76. return "[All Turns] [Once Per Turn] When this Digimon with [Diaboromon] in its text would leave the battle area, by deleting 1 of your other [Diaboromon], it doesn't leave.";
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  81. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  86. card.PermanentOfThisCard().TopCard.HasText("Diaboromon") &&
  87. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  88. }
  89. bool CanSelectPermanentCondition(Permanent permanent)
  90. {
  91. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  92. permanent != card.PermanentOfThisCard() &&
  93. permanent.TopCard.EqualsCardName("Diaboromon");
  94. }
  95. IEnumerator ActivateCoroutine(Hashtable hashtable)
  96. {
  97. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  98. {
  99. Permanent thisCardPermanent = card.PermanentOfThisCard();
  100. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  101. selectPermanentEffect.SetUp(
  102. selectPlayer: card.Owner,
  103. canTargetCondition: CanSelectPermanentCondition,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. maxCount: 1,
  107. canNoSelect: true,
  108. canEndNotMax: false,
  109. selectPermanentCoroutine: SelectPermanentCoroutine,
  110. afterSelectPermanentCoroutine: null,
  111. mode: SelectPermanentEffect.Mode.Custom,
  112. cardEffect: activateClass);
  113. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  116. {
  117. yield return ContinuousController.instance.StartCoroutine(
  118. CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  119. targetPermanents: new List<Permanent>() { permanent },
  120. activateClass: activateClass,
  121. successProcess: _ => SuccessProcess(),
  122. failureProcess: null));
  123. IEnumerator SuccessProcess()
  124. {
  125. thisCardPermanent.willBeRemoveField = false;
  126. thisCardPermanent.HideDeleteEffect();
  127. thisCardPermanent.HideHandBounceEffect();
  128. thisCardPermanent.HideDeckBounceEffect();
  129. thisCardPermanent.HideWillRemoveFieldEffect();
  130. yield return null;
  131. }
  132. }
  133. }
  134. }
  135. }
  136. #endregion
  137. return cardEffects;
  138. }
  139. }
  140. }