BT8_087.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT8_087 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. if (timing == EffectTiming.OnAllyAttack)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[Opponent's Turn] When one of your opponent's Digimon attacks one of your blue Digimon, you may suspend this Tamer to <Draw 1>. (Draw 1 card from your deck.)";
  26. }
  27. bool PermanentCondition(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsOpponentPermanent(permanent, card);
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (CardEffectCommons.IsOpponentTurn(card))
  36. {
  37. if (CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition))
  38. {
  39. if (CardEffectCommons.IsOwnerPermanent(GManager.instance.attackProcess.DefendingPermanent, card))
  40. {
  41. if (GManager.instance.attackProcess.DefendingPermanent.TopCard.CardColors.Contains(CardColor.Blue))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  65. new List<Permanent>() { card.PermanentOfThisCard() },
  66. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  67. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  68. }
  69. }
  70. if (timing == EffectTiming.SecuritySkill)
  71. {
  72. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  73. }
  74. return cardEffects;
  75. }
  76. }