/// <summary> /// 为target添加技能效果. /// skillEffectResID为skilleffect.txt的资源ID. /// </summary> public static ErrorCode AddSkillEffectByResource(AttackerAttr attackerAttr, BattleUnit target, uint skillEffectResID) { if (skillEffectResID == uint.MaxValue) { return(ErrorCode.Succeeded); } SkillEffectTableItem effectRes = DataManager.SkillEffectTable[skillEffectResID] as SkillEffectTableItem; if (effectRes == null) { SkillUtilities.ResourceNotFound("skilleffect", skillEffectResID); return(ErrorCode.ConfigError); } System.Type T = effectRes.GetType(); for (uint i = 0; i < SkillEffectTableItem.SkillEffectCount; ++i) { SkillEffectItem item = effectRes.items[i]; if (item.effectType == SkillEffectType.Invalid || item.effectID == uint.MaxValue) { break; } ErrorHandler.Parse( target.AddSkillEffect(attackerAttr, item.effectType, item.effectID), "in AddSkillEffectByResource" ); } return(ErrorCode.Succeeded); }
static public bool AddBuffByResId(uint objId, uint target, int buffResId) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return(false); } BattleUnit tar = scn.FindObject(target) as BattleUnit; if (tar == null) { return(false); } BattleUnit sender = scn.FindObject(objId) as BattleUnit; if (sender == null) { return(false); } return(tar.AddSkillEffect(new AttackerAttr(sender), SkillEffectType.Buff, (uint)buffResId) == ErrorCode.Succeeded); }
override public void OnSpriteModelLoaded(uint instanceid) { base.OnSpriteModelLoaded(instanceid); BattleUnit unit = FindObject(instanceid) as BattleUnit; if (unit == null) { return; } if (PlayerController.Instance.GetMainCropsControl() == instanceid || PlayerController.Instance.GetSubCropsControl() == instanceid || PlayerController.Instance.GetControl() == instanceid) { unit.AddEffect(528, null); unit.AddSkillEffect(new AttackerAttr(unit), SkillEffectType.Buff, GameConfig.PvpBuffId); } else { Ghost ghost = unit as Ghost; if (ghost == null) { return; } mGhost = ghost; ghost.AddSkillEffect(new AttackerAttr(ghost), SkillEffectType.Buff, GameConfig.PvpBuffId); } }
private bool AddSkillEffect(ObjectBase obj, respond_msg_gm respond) { if (obj == null || respond == null) { return(false); } if (obj is BattleUnit) { BattleUnit battleunit = obj as BattleUnit; battleunit.AddSkillEffect(new AttackerAttr(battleunit), (SkillEffectType)System.Convert.ToUInt32(respond.param1), System.Convert.ToUInt32(respond.param2)); return(true); } return(false); }
static public void UseSkillEffect(uint objId, SkillEffectType type, uint resID) { BaseScene scn = SceneManager.Instance.GetCurScene(); if (scn == null) { return; } ObjectBase obj = scn.FindObject(objId); if (obj == null) { return; } BattleUnit npc = (BattleUnit)obj; npc.AddSkillEffect(new AttackerAttr(npc), type, resID); }
private bool AddSkillEffect(ObjectBase obj, ArrayList param) { if (obj == null || param == null) { return(false); } if (param.Count != 2) { GameDebug.Log("usage: .addskilleffect effect_type[0:buff, 1:impact, 2:displacement] effect_id"); return(false); } if (obj is BattleUnit) { BattleUnit battleunit = obj as BattleUnit; battleunit.AddSkillEffect(new AttackerAttr(battleunit), (SkillEffectType)System.Convert.ToUInt32(param[0]), System.Convert.ToUInt32(param[1])); return(true); } return(false); }