BT9_086.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 BT9_086 : 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 "[Your Turn] When you attack with a Digimon that has [Jellymon] in its name or is level 5 or higher, if you have 7 or fewer cards in hand, you may suspend this Tamer to <Draw 1>. (Draw 1 card from your deck.)";
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (isExistOnField(card))
  30. {
  31. if (CardEffectCommons.IsOwnerTurn(card))
  32. {
  33. if (GManager.instance.attackProcess.AttackingPermanent != null)
  34. {
  35. if (GManager.instance.attackProcess.AttackingPermanent.TopCard != null)
  36. {
  37. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.Owner == card.Owner)
  38. {
  39. if (GManager.instance.attackProcess.AttackingPermanent.IsDigimon)
  40. {
  41. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.ContainsCardName("Jellymon"))
  42. {
  43. return true;
  44. }
  45. if (GManager.instance.attackProcess.AttackingPermanent.Level >= 5)
  46. {
  47. if (GManager.instance.attackProcess.AttackingPermanent.TopCard.HasLevel)
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. }
  58. return false;
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. if (isExistOnField(card))
  63. {
  64. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  65. {
  66. if (card.Owner.HandCards.Count <= 7)
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. return false;
  73. }
  74. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  75. {
  76. if (isExistOnField(card))
  77. {
  78. if (!card.PermanentOfThisCard().IsSuspended && card.PermanentOfThisCard().CanSuspend)
  79. {
  80. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  81. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  82. }
  83. }
  84. }
  85. }
  86. if (timing == EffectTiming.SecuritySkill)
  87. {
  88. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  89. }
  90. return cardEffects;
  91. }
  92. }