using CommonAI.Zone.Helper; using CommonAI.Zone; using CommonAI.Zone.Instance; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator; using XmdsCommonServer.XLS.Data; using XmdsCommonSkill.Plugin.Buffs; using XmdsCommonSkill.Plugin.PassiveSkills.Remedy; using System.Diagnostics; using CommonLang; namespace XmdsCommonSkill.Plugin.Skills.Remedy { /// /// 治疗 二技能: 2 基类 /// 向X码范围内的友方(包括自己)释放一个绿色的风精灵,精灵飞到队友身上,持续恢复奶妈攻击力的百分之X血量 /// (值不是动态变化的,在释放那一刻已经结算好,只有重伤效果可以即刻影响) /// 回血机制通过法术触发伤害实现 /// public class Remedy_510200 : RemedySkillBase { private static readonly int ID = 510200; public override int SkillID { get { return ID; } } //回血buff private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.REMEDY_2_0_ADDHP; //回血持续时间 protected XmdsSkillValue buffTime; // 回血系数 : 固定值_百分比 protected XmdsSkillValue valueSet; protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template) { base.OnInit(info, unit, ref template); //// Buff修改 var pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID); var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.AddHP) as XmdsBuff_AddHP; buff.ChangeValue = 0;// CUtils.CastInt(unit.MirrorProp.MaxAttack * XmdsUnitProp.PER * valueSet.GetValue(info.SkillLevel, 1)); var bt = pack.mBuffTemplate; bt.LifeTimeMS = buffTime.GetValue(info.SkillLevel); bt.IsHarmful = true; pack.BindTemplateAndDispose(); unit.RegistSendBuff(bt); unit.RegistLaunchSkillOver(OnLaunchSkillOver, info); this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent); } protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit) { var bt = unit.GetRegistBuff(Buff_ID); bt.LifeTimeMS = buffTime.GetValue(gs.SkillLevel); } protected virtual void OnUseFormluaTypeEvent(BattleParams param) { if (param.Attacker.IsAllies(param.Hitter, true, true)) { //友军无伤害,只加buff param.UseDamageType = CommonAI.Data.DamageType.None; } else { param.UseDamageType = CommonAI.Data.DamageType.Damage; } } private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state) { info.mHitUnits.Clear(); return 0; } protected override void OnSkillDamagePerEvent(BattleParams param) { param.SkillDamageAdd = valueSet.GetValue(param.GameSkill.SkillLevel, 2); param.SkillDamagePer = valueSet.GetValueExt(param.GameSkill.SkillLevel, 2); } protected void AddHpBuff(BattleParams param) { var buff = param.Attacker.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_AddHP; int changePer = CUtils.CastInt(param.Attacker.MirrorProp.MaxAttack * XmdsUnitProp.PER * valueSet.GetValueExt(param.GameSkill.SkillLevel, 1)); buff.ChangeValue = valueSet.GetValue(param.GameSkill.SkillLevel, 1) + changePer; param.Hitter.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit); param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, 1); } protected override void OnSkillLogicEvent(BattleParams param) { if (param.Attacker.IsAllies(param.Hitter, true, true) && !param.GameSkill.mHitUnits.ContainsKey(param.Hitter.mUnit.ID)) { AddHpBuff(param); } } protected override void OnInitConfig() { XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID); base.InitBaseConfig(data); InitData(data, out buffTime, XmdsSkillData.XmdsSkillDataKey.DmgRate); InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet); } } }