BT23_083.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Fei
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_083 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. bool PermamentCondition(Permanent permanent)
  15. {
  16. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  17. && permanent.TopCard.HasRoyalBaseTraits || permanent.TopCard.HasCSTraits;
  18. }
  19. bool Condition()
  20. {
  21. return CardEffectCommons.IsOwnerTurn(card);
  22. }
  23. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOwnerDigimonConditionalEffect(
  24. effectDescription: "[Start of Your Main Phase] If you have a Digimon with the [Royal Base] or [CS] trait, gain 1 memory.",
  25. permamentCondition: PermamentCondition,
  26. condition: Condition,
  27. card: card));
  28. }
  29. #endregion
  30. #region All Turns
  31. if (timing == EffectTiming.OnAddSecurity)
  32. {
  33. ActivateClass activateClass = new ActivateClass();
  34. activateClass.SetUpICardEffect("By suspending this tamer, Gain 1 memory. then if you has 7- in hand, draw 1", CanUseCondition, card);
  35. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  36. cardEffects.Add(activateClass);
  37. string EffectDiscription()
  38. {
  39. return "[All Turns] When cards are placed face up in your security stack, if any of them have the [Zaxon] or [Royal Base] trait, by suspending this Tamer, gain 1 memory. Then, if you have 7 or fewer cards in your hand, <Draw 1>";
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. List<CardSource> securityCards = CardEffectCommons.GetCardSourcesFromHashtable(hashtable).Filter(SecurityCondition);
  44. return CardEffectCommons.IsExistOnBattleArea(card)
  45. && CardEffectCommons.CanTriggerWhenAddSecurity(hashtable, player => player == card.Owner)
  46. && securityCards.Count > 0;
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleArea(card)
  51. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  52. }
  53. bool SecurityCondition(CardSource cardSource)
  54. {
  55. return !cardSource.IsFlipped &&
  56. (cardSource.HasRoyalBaseTraits || cardSource.EqualsTraits("Zaxon"));
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable hashtable)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  61. if (card.Owner.CanAddMemory(activateClass)) yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  62. if (card.Owner.HandCards.Count <= 7) yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  63. }
  64. }
  65. #endregion
  66. #region Security
  67. if (timing == EffectTiming.SecuritySkill)
  68. {
  69. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  70. }
  71. #endregion
  72. return cardEffects;
  73. }
  74. }
  75. }