BT18_044.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_044 : 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.IsLevel2 &&
  16. targetPermanent.TopCard.EqualsTraits("Royal Base");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
  20. card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Place 1 [Royal Base] trait Digimon face up as bottom security, add top security to hand", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[On Play] By placing 1 Digimon card with the [Royal Base] trait in your hand face up as your bottom security card, add your top security card to the hand.";
  33. }
  34. bool IsRoyalBaseDigimon(CardSource card)
  35. {
  36. return card.IsDigimon &&
  37. card.EqualsTraits("Royal Base");
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  46. && CardEffectCommons.HasMatchConditionOwnersHand(card, IsRoyalBaseDigimon)
  47. && card.Owner.CanAddSecurity(activateClass);
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. bool cardAdded = false;
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: IsRoyalBaseDigimon,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: 1,
  59. canNoSelect: true,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: CardSelected,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.PutSecurityBottom,
  65. cardEffect: activateClass);
  66. selectHandEffect.SetIsFaceup();
  67. yield return StartCoroutine(selectHandEffect.Activate());
  68. IEnumerator CardSelected(CardSource cardSource)
  69. {
  70. if (cardSource != null)
  71. cardAdded = true;
  72. yield return null;
  73. }
  74. if (cardAdded)
  75. {
  76. CardSource topCard = card.Owner.SecurityCards[0];
  77. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { topCard }, false, activateClass));
  78. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  79. player: card.Owner,
  80. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  81. activateClass).ReduceSecurity());
  82. }
  83. }
  84. }
  85. #endregion
  86. #region All Turns - ESS
  87. if (timing == EffectTiming.None)
  88. {
  89. bool Condition()
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. return true;
  94. }
  95. return false;
  96. }
  97. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  98. }
  99. #endregion
  100. #region All Turns - Security
  101. if (timing == EffectTiming.None)
  102. {
  103. string EffectDiscription()
  104. {
  105. return "(Security) [All Turns] All of your [Royal Base] trait Digimon get +1000 DP.";
  106. }
  107. bool Condition()
  108. {
  109. return CardEffectCommons.IsExistInSecurity(card, false);
  110. }
  111. bool PermanentCondition(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  114. {
  115. if (permanent.TopCard.EqualsTraits("Royal Base"))
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  123. permanentCondition: PermanentCondition,
  124. changeValue: 1000,
  125. isInheritedEffect: false,
  126. card: card,
  127. condition: Condition,
  128. effectName: EffectDiscription));
  129. }
  130. #endregion
  131. return cardEffects;
  132. }
  133. }
  134. }