Veemon_BT16_017.cs 3.7 KB

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