/// <summary> /// 给当前单位添加技能效果. /// </summary> /// <param name="attackerAttr">为this添加技能效果的单位的属性</param> /// <param name="type">效果类型</param> /// <param name="resID">效果ID</param> /// <returns></returns> public ErrorCode AddSkillEffect(AttackerAttr attackerAttr, SkillEffectType type, uint resID) { // 是否死亡. if (IsDead()) { return(ErrorCode.TargetIsDead); } // 由单位的本身类型, 决定的是否免疫给类型的技能效果. if (SkillEffectImmunity(type)) { return(ErrorCode.AddEffectFailedSkillEffectImmunity); } if (SkillUtilities.IsHarmfulEffect(type, resID) && IsInviolable()) { return(ErrorCode.AddEffectFailedSkillEffectImmunity); } ErrorCode err = ErrorCode.ConfigError; switch (type) { case SkillEffectType.Spasticity: #region Pending err = SkillDetails.StartSpasticity(mActionCenter, attackerAttr, resID, ref mSpasticityCd); #endregion Pending break; case SkillEffectType.Displacement: err = SkillDetails.StartDisplace(mActionCenter, attackerAttr, resID); break; case SkillEffectType.Buff: case SkillEffectType.Impact: err = SkillDetails.StartSkillEffect(attackerAttr, mSkillEffectManager, type, resID); break; default: break; } if (err == ErrorCode.Succeeded && type == SkillEffectType.Buff) { onSkillBuffAdded((uint)resID); } return(err); }
private bool checkTrap() { DataType myName = DataType.DATA_TRAP; IDictionaryEnumerator itr = DataManager.TrapTable.GetEnumerator(); while (itr.MoveNext()) { TrapTableItem item = itr.Value as TrapTableItem; if (!checkParam(item.modelID != uint.MaxValue, myName, item.resID, "模型ID")) { return(false); } if (!checkLink(myName, item.resID, DataType.DATA_MODEL, item.modelID)) { return(false); } if (item.buffID != uint.MaxValue && !checkLink(myName, item.resID, DataType.DATA_SKILL_BUFF, item.buffID)) { return(false); } if (!checkParam(item.explodeDelay != uint.MaxValue, myName, item.resID, "爆炸延迟")) { return(false); } if (item.buffID != uint.MaxValue && !checkParam( !SkillUtilities.IsHarmfulEffect(SkillEffectType.Buff, item.buffID), DataType.DATA_TRAP, item.resID, "出生buff", "不能为trap添加有害的出生buff.")) { return(false); } if (item.delayEffect != uint.MaxValue && !checkLink(myName, item.resID, DataType.DATA_EFFECT, item.delayEffect)) { return(false); } if (!checkParam(item.collideRadius != uint.MaxValue, myName, item.resID, "碰撞检测半径", "无效的碰撞检测半径需要填入0")) { return(false); } if (item.targetSelectionOnExplode != uint.MaxValue && !checkLink(myName, item.resID, DataType.DATA_SKILL_TARGET_SELECTION, item.targetSelectionOnExplode)) { return(false); } if (item.skillEffectOnExplode != uint.MaxValue && !checkLink(myName, item.resID, DataType.DATA_SKILL_EFFECT, item.skillEffectOnExplode)) { return(false); } if (item._3DEffectOnExplode != uint.MaxValue && !checkLink(myName, item.resID, DataType.DATA_EFFECT, item._3DEffectOnExplode)) { return(false); } } // foreach (int key in DataManager.TrapTable.Keys) // { // TrapTableItem item = DataManager.TrapTable[key] as TrapTableItem; // if(!checkParam(item.modelID != uint.MaxValue, myName, key, "模型ID")) // return false; // // if (!checkLink(myName, key, DataType.DATA_MODEL, item.modelID)) // return false; // // if (item.buffID != uint.MaxValue // && !checkLink(myName, key, DataType.DATA_SKILL_BUFF, item.buffID)) // return false; // // if (!checkParam(item.explodeDelay != uint.MaxValue, myName, key, "爆炸延迟")) // return false; // // if (item.buffID != uint.MaxValue // && !checkParam( // !SkillUtilities.IsHarmfulEffect(SkillEffectType.Buff, item.buffID), // DataType.DATA_TRAP, key, "出生buff", "不能为trap添加有害的出生buff.")) // return false; // // if (item.delayEffect != uint.MaxValue && !checkLink(myName, key, DataType.DATA_EFFECT, item.delayEffect)) // return false; // // if (!checkParam(item.collideRadius != uint.MaxValue, myName, key, "碰撞检测半径", "无效的碰撞检测半径需要填入0")) // return false; // // if (item.targetSelectionOnExplode != uint.MaxValue // && !checkLink(myName, key, DataType.DATA_SKILL_TARGET_SELECTION, item.targetSelectionOnExplode)) // return false; // // if (item.skillEffectOnExplode != uint.MaxValue // && !checkLink(myName, key, DataType.DATA_SKILL_EFFECT, item.skillEffectOnExplode)) // return false; // // if (item._3DEffectOnExplode != uint.MaxValue // && !checkLink(myName, key, DataType.DATA_EFFECT, item._3DEffectOnExplode)) // return false; // } return(true); }