123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.Instance;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using System;
- using static CommonAI.Zone.Instance.InstanceUnit;
- using XmdsCommon.Plugin;
- using CommonAI.Zone;
- using XmdsCommonServer.Plugin.Units;
- using CommonAI.Zone.Formula;
- using XmdsCommonSkill.Plugin.Skills;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonSkill.Plugin.Skills.Remedy;
- using XmdsCommonSkill.Plugin.Skills.Magic;
- using CommonAI.Data;
- using CommonLang;
- using CommonAI.ZoneServer.JSGModule;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Remedy
- {
- /// <summary>
- /// 治疗被动
- /// 灵桓蝶舞:普攻(几率为n1%)或者特定技能技能(按数值要求:每个技能几率单配)
- /// 造成的每段伤害,会给目标施加n层毒伤,每层伤害为每T秒对目标造成施法单位攻击力的n3%伤害,持续T2秒,每次都会叠加层数,
- /// 并刷新存在CD,最多叠加n2层,当CD时间到了,全部层数一起消失。并且不同施法目标对同一个目标施加这个效果独立计算。
- /// </summary>
- class Remedy_510601 : XmdsPassiveSkillBase
- {
- /// 技能ID.
- public static readonly int ID = 510601;
- public override int SkillID { get { return ID; } }
- public static readonly int Buff_POISON = (int)XmdsBuffBase.XmdsBuffList.REMEDY_POISON; // 毒buff
- //毒伤buff时间,基础效果固伤_百分比系数,每层毒提供效果固伤_百分比系数
- private static XmdsSkillValue mValueSet1;
- //私有数据
- private PlayerCache_Remedy mPlayerCache;
- private int mUUID_1 = 0;
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- int skillLv = skillInfo.GetPassiveLevel();
- mPlayerCache = XmdsPlayerCache.PlayerTalnetInit(XmdsUnitPro.Priest, owner.mUnit, mValueSet1.GetValue(skillLv, 1), null) as PlayerCache_Remedy;
- owner.SetPlayerCache(mPlayerCache);
- // Buff1修改
- var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_POISON);
- var buff1 = pack1.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.RemedyPoison) as XmdsBuff_RemedyPoison;
- buff1.mBaseDmg = mValueSet1.GetValue(skillLv, 2);
- buff1.mBaseDmgPer = mValueSet1.GetValue(skillLv, 3);
- buff1.mDeeperDmg = mValueSet1.GetValue(skillLv, 4);
- buff1.mDeeperDmgPer = mValueSet1.GetValue(skillLv, 5);
- var bt1 = pack1.mBuffTemplate;
- bt1.LifeTimeMS = mValueSet1.GetValue(skillLv, 1);
- bt1.IsHarmful = false;
- pack1.BindTemplateAndDispose();
- owner.RegistSendBuff(bt1);
- mUUID_1 = owner.RegistOnHitOther(OnHitOther, skillInfo, true);
- }
- protected virtual float OnHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if (damage <= 0 || attacker.mUnit.IsMonster || source.FromSkillType == XmdsSkillType.cardSkill)//治疗
- {
- return damage;
- }
- if(mPlayerCache == null)
- {
- log.Error("Remedy_510601找不到玩家天赋缓存:" + attacker.mUnit.PlayerUUID);
- return damage;
- }
- if(source.Attack == null || source.Attack.Properties == null)
- {
- log.Error("Remedy_510601解析伤害技能异常1:"+ attacker.mUnit.PlayerUUID + ", " + attacker.mUnit.Parent.GetSceneID());
- return damage;
- }
- XmdsAttackProperties prop = (source.Attack.Properties as XmdsAttackProperties);
- //来自编辑器自行配置的攻击,调过叠毒检测
- if(prop.SkillTemplateID == XmdsBattleSkill.DefaultSkillScriptID)
- {
- return damage;
- }
- IntIntData poisonRate = mPlayerCache.GePoisonRateInfo(prop.SkillTemplateID);
- if(poisonRate == null)
- {
- log.Error("Remedy_510601解析伤害技能异常2:" + attacker.mUnit.PlayerUUID + ", " + prop.SkillTemplateID +
- ", " + attacker.mUnit.Parent.GetSceneID() + ", " + JSGModule.GetAttackSourceDes(source));
- return damage;
- }
- //挂毒buff
- if(poisonRate.value1 > 0 && poisonRate.value2 > 0 && attacker.mUnit.RandomN.Next(GlobalData.RATE_BASE) < (poisonRate.value1 + mPlayerCache.GetRateAddition()))
- {
- hitted.mUnit.AddBuff(Buff_POISON, attacker.mUnit, 0, false, false, false, 0, poisonRate.value2);
- mPlayerCache.RecordPoisonPlayer(hitted);
- }
- return damage;
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- int skillLv = gs.GetPassiveLevel();
- var bt = unit.GetRegistBuff(Buff_POISON);
- bt.LifeTimeMS = mValueSet1.GetValue(skillLv, 1);
- var buff = unit.GetRegisBuffVirtual(Buff_POISON) as XmdsBuff_RemedyPoison;
- buff.mBaseDmg = mValueSet1.GetValue(skillLv, 2);
- buff.mBaseDmgPer = mValueSet1.GetValue(skillLv, 3);
- buff.mDeeperDmg = mValueSet1.GetValue(skillLv, 4);
- buff.mDeeperDmgPer = mValueSet1.GetValue(skillLv, 5);
- mPlayerCache.RefreshConfig(mValueSet1.GetValue(skillLv, 1));
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.UnRegistOnHitOther(mUUID_1);
- XmdsPlayerCache.PlayerTalnetDestory(owner.mUnit);
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- }
- }
- /*
- * //2021.07.25 13.55这个被动已经完全替换成新效果了
- /// <summary>
- /// 治疗被动
- //表格配置: 下次普攻加成 1:1000;2:2000;3:3000;4:4000 移速提升,时间 1:2000,2000;2:2500,2000;3:3000,2000;4:4000,2000
- /// 灵桓蝶舞:释放三次技能下次普攻附带攻击力系数的增益,自身移速增加n% S秒
- /// </summary>
- class Remedy_510601 : XmdsPassiveSkillBase
- {
- /// 技能ID.
- public static int ID = 510601;
- private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.NORMAL_ATTACK_STRENGTH; // 下次普攻强化
- //攻击提升
- private static XmdsSkillValue mValueSet1;
- //速度提升值
- private static XmdsSkillValue mValueSet2;
- private int mSkillLaunchTimes = 0;
- private int mNormalAtkDmgAdd = 0;
- private int mUUID_1 = 0;
- private int mUUID_2 = 0;
- /// 获取技能ID.
- public override int SkillID {get{return ID;}}
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- // Buff1修改
- var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- var buff1 = pack1.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.MoveSpeedUp) as XmdsBuff_MoveSpeedUp;
- buff1.ChangePercent = mValueSet2.GetValue(skillInfo.GetPassiveLevel(), 1);
- var bt1 = pack1.mBuffTemplate;
- bt1.LifeTimeMS = mValueSet2.GetValue(skillInfo.GetPassiveLevel(), 2);
- bt1.IsHarmful = false;
- pack1.BindTemplateAndDispose();
- owner.RegistSendBuff(bt1);
- //收到攻击监听注册
- mUUID_1 = owner.RegistLaunchSkillOver(OnLaunchSkillOver, skillInfo, true);
- mUUID_2 = owner.RegistOnHitOther(OnHandleHitOther, skillInfo, true);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- var buff = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_MoveSpeedUp;
- buff.ChangePercent = mValueSet2.GetValue(gs.GetPassiveLevel(), 1);
- var bt = unit.GetRegistBuff(Buff_ID);
- bt.LifeTimeMS = mValueSet2.GetValue(gs.GetPassiveLevel(), 2);
- }
- private int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher,
- CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
- {
- if (skill.GetSkillType() == XmdsSkillType.active)
- {
- if (++this.mSkillLaunchTimes >= 3)
- {
- launcher.mUnit.AddBuff(Buff_ID);
- mNormalAtkDmgAdd = 2;
- this.mSkillLaunchTimes = 0;
- }
- }
- else if(skill.GetSkillType() == XmdsSkillType.normalAtk)
- {
- mNormalAtkDmgAdd--;
- }
- return 0;
- }
- //单位受击
- private float OnHandleHitOther(float damage, XmdsVirtual hitted, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if(source.FromSkillType == XmdsSkillType.normalAtk && mNormalAtkDmgAdd > 0)
- {
- damage += Math.Max(1, CUtils.CastInt(damage * XmdsUnitProp.PER * mValueSet1.GetValue(skill.GetPassiveLevel())));
- }
- return damage;
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.UnRegistLaunchSkillOver(mUUID_1);
- owner.UnRegistOnHitOther(mUUID_2);
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- }
- }
- */
- }
|