BT16_049.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_049 : 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 Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.CardNames.Contains("Upamon"))
  17. {
  18. return true;
  19. }
  20. return false;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  23. permanentCondition: PermanentCondition,
  24. digivolutionCost: 0,
  25. ignoreDigivolutionRequirement: false,
  26. card: card,
  27. condition: null));
  28. }
  29. #endregion
  30. #region Your turn - when another digimon is played, +1 memory
  31. if (timing == EffectTiming.OnEnterFieldAnyone)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[Your Turn] [Once per Turn] When one of your other Digimon is played or digivolves, if that Digimon is yellow or has the [Free] trait, gain 1 memory.";
  40. }
  41. bool PermanentCondition(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent != card.PermanentOfThisCard())
  46. {
  47. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.ContainsTraits("Free"))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition) || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
  60. {
  61. if (CardEffectCommons.IsOwnerTurn(card))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. bool CanActivateCondition(Hashtable hashtable)
  70. {
  71. if (CardEffectCommons.IsExistOnBattleArea(card))
  72. {
  73. if (card.Owner.CanAddMemory(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable hashtable)
  81. {
  82. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  83. }
  84. }
  85. #endregion
  86. #region Inherited Effect
  87. if (timing == EffectTiming.None)
  88. {
  89. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect<Func<int>>(
  90. changeValue: () => 1000,
  91. isInheritedEffect: true,
  92. card: card,
  93. condition: null));
  94. }
  95. #endregion
  96. return cardEffects;
  97. }
  98. }
  99. }