BT7_084.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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_084 : 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.None)
  14. {
  15. bool Condition()
  16. {
  17. if (CardEffectCommons.IsExistOnBattleArea(card))
  18. {
  19. if (CardEffectCommons.IsOwnerTurn(card))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. bool PermanentCondition(Permanent permanent)
  27. {
  28. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  29. {
  30. if (permanent != card.PermanentOfThisCard())
  31. {
  32. if (permanent.TopCard.CardNames.Contains("Eosmon"))
  33. {
  34. return true;
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  41. permanentCondition: PermanentCondition,
  42. changeValue: 1000,
  43. isInheritedEffect: false,
  44. card: card,
  45. condition: Condition,
  46. effectName: () => "Your other [Eosmon]s gain DP +1000"));
  47. }
  48. if (timing == EffectTiming.OnDestroyedAnyone)
  49. {
  50. ActivateClass activateClass = new ActivateClass();
  51. activateClass.SetUpICardEffect("Play 1n [Eosmon] from hand", CanUseCondition, card);
  52. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  53. cardEffects.Add(activateClass);
  54. string EffectDiscription()
  55. {
  56. return "[On Deletion] You may play 1 level 5 or lower [Eosmon] from your hand without paying its memory cost.";
  57. }
  58. bool CanSelectCardCondition(CardSource cardSource)
  59. {
  60. if (cardSource.Level <= 5)
  61. {
  62. if (cardSource.CardNames.Contains("Eosmon"))
  63. {
  64. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  65. {
  66. if (cardSource.HasLevel)
  67. {
  68. return true;
  69. }
  70. }
  71. }
  72. }
  73. return false;
  74. }
  75. bool CanUseCondition(Hashtable hashtable)
  76. {
  77. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  78. }
  79. bool CanActivateCondition(Hashtable hashtable)
  80. {
  81. if (CardEffectCommons.IsExistOnTrash(card))
  82. {
  83. if (card.Owner.HandCards.Count >= 1)
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  91. {
  92. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  93. {
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. int maxCount = 1;
  96. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  97. selectHandEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectCardCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: true,
  104. canEndNotMax: false,
  105. isShowOpponent: true,
  106. selectCardCoroutine: SelectCardCoroutine,
  107. afterSelectCardCoroutine: null,
  108. mode: SelectHandEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  111. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  112. yield return StartCoroutine(selectHandEffect.Activate());
  113. IEnumerator SelectCardCoroutine(CardSource cardSource)
  114. {
  115. selectedCards.Add(cardSource);
  116. yield return null;
  117. }
  118. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  119. cardSources: selectedCards,
  120. activateClass: activateClass,
  121. payCost: false,
  122. isTapped: false,
  123. root: SelectCardEffect.Root.Hand,
  124. activateETB: true));
  125. }
  126. }
  127. }
  128. return cardEffects;
  129. }
  130. }