BT14_048.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT14
  4. {
  5. public class BT14_048 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnAllyAttack)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Digivolve this Digimon", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[When Attacking] If attacked a Digimon with higher DP than this Digimon, this Digimon may digivolve into 1 level 6 Digimon card with [Leomon] in its name in your hand for a digivolution cost of 6, ignoring its digivolution requirements.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.IsDigimon)
  23. {
  24. if (cardSource.ContainsCardName("Leomon"))
  25. {
  26. if (cardSource.HasLevel)
  27. {
  28. if (cardSource.Level == 6)
  29. {
  30. return true;
  31. }
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. if (CardEffectCommons.IsExistOnBattleArea(card))
  40. {
  41. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  42. {
  43. if (GManager.instance.attackProcess.DefendingPermanent != null)
  44. {
  45. if (GManager.instance.attackProcess.DefendingPermanent.DP > card.PermanentOfThisCard().DP)
  46. {
  47. return true;
  48. }
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. if (card.Owner.HandCards.Count >= 1)
  59. {
  60. return true;
  61. }
  62. }
  63. return false;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  68. targetPermanent: card.PermanentOfThisCard(),
  69. cardCondition: CanSelectCardCondition,
  70. payCost: true,
  71. reduceCostTuple: null,
  72. fixedCostTuple: null,
  73. ignoreDigivolutionRequirementFixedCost: 6,
  74. isHand: true,
  75. activateClass: activateClass,
  76. successProcess: null));
  77. }
  78. }
  79. if (timing == EffectTiming.None)
  80. {
  81. bool Condition()
  82. {
  83. if (CardEffectCommons.IsOwnerTurn(card))
  84. {
  85. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Leomon"))
  86. {
  87. return true;
  88. }
  89. }
  90. return false;
  91. }
  92. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 2000, isInheritedEffect: true, card: card, condition: Condition));
  93. }
  94. return cardEffects;
  95. }
  96. }
  97. }