BT21_055.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT21
  4. {
  5. //Sunarizamon
  6. public class BT21_055 : 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.None)
  13. {
  14. bool Condition()
  15. {
  16. return CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card);
  17. }
  18. bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent == card.PermanentOfThisCard();
  21. }
  22. bool CardSourceCondition(CardSource cardSource)
  23. {
  24. if (cardSource.EqualsTraits("Mineral") | cardSource.EqualsTraits("Rock"))
  25. {
  26. return true;
  27. }
  28. return false;
  29. }
  30. bool RootCondition(SelectCardEffect.Root root)
  31. {
  32. return true;
  33. }
  34. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  35. changeValue: -1,
  36. permanentCondition: PermanentCondition,
  37. cardCondition: CardSourceCondition,
  38. rootCondition: RootCondition,
  39. isInheritedEffect: false,
  40. card: card,
  41. condition: Condition,
  42. setFixedCost: false));
  43. }
  44. #endregion
  45. #region Inherited
  46. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  47. {
  48. ActivateClass activateClass = new ActivateClass();
  49. activateClass.SetUpICardEffect("Delete 4 cost or less Digimon", CanUseCondition, card);
  50. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  51. activateClass.SetIsInheritedEffect(true);
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. {
  55. return "When effects trash this card from a [Mineral] or [Rock] trait Digimon's digivolution cards, delete 1 of your opponent's Digimon with a play cost of 4 or less.";
  56. }
  57. bool CanSelectOpponentsDigimon(Permanent permanent)
  58. {
  59. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  60. return permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 4;
  61. return false;
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. Permanent trashedPermanent = CardEffectCommons.GetPermanentFromHashtable(hashtable);
  66. return (trashedPermanent.TopCard.EqualsTraits("Mineral") || trashedPermanent.TopCard.EqualsTraits("Rock")) &&
  67. CardEffectCommons.CanTriggerOnTrashSelfDigivolutionCard(hashtable, cardEffect => cardEffect != null, card);
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnTrash(card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable hashtable)
  74. {
  75. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentsDigimon))
  76. {
  77. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  78. selectPermanentEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: CanSelectOpponentsDigimon,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: 1,
  84. canNoSelect: false,
  85. canEndNotMax: false,
  86. selectPermanentCoroutine: null,
  87. afterSelectPermanentCoroutine: null,
  88. mode: SelectPermanentEffect.Mode.Destroy,
  89. cardEffect: activateClass);
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. }
  92. }
  93. }
  94. #endregion
  95. return cardEffects;
  96. }
  97. }
  98. }