123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using CommonAI.Data;
- using CommonAI.Zone;
- using CommonAI.Zone.Formula;
- 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.XLS.Data;
- /// <summary>
- /// 治疗【1】技能 1 基类
- /// 向一个方向丢出巨大的幻化扇子,到达最大距离时原地旋转2S,伤害分为2个部分,
- /// 飞行过程,旋转,造成伤害自身恢复损失生命值的n%(7-8)
- /// </summary>
- ///
- namespace XmdsCommonSkill.Plugin.Skills.Remedy
- {
- public class Remedy_510100 : RemedySkillBase
- {
- private static readonly int ID = 510100;
- public override int SkillID { get { return ID; } }
- // 伤害倍数:固定值_百分比
- protected XmdsSkillValue valueSet1;
- //扩展配置
- protected XmdsSkillValue valueSet5; //基础治疗值, 最大治疗次数
- //当前总治疗次数
- protected int mBaseHealTimes;
- protected override void OnInit(GameSkill info, XmdsVirtual unit, ref SkillTemplate template)
- {
- base.OnInit(info, unit, ref template);
- unit.RegistLaunchSkillOver(OnLaunchSkillOver, info);
- this.RegistEvent(EventType.UseFormluaType, OnUseFormluaTypeEvent);
- }
- protected virtual void OnUseFormluaTypeEvent(BattleParams param)
- {
- param.UseDamageType = base.AutoGetDamageType(param, CommonAI.Data.DamageType.None);
- }
- protected virtual int OnLaunchSkillOver(GameSkill info, XmdsCommonServer.Plugin.XmdsVirtual launcher, CommonAI.Zone.Instance.InstanceUnit.SkillState state)
- {
- info.mHitUnits.Clear();
- this.mBaseHealTimes = 0;
- return 0;
- }
- protected bool GetDamagePer(BattleParams param)
- {
- int hitNums = param.GameSkill.mHitUnits.Get(param.Hitter.mUnit.ID);
- param.SkillDamageAdd = valueSet1.GetValue(param.GameSkill.SkillLevel);
- param.SkillDamagePer = valueSet1.GetValueExt(param.GameSkill.SkillLevel);
- param.GameSkill.mHitUnits.Put(param.Hitter.mUnit.ID, hitNums + 1);
- return hitNums <= 0;
- }
- /** 自疗恢复已损失生命百分百 */
- protected virtual float GetHealValue(BattleParams param)
- {
- return valueSet5.GetValue(param.GameSkill.SkillLevel, 1);
- }
- protected override void OnSkillDamagePerEvent(BattleParams param)
- {
- bool firstHit = GetDamagePer(param);
- if (mBaseHealTimes >= valueSet5.GetValue(param.GameSkill.SkillLevel, 2))
- {
- return;
- }
- if (param.Attacker.mUnit.CurrentHP < param.Attacker.mUnit.MaxHP && firstHit)
- {
- int addHP = CUtils.CastInt((param.Attacker.mUnit.MaxHP - param.Attacker.mUnit.CurrentHP)
- * XmdsUnitProp.PER * GetHealValue(param));
- param.Attacker.AddHP(Math.Max(1, addHP), param.Attacker.mUnit);
- mBaseHealTimes++;
- }
- }
- protected override void OnInitConfig()
- {
- XmdsSkillData data = XmdsDataMgr.GetInstance().GetXmdsSkillData(ID);
- base.InitBaseConfig(data);
- InitData(data, out valueSet1, XmdsSkillData.XmdsSkillDataKey.ValueSet);
- //扩展配置
- InitData(data, out valueSet5, XmdsSkillData.XmdsSkillDataKey.ValueSet5);
- }
- }
- }
|