BT6_068.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 BT6_068 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 1 card from hand to return 1 card from trash to hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may trash 1 card in your hand. If you do, return 1 Digimon card with [Seven Great Demon Lords] or [Three Musketeers] in its type from your trash to your hand.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.Owner == card.Owner)
  30. {
  31. if (cardSource.CardTraits.Contains("Seven Great Demon Lords"))
  32. {
  33. return true;
  34. }
  35. if (cardSource.CardTraits.Contains("SevenGreatDemonLords"))
  36. {
  37. return true;
  38. }
  39. if (cardSource.CardTraits.Contains("Three Musketeers"))
  40. {
  41. return true;
  42. }
  43. if (cardSource.CardTraits.Contains("ThreeMusketeers"))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (card.Owner.HandCards.Count >= 1)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. if (isExistOnField(card))
  70. {
  71. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  72. {
  73. if (card.Owner.HandCards.Count >= 1)
  74. {
  75. bool discarded = false;
  76. int discardCount = 1;
  77. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  78. selectHandEffect.SetUp(
  79. selectPlayer: card.Owner,
  80. canTargetCondition: (cardSource) => true,
  81. canTargetCondition_ByPreSelecetedList: null,
  82. canEndSelectCondition: null,
  83. maxCount: discardCount,
  84. canNoSelect: true,
  85. canEndNotMax: false,
  86. isShowOpponent: true,
  87. selectCardCoroutine: null,
  88. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  89. mode: SelectHandEffect.Mode.Discard,
  90. cardEffect: activateClass);
  91. yield return StartCoroutine(selectHandEffect.Activate());
  92. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  93. {
  94. if (cardSources.Count >= 1)
  95. {
  96. discarded = true;
  97. yield return null;
  98. }
  99. }
  100. if (discarded)
  101. {
  102. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  103. {
  104. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  105. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  106. selectCardEffect.SetUp(
  107. canTargetCondition: CanSelectCardCondition,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. canNoSelect: () => false,
  111. selectCardCoroutine: null,
  112. afterSelectCardCoroutine: null,
  113. message: "Select 1 card to add to your hand.",
  114. maxCount: maxCount,
  115. canEndNotMax: false,
  116. isShowOpponent: true,
  117. mode: SelectCardEffect.Mode.AddHand,
  118. root: SelectCardEffect.Root.Trash,
  119. customRootCardList: null,
  120. canLookReverseCard: true,
  121. selectPlayer: card.Owner,
  122. cardEffect: activateClass);
  123. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. return cardEffects;
  132. }
  133. }