BT19_048.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_048 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel3 &&
  16. targetPermanent.TopCard.EqualsTraits("Royal Base");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  20. card: card, condition: null));
  21. }
  22. #endregion
  23. #region Your Turn
  24. if (timing == EffectTiming.WhenRemoveField)
  25. {
  26. List<Permanent> removedPermanents = new List<Permanent>();
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Place face up on bottom of security, to prevent other [Royal Base] trait digimon from leaving the battle area", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[All Turns] When any of your other Digimon with the [Royal Base] trait would leave the battle area by effects, by placing this Digimon face up as the bottom security card, they don't leave.";
  34. }
  35. bool HasOtherRoyalBaseDigimon(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  38. {
  39. if (permanent != card.PermanentOfThisCard())
  40. return permanent.TopCard.EqualsTraits("Royal Base");
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  47. {
  48. if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, HasOtherRoyalBaseDigimon))
  49. {
  50. if (CardEffectCommons.IsByEffect(hashtable, null))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(HasOtherRoyalBaseDigimon);
  61. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  62. && card.Owner.CanAddSecurity(activateClass);
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable hashtable)
  65. {
  66. yield return ContinuousController.instance.StartCoroutine(new IPutSecurityPermanent(
  67. card.PermanentOfThisCard(),
  68. CardEffectCommons.CardEffectHashtable(activateClass), toTop: false, isFaceup: true).PutSecurity());
  69. if (card.Owner.SecurityCards.Contains(card))
  70. {
  71. foreach (Permanent removed in removedPermanents)
  72. {
  73. removed.willBeRemoveField = false;
  74. removed.HideHandBounceEffect();
  75. removed.HideDeckBounceEffect();
  76. removed.HideWillRemoveFieldEffect();
  77. }
  78. }
  79. }
  80. }
  81. #endregion
  82. #region All Turns - ESS
  83. if (timing == EffectTiming.None)
  84. {
  85. bool Condition()
  86. {
  87. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  88. }
  89. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  90. }
  91. #endregion
  92. #region All Turns - Security
  93. if (timing == EffectTiming.None)
  94. {
  95. string EffectDiscription()
  96. {
  97. return "(Security) [All Turns] All of your [Royal Base] trait Digimon get +1000 DP.";
  98. }
  99. bool Condition()
  100. {
  101. return CardEffectCommons.IsExistInSecurity(card, false);
  102. }
  103. bool PermanentCondition(Permanent permanent)
  104. {
  105. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  106. {
  107. if (permanent.TopCard.EqualsTraits("Royal Base"))
  108. {
  109. return true;
  110. }
  111. }
  112. return false;
  113. }
  114. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  115. permanentCondition: PermanentCondition,
  116. changeValue: 1000,
  117. isInheritedEffect: false,
  118. card: card,
  119. condition: Condition,
  120. effectName: EffectDiscription));
  121. }
  122. #endregion
  123. return cardEffects;
  124. }
  125. }
  126. }