BT22_064.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Diaboromon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_064 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5
  18. && (targetPermanent.TopCard.HasCSTraits || targetPermanent.TopCard.EqualsCardName("Infermon"));
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null)
  26. );
  27. }
  28. #endregion
  29. #region Alliance
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(
  33. isInheritedEffect: false,
  34. card: card,
  35. condition: null));
  36. }
  37. #endregion
  38. #region WD/WA Shared
  39. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  40. {
  41. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayDiaboromonToken(activateClass));
  42. }
  43. #endregion
  44. #region When Digivolving
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Play 1 [Diaboromon] token", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[When Digivolving] You may play 1 [Diaboromon] Token without paying the cost. (Digimon/Cost 14/Lv.6/White/Mega/Unknown/Unidentified/3000 DP)";
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable hashtable)
  64. {
  65. yield return SharedActivateCoroutine(hashtable, activateClass);
  66. }
  67. }
  68. #endregion
  69. #region When Attacking
  70. if (timing == EffectTiming.OnAllyAttack)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Play 1 [Diaboromon] token", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  75. cardEffects.Add(activateClass);
  76. string EffectDiscription()
  77. {
  78. return "[When Attacking] You may play 1 [Diaboromon] Token without paying the cost. (Digimon/Cost 14/Lv.6/White/Mega/Unknown/Unidentified/3000 DP)";
  79. }
  80. bool CanUseCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable hashtable)
  89. {
  90. yield return SharedActivateCoroutine(hashtable, activateClass);
  91. }
  92. }
  93. #endregion
  94. #region All Turns
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Delete lowest play cost digimon", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  100. activateClass.SetHashString("BT22_064_Destroy");
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[All Turns] [Once Per Turn] When any of your other Digimon with the [Unidentified] trait are played, delete 1 of your opponent's Digimon with the lowest play cost.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsUnidentified, null);
  109. }
  110. bool CanActivateCondition(Hashtable hashtable)
  111. {
  112. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  113. && CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  114. }
  115. bool IsUnidentified(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  118. && permanent.TopCard.HasUnidentifiedTraits
  119. && permanent != card.PermanentOfThisCard();
  120. }
  121. bool IsOpponentsDigimon(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  124. permanent.TopCard.HasPlayCost &&
  125. CardEffectCommons.IsMinCost(permanent, card.Owner.Enemy, true);
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  130. {
  131. #region Delete Lowest Play Cost Digimon
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: IsOpponentsDigimon,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Destroy,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. #endregion
  147. }
  148. }
  149. }
  150. #endregion
  151. return cardEffects;
  152. }
  153. }
  154. }