BT18_085.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT18
  5. {
  6. public class BT18_085 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Shared
  12. #endregion
  13. #region Digivolution Cost Reduction
  14. if (timing == EffectTiming.None)
  15. {
  16. bool Condition()
  17. {
  18. return !CardEffectCommons.IsExistOnField(card);
  19. }
  20. int OpponentTrashColorCount()
  21. {
  22. List<CardColor> cardColors = new List<CardColor>();
  23. foreach (CardSource cardSource in card.Owner.Enemy.TrashCards)
  24. {
  25. cardColors.AddRange(cardSource.CardColors);
  26. }
  27. cardColors = cardColors.Distinct().ToList();
  28. return cardColors.Count;
  29. }
  30. bool PermanentCondition(Permanent targetPermanent)
  31. {
  32. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card);
  33. }
  34. bool CardSourceCondition(CardSource cardSource)
  35. {
  36. return cardSource == card;
  37. }
  38. bool RootCondition(SelectCardEffect.Root root)
  39. {
  40. return true;
  41. }
  42. cardEffects.Add(CardEffectFactory.ChangeDigivolutionCostStaticEffect<Func<int>>(
  43. changeValue: () => -OpponentTrashColorCount(),
  44. permanentCondition: PermanentCondition,
  45. cardCondition: CardSourceCondition,
  46. rootCondition: RootCondition,
  47. isInheritedEffect: false,
  48. card: card,
  49. condition: Condition,
  50. setFixedCost: false));
  51. }
  52. #endregion
  53. #region Your Turn
  54. if (timing == EffectTiming.None)
  55. {
  56. bool Condition()
  57. {
  58. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  59. CardEffectCommons.IsOwnerTurn(card);
  60. }
  61. int OpponentTrashColorCount()
  62. {
  63. List<CardColor> cardColors = new List<CardColor>();
  64. foreach (CardSource cardSource in card.Owner.Enemy.TrashCards)
  65. {
  66. cardColors.AddRange(cardSource.BaseCardColorsFromEntity);
  67. }
  68. cardColors = cardColors.Distinct().ToList();
  69. return cardColors.Count / 2;
  70. }
  71. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: OpponentTrashColorCount(),
  72. isInheritedEffect: false, card: card, condition: Condition));
  73. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000 * (OpponentTrashColorCount()),
  74. isInheritedEffect: false, card: card, condition: Condition));
  75. }
  76. #endregion
  77. return cardEffects;
  78. }
  79. }
  80. }