BT6_016.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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_016 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Play 1 Digimon with [Sistermon] in its name from hand or trash", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking] You may play 1 Digimon card with [Sistermon] in its name from your hand or trash without paying its memory cost. ";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.IsDigimon)
  26. {
  27. if (cardSource.ContainsCardName("Sistermon"))
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  46. {
  47. return true;
  48. }
  49. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  59. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  60. if (canSelectHand || canSelectTrash)
  61. {
  62. if (canSelectHand && canSelectTrash)
  63. {
  64. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  65. {
  66. new SelectionElement<bool>(message: $"From hand", value : true, spriteIndex: 0),
  67. new SelectionElement<bool>(message: $"From trash", value : false, spriteIndex: 1),
  68. };
  69. string selectPlayerMessage = "From which area do you play a card?";
  70. string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
  71. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  72. }
  73. else
  74. {
  75. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  76. }
  77. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  78. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  79. List<CardSource> selectedCards = new List<CardSource>();
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCards.Add(cardSource);
  83. yield return null;
  84. }
  85. if (fromHand)
  86. {
  87. int maxCount = 1;
  88. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  89. selectHandEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectCardCondition,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. maxCount: maxCount,
  95. canNoSelect: true,
  96. canEndNotMax: false,
  97. isShowOpponent: true,
  98. selectCardCoroutine: SelectCardCoroutine,
  99. afterSelectCardCoroutine: null,
  100. mode: SelectHandEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  103. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  104. yield return StartCoroutine(selectHandEffect.Activate());
  105. }
  106. else
  107. {
  108. int maxCount = 1;
  109. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  110. selectCardEffect.SetUp(
  111. canTargetCondition: CanSelectCardCondition,
  112. canTargetCondition_ByPreSelecetedList: null,
  113. canEndSelectCondition: null,
  114. canNoSelect: () => true,
  115. selectCardCoroutine: SelectCardCoroutine,
  116. afterSelectCardCoroutine: null,
  117. message: "Select 1 card to play.",
  118. maxCount: maxCount,
  119. canEndNotMax: false,
  120. isShowOpponent: true,
  121. mode: SelectCardEffect.Mode.Custom,
  122. root: SelectCardEffect.Root.Trash,
  123. customRootCardList: null,
  124. canLookReverseCard: true,
  125. selectPlayer: card.Owner,
  126. cardEffect: activateClass);
  127. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  128. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  129. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  130. }
  131. SelectCardEffect.Root root = SelectCardEffect.Root.Hand;
  132. if (!fromHand)
  133. {
  134. root = SelectCardEffect.Root.Trash;
  135. }
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: root, activateETB: true));
  137. }
  138. }
  139. }
  140. if (timing == EffectTiming.OnEnterFieldAnyone)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("This Digimon gains DP +3000 and Pierce", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  145. activateClass.SetHashString("GetEffects_BT6_016");
  146. cardEffects.Add(activateClass);
  147. string EffectDiscription()
  148. {
  149. return "[Your Turn][Once Per Turn] When you play another Digimon, this Digimon gets +3000 DP and <Piercing> for the turn. (When this Digimon attacks and deletes an opponent's Digimon and survives the battle, it performs any security checks it normally would.)";
  150. }
  151. bool PermanentCondition(Permanent permanent)
  152. {
  153. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  154. {
  155. if (permanent != card.PermanentOfThisCard())
  156. {
  157. return true;
  158. }
  159. }
  160. return false;
  161. }
  162. bool CanUseCondition(Hashtable hashtable)
  163. {
  164. if (CardEffectCommons.IsExistOnBattleArea(card))
  165. {
  166. if (CardEffectCommons.IsOwnerTurn(card))
  167. {
  168. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  169. {
  170. return true;
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleArea(card))
  179. {
  180. return true;
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  188. }
  189. }
  190. return cardEffects;
  191. }
  192. }