using CommonAI.Data; using CommonAI.Zone; using CommonAI.Zone.Formula; using CommonAI.Zone.Instance; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills; namespace XmdsCommonSkill.Plugin.Buffs { /// /// Description: 测试buff /// public class XmdsBuff_TestBuff : XmdsBuffBase { public int ChangeValue = 0; public bool RemoveOnHit = false; private int UUID = 0; protected override void OnBindTemplate(ref BuffTemplate buffTemplate) { //DOT类技能首帧无效. buffTemplate.FirstTimeEnable = false; base.OnBindTemplate(ref buffTemplate); } public override int GetAbilityID() { return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.JSGTestBuff; } protected override int OnBuffHit(XmdsVirtual hitter, XmdsVirtual attacker, CommonAI.Zone.Formula.AttackSource source, ref XmdsVirtual.AtkResult result) { //为自己加血. hitter.AddHP(ChangeValue, attacker.mUnit); return 0; } public override void BuffBegin(XmdsVirtual hitter, XmdsVirtual attacker, InstanceUnit.BuffState state) { if (RemoveOnHit) { UUID = hitter.RegistOnHitDamage(OnUnitHitEvent, null); } } public override void BuffEnd(XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace) { if (RemoveOnHit) { hitter.UnRegistOnHitDamage(UUID); } } //被打监听. protected virtual float OnUnitHitEvent(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source, ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch) { return damage; } protected override void OnDispose() { base.OnDispose(); } } }