BT20_020.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. namespace DCGO.CardEffects.BT20
  9. {
  10. public class BT20_020 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region Alternate Digivolution
  16. if (timing == EffectTiming.None)
  17. {
  18. bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.EqualsCardName("Imperialdramon: Dragon Mode");
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  23. }
  24. #endregion
  25. #region Pierce
  26. if(timing == EffectTiming.OnDetermineDoSecurityCheck)
  27. {
  28. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region Raid
  32. if(timing == EffectTiming.OnAllyAttack)
  33. {
  34. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  35. }
  36. #endregion
  37. #region When Digivolving
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Gains raid, piercing, trash security stack", CanUseCondition, card);
  42. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  43. cardEffects.Add(activateClass);
  44. string EffectDiscription()
  45. {
  46. return "[When Digivolving] Your opponent can't play Digimon or Tamers by effects until the end of their turn. Then, if [Imperialdramon: Dragon Mode] is in this Digimon's digivolution cards, trash your opponent's top security card.";
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  51. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. CanNotPutFieldClass canNotPutFieldClass = new CanNotPutFieldClass();
  60. canNotPutFieldClass.SetUpICardEffect("Can't play Digimon or Tamers by effect", CanUseCondition1, card);
  61. canNotPutFieldClass.SetUpCanNotPutFieldClass(cardCondition: CardCondition, cardEffectCondition: CardEffectCondition);
  62. card.Owner.Enemy.UntilOwnerTurnEndEffects.Add((_timing) => canNotPutFieldClass);
  63. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  64. bool CanUseCondition1(Hashtable hashtable)
  65. {
  66. return true;
  67. }
  68. bool CardCondition(CardSource cardSource)
  69. {
  70. return cardSource.IsDigimon || cardSource.IsTamer || cardSource.IsDigiEgg;
  71. }
  72. bool CardEffectCondition(ICardEffect cardEffect)
  73. {
  74. return cardEffect != null &&
  75. cardEffect.EffectSourceCard.Owner == card.Owner.Enemy;
  76. }
  77. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Imperialdramon: Dragon Mode")) >= 1)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  80. player: card.Owner.Enemy,
  81. destroySecurityCount: 1,
  82. cardEffect: activateClass,
  83. fromTop: true).DestroySecurity());
  84. }
  85. }
  86. }
  87. #endregion
  88. #region All Turns
  89. if(timing == EffectTiming.OnLoseSecurity)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Delete 1 Digimon with as much or less DP as this Digimon", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  94. activateClass.SetHashString("ImperialDramon_BT20_020");
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[All Turns] [Once Per Turn] When your opponent's security stack is removed from, delete 1 of their Digimon with as much or less DP as this Digimon.";
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  103. {
  104. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  114. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition);
  115. }
  116. bool CanSelectPermanentCondition(Permanent permanent)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  119. {
  120. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(card.PermanentOfThisCard().DP,activateClass))
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. IEnumerator ActivateCoroutine(Hashtable hashtable)
  128. {
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  130. {
  131. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  132. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: maxCount,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: null,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Destroy,
  144. cardEffect: activateClass);
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. }
  147. }
  148. }
  149. #endregion
  150. return cardEffects;
  151. }
  152. }
  153. }