BT18_069.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_069 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Blocker
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  15. isInheritedEffect: false,
  16. card: card,
  17. condition: null));
  18. }
  19. #endregion
  20. #region On End Turn
  21. if (timing == EffectTiming.OnEndTurn)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Opponent's 1 Digimon attacks", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[End of Opponent's Turn] [Once Per Turn] You may choose 1 of your opponent's Digimon. Your opponent attacks with the chosen Digimon.";
  30. }
  31. bool CanSelectPermanentCondition(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. if (CardEffectCommons.IsExistOnBattleArea(card))
  38. {
  39. if (CardEffectCommons.IsOpponentTurn(card))
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanActivateCondition(Hashtable hashtable)
  47. {
  48. if (CardEffectCommons.IsExistOnBattleArea(card))
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  52. if (!GManager.instance.attackProcess.IsAttacking)
  53. {
  54. return true;
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. Permanent selectedPermanent = null;
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition: CanSelectPermanentCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: maxCount,
  71. canNoSelect: true,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: SelectPermanentCoroutine,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.", "The opponent is selecting 1 Digimon that will attack.");
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  80. {
  81. selectedPermanent = permanent;
  82. yield return null;
  83. }
  84. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(selectedPermanent, card))
  85. {
  86. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  87. {
  88. if (selectedPermanent.CanAttack(activateClass))
  89. {
  90. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  91. selectAttackEffect.SetUp(
  92. attacker: selectedPermanent,
  93. canAttackPlayerCondition: () => true,
  94. defenderCondition: (permanent) => true,
  95. cardEffect: activateClass);
  96. selectAttackEffect.SetCanNotSelectNotAttack();
  97. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  98. }
  99. }
  100. }
  101. }
  102. }
  103. #endregion
  104. #region ESS - All Turns
  105. if (timing == EffectTiming.None)
  106. {
  107. bool Condition()
  108. {
  109. if (CardEffectCommons.IsExistOnBattleArea(card))
  110. {
  111. return true;
  112. }
  113. return false;
  114. }
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  118. {
  119. if (permanent.TopCard.HasText("Knightmon"))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  127. permanentCondition: PermanentCondition,
  128. changeValue: 2000,
  129. isInheritedEffect: true,
  130. card: card,
  131. condition: Condition,
  132. effectName: () => "Your Digimon with [Knightmon] in text traits gain DP +2000"));
  133. }
  134. #endregion
  135. return cardEffects;
  136. }
  137. }
  138. }