BT15_085.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT15
  5. {
  6. public class BT15_085 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. //Start of Your Turn
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #region Opponent's Turn
  17. if (timing == EffectTiming.OnAllyAttack)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Switch Attack Target to your Digimon", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[Opponent's Turn] When an opponent's Digimon attacks, by suspending this Tamer, switch the target of attack to 1 of your suspended Digimon with the [Insectoid] trait.";
  26. }
  27. bool CanSelectPermanentCondition(Permanent permanent)
  28. {
  29. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  30. {
  31. if (permanent.TopCard.CardTraits.Contains("Insectoid"))
  32. {
  33. if (permanent.IsSuspended)
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool PermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.IsOpponentTurn(card))
  50. {
  51. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  52. {
  53. return true;
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  64. {
  65. return true;
  66. }
  67. }
  68. return false;
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  73. new List<Permanent>() { card.PermanentOfThisCard() },
  74. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  76. {
  77. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: maxCount,
  85. canNoSelect: false,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: SelectPermanentCoroutine,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Custom,
  90. cardEffect: activateClass);
  91. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that opponent's Digimon attacks to.", "The opponent is selecting 1 Digimon that your Digimon attacks to.");
  92. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  93. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(GManager.instance.attackProcess.SwitchDefender(
  96. activateClass,
  97. false,
  98. permanent));
  99. }
  100. }
  101. }
  102. }
  103. #endregion
  104. //Security Effect
  105. if (timing == EffectTiming.SecuritySkill)
  106. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  107. return cardEffects;
  108. }
  109. }
  110. }