BT7_024.cs 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_024 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 1 for each opponent's Digimon with no digivolution cards", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] For each Digimon your opponent has with no digivolution cards, <Draw 1>. (Draw 1 card from your deck.)";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. int count = CardEffectCommons.MatchConditionOpponentsPermanentCount(card, (permanent) => permanent.IsDigimon && permanent.HasNoDigivolutionCards);
  32. if (count >= 1)
  33. {
  34. if (card.Owner.LibraryCards.Count >= 1)
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. int count = CardEffectCommons.MatchConditionOpponentsPermanentCount(card, (permanent) => permanent.IsDigimon && permanent.HasNoDigivolutionCards);
  45. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, count, activateClass).Draw());
  46. }
  47. }
  48. if (timing == EffectTiming.None)
  49. {
  50. bool AttackerCondition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.Level == 3)
  55. {
  56. if (permanent.TopCard.HasLevel)
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. bool Condition()
  65. {
  66. if (CardEffectCommons.IsExistOnBattleArea(card))
  67. {
  68. if (CardEffectCommons.IsOpponentTurn(card))
  69. {
  70. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardTraits.Contains("Hybrid")) >= 1)
  71. {
  72. return true;
  73. }
  74. }
  75. }
  76. return false;
  77. }
  78. cardEffects.Add(CardEffectFactory.CanNotAttackStaticEffect(attackerCondition: AttackerCondition, defenderCondition: null, isInheritedEffect: false, card: card, condition: Condition, effectName: "Opponent's level 3 Digimon can't Attack"));
  79. }
  80. return cardEffects;
  81. }
  82. }