BT5_031.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 BT5_031 : 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("Return 1 Digimon to deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] If a Digimon card with [Garurumon] in its name (other than [KendoGarurumon]) is in this Digimon's digivolution cards, return 1 of your opponent's Digimon with an [On Deletion] effect to the bottom of its owner's deck. Trash all of the digivolution cards of that Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.HasOnDeletionEffect)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasGarurumonName) >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  55. {
  56. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectPermanentCondition,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: maxCount,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: null,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  69. cardEffect: activateClass);
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. }
  72. }
  73. }
  74. if (timing == EffectTiming.OnAllyAttack)
  75. {
  76. ActivateClass activateClass = new ActivateClass();
  77. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  78. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  79. activateClass.SetIsInheritedEffect(true);
  80. activateClass.SetHashString("Memory+1_BT5_031");
  81. cardEffects.Add(activateClass);
  82. string EffectDiscription()
  83. {
  84. return "[When Attacking] Gain 1 memory.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  89. }
  90. bool CanActivateCondition(Hashtable hashtable)
  91. {
  92. if (CardEffectCommons.IsExistOnBattleArea(card))
  93. {
  94. return true;
  95. }
  96. return false;
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  101. }
  102. }
  103. return cardEffects;
  104. }
  105. }