P_045.cs 4.1 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 P_045 : 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.None)
  14. {
  15. AddSkillClass addSkillClass = new AddSkillClass();
  16. addSkillClass.SetUpICardEffect("Your Digimon gain Decoy", CanUseCondition, card);
  17. addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
  18. addSkillClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(addSkillClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. if (CardEffectCommons.IsExistOnBattleArea(card))
  23. {
  24. return true;
  25. }
  26. return false;
  27. }
  28. bool PermanentCondition(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. {
  32. if (permanent != card.PermanentOfThisCard())
  33. {
  34. if (permanent.TopCard.HasSameCardName(card.PermanentOfThisCard().TopCard))
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool CardSourceCondition(CardSource cardSource)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
  45. {
  46. if (cardSource.Owner == card.Owner)
  47. {
  48. if (cardSource == cardSource.PermanentOfThisCard().TopCard)
  49. {
  50. if (PermanentCondition(cardSource.PermanentOfThisCard()))
  51. {
  52. return true;
  53. }
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
  60. {
  61. if (_timing == EffectTiming.WhenPermanentWouldBeDeleted)
  62. {
  63. bool Condition()
  64. {
  65. return CardSourceCondition(cardSource);
  66. }
  67. bool CanSelectPermanentCondition(Permanent permanent)
  68. {
  69. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, cardSource))
  70. {
  71. if (permanent != cardSource.PermanentOfThisCard())
  72. {
  73. if (permanent.TopCard.CardColors.Contains(CardColor.Black) || permanent.TopCard.CardColors.Contains(CardColor.White))
  74. {
  75. if (permanent.willBeRemoveField)
  76. {
  77. return true;
  78. }
  79. }
  80. }
  81. }
  82. return false;
  83. }
  84. string EffectDiscription()
  85. {
  86. return "<Decoy (Black/White)> (When one of your other black or white Digimon would be deleted by an opponent's effect, you may delete this Digimon to prevent that deletion.)";
  87. }
  88. cardEffects.Add(CardEffectFactory.DecoySelfEffect(isInheritedEffect: false, card: cardSource, condition: Condition, permanentCondition: CanSelectPermanentCondition, effectName: "Decoy (Black/White)", effectDiscription: EffectDiscription(), rootCardEffect: addSkillClass));
  89. }
  90. return cardEffects;
  91. }
  92. }
  93. return cardEffects;
  94. }
  95. }