BT9_051.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 BT9_051 : 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 PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Panjyamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.None)
  22. {
  23. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  24. changeCardNamesClass.SetUpICardEffect("Also treated as having [Leomon] in its name", CanUseCondition, card);
  25. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: changeCardNames);
  26. cardEffects.Add(changeCardNamesClass);
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return true;
  30. }
  31. List<string> changeCardNames(CardSource cardSource, List<string> CardNames)
  32. {
  33. if (cardSource == card)
  34. {
  35. CardNames.Add("Leomon_BT9_051");
  36. }
  37. return CardNames;
  38. }
  39. }
  40. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Play 1 [Leomon] from digivolution cards", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  45. activateClass.SetHashString("Substitute_BT9_051");
  46. cardEffects.Add(activateClass);
  47. string EffectDiscription()
  48. {
  49. return "[All Turns] When this Digimon would be deleted in battle, you may play 1 [Leomon] from this Digimon's digivolution cards without paying its memory cost.";
  50. }
  51. bool CanSelectCardCondition(CardSource cardSource)
  52. {
  53. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  54. {
  55. if (cardSource.CardNames.Contains("Leomon"))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  67. {
  68. if (CardEffectCommons.IsByBattle(hashtable))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. bool CanActivateCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  81. {
  82. return true;
  83. }
  84. }
  85. return false;
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. if (CardEffectCommons.IsExistOnBattleArea(card))
  90. {
  91. Permanent selectedPermanent = card.PermanentOfThisCard();
  92. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  93. {
  94. List<CardSource> selectedCards = new List<CardSource>();
  95. int maxCount = 1;
  96. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  97. selectCardEffect.SetUp(
  98. canTargetCondition: CanSelectCardCondition,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. canNoSelect: () => true,
  102. selectCardCoroutine: SelectCardCoroutine,
  103. afterSelectCardCoroutine: null,
  104. message: "Select 1 card to play.",
  105. maxCount: maxCount,
  106. canEndNotMax: false,
  107. isShowOpponent: true,
  108. mode: SelectCardEffect.Mode.Custom,
  109. root: SelectCardEffect.Root.Custom,
  110. customRootCardList: selectedPermanent.DigivolutionCards,
  111. canLookReverseCard: true,
  112. selectPlayer: card.Owner,
  113. cardEffect: activateClass);
  114. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  115. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  116. yield return StartCoroutine(selectCardEffect.Activate());
  117. IEnumerator SelectCardCoroutine(CardSource cardSource)
  118. {
  119. selectedCards.Add(cardSource);
  120. yield return null;
  121. }
  122. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  123. cardSources: selectedCards,
  124. activateClass: activateClass,
  125. payCost: false,
  126. isTapped: false,
  127. root: SelectCardEffect.Root.DigivolutionCards,
  128. activateETB: true));
  129. }
  130. }
  131. }
  132. }
  133. return cardEffects;
  134. }
  135. }