BT5_044.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT5_044 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnMove)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("The moved Digimon gains Security Attack -3", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Opponent's Turn] When an opponent's Digimon moves from the breeding area to the battle area, it gains <Security Attack -3> (This Digimon checks 3 fewer security cards) for the turn.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (CardEffectCommons.IsOpponentTurn(card))
  32. {
  33. if (CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition))
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. Permanent movedPermanent = CardEffectCommons.GetMovedPermanentFromHashtable(hashtable);
  46. if (movedPermanent != null)
  47. {
  48. if (CardEffectCommons.IsPermanentExistsOnBattleArea(movedPermanent))
  49. {
  50. return true;
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. Permanent movedPermanent = CardEffectCommons.GetMovedPermanentFromHashtable(_hashtable);
  59. if (movedPermanent != null)
  60. {
  61. if (CardEffectCommons.IsPermanentExistsOnBattleArea(movedPermanent))
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: movedPermanent, changeValue: -3, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  64. }
  65. }
  66. }
  67. }
  68. if (timing == EffectTiming.None)
  69. {
  70. bool CardCondition(CardSource cardSource)
  71. {
  72. return cardSource.Owner == card.Owner.Enemy;
  73. }
  74. bool Condition()
  75. {
  76. if (CardEffectCommons.IsExistOnBattleArea(card))
  77. {
  78. if (CardEffectCommons.IsOwnerTurn(card))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. cardEffects.Add(CardEffectFactory.ChangeSecurityDigimonCardDPStaticEffect(
  86. cardCondition: CardCondition,
  87. changeValue: -3000,
  88. isInheritedEffect: false,
  89. card: card,
  90. condition: Condition,
  91. effectName: "Opponent's Security Digimon gains DP -3000"));
  92. }
  93. return cardEffects;
  94. }
  95. }