XmdsInstanceUtils.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using CommonAI.Zone;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using XmdsCommon.Plugin;
  7. namespace XmdsCommonServer.Plugin.Units
  8. {
  9. public class XmdsInstanceUtils
  10. {
  11. public static bool IsDebuff(XmdsBuffProperties.XmdsBuffAbility ability)
  12. {
  13. if (ability == XmdsBuffProperties.XmdsBuffAbility.FROZEN
  14. || ability == XmdsBuffProperties.XmdsBuffAbility.STUN
  15. || ability == XmdsBuffProperties.XmdsBuffAbility.Silent
  16. || ability == XmdsBuffProperties.XmdsBuffAbility.Sap
  17. || ability == XmdsBuffProperties.XmdsBuffAbility.Nothingness
  18. || ability == XmdsBuffProperties.XmdsBuffAbility.Fear
  19. || ability == XmdsBuffProperties.XmdsBuffAbility.JINGU
  20. || ability == XmdsBuffProperties.XmdsBuffAbility.Mocking
  21. || ability == XmdsBuffProperties.XmdsBuffAbility.MoveSpeedDown)
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. public static bool IsControlBuff(BuffTemplate buff)
  28. {
  29. // buff属性
  30. if (buff.IsSilent || !buff.IsCanMove || buff.MakeStun)
  31. {
  32. return true;
  33. }
  34. XmdsBuffProperties zb = buff.Properties as XmdsBuffProperties;
  35. if (zb == null || zb.BuffAbilityList == null)
  36. {
  37. return false;
  38. }
  39. // 能力属性
  40. List<XmdsBuffProperties.XmdsBuffAbilityNode> list = zb.BuffAbilityList;
  41. for (int i = 0; i < list.Count; i++)
  42. {
  43. if (XmdsInstanceUtils.IsControlAbilityBuff(list[i].ability))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. private static bool IsControlAbilityBuff(XmdsBuffProperties.XmdsBuffAbility ability)
  51. {
  52. if (ability == XmdsBuffProperties.XmdsBuffAbility.FROZEN || ability == XmdsBuffProperties.XmdsBuffAbility.STUN
  53. || ability == XmdsBuffProperties.XmdsBuffAbility.JINGU || ability == XmdsBuffProperties.XmdsBuffAbility.Silent
  54. || ability == XmdsBuffProperties.XmdsBuffAbility.Mocking)
  55. {
  56. return true;
  57. }
  58. return false;
  59. }
  60. /// <summary>
  61. /// </summary>
  62. /// <param name="怪物和人物对于控制的概念不太一样,比如嘲讽。所以需要分开"></param>
  63. /// <returns></returns>
  64. public static bool IsControlBuff_Monster(BuffTemplate buff)
  65. {
  66. // buff属性
  67. if (buff.IsSilent || !buff.IsCanMove || buff.MakeStun)
  68. {
  69. return true;
  70. }
  71. XmdsBuffProperties zb = buff.Properties as XmdsBuffProperties;
  72. if (zb == null || zb.BuffAbilityList == null)
  73. {
  74. return false;
  75. }
  76. // 能力属性
  77. List<XmdsBuffProperties.XmdsBuffAbilityNode> list = zb.BuffAbilityList;
  78. for (int i = 0; i < list.Count; i++)
  79. {
  80. if (XmdsInstanceUtils.IsControlAbilityBuff_Monster(list[i].ability))
  81. {
  82. return true;
  83. }
  84. }
  85. return false;
  86. }
  87. private static bool IsControlAbilityBuff_Monster(XmdsBuffProperties.XmdsBuffAbility ability)
  88. {
  89. if (ability == XmdsBuffProperties.XmdsBuffAbility.FROZEN || ability == XmdsBuffProperties.XmdsBuffAbility.STUN
  90. || ability == XmdsBuffProperties.XmdsBuffAbility.JINGU || ability == XmdsBuffProperties.XmdsBuffAbility.Silent)
  91. {
  92. return true;
  93. }
  94. return false;
  95. }
  96. }
  97. }