BT7_091.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 BT7_091 : 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.SecuritySkill)
  14. {
  15. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  16. }
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. ActivateClass activateClass = new ActivateClass();
  20. activateClass.SetUpICardEffect("Draw 1 and trash 1 card from hand", CanUseCondition, card);
  21. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  22. cardEffects.Add(activateClass);
  23. string EffectDiscription()
  24. {
  25. return "[On Play] Trigger <Draw 1>. (Draw 1 card from your deck.) Then, trash 1 card in your hand.";
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (isExistOnField(card))
  34. {
  35. if (card.Owner.GetBattleAreaPermanents().Contains(card.PermanentOfThisCard()))
  36. {
  37. if (card.Owner.LibraryCards.Count >= 1)
  38. {
  39. return true;
  40. }
  41. if (card.Owner.HandCards.Count >= 1)
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. if (isExistOnField(card))
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  54. if (card.Owner.HandCards.Count >= 1)
  55. {
  56. int discardCount = 1;
  57. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  58. selectHandEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: (cardSource) => true,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: discardCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. selectCardCoroutine: null,
  68. afterSelectCardCoroutine: null,
  69. mode: SelectHandEffect.Mode.Discard,
  70. cardEffect: activateClass);
  71. yield return StartCoroutine(selectHandEffect.Activate());
  72. }
  73. }
  74. }
  75. }
  76. if (timing == EffectTiming.OnDestroyedAnyone)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  81. activateClass.SetIsInheritedEffect(true);
  82. activateClass.SetIsDigimonEffect(true);
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[On Deletion] Gain 1 memory.";
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  91. }
  92. bool CanActivateCondition(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  95. {
  96. return true;
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. if (card.Owner.CanAddMemory(activateClass))
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  105. }
  106. }
  107. }
  108. return cardEffects;
  109. }
  110. }