BT22_018.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //BT22 Sangomon
  4. namespace DCGO.CardEffects.BT22
  5. {
  6. public class BT22_018 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Place under to give blocker and battle immunity", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. => "[On Play] By placing this Digimon as the bottom digivolution card of any of your other Digimon with [Aqua] or [Sea Animal] in any of their traits, until your opponent's turn ends, that Digimon gains <Blocker> and can't be deleted in battle.";
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  23. {
  24. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. return CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  36. }
  37. return false;
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent != card.PermanentOfThisCard())
  44. {
  45. if (!permanent.TopCard.Equals(card))
  46. return permanent.TopCard.ContainsTraits("Aqua") || permanent.TopCard.ContainsTraits("Sea Animal");
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. List<CardSource> selectedCards = new List<CardSource>();
  54. SelectPermanentEffect selectPermanentEffect =
  55. GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: CanSelectPermanentCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage(
  69. "Select 1 Digimon to place this Digimon beneath.",
  70. "The opponent is selecting 1 Digimon to place this Digimon beneath.");
  71. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  72. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  73. {
  74. selectedCards.Add(permanent.TopCard);
  75. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(
  76. new List<Permanent[]>() { new Permanent[] { card.PermanentOfThisCard(), permanent } },
  77. false,
  78. activateClass).PlacePermanentToDigivolutionCards());
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByBattle(
  81. targetPermanent: permanent,
  82. canNotBeDestroyedByBattleCondition: CanNotBeDestroyedByBattleCondition,
  83. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  84. activateClass: activateClass,
  85. effectName: "Can't be deleted in battle"));
  86. bool CanNotBeDestroyedByBattleCondition(Permanent permanent, Permanent attackingPermanent,
  87. Permanent defendingPermanent, CardSource defendingCard)
  88. {
  89. return permanent == attackingPermanent || permanent == defendingPermanent;
  90. }
  91. }
  92. }
  93. }
  94. #endregion
  95. #region ESS
  96. if (timing == EffectTiming.None)
  97. {
  98. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  99. isInheritedEffect: true,
  100. card: card,
  101. condition: null));
  102. }
  103. #endregion
  104. return cardEffects;
  105. }
  106. }
  107. }