ForgeBeemon_BT19_048.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class ForgeBeemon_BT19_048 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel3 &&
  17. targetPermanent.TopCard.EqualsTraits("Royal Base");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region Your Turn
  25. if (timing == EffectTiming.WhenRemoveField)
  26. {
  27. List<Permanent> removedPermanents = new List<Permanent>();
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Place face up on bottom of security, to prevent other [Royal Base] trait digimon from leaving the battle area", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. 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.";
  35. }
  36. bool HasOtherRoyalBaseDigimon(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. if (permanent != card.PermanentOfThisCard())
  41. return permanent.TopCard.EqualsTraits("Royal Base");
  42. }
  43. return false;
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  48. {
  49. if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, HasOtherRoyalBaseDigimon))
  50. {
  51. if (CardEffectCommons.IsByEffect(hashtable, null))
  52. {
  53. return true;
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanActivateCondition(Hashtable hashtable)
  60. {
  61. removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(HasOtherRoyalBaseDigimon);
  62. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  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. }