BT20_020.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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
  32. if(timing == EffectTiming.OnAllyAttack)
  33. {
  34. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  35. }
  36. #endregion
  37. #region When Digievolving
  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. bool CardEffectCondition(ICardEffect cardEffect)
  45. {
  46. return cardEffect != null;
  47. }
  48. string EffectDiscription()
  49. {
  50. 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.";
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. if (CardEffectCommons.IsOwnerTurn(card))
  57. {
  58. return true;
  59. }
  60. return false;
  61. }
  62. return false;
  63. }
  64. bool CanActivateCondition(Hashtable hashtable)
  65. {
  66. return true;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. CanNotPutFieldClass canNotPutFieldClass = new CanNotPutFieldClass();
  71. canNotPutFieldClass.SetUpICardEffect("Can't play Digimon or Tamers by effect", CanUseCondition1, card);
  72. canNotPutFieldClass.SetUpCanNotPutFieldClass(cardCondition: CardCondition, cardEffectCondition: CardEffectCondition1);
  73. card.Owner.Enemy.UntilOwnerTurnEndEffects.Add((_timing) => canNotPutFieldClass);
  74. ContinuousController.instance.PlaySE(GManager.instance.GetComponent<Effects>().DebuffSE);
  75. bool CanUseCondition1(Hashtable hashtable)
  76. {
  77. return true;
  78. }
  79. bool CardCondition(CardSource cardSource)
  80. {
  81. if (cardSource.Owner == card.Owner.Enemy)
  82. {
  83. if (cardSource.IsDigimon || cardSource.IsTamer)
  84. {
  85. return true;
  86. }
  87. }
  88. return false;
  89. }
  90. bool CardEffectCondition1(ICardEffect cardEffect)
  91. {
  92. return true;
  93. }
  94. if(card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Imperialdramon: Imperialdramon: Dragon Mode")) >= 1)
  95. {
  96. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  97. player: card.Owner.Enemy,
  98. destroySecurityCount: 1,
  99. cardEffect: activateClass,
  100. fromTop: true).DestroySecurity());
  101. }
  102. }
  103. }
  104. #endregion
  105. #region All Turns
  106. if(timing == EffectTiming.OnLoseSecurity)
  107. {
  108. ActivateClass activateClass1 = new ActivateClass();
  109. activateClass1.SetUpICardEffect("Delete 1 Digimon with as much or less DP as this Digimon", CanUseCondition1, card);
  110. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, 1, false, EffectDiscription1());
  111. activateClass1.SetHashString("ImperialDramon_BT20_020");
  112. cardEffects.Add(activateClass1);
  113. string EffectDiscription1()
  114. {
  115. 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.";
  116. }
  117. bool CanUseCondition1(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  120. {
  121. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanActivateCondition1(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. return true;
  133. }
  134. return false;
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  139. {
  140. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(13000,activateClass1))
  141. {
  142. return true;
  143. }
  144. }
  145. return false;
  146. }
  147. IEnumerator ActivateCoroutine1(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  150. {
  151. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectPermanentCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: maxCount,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: null,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Destroy,
  164. cardEffect: activateClass1);
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. }
  167. }
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }