Monster_10490404.cs 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. 
  2. using XmdsCommonServer.XLS.Data;
  3. using XmdsCommonServer.Plugin;
  4. using CommonAI.Zone;
  5. using XmdsCommon.Plugin;
  6. using XmdsCommonSkill.Plugin.Buffs;
  7. namespace XmdsCommonSkill.Plugin.Skills.Monster
  8. {
  9. /// <summary>
  10. /// 哺育者(琪尔嫚) - 潜伏: 哺育者潜入地下,变得不可被攻击,潜伏时间持续8秒.
  11. /// 期间哺育者将从地底对随机敌人发起攻击,造成x%倍物攻伤害和额外y点物理伤害.
  12. /// 实现方式:技能初始化后将10490414设置为false,潜伏施放后将原有技能置为false,BUFF结束时再将技能激活.
  13. /// </summary>
  14. public class Monster_10490404 : XmdsSkillBase
  15. {
  16. /// <summary>
  17. /// 技能ID.
  18. /// </summary>
  19. public static int ID = 10490404;
  20. public static int BUFF_ID = 10490404;
  21. public static XmdsSkillValue DP_1;
  22. public override int SkillID { get { return ID; } }
  23. protected override void OnSkillDamagePerEvent(BattleParams param)
  24. {
  25. int ret = CalDamagePer(DP_1, param.GameSkill.SkillLevel);
  26. param.SkillDamagePer = ret;
  27. }
  28. protected override void OnRegistEvent()
  29. {
  30. this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
  31. base.OnRegistEvent();
  32. }
  33. private void OnUseFormluaTypeEvent(BattleParams param)
  34. {
  35. //该技能无伤害.
  36. param.UseDamageType = CommonAI.Data.DamageType.None;
  37. }
  38. protected override void OnSkillLogicEvent(BattleParams param)
  39. {
  40. //思路.上变身无敌BUFF,激活地底攻击技能,冻结其他技能。
  41. ActiveSkills(param.Attacker, false);
  42. //上无敌变身BUFF.
  43. XmdsBuff_Invincible buff = param.Attacker.GetRegisBuffVirtual(BUFF_ID) as XmdsBuff_Invincible;
  44. buff.OnHandleBuffEndEvent += ((hitter, state) =>
  45. {
  46. {
  47. //还原技能状态.
  48. ActiveSkills(hitter, true);
  49. }
  50. });
  51. param.Attacker.mUnit.AddBuff(BUFF_ID);
  52. }
  53. private void ActiveSkills(XmdsVirtual zv, bool active)
  54. {
  55. //冻结技能,保证地底时不再施放.
  56. zv.mUnit.SetSkillActive(10490401, active, true);
  57. zv.mUnit.SetSkillActive(10490402, active, true);
  58. zv.mUnit.SetSkillActive(10490403, active, true);
  59. zv.mUnit.SetSkillActive(10490404, active, true);
  60. //激活地底时攻击技能.
  61. zv.mUnit.SetSkillActive(10490414, !active);
  62. }
  63. protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
  64. {
  65. XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(BUFF_ID);
  66. BuffTemplate bt = pack.mBuffTemplate;
  67. bt.IsHarmful = false;
  68. pack.BindTemplateAndDispose();
  69. unit.RegistSendBuff(bt);
  70. }
  71. protected override void OnInitOver(XmdsVirtual unit, GameSkill skill)
  72. {
  73. //初始化时先将该技能冻结,避免正常状态时使用.
  74. unit.mUnit.SetSkillActive(10490414, false);
  75. }
  76. protected override void OnInitSkillParam()
  77. {
  78. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
  79. InitData(data, out DP_1, XmdsSkillData.XmdsSkillDataKey.DmgRate);
  80. }
  81. }
  82. }