123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- using CommonLang;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using XmdsCommon.Plugin;
- using XmdsCommonServer.Plugin;
- using XmdsCommonServer.Plugin.XmdsSkillTemplate.DamageCalculator;
- using XmdsCommonServer.XLS.Data;
- using XmdsCommonSkill.Plugin.Buffs;
- using XmdsCommonSkill.Plugin.Skills;
- namespace XmdsCommonSkill.Plugin.PassiveSkills.Monster
- {
- /// <summary>
- /// 狂暴 生命值低于50时触发,赤虎妖伤害大幅上升,自身移动速度大幅下降 一个增加自身伤害同时降低自身速度的BUFF
- /// </summary>
- public class Monster_601011 : XmdsPassiveSkillBase
- {
- /// <summary>
- ///ID.
- /// </summary>
- public static int ID = 601011;
- /// <summary>
- /// BUFF时间. 姚晟:填一个很长的数值,90000秒这样
- /// </summary>
- public static int Buff_Time = 90000000;
-
- public static int Buff_ID = 601011;
- /// <summary>
- /// BUFF 攻击增加.
- /// </summary>
- public static XmdsSkillValue Buff_Value_1;
- /// <summary>
- /// BUFF 减速
- /// </summary>
- public static XmdsSkillValue Buff_Value_2;
- public static int Condition_1 = 5000;
- /// <summary>
- /// 是否使用.
- /// </summary>
- private bool HasDone = false;
- private int mUUID = 0;
- public override int SkillID
- {
- get { return ID; }
- }
- protected override void OnInit(GameSkill skillInfo, XmdsVirtual owner)
- {
- XmdsBuffPack pack = XmdsBuffFactory.GetInstance().GetXmdsBuffPack(Buff_ID);
- var bufflist = pack.GetXmdsBuffList();
- if (bufflist.Count >= 2)
- {
- //攻击增加.
- var propChange = (XmdsBuff_PropChange)bufflist[0];
- propChange.CurentChangeType = XmdsVirtual.UnitAttributeType.Attack;
- propChange.CurrentValue = this.GetTargetFormulaValue(skillInfo.SkillLevel, Buff_Value_1);
- propChange.IsPercent = true;
- //防御增加.
- var buff_speed = (XmdsBuff_MoveSpeedDown)bufflist[1];
- buff_speed.ChangePercent = -this.GetTargetFormulaValue(skillInfo.SkillLevel, Buff_Value_2);
- propChange.IsPercent = true;
- }
- BuffTemplate bt = pack.mBuffTemplate;
- bt.IsHarmful = false;
- bt.LifeTimeMS = Buff_Time;
-
- pack.BindTemplateAndDispose();
- owner.RegistSendBuff(bt);
- //注册招架监听.
- mUUID = owner.RegistOnHitDamage(OnHandleOnHitDamage, skillInfo, true);
- }
- private float OnHandleOnHitDamage(float damage, XmdsVirtual hitter, XmdsVirtual attacker, AttackSource source,
- ref XmdsVirtual.AtkResult result, DamageType damageType, GameSkill skill, ref bool isEndDispatch)
- {
- if (HasDone == false)
- {
- int v1 = CUtils.CastInt(hitter.mUnit.MaxHP * (Condition_1 * 1.0f / XmdsDamageCalculator.PERER));
- //小于指定血量.
- if (hitter.mUnit.CurrentHP - damage < v1)
- {
- HasDone = true;
- //触发技能效果.
- hitter.mUnit.AddBuff(Buff_ID, hitter.mUnit);
- CommonAI.Zone.LaunchSpell ls = new CommonAI.Zone.LaunchSpell();
- ls.SpellID = SkillID;
- //播放声音特效.
- //hitter.mUnit.Parent.unitLaunchSpell(hitter.mUnit, ls,
- // hitter.mUnit.X, hitter.mUnit.Y,
- // hitter.mUnit.ID);
- }
- }
- return damage;
- }
- protected override void OnDispose(XmdsVirtual owner)
- {
- owner.UnRegistOnHitDamage(mUUID);
- }
- protected override void OnInitSkillParam()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- InitData(data, out Buff_Value_1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- InitData(data, out Buff_Value_2, XmdsSkillData.XmdsSkillDataKey.ValueSet2);
- }
- }
- }
|