BT7_110.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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_110 : 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. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  16. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  17. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  18. cardEffects.Add(ignoreColorConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (card.Owner.GetBattleAreaDigimons().Count((permanet) => permanet.TopCard.CardTraits.Contains("Hybrid")) >= 1)
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. bool CardCondition(CardSource cardSource)
  28. {
  29. if (cardSource == card)
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. }
  36. if (timing == EffectTiming.OptionSkill)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  40. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[Main] Your level 4 Digimon can digivolve into 1 Digimon card in your hand with matching colors and [Ten Warriors] in its traits for its digivolution cost, ignoring its level.";
  45. }
  46. bool CanSelectPermanentCondition(Permanent permanent)
  47. {
  48. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  49. {
  50. if (permanent.TopCard.HasLevel && permanent.TopCard.Level == 4)
  51. {
  52. foreach (CardSource cardSource in card.Owner.HandCards)
  53. {
  54. if(cardSource.CardColors.Any(x => permanent.TopCard.CardColors.Contains(x)))
  55. {
  56. if (IsYourDigimonToDigivolve(cardSource))
  57. {
  58. if (!cardSource.CanNotEvolve(permanent))
  59. {
  60. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, true, activateClass, ignore: CardEffectCommons.IgnoreRequirement.Level))
  61. {
  62. return true;
  63. }
  64. }
  65. }
  66. }
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. bool IsYourDigimonToDigivolve(CardSource cardSource)
  73. {
  74. if (cardSource.EqualsTraits("Ten Warriors"))
  75. {
  76. if (cardSource.IsDigimon)
  77. {
  78. return true;
  79. }
  80. }
  81. return false;
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  86. }
  87. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  88. {
  89. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  90. {
  91. Permanent selectedPermanent = null;
  92. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: maxCount,
  100. canNoSelect: true,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage("Select a level 4 Digimon.", "The opponent is selecting a level 4 Digimon.");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  109. {
  110. selectedPermanent = permanent;
  111. yield return null;
  112. }
  113. if (selectedPermanent != null)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  116. targetPermanent: selectedPermanent,
  117. cardCondition: IsYourDigimonToDigivolve,
  118. payCost: true,
  119. reduceCostTuple: null,
  120. fixedCostTuple: null,
  121. ignoreDigivolutionRequirementFixedCost: -1,
  122. isHand: true,
  123. activateClass: activateClass,
  124. successProcess: null,
  125. ignoreRequirements: CardEffectCommons.IgnoreRequirement.Level));
  126. }
  127. }
  128. }
  129. }
  130. if (timing == EffectTiming.SecuritySkill)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect($"Add this card to hand", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  135. activateClass.SetIsSecurityEffect(true);
  136. cardEffects.Add(activateClass);
  137. string EffectDiscription()
  138. {
  139. return "[Security] Add this card to its owner's hand.";
  140. }
  141. bool CanUseCondition(Hashtable hashtable)
  142. {
  143. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  148. }
  149. }
  150. return cardEffects;
  151. }
  152. }