using System; using CommonAI.Data; using CommonAI.Zone; using CommonAI.Zone.Formula; 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.PassiveSkills.Remedy; using XmdsCommonSkill.Plugin.Skills.PetSkill; using static CommonAI.Zone.Instance.InstanceUnit; using XmdsCommonSkill.Plugin.Interface; namespace XmdsCommonSkill.Plugin.Skills.Warrior { /// /// 斩妖-战士2 /// public class ZhanYao_70011 : PetGiveSkillBase { private static readonly int ID = 70011; private static readonly int Buff_ID = (int)XmdsBuffBase.XmdsBuffList.ZHANYAO_ZS_2; private static readonly int Buff_IDEXT = (int)XmdsBuffBase.XmdsBuffList.ZHANYAO_ZS_S_2; /// 特殊效果触发概率 private XmdsSkillValue mSpecialEffectRate; //基础效果 private XmdsSkillValue mValueSet1; //特殊效果 private XmdsSkillValue mValueSet2; public override int SkillID { get { return ID; } } protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template) { var pack1 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID); var buff1 = pack1.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.PropChange) as XmdsBuff_PropChange; buff1.CurentChangeType = XmdsVirtual.UnitAttributeType.Defence; buff1.CurrentValue = mValueSet1.GetValue(info.SkillLevel, 1); buff1.IsPercent = true; var bt1 = pack1.mBuffTemplate; bt1.LifeTimeMS = mValueSet1.GetValue(info.SkillLevel, 2) + info.TalentSkillLevel3; bt1.IsHarmful = false; pack1.BindTemplateAndDispose(); unit.RegistSendBuff(bt1); var pack2 = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_IDEXT); var buff2 = pack2.GetXmdsBuff(XmdsBuffProperties.XmdsBuffAbility.Attack_AddHPEXT) as XmdsBuff_AttackAddHPExt; buff2.recoverHp = mValueSet2.GetValue(info.SkillLevel, 1) * XmdsUnitProp.PER; var bt2 = pack2.mBuffTemplate; bt2.LifeTimeMS = mValueSet2.GetValue(info.SkillLevel, 2);// + info.TalentSkillLevel3; bt2.IsHarmful = true; pack2.BindTemplateAndDispose(); unit.RegistSendBuff(bt2); this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent); unit.RegistTriggerPetSkillEvent(OnTriggerPetSkill, info); } protected override void OnSkillDataChange(GameSkill gs, XmdsVirtual unit) { Console.WriteLine("OnSkillDataChange: " + gs.TalentSkillLevel1 + ", " + gs.TalentSkillLevel2 + ", " + gs.TalentSkillLevel3); var buffData1 = unit.GetRegisBuffVirtual(Buff_ID) as XmdsBuff_PropChange; buffData1.CurrentValue = mValueSet1.GetValue(gs.SkillLevel, 1); var buf1 = unit.GetRegistBuff(Buff_ID); buf1.LifeTimeMS = mValueSet1.GetValue(gs.SkillLevel, 2) + gs.TalentSkillLevel3; var buffData2 = unit.GetRegisBuffVirtual(Buff_IDEXT) as XmdsBuff_AttackAddHPExt; buffData2.recoverHp = mValueSet2.GetValue(gs.SkillLevel, 1) * XmdsUnitProp.PER; //var buf2 = unit.GetRegistBuff(Buff_IDEXT); //buf2.LifeTimeMS = mValueSet2.GetValue(gs.SkillLevel, 2) + gs.TalentSkillLevel3; } private bool OnTriggerPetSkill(GameSkill info, ref InstanceUnit.SkillState skill, XmdsVirtual launcher, ref InstanceUnit.LaunchSkillParam param) { //玩家释放技能,增加效果,并触发机制 skill.SetDecreaseTotalTimeMS(info.TalentSkillLevel1); base.PlayerLauncherSkillOverExt(launcher, ComSpellTemplate.XmdsSpellID.ZHANYAO_ZS_2); return true; } private void OnUseFormluaTypeEvent(BattleParams param) { param.UseDamageType = CommonAI.Data.DamageType.None; } protected override void OnSkillLogicEvent(BattleParams param) { param.Hitter.mUnit.AddBuff(Buff_ID, param.Attacker.mUnit); if (param.Hitter.RandomPercent(this.mSpecialEffectRate.GetValue() + param.GameSkill.TalentSkillLevel2)) { param.Hitter.mUnit.AddBuff(Buff_IDEXT, param.Attacker.mUnit); } } protected override void OnInitConfig() { XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID); InitData(data, out mSpecialEffectRate, XmdsSkillData.XmdsSkillDataKey.DmgRate); InitData(data, out mValueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet); InitData(data, out mValueSet2, XmdsSkillData.XmdsSkillDataKey.ValueSet2); } } }