RB1_024.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 RB1_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("This Digimon gains Pierce and suspend 1 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] This Digimon gains <Piercing> for the turn. Then, if a Digimon card with [Angoramon] in its name is in this Digimon's digivolution cards, suspend 1 of your opponent's Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleArea(card);
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  36. {
  37. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainPierce(
  38. targetPermanent: card.PermanentOfThisCard(),
  39. effectDuration: EffectDuration.UntilEachTurnEnd,
  40. activateClass: activateClass));
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.PermanentOfThisCard().DigivolutionCards.Count(cardSource => cardSource.ContainsCardName("Angoramon")) >= 1)
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: null,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Tap,
  58. cardEffect: activateClass);
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. }
  61. }
  62. }
  63. }
  64. if (timing == EffectTiming.OnEndBattle)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  69. activateClass.SetIsInheritedEffect(true);
  70. activateClass.SetHashString("TrashSecurity_RB1_024");
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[Your Turn][Once Per Turn] When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. if (CardEffectCommons.IsExistOnBattleArea(card))
  79. {
  80. if (CardEffectCommons.IsOwnerTurn(card))
  81. {
  82. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  83. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  84. if (CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(
  85. hashtable: hashtable,
  86. winnerCondition: WinnerCondition,
  87. loserCondition: LoserCondition,
  88. isOnlyWinnerSurvive: false))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. return true;
  101. }
  102. return false;
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  107. player: card.Owner.Enemy,
  108. destroySecurityCount: 1,
  109. cardEffect: activateClass,
  110. fromTop: true).DestroySecurity());
  111. }
  112. }
  113. return cardEffects;
  114. }
  115. }