Monster_5270302.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using CommonAI.Zone;
  2. using XmdsCommonServer.Plugin;
  3. using XmdsCommonServer.Plugin.Units;
  4. using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
  5. using XmdsCommonServer.XLS.Data;
  6. namespace XmdsCommonSkill.Plugin.Skills.Monster
  7. {
  8. /// <summary>
  9. /// 巢穴驯兽师 - 召唤黑狼: 召唤一头黑狼.
  10. /// </summary>
  11. public class Monster_5270302 : XmdsSkillBase
  12. {
  13. public static int ID = 5270302;
  14. public static int SummonUnit_ID = 52704;
  15. /// 可召唤最大个数.
  16. public static XmdsSkillValue SummonLimit;
  17. /// 单次召唤数量(目前固定为1).
  18. public static XmdsSkillValue SumUnitCount;
  19. public override int SkillID { get { return ID; } }
  20. protected override void OnRegistEvent()
  21. {
  22. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  23. base.OnRegistEvent();
  24. }
  25. private void OnUseFormluaTypeEvent(BattleParams param)
  26. {
  27. param.UseDamageType = CommonAI.Data.DamageType.None;
  28. }
  29. protected override void OnSkillLogicEvent(BattleParams param)
  30. {
  31. if (param.AtkProp.DamagePerID == 1)
  32. {
  33. callMonster(param, SummonUnit_ID);
  34. }
  35. }
  36. /// <summary>
  37. /// 召唤黑狼.
  38. /// </summary>
  39. protected void callMonster(BattleParams param, int templateID)
  40. {
  41. UnitInfo info = XmdsBattleSkill.GetUnitInfo(templateID);
  42. int r = this.GetTargetFormulaValue(param.GameSkill.SkillLevel, SummonLimit);
  43. int numPerTime = this.GetTargetFormulaValue(param.GameSkill.SkillLevel, SumUnitCount);
  44. XmdsVirtual_Monster monster = param.Attacker as XmdsVirtual_Monster;
  45. XmdsVirtual su = null;
  46. if (monster != null)
  47. {
  48. int cur = monster.GetSummonUnitListCount();
  49. while (cur + numPerTime > r)
  50. {
  51. su = monster.GetFirstTimesupSummonUnit();
  52. if (su != null)
  53. {
  54. (su.mUnit).kill(null, false);
  55. cur--;
  56. }
  57. }
  58. }
  59. for (int i = 0; i < numPerTime; i++)
  60. {
  61. var pos = param.Attacker.mUnit.Parent.PathFinder.FindNearRandomMoveableNode(
  62. param.Attacker.mUnit.RandomN,
  63. param.Attacker.mUnit.X,
  64. param.Attacker.mUnit.Y,
  65. 2, true);
  66. AddUnitEvent aue = null;
  67. //控制生命周期.
  68. info.LifeTimeMS = 10000;
  69. var unit = (param.Attacker.mUnit.Parent.AddUnit(
  70. info, info.Name,
  71. param.Attacker.mUnit.Force, param.Attacker.GetUnitLv(),
  72. pos.PosX,
  73. pos.PosY,
  74. param.Attacker.mUnit.Direction,
  75. out aue,
  76. param.Attacker.mUnit)) as XmdsInstanceMonster;
  77. XmdsVirtual zv = (unit.Virtual) as XmdsVirtual;
  78. unit.guardUnit(param.Attacker.mUnit);
  79. if (monster != null)
  80. {
  81. monster.AddSummonUnitList(unit.Virtual as XmdsVirtual);
  82. }
  83. }
  84. }
  85. protected override void OnInitSkillParam()
  86. {
  87. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  88. InitData(data, out SummonLimit, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  89. InitData(data, out SumUnitCount, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
  90. }
  91. }
  92. }