using CommonAI.Data; using CommonAI.Zone; using CommonAI.Zone.Helper; using CommonAI.Zone.Instance; using XmdsCommon.Plugin; using XmdsCommonServer.Plugin; using XmdsCommonServer.XLS.Data; using XmdsCommonSkill.Plugin.Buffs; using XmdsCommonSkill.Plugin.Interface; namespace XmdsCommonSkill.Plugin.Skills.Warrior { /// /// 三技能 : 3 基类 /// 消耗n点怒气值,怒气不足不能放 (前置添加了一个蓄力动作)n秒读条施法, 蓄力T秒双手持剑由怀中向地面戳击,向指定方向释放出一道熔岩爆裂 /// (线性伤害,一条直线上所有敌人同时受到伤害,并减速n%,T秒)(类似DOTA牛的沟壑)(长方形9*3.5) /// 蓄力期间妖兽免伤提升x%,并且是霸体状态 伤害和击打距离随蓄力时长递增,满蓄可以整个区域小击飞及额外妖兽伤害加成n%(蓄力打的逻辑和5技能类似,可以提前点击释放) /// (特效等会有变化,并且特效指示器可否做成随着时间往前蔓延式的)【蓄力生成法术弄成蔓延式的,对应特效也要配合(指示器+伤害法术特效),满蓄的击飞逻辑放在满蓄时间对应的序列时间点上。】 /// public class Warrior_110300 : XmdsSkillBase { private static readonly int ID = 110300; public override int SkillID { get { return ID; } } protected static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.ZS_SPEEDDOWN_3; //释放动作期间免伤 protected static readonly int Buff_INGORE_DAMAGE = (int)XmdsBuffBase.XmdsBuffList.ZS_INGOREDMG_3; /// 伤害倍数:固定值_百分比(满蓄力伤害) protected XmdsSkillValue mValueSet1; // 基础-减速数值,减速时间,免伤比例,免伤时间 protected XmdsSkillValue mValueSet5; //蓄力N毫秒以上即满蓄,满蓄法术ID, 满蓄妖兽伤害提升 protected XmdsSkillValue mValueSet8; //技能释放时间 protected long mSkillLaunchTime; //蓄力伤害 - 根据蓄力时间/总蓄力伤害 protected int mSpecialDamge; //是否满蓄 protected bool mIsFullStorage; //技能等级 protected int mSkillLv; protected override void OnSkillDamagePerEvent(BattleParams param) { param.SkillDamageAdd = mValueSet1.GetValue(param.GameSkill.SkillLevel); param.SkillDamagePer = mSpecialDamge; // 满蓄后额外的一段伤害 if(param.Hitter.mUnit.IsMonster && mIsFullStorage) { param.SkillDamagePer += mValueSet8.GetValue(this.mSkillLv, 3); } } protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template) { //注册减速 XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID); var buff = pack.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.MoveSpeedDown) as XmdsBuff_MoveSpeedDown; buff.ChangePercent = -this.GetBaseSpeedDownValue(info); BuffTemplate bt = pack.mBuffTemplate; bt.LifeTimeMS = this.GetBaseSpeedDownTime(info); bt.IsHarmful = true; pack.BindTemplateAndDispose(); unit.RegistSendBuff(bt); //注册免伤buff XmdsBuffPack pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_INGORE_DAMAGE); XmdsBuff_PropChange buff2 = (XmdsBuff_PropChange)pack2.GetXmdsBuff(0); buff2.CurentChangeType = XmdsVirtual.UnitAttributeType.AllDmgReduce; buff2.CurrentValue = mValueSet5.GetValue(info.SkillLevel, 3); // 免伤比例 buff2.IsPercent = true; BuffTemplate bt2 = pack2.mBuffTemplate; bt2.IsHarmful = true; bt2.LifeTimeMS = mValueSet5.GetValue(info.SkillLevel, 4); pack2.BindTemplateAndDispose(); unit.RegistSendBuff(bt2); //注册增加法术的监听 unit.RegistTrySendSpellEvent(OnTrySendSpell, info); unit.RegistLaunchSkillOver(OnLaunchSkillOver, info); this.mSkillLv = info.SkillLevel; } //获取基础减速效果-减速值 public virtual int GetBaseSpeedDownValue(GameSkill info) { return mValueSet5.GetValue(info.SkillLevel, 1); } //获取基础减速效果-减速时间 public virtual int GetBaseSpeedDownTime(GameSkill info) { return mValueSet5.GetValue(info.SkillLevel, 2); } // 增加释放法术的监听 private void OnTrySendSpell(GameSkill skill, XmdsVirtual launcher, LaunchSpell launch, ref SpellTemplate spell, ref JSGCreateSpellData createData, ref float startX, ref float startY) { //满蓄击飞 if(skill.SkillID == spell.ID && this.mIsFullStorage) { LaunchSpell launchSpll = ComSpellTemplate.Instance().GetCardSpell(mValueSet8.GetValue(this.mSkillLv, 2)); launcher.mUnit.Parent.unitLaunchSpell(XmdsSkillType.active, launcher.mUnit, launchSpll, launcher.mUnit.X, launcher.mUnit.Y); } } //蓄力变化式技能【法术基础时间,法术最大时间,蓄力最大时间,蓄力时间转法术时间系数,满蓄伤害提升,满蓄妖兽伤害提升】 private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill) { //特殊的延展式攻击的法术时间 if (skill.ActionIndex <= 0) { this.mSkillLaunchTime = CommonLang.CUtils.localTimeMS; this.mSpecialDamge = mValueSet1.GetValueExt(this.mSkillLv); this.mIsFullStorage = true; launcher.mUnit.AddBuff(Buff_INGORE_DAMAGE); } else { //蓄力时间 int storageTime = (int)(CommonLang.CUtils.localTimeMS - this.mSkillLaunchTime); float stroagePrecent = (float)storageTime / mValueSet8.GetValue(this.mSkillLv, 1); this.mIsFullStorage = stroagePrecent >= 1.0f; this.mSpecialDamge = (int)(mValueSet1.GetValueExt(this.mSkillLv) * (System.Math.Min(1.0f, stroagePrecent))); launcher.mUnit.removeBuff(Buff_INGORE_DAMAGE); } return 0; } protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit) { base.OnSkillDataChange(gs, unit); this.mSkillLv = gs.SkillLevel; //减速 var buff1 = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_MoveSpeedDown; buff1.ChangePercent = GetBaseSpeedDownValue(gs); var bt1 = unit.GetRegistBuff(Buff_ID); bt1.LifeTimeMS = GetBaseSpeedDownTime(gs); //免伤 var buff2 = unit.GetRegisBuffVirtual(Buff_INGORE_DAMAGE) as XmdsBuff_PropChange; buff2.CurrentValue = mValueSet5.GetValue(gs.SkillLevel, 3); var bt2 = unit.GetRegistBuff(Buff_INGORE_DAMAGE); bt2.LifeTimeMS = mValueSet5.GetValue(gs.SkillLevel, 4); } protected override void OnSkillLogicEvent(BattleParams param) { base.OnSkillLogicEvent(param); if(param.Attacker.mUnit != param.Hitter.mUnit) { param.Hitter.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit); } } protected override void OnInitConfig() { XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID); InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet); // 基础-减速数值 InitData(data, out mValueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5); //蓄力技能规则 InitData(data, out mValueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8); } protected int GetBufEffect(int nCount) { if (nCount >= 5) { return 3; } else if (nCount >= 3) { return 2; } else if (nCount > 0) { return 1; } return 0; } } }