EX12_062.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Kokeshimon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_062 : 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.EqualsTraits("Puppet")
  17. || targetPermanent.TopCard.EqualsTraits("Shambala");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 2,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null,
  25. level: 3)
  26. );
  27. }
  28. #endregion
  29. #region Shared OP/WD
  30. string SharedEffectName = "Delete 1 of your own Digimon to delete 1 enemy lvl 4 or lower Digimon";
  31. CardEffectFactory.ActivateClassesForSharedEffects
  32. (ref cardEffects, timing, card,
  33. SharedEffectName,
  34. SharedActivateCoroutine,
  35. SharedEffectDescription,
  36. optional: false,
  37. isSkippable: true,
  38. onPlay: true,
  39. whenDigivolving: true);
  40. string SharedEffectDescription(string tag)
  41. {
  42. return $"[{tag}] By deleting 1 of your Digimon, delete 1 of your opponent's level 4 or lower Digimon.";
  43. }
  44. bool CanSelectOwnPermanentCondition(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanSelectEnemyPermanentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  51. && permanent.TopCard.HasLevel
  52. && permanent.TopCard.Level <= 4;
  53. }
  54. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnPermanentCondition))
  57. {
  58. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect.SetUp(
  60. selectPlayer: card.Owner,
  61. canTargetCondition: CanSelectOwnPermanentCondition,
  62. canTargetCondition_ByPreSelecetedList: null,
  63. canEndSelectCondition: null,
  64. maxCount: 1,
  65. canNoSelect: true,
  66. canEndNotMax: false,
  67. selectPermanentCoroutine: SelectPermanentCoroutine,
  68. afterSelectPermanentCoroutine: null,
  69. mode: SelectPermanentEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  74. {
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { permanent }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  76. IEnumerator SuccessProcess()
  77. {
  78. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemyPermanentCondition))
  79. {
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectEnemyPermanentCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: 1,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Destroy,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. }
  96. }
  97. }
  98. }
  99. #endregion
  100. #region Inherited
  101. if (timing == EffectTiming.OnAllyAttack)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("<Draw 1> and trash 1", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  106. activateClass.SetHashString("EX12_062_Inherited");
  107. activateClass.SetIsInheritedEffect(true);
  108. cardEffects.Add(activateClass);
  109. string EffectDescription()
  110. {
  111. return "[When Attacking] [Once Per Turn] <Draw 1> and trash 1 card in your hand.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  116. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable hashtable)
  123. {
  124. if (card.Owner.LibraryCards.Count >= 1)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  127. }
  128. if (card.Owner.HandCards.Count >= 1)
  129. {
  130. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  131. selectHandEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: (cardSource) => true,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: 1,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. isShowOpponent: true,
  140. selectCardCoroutine: null,
  141. afterSelectCardCoroutine: null,
  142. mode: SelectHandEffect.Mode.Discard,
  143. cardEffect: activateClass);
  144. yield return StartCoroutine(selectHandEffect.Activate());
  145. }
  146. }
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }