BT6_078.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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_078 : 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.OnDiscardHand)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Place this card to digivolution cards", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "When you trash this card in your hand using one of your effects, you may place it under 1 of your purple Digimon at the bottom of its digivolution cards.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  28. {
  29. if (!permanent.IsToken)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. bool SkillCondition(ICardEffect cardEffect)
  40. {
  41. if (cardEffect != null)
  42. {
  43. if (cardEffect.EffectSourceCard != null)
  44. {
  45. if (cardEffect.EffectSourceCard.Owner == card.Owner)
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. return CardEffectCommons.CanTriggerOnTrashSelfHand(hashtable, SkillCondition, card);
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnTrash(card))
  58. {
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. if (CardEffectCommons.IsExistOnTrash(card))
  69. {
  70. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  71. {
  72. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  73. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  74. selectPermanentEffect.SetUp(
  75. selectPlayer: card.Owner,
  76. canTargetCondition: CanSelectPermanentCondition,
  77. canTargetCondition_ByPreSelecetedList: null,
  78. canEndSelectCondition: null,
  79. maxCount: maxCount,
  80. canNoSelect: true,
  81. canEndNotMax: false,
  82. selectPermanentCoroutine: SelectPermanentCoroutine,
  83. afterSelectPermanentCoroutine: null,
  84. mode: SelectPermanentEffect.Mode.Custom,
  85. cardEffect: activateClass);
  86. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  87. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  88. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  89. {
  90. Permanent selectedPermanent = permanent;
  91. if (selectedPermanent != null)
  92. {
  93. if (card.Owner.TrashHandCard.gameObject.activeSelf)
  94. {
  95. card.Owner.TrashHandCard.gameObject.SetActive(false);
  96. }
  97. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { card }, activateClass));
  98. }
  99. }
  100. }
  101. }
  102. }
  103. }
  104. if (timing == EffectTiming.OnAllyAttack)
  105. {
  106. ActivateClass activateClass = new ActivateClass();
  107. activateClass.SetUpICardEffect("Trash 1 card from hand to get DP +3000", CanUseCondition, card);
  108. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  109. cardEffects.Add(activateClass);
  110. string EffectDiscription()
  111. {
  112. return "[When Attacking] You may trash 1 card in your hand to have this Digimon get +3000 DP for the turn.";
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. if (card.Owner.HandCards.Count >= 1)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (card.Owner.HandCards.Count >= 1)
  132. {
  133. bool discarded = false;
  134. int discardCount = 1;
  135. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  136. selectHandEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: (cardSource) => true,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: discardCount,
  142. canNoSelect: true,
  143. canEndNotMax: false,
  144. isShowOpponent: true,
  145. selectCardCoroutine: null,
  146. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  147. mode: SelectHandEffect.Mode.Discard,
  148. cardEffect: activateClass);
  149. yield return StartCoroutine(selectHandEffect.Activate());
  150. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  151. {
  152. if (cardSources.Count >= 1)
  153. {
  154. discarded = true;
  155. yield return null;
  156. }
  157. }
  158. if (discarded)
  159. {
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  161. }
  162. }
  163. }
  164. }
  165. if (timing == EffectTiming.OnDestroyedAnyone)
  166. {
  167. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: null));
  168. }
  169. return cardEffects;
  170. }
  171. }