123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.Instance;
- using CommonLang;
- using System;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using XmdsCommonSkill.Plugin.Interface;
- using static XmdsCommonSkill.Plugin.Interface.ComSpellTemplate;
- namespace XmdsCommonSkill.Plugin.Skills.Warrior
- {
- /// <summary>
- /// 四技能4-6(buff期间受到伤害每5%血量减少(不算回血,仅计算受到伤害量)向周围范围产生血气冲击,造成伤害(生命值系数))
- /// </summary>
- public class Warrior_110460 : Warrior_110450
- {
- private static int ID = 110460;
- //气血冲击伤害
- protected XmdsSkillValue mValueSet4;
- private static int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.HPReduce_Damage_4_6;
- //受伤统计
- private int mCurTotalDamage = 0;
- private long mPreReduceHPAddSpellTime = 0;
- private int mHPReduceTriggerSpell = 0;
- public override int SkillID { get { return ID; } }
- protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
- {
- base.OnInit(info, unit, ref template);
- // Buff3修改
- var pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- var buf = (XmdsBuff_Event_OnHitDamage)pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.Event_OnHitDamageEvent);
- buf.OnHitDamageEvent = OnUnitHit;
- pack.mBuffTemplate.LifeTimeMS = mValueSet6.GetValue(info.SkillLevel);
- var bt = pack.mBuffTemplate;
- pack.BindTemplateAndDispose();
- unit.RegistSendBuff(bt);
- unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
- unit.RegistCalThreatValue(OnHandleCalThreatValue, info, true);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- base.OnSkillDataChange(gs, unit);
- var bt = unit.GetRegistBuff(Buff_ID);
- bt.LifeTimeMS = mValueSet6.GetValue(gs.SkillLevel);
- }
- private void OnHandleCalThreatValue(XmdsVirtual attacker, XmdsVirtual hitter, AttackSource source, GameSkill gs, ref XmdsVirtual.AtkResult result)
- {
- if(source == null || source.Attack == null)
- {
- return;
- }
- XmdsAttackProperties atkProp = source.Attack.Properties as XmdsAttackProperties;
- if(atkProp == null)
- {
- return;
- }
-
- if(atkProp.DamagePerID == 2)
- {
- result.breakShieldValue = mValueSet4.GetValue(gs.TalentSkillLevel3, 3);
- }
- }
- protected override bool OnSkillFinalDamageModifyEvent(BattleParams param)
- {
- //MMO-16584 - sub- MMO-16524, 修改成最大生命伤害系数
- if (param.AtkProp.DamagePerID != 1)
- {
- int hpValue = CUtils.CastInt(param.Attacker.mUnit.MaxHP * XmdsUnitProp.PER * mValueSet4.GetValue(param.GameSkill.TalentSkillLevel3, 2));
- param.HitDamge = XmdsDamageCalculator.GetDamage(hpValue, param.Attacker, param.Hitter, param.Source);
- return true;
- }
- else
- {
- return base.OnSkillFinalDamageModifyEvent(param);
- }
- }
- private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
- {
- launcher.mUnit.AddBuff(Buff_ID, launcher.mUnit);
- this.mHPReduceTriggerSpell = Math.Max(1, CUtils.CastInt(launcher.MirrorProp.MaxHP * XmdsUnitProp.PER *
- mValueSet4.GetValue(info.TalentSkillLevel3, 1)));
- return 0;
- }
- public float OnUnitHit(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- mCurTotalDamage = mCurTotalDamage + (int)damage;
- //受到伤害大于 N ,创建法术
- if(mCurTotalDamage > this.mHPReduceTriggerSpell)
- {
- long lcurTime = CommonLang.CUtils.localTimeMS;
- //确保不密集触发
- if(lcurTime - mPreReduceHPAddSpellTime > 500 || lcurTime - mPreReduceHPAddSpellTime < 0)
- {
- mCurTotalDamage = 0;
- mPreReduceHPAddSpellTime = lcurTime;
- hitted.mUnit.Parent.unitLaunchSpell(XmdsSkillType.none, hitted.mUnit,
- ComSpellTemplate.Instance().GetSpellByID(XmdsSpellID.WARRIOR_4_6),
- hitted.mUnit.X, hitted.mUnit.Y, attacker.mUnit.ID);
- }
- }
- return damage;
- }
- protected override void OnInitConfig()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out mDamageReduce, XmdsSkillData.XmdsSkillDataKey.DmgRate);
- InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- InitData(data, out mValueSet3, XmdsSkillData.XmdsSkillDataKey.ValueSet3);
- InitData(data, out mValueSet4, XmdsSkillData.XmdsSkillDataKey.ValueSet4);
- // 扩展配置
- InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
- InitData(data, out mValueSet6, XmdsSkillData.XmdsSkillDataKey.ValueSet6);
- InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
- }
- }
- }
|