BT6_029.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 BT6_029 : 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("Trash digivolution cards from opponent's all Digimon and gain Memory", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Trash 1 digivolution card from the bottom of all of your opponent's Digimon. Then, gain 1 memory for each of your opponent's Digimon with no digivolution cards.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DigivolutionCards.Count((cardSource) => !cardSource.CanNotTrashFromDigivolutionCards(activateClass)) >= 1)
  28. {
  29. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. return true;
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  50. {
  51. if (isExistOnField(card))
  52. {
  53. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  54. {
  55. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  56. {
  57. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  58. {
  59. if (CanSelectPermanentCondition(selectedPermanent))
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: false, activateClass: activateClass));
  62. }
  63. }
  64. }
  65. int count = card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.HasNoDigivolutionCards);
  66. if (count >= 1)
  67. {
  68. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(count, activateClass));
  69. }
  70. }
  71. }
  72. }
  73. }
  74. if (timing == EffectTiming.None)
  75. {
  76. int count()
  77. {
  78. return card.Owner.Enemy.GetBattleAreaDigimons().Count((permanent) => permanent.HasNoDigivolutionCards);
  79. }
  80. bool Condition()
  81. {
  82. if (CardEffectCommons.IsExistOnBattleArea(card))
  83. {
  84. if (CardEffectCommons.IsOwnerTurn(card))
  85. {
  86. if (count() >= 1)
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect<Func<int>>(changeValue: () => count(), isInheritedEffect: false, card: card, condition: Condition));
  95. }
  96. return cardEffects;
  97. }
  98. }