ST8_04.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 ST8_04 : 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. if (CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card))
  18. {
  19. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.Level >= 6 && permanent.TopCard.HasLevel))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. bool PermanentCondition(Permanent targetPermanent)
  27. {
  28. return targetPermanent == card.PermanentOfThisCard();
  29. }
  30. bool CardCondition(CardSource cardSource)
  31. {
  32. if (cardSource != null)
  33. {
  34. if (cardSource.Owner == card.Owner)
  35. {
  36. if (cardSource.Owner.HandCards.Contains(cardSource))
  37. {
  38. if (cardSource.CardNames.Contains("UlforceVeedramon"))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. }
  45. return false;
  46. }
  47. string effectName = $"Can digivolve to [UlforceVeedramon]";
  48. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: true, card: card, condition: Condition, effectName: effectName, cardCondition: CardCondition));
  49. }
  50. if (timing == EffectTiming.OnAllyAttack)
  51. {
  52. ActivateClass activateClass = new ActivateClass();
  53. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  54. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  55. activateClass.SetIsInheritedEffect(true);
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[When Attacking] If you have 7 or fewer cards in your hand, trigger <Draw 1>. (Draw 1 card from your deck.)";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.IsExistOnBattleArea(card))
  68. {
  69. if (card.Owner.HandCards.Count <= 7)
  70. {
  71. if (card.Owner.LibraryCards.Count >= 1)
  72. {
  73. return true;
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  82. }
  83. }
  84. return cardEffects;
  85. }
  86. }