BT7_038.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_038 : 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. return card.Owner.HandCards.Contains(card);
  18. }
  19. bool PermanentCondition(Permanent targetPermanent)
  20. {
  21. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card))
  22. {
  23. if (targetPermanent.DigivolutionCards.Count((cardSource) => cardSource.IsTamer) >= 1)
  24. {
  25. return true;
  26. }
  27. }
  28. return false;
  29. }
  30. bool CardSourceCondition(CardSource cardSource)
  31. {
  32. return cardSource == card && cardSource.Owner.HandCards.Contains(cardSource);
  33. }
  34. bool RootCondition(SelectCardEffect.Root root)
  35. {
  36. return root == SelectCardEffect.Root.Hand;
  37. }
  38. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect(
  39. changeValue: -2,
  40. permanentCondition: PermanentCondition,
  41. cardCondition: CardSourceCondition,
  42. rootCondition: RootCondition,
  43. isInheritedEffect: false,
  44. card: card,
  45. condition: Condition,
  46. setFixedCost: false));
  47. }
  48. if (timing == EffectTiming.OnEnterFieldAnyone)
  49. {
  50. ActivateClass activateClass = new ActivateClass();
  51. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  52. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  53. cardEffects.Add(activateClass);
  54. string EffectDiscription()
  55. {
  56. return "[When Digivolving] If a card with [Hybrid] in its traits is in this Digimon's digivolution cards, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardTraits.Contains("Hybrid")) >= 1)
  67. {
  68. if (card.Owner.LibraryCards.Count >= 1)
  69. {
  70. if (card.Owner.CanAddSecurity(activateClass))
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  82. }
  83. }
  84. return cardEffects;
  85. }
  86. }