ST20_10.cs 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //ST20-10 Agumon
  4. namespace DCGO.CardEffects.ST20
  5. {
  6. public class ST20_10 : 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. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return (targetPermanent.TopCard.HasAdventureTraits || targetPermanent.TopCard.HasHeroTraits) && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 2;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region Warp Digivolution
  22. if (timing == EffectTiming.None)
  23. {
  24. bool enoughTamerColours()
  25. {
  26. List<CardSource> tamerCards = new List<CardSource>();
  27. foreach (Permanent permanent in card.Owner.GetBattleAreaPermanents())
  28. {
  29. if (permanent.IsTamer)
  30. {
  31. tamerCards.Add(permanent.TopCard);
  32. }
  33. }
  34. return Combinations.GetDifferenetColorCardCount(tamerCards) >= 3;
  35. }
  36. bool Condition()
  37. {
  38. if (CardEffectCommons.IsOwnerTurn(card) && CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, (permanent) => permanent.IsDigimon && permanent.HasDP && permanent.DP >= 10000))
  41. {
  42. return true;
  43. }
  44. return enoughTamerColours();
  45. }
  46. return false;
  47. }
  48. bool PermanentCondition(Permanent targetPermanent)
  49. {
  50. return targetPermanent == card.PermanentOfThisCard();
  51. }
  52. bool CardCondition(CardSource cardSource)
  53. {
  54. if (cardSource != null)
  55. {
  56. //compared to the code I was copying from (ST8-04), removed a check that owner matched between cardsource and card, as that should be handled by whose hand the card is in. If this breaks, try putting it back.
  57. if (card.Owner.HandCards.Contains(cardSource))
  58. {
  59. return cardSource.EqualsCardName("WarGreymon");
  60. }
  61. }
  62. return false;
  63. }
  64. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: true, card: card, condition: Condition, cardCondition: CardCondition));
  65. }
  66. #endregion
  67. #region Reboot - ESS
  68. if (timing == EffectTiming.None)
  69. {
  70. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  71. }
  72. #endregion
  73. return cardEffects;
  74. }
  75. }
  76. }