BT20_090.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_090 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Turn
  11. if (timing == EffectTiming.OnStartTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  14. }
  15. #endregion
  16. #region End of Your Turn
  17. if (timing == EffectTiming.OnEndTurn)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("1 of your [Dark Dragon] or [Evil Dragon] Digimon may attack a player.", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[End of Your Turn] If you have 4 pr fewer cards in your hand, by suspending this Tamer, 1 of your [Dark Dragon] or [Evil Dragon] trait Digimon may attack a player.";
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (CardEffectCommons.IsOwnerTurn(card))
  32. {
  33. if (card.Owner.HandCards.Count <= 4)
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanSelectPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && (permanent.TopCard.EqualsTraits("Evil Dragon")
  44. || permanent.TopCard.EqualsTraits("Dark Dragon"));
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.IsExistOnBattleArea(card) &&
  49. CardEffectCommons.CanActivateSuspendCostEffect(card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(
  54. new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() },
  55. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  56. Permanent selectedPermanent = null;
  57. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  58. {
  59. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: SelectPermanentCoroutine,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack a player.",
  73. "The opponent is selecting 1 Digimon that will attack a player.");
  74. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  75. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  76. {
  77. selectedPermanent = permanent;
  78. yield return null;
  79. }
  80. if (selectedPermanent != null)
  81. {
  82. if (selectedPermanent.CanAttack(activateClass))
  83. {
  84. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  85. selectAttackEffect.SetUp(
  86. attacker: selectedPermanent,
  87. canAttackPlayerCondition: () => true,
  88. defenderCondition: _ => false,
  89. cardEffect: activateClass);
  90. selectAttackEffect.SetCanNotSelectNotAttack();
  91. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  92. }
  93. }
  94. }
  95. }
  96. }
  97. #endregion
  98. #region Security Effect
  99. if (timing == EffectTiming.SecuritySkill)
  100. {
  101. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  102. }
  103. #endregion
  104. return cardEffects;
  105. }
  106. }
  107. }