/// <summary> /// 挑出TimeOut的判定 /// </summary> /// <returns>The up.</returns> /// <param name="sk">Sk.</param> ConditionConfigure pickUp(RtSkData sk) { ConditionConfigure ConCfg = null; //获取激活的判定规则ID列表 int[] IncideCon = sk.skillCfg.Incite; if (IncideCon != null && IncideCon.Length > 0) { int len = IncideCon.Length; for (int i = 0; i < len; ++i) { //获取激活的判定规则ID int CondiId = IncideCon[i]; if (CondiId > 0) { ConCfg = ConModel.get(CondiId); if (ConCfg.ConditionType == SkConditionType.TimeOut) { break; } } } } return(ConCfg); }
/// <summary> /// 检测是否符合逻辑 /// </summary> /// <param name="sk">技能</param> /// <param name="cfg">条件配置技能</param> /// <param name="caster">施法者忽略</param> /// <param name="targets">目标者们忽略</param> public bool check(RtSkData sk, ConditionConfigure cfg, ServerNPC caster, IEnumerable <ServerNPC> targets) { #if DEBUG Utils.Assert(sk == null, "Skill is null in TimeoutCondition."); Utils.Assert(cfg == null, "ConditionConfigure is null in TimeoutCondition."); #endif bool Condi = false; /// /// 1. 判定是否符合关心的BeHead类型 /// var self = this.GetType(); var classAttribute = (ConditionAttribute)Attribute.GetCustomAttribute(self, typeof(ConditionAttribute)); if (cfg.ConditionType == classAttribute.Con) { RtFakeSkData fakeSk = sk as RtFakeSkData; if (fakeSk != null) { float TimeOut = cfg.Param1 * Consts.OneThousand; /// ///2.判定是否超时 /// Condi = fakeSk.aliveDur >= TimeOut; ///3.判定概率 if (Condi) { Condi = PseudoRandom.getInstance().happen(cfg.Prop); } } } return(Condi); }
/// <summary> /// 检测有没有斩首的逻辑,如果有伤害逻辑,就得要延迟执行 /// </summary> /// <returns><c>true</c>, if be head was checked, <c>false</c> otherwise.</returns> /// <param name="sk">Sk.</param> bool CheckBeHead(RtSkData sk) { bool hasInjury = false; ConditionConfigure ConCfg = null; //获取激活的判定规则ID列表 int[] IncideCon = sk.skillCfg.Incite; if (IncideCon != null && IncideCon.Length > 0) { int len = IncideCon.Length; for (int i = 0; i < len; ++i) { //获取激活的判定规则ID int CondiId = IncideCon[i]; if (CondiId > 0) { ConCfg = ConModel.get(CondiId); if (ConCfg.ConditionType == SkConditionType.BeHead || ConCfg.ConditionType == SkConditionType.BeHead2 || ConCfg.ConditionType == SkConditionType.BeHeadReset || ConCfg.ConditionType == SkConditionType.BeHead2Reset) { hasInjury = true; break; } } } } return(hasInjury); }
void EnterIncite(RtSkData sk, ServerNPC caster, IEnumerable <ServerNPC> targets) { ConditionConfigure ConCfg = null; //获取激活的判定规则ID列表 int[] IncideCon = sk.skillCfg.Incite; if (IncideCon != null && IncideCon.Length > 0) { int len = IncideCon.Length; for (int i = 0; i < len; ++i) { //获取激活的判定规则ID int CondiId = IncideCon[i]; if (CondiId > 0) { ConCfg = ConModel.get(CondiId); Utils.Assert(ConCfg == null, "Can't find Condition Configure. Condition ID = " + ConCfg); //判定器--- 如果成功就跳出 ICondition decider = Mgr.getImplement(ConCfg.ConditionType); bool suc = decider.check(sk, ConCfg, caster, targets); if (suc) { ServerLifeNpc life = caster as ServerLifeNpc; bool isReset = ConCfg.ConditionClass == SkConditionClass.ResetSkill; life.runSkMd.switchToSkill(sk.pos, ConCfg.TargetSkID, isReset); break; } } } } }
/// <summary> /// 检测是否符合逻辑 /// </summary> /// <param name="sk">技能忽略</param> /// <param name="cfg">条件配置技能忽略</param> /// <param name="caster">施法者忽略</param> /// <param name="targets">目标者们忽略</param> public bool check(RtSkData sk, ConditionConfigure cfg, ServerNPC caster, IEnumerable <ServerNPC> targets) { #if DEBUG Utils.Assert(cfg == null, "ConditionConfigure is null in PropCondition."); #endif ///1.判定概率 bool Condi = PseudoRandom.getInstance().happen(cfg.Prop); return(Condi); }
/// <summary> /// 倒计时调用的检查逻辑 /// </summary> /// <param name="fakeSk">Fake sk.</param> public void EnterIncite(RtFakeSkData fakeSk) { ConditionConfigure timeOut = pickUp(fakeSk); Utils.Assert(timeOut == null, "Time out must exist."); float max = timeOut.Param1 * Consts.OneThousand; //超时 if (fakeSk.aliveDur >= max) { ServerLifeNpc life = WarServerManager.Instance.npcMgr.GetNPCByUniqueID(fakeSk.lifeNpcId) as ServerLifeNpc; life.runSkMd.switchToSkill(fakeSk.pos, timeOut.TargetSkID, false); } }
/// <summary> /// 检测是否符合逻辑 /// </summary> /// <param name="sk">技能,忽略</param> /// <param name="caster">施法者,忽略</param> /// <param name="targets">目标者们</param> public bool check(RtSkData sk, ConditionConfigure cfg, ServerNPC caster, IEnumerable <ServerNPC> targets) { #if DEBUG Utils.Assert(cfg == null, "ConditionConfigure is null in BeHeadCondition."); Utils.Assert(targets == null, "Targets are null in BeHeadCondition."); #endif bool Condi = false; /// /// 1. 判定是否符合关心的BeHead类型 /// var self = this.GetType(); var classAttribute = (ConditionAttribute)Attribute.GetCustomAttribute(self, typeof(ConditionAttribute)); if (cfg.ConditionType == classAttribute.Con) { //血线 float hpLineFactor = cfg.Param1 * Consts.OneThousand; //满足的个数 int Count = cfg.Param2; int curCnt = 0; foreach (ServerNPC npc in targets) { float hpLine = (int)hpLineFactor * npc.data.rtData.totalHp; if (npc.data.rtData.curHp <= hpLine) { curCnt++; } } if (curCnt >= Count) { Condi = true; } //判定概率 if (Condi) { Condi = PseudoRandom.getInstance().happen(cfg.Prop); } } return(Condi); }
/// <summary> /// 检测是否符合逻辑 /// </summary> /// <param name="sk">技能</param> /// <param name="cfg">条件配置技能, 忽略</param> /// <param name="caster">施法者, 忽略</param> /// <param name="targets">目标者们, 忽略</param> public bool check(RtSkData sk, ConditionConfigure cfg, ServerNPC caster, IEnumerable <ServerNPC> targets) { #if DEBUG Utils.Assert(sk == null, "Skill is null in CountingCondition."); Utils.Assert(cfg == null, "ConditionConfigure is null in CountingCondition."); #endif bool Condi = false; /// /// 1. 判定是否符合关心的Counting类型 /// var self = this.GetType(); var classAttribute = (ConditionAttribute)Attribute.GetCustomAttribute(self, typeof(ConditionAttribute)); if (cfg.ConditionType == classAttribute.Con) { /// /// 2. 只有RtFakeSkData才有计算功能 /// RtFakeSkData fakeSk = sk as RtFakeSkData; if (fakeSk != null) { /// /// 3. 判定计数 /// if (fakeSk.curCounting >= cfg.Param1) { Condi = true; } ///4.判定概率 if (Condi) { Condi = PseudoRandom.getInstance().happen(cfg.Prop); } } } return(Condi); }