123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using CommonAI.Zone;
- using CommonAI.Zone.Instance;
- using CommonLang;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- namespace XmdsCommonSkill.Plugin.Buffs
- {
- public class XmdsBuff_Damage : XmdsBuffBase
- {
- /// <summary>
- ///攻击值
- /// </summary>
- public int mDamageValue = 0; // 伤害固定值
- public int mDamagePer = 0; // 伤害百分比
- public override int GetAbilityID()
- {
- return (int)XmdsCommon.Plugin.XmdsBuffProperties.XmdsBuffAbility.Damage;
- }
- public override void CopyTo(UnitBuff other)
- {
- var ret = other as XmdsBuff_Damage;
- ret.mDamageValue = this.mDamageValue;
- ret.mDamagePer = this.mDamagePer;
- base.CopyTo(other);
- }
- protected override void OnBindTemplate(ref BuffTemplate buffTemplate)
- {
- //DOT类技能首帧无效.
- base.OnBindTemplate(ref buffTemplate);
- }
- protected override void OnBuffBegin(XmdsCommonServer.Plugin.XmdsVirtual hitter, XmdsCommonServer.Plugin.XmdsVirtual attacker, InstanceUnit.BuffState state)
- {
-
- }
- protected override void OnBuffEnd(XmdsCommonServer.Plugin.XmdsVirtual hitter, InstanceUnit.BuffState state, bool replace)
- {
-
- }
- protected override int OnBuffHit(XmdsVirtual hitter, XmdsVirtual attacker, CommonAI.Zone.Formula.AttackSource source, ref XmdsVirtual.AtkResult result)
- {
- if (this.mDamageValue != 0 || this.mDamagePer != 0)
- {
- return GetFinalDamage(attacker, hitter, source);
- }
- return base.OnBuffHit(hitter, attacker, source, ref result);
- }
- private int GetFinalDamage(XmdsVirtual attacker, XmdsVirtual hitter, CommonAI.Zone.Formula.AttackSource source)
- {
- int finalDamage = this.mDamageValue;
- if (this.mDamagePer > 0)
- {
- float attackFinal = attacker.MirrorProp.GetFinalAttack(hitter.mUnit.IsMonster) * XmdsUnitProp.PER * this.mDamagePer;
- finalDamage += XmdsDamageCalculator.GetDamage((int)attackFinal, attacker, hitter, null);
- }
- return finalDamage;
- }
- }
- }
|