Pet_80300.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using CommonAI.Data;
  2. using CommonAI.Zone;
  3. using CommonAI.Zone.Formula;
  4. using CommonAI.Zone.Helper;
  5. using CommonLang;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using XmdsCommon.Plugin;
  12. using XmdsCommonServer.Plugin;
  13. using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
  14. using XmdsCommonServer.XLS.Data;
  15. using XmdsCommonSkill.Plugin.Interface;
  16. using XmdsCommonSkill.Plugin.Skills;
  17. namespace XmdsCommonSkill.Plugin.PassiveSkills.Pet20200515
  18. {
  19. /// <summary>
  20. /// 宠物装备被动:受击几率触发 -》 圆形范围持续伤害
  21. /// </summary>
  22. ///
  23. class Pet_80300 : PetEquipSkillBase
  24. {
  25. /// 技能ID.
  26. private static int ID = 80300;
  27. public override int SkillID { get { return ID; } }
  28. //持续伤害
  29. protected XmdsSkillValue mDamage;
  30. //内部变量
  31. private int mUUID_1 = 0;
  32. private int mUUID_2 = 0;
  33. //绑定法术
  34. LaunchSpell mBindSpell;
  35. protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
  36. {
  37. mUUID_1 = owner.RegistOnHitDamage(OnHandleHitDamage, skillInfo, true);
  38. mUUID_2 = owner.RegistCalDamage(OnCallDamageProcess, skillInfo, false);
  39. }
  40. protected override void OnDispose(XmdsVirtual owner)
  41. {
  42. owner.UnRegistOnHitDamage(mUUID_1);
  43. owner.UnRegistCalDamage(mUUID_2);
  44. }
  45. private float OnHandleHitDamage(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
  46. ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
  47. {
  48. if (damage > 0 && base.IsTrigger(attacker, skill.SkillLevel))
  49. {
  50. hitted.mUnit.Parent.unitLaunchSpell(XmdsSkillType.none, hitted.mUnit, mBindSpell,
  51. hitted.mUnit.X, hitted.mUnit.Y, hitted.mUnit.ID);
  52. }
  53. return damage;
  54. }
  55. public virtual bool OnCallDamageProcess(XmdsVirtual attacker, XmdsVirtual hitter, AttackSource source, GameSkill gs,
  56. ref XmdsCommonServer.Plugin.XmdsVirtual.AtkResult result, ref int damage)
  57. {
  58. int damageBase = CUtils.CastInt(attacker.MirrorProp.GetFinalAttack(hitter.mUnit.IsMonster) * XmdsUnitProp.PER * mDamage.GetValue(gs.SkillLevel));
  59. damage = XmdsDamageCalculator.GetDamage(damageBase, attacker, hitter, source);
  60. return true;
  61. }
  62. protected override void OnInitConfig(GameSkill skillInfo)
  63. {
  64. XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(this.SkillID);
  65. XmdsSkillValue triggerInterval, triggerRate, bindEffectSpell; ;
  66. InitData(data, out triggerInterval, XmdsSkillData.XmdsSkillDataKey.ValueSet);
  67. InitData(data, out triggerRate, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
  68. InitData(data, out bindEffectSpell, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
  69. InitData(data, out mDamage, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
  70. base.initEquipSkillBase(triggerInterval, triggerRate, skillInfo.SkillLevel);
  71. mBindSpell = ComSpellTemplate.Instance().GetSpellBySpellID(bindEffectSpell.GetValue());
  72. if (mBindSpell == null)
  73. {
  74. log.Error("Pet_80300找不到绑定特效法术ID:" + bindEffectSpell.GetValue());
  75. }
  76. }
  77. }
  78. }