BT8_066.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 BT8_066 : 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.OnAddDigivolutionCards)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] When one of your effects places a digivolution card under this Digimon, you may digivolve this Digimon into a Digimon card in your hand with [X-Antibody] in its traits by paying its digivolution cost. When this Digimon would digivolve with this effect, reduce the digivolution cost by 1.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.HasXAntibodyTraits)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (CardEffectCommons.IsOwnerTurn(card))
  39. {
  40. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  41. hashtable: hashtable,
  42. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  43. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null && cardEffect.EffectSourceCard.Owner == card.Owner,
  44. cardCondition: null))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (card.Owner.HandCards.Count >= 1)
  57. {
  58. return true;
  59. }
  60. }
  61. return false;
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  66. targetPermanent: card.PermanentOfThisCard(),
  67. cardCondition: CanSelectCardCondition,
  68. payCost: true,
  69. reduceCostTuple: (reduceCost: 1, reduceCostCardCondition: null),
  70. fixedCostTuple: null,
  71. ignoreDigivolutionRequirementFixedCost: -1,
  72. isHand: true,
  73. activateClass: activateClass,
  74. successProcess: null));
  75. }
  76. }
  77. if (timing == EffectTiming.None)
  78. {
  79. bool Condition()
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. if (CardEffectCommons.IsOpponentTurn(card))
  84. {
  85. if (card.PermanentOfThisCard().TopCard.HasXAntibodyTraits)
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  94. }
  95. return cardEffects;
  96. }
  97. }