ST20_07.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. //ST20 Tentomon
  5. namespace DCGO.CardEffects.ST20
  6. {
  7. public class ST20_07 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region alternative digivolution method
  13. if(timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. return permanent.Level == 2 && permanent.TopCard.HasAdventureTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 0, false, card, null));
  20. }
  21. #endregion
  22. #region Can't reduce digivolution costs
  23. if (timing == EffectTiming.None)
  24. {
  25. CannotReduceCostClass cannotReduceCostClass = new CannotReduceCostClass();
  26. cannotReduceCostClass.SetUpICardEffect("Opponent can't reduce digivolution costs", CanUseCondition, card);
  27. cannotReduceCostClass.SetUpCannotReduceCostClass(
  28. playerCondition: PlayerCondition,
  29. targetPermanentsCondition: TargetPermanentsCondition,
  30. cardCondition: CardCondition);
  31. cardEffects.Add(cannotReduceCostClass);
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.IsOpponentTurn(card))
  37. {
  38. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  39. {
  40. return true;
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool PlayerCondition(Player player)
  47. {
  48. if (player == card.Owner.Enemy)
  49. {
  50. return true;
  51. }
  52. return false;
  53. }
  54. bool TargetPermanentsCondition(List<Permanent> targetPermanents)
  55. {
  56. if (targetPermanents != null)
  57. {
  58. if (targetPermanents.Count((permanent) => permanent != null) >= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. bool CardCondition(CardSource cardSource)
  66. {
  67. return cardSource.IsPermanent;
  68. }
  69. }
  70. #endregion
  71. return cardEffects;
  72. }
  73. }
  74. }