123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using CommonAI.Data;
- using CommonAI.Zone;
- 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.Plugin.XmdsSkillTemplate.Skills;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using XmdsCommonSkill.Plugin.PassiveSkills.Remedy;
- using static CommonAI.Zone.Instance.InstanceUnit;
- namespace XmdsCommonSkill.Plugin.Skills.Remedy
- {
- /// <summary>
- /// 治疗, 四技能 4 : 基类
- /// 向一个指定区域的中心抛出绿色的水灵,水灵打到小区域回血,冒出向四周4个方向蔓延的藤曼(类似婕拉和大树大招的结合),
- /// 造成伤害并禁锢1.5s(可攻击可释放非位移技能,不能移动) 编辑器
- /// 伤害帧备注:1:藤蔓伤害; 2:强化1治疗; 3:特殊挂毒区域
- /// </summary>
- public class Remedy_510400 : RemedySkillBase
- {
- private static readonly int ID = 510400;
- protected static readonly int Buff_JINGU = (int)XmdsBuffBase.XmdsBuffList.REMEDY_4_JINGU;
- /// 伤害倍数, 回血 : 固定值_百分比
- protected XmdsSkillValue valueSet;
- //扩展配置
- protected XmdsSkillValue valueSet5;
- //毒爆范围,毒爆基础伤害,毒爆百分比伤害[1:10,10,500]
- //protected XmdsSkillValue valueSet8;
- //毒爆伤害,等级:层数伤害百分比
- protected XmdsSkillValue valueSet8;
- public override int SkillID { get { return ID; } }
- protected override void OnSkillDamagePerEvent(BattleParams param)
- {
- param.SkillDamageAdd = valueSet.GetValue(param.GameSkill.SkillLevel);
- param.SkillDamagePer = valueSet.GetValueExt(param.GameSkill.SkillLevel);
- }
- protected override bool OnSkillFinalDamageModifyEvent(BattleParams param)
- {
- if (param.GameSkill.mHitUnits.ContainsKey(param.Hitter.mUnit.ID))
- {
- return true;
- }
- param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, 1);
- var playerCache = param.Attacker.GetPlayerCache() as PlayerCache_Remedy;
- if(playerCache == null)
- {
- //职业技能给怪物用了
- if (param.Attacker.mUnit.IsPlayer)
- {
- log.Error("Remedy_510400玩家缓存信息异常:" + param.Attacker.mUnit.PlayerUUID);
- }
- return false;
- }
- //攻击到了,检测毒爆
- BuffState buffState = param.Hitter.mUnit.GetBuffByIDAndSender(Remedy_510601.Buff_POISON, param.Attacker.mUnit.ID);
- if (buffState != null)
- {
- int finalLayer = buffState.OverlayLevel + 1 + this.GetSkillValue(AbstractSkillType.Value1);
- //伤害百分比
- int atkPer = finalLayer * valueSet8.GetValue(param.GameSkill.SkillLevel, finalLayer);
- int attackTemp = (int)(param.Attacker.MirrorProp.GetFinalAttack(param.Hitter.mUnit.IsMonster) / XmdsDamageCalculator.PERER * atkPer);
- //基础伤害
- int calcDmg = XmdsDamageCalculator.GetDamage(attackTemp, param.Attacker, param.Hitter, null);
- //最终强化伤害
- int strongEffect = (playerCache.mPoisonBreakDmgAdd + (finalLayer >= buffState.Data.MaxOverlay ? playerCache.mPoisonBreakFullDmgAdd : 0));
- int finalDmg = CUtils.CastInt(calcDmg * (1.0f + strongEffect / XmdsDamageCalculator.PERER));
- param.Hitter.AddHP(-finalDmg, param.Attacker.mUnit, DamageSource.RemedyPoison);
- param.Hitter.mUnit.removeBuffBySender(Remedy_510601.Buff_POISON, param.Attacker.mUnit.ID);
- int breakBuffID = this.GetSkillValue(AbstractSkillType.Value3);
- if (breakBuffID > 0)
- {
- BuffState buff = param.Hitter.mUnit.AddBuff(breakBuffID, param.Attacker.mUnit, 0, false, false, false, 0, finalLayer);
- if(buff != null)
- {
- buff.SetLayerLevel((byte)(Math.Min(this.GetSkillValue(AbstractSkillType.Value2), finalLayer)));
- }
- }
- }
- return false;
- }
- protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
- {
- base.OnInit(info, unit, ref template);
- //禁锢buf
- XmdsBuffPack pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_JINGU);
- BuffTemplate bt2 = pack2.mBuffTemplate;
- bt2.IsHarmful = true;
- bt2.LifeTimeMS = valueSet5.GetValue(info.SkillLevel);
- pack2.BindTemplateAndDispose();
- unit.RegistSendBuff(bt2);
- this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
- unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
- }
- protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit)
- {
- base.OnSkillDataChange(gs, unit);
- var bt = unit.GetRegistBuff(Buff_JINGU);
- bt.LifeTimeMS = valueSet5.GetValue(gs.SkillLevel);
- }
- protected virtual int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState skill)
- {
- //执行毒爆检测(改成攻击到触发)
- //var playerCache = launcher.GetPlayerCache() as PlayerCache_Remedy;
- //if(playerCache == null)
- //{
- // //职业技能给怪物用了
- // if(launcher.mUnit.IsPlayer)
- // {
- // log.Error("Remedy_510400玩家缓存信息异常:" + launcher.mUnit.PlayerUUID);
- // }
- //}
- //else
- //{
- // playerCache.TriggerPoisonEffect(valueSet8.GetValue(info.SkillLevel, 2), valueSet8.GetValue(info.SkillLevel, 3),
- // valueSet8.GetValue(info.SkillLevel, 1),
- // this.GetSkillValue(AbstractSkillType.Value1),
- // this.GetSkillValue(AbstractSkillType.Value3),
- // this.GetSkillValue(AbstractSkillType.Value2));
- //}
- info.mHitUnits.Clear();
- return 0;
- }
- protected void OnUseFormluaTypeEvent(BattleParams param)
- {
- if (param.AtkProp.DamagePerID == 2)
- {
- param.UseDamageType = base.AutoGetDamageType(param);
- }
- else
- {
- param.UseDamageType = CommonAI.Data.DamageType.Damage;
- }
- }
- protected override void OnSkillLogicEvent(BattleParams param)
- {
- if (param.AtkProp.DamagePerID == 1)//藤蔓
- {
- param.Hitter.mUnit.AddBuff(Buff_JINGU, param.Attacker.mUnit);
- }
- }
- protected override void OnInitConfig()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- base.InitBaseConfig(data);
- InitData(data, out valueSet, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- //扩展配置
- InitData(data, out valueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
- InitData(data, out valueSet8, XmdsSkillData.XmdsSkillDataKey.ValueSet8);
- }
- }
- }
|