// mount/unmount buff public static SkBuffInst MountBuff(SkEntity target, int buffId, List <int> idxList, List <float> valList) // To save memory ,idxList should be increase step by step { int maxIdx = 0; int n = idxList != null ? idxList.Count : 0; for (int i = 0; i < n; i++) { if (idxList[i] > maxIdx) { maxIdx = idxList[i]; } } SkAttribs buffAttribs = new SkAttribs(null, maxIdx + 1); for (int i = 0; i < n; i++) { int idx = idxList[i]; buffAttribs.sums[idx] = buffAttribs.raws[idx] = valList[i]; } //lz-2016.08.22 引导检测玩家进入buff Pathea.PeEntity entity = target.GetComponent <Pathea.PeEntity>(); if (null != entity && entity.IsMainPlayer) { InGameAidData.CheckInBuff(buffId); } return(SkBuffInst.Mount(target._attribs.pack as SkPackage, SkBuffInst.Create(buffId, buffAttribs, target._attribs))); }
void OnHpChange(SkillSystem.SkEntity skEntity, float damage) { if (_agent.entity != null) { hpPercent = _agent.entity.HPPercent; } }
// skill instances management //============================ public static SkInst StartSkill(SkEntity caster, SkEntity target, int skId, ISkPara para = null, bool bStartImm = true) { SkData skData = null; if (!SkData.s_SkillTbl.TryGetValue(skId, out skData)) { Debug.LogError("[SkInst]:Invalid skill id:" + skId); return(null); } #if DBG_COL_ATK //if(!SkDebug.IsDebuggingID(skId)) return null; #endif // cool check SkCoolInfo cinfo = GetSkillCoolingInfo(caster, skData); if (cinfo != null && cinfo._fLeftTime > 0) { //Debug.LogError("[SkInst]:Skill id:" + skId +" in cooling.."); return(null); } SkInst inst = new SkInst(); SkInstPool.Instance._skInsts.Add(inst); inst._skData = skData; inst._para = para; inst._caster = caster; inst._target = target; inst._coroutine = bStartImm ? new CoroutineStoppable(caster, inst.Exec()) : null; return(inst); }
public void SendStartSkill(SkEntity target, int id, float[] para = null) { _skCanLoop.Reset(); if (IsController()) { if (para != null && para.Length > 0) { if (target != null && target.GetId() != 0) { _net.RPCServer(EPacketType.PT_InGame_SKStartSkill, id, target.GetId(), true, para); } else { _net.RPCServer(EPacketType.PT_InGame_SKStartSkill, id, 0, true, para); } } else { if (target != null && target.GetId() != 0) { _net.RPCServer(EPacketType.PT_InGame_SKStartSkill, id, target.GetId(), false); } else { _net.RPCServer(EPacketType.PT_InGame_SKStartSkill, id, 0, false); } } } }
public void Attack(int index = 0, SkillSystem.SkEntity targetEntity = null) { if (null == m_MotionMgr) { return; } if (null != m_MotionEquip) { m_MotionEquip.SetTarget(targetEntity); } if (index > 0) { PEActionParamN param = PEActionParamN.param; param.n = index; m_MotionMgr.DoAction(PEActionType.GunMelee, param); } else { PEActionParamB param = PEActionParamB.param; param.b = true; m_MotionMgr.DoAction(PEActionType.GunFire, param); } if (null != m_AttackMode && m_AttackMode.Length > index) { m_AttackMode[index].ResetCD(); } }
public void ExecEventsFromCol(Pathea.PECapsuleHitResult colInfo) // exetern call { if (_bExecExtEnable) { SkEntity tar = (SkEntity)colInfo.hitTrans; if (tar != null && !_hitInGuide.Contains(tar) && (_target == null || _target == tar)) { _colInfo = colInfo; foreach (SkTriggerEvent skEvent in _eventsActFromCol) { if (skEvent.Exec(this)) { _hitInGuide.Add(tar); break; // filter left skevent if needed } } //Debug.Log("[Skill] Hit:" + _hit); } } #if DBG_COL_ATK else { Debug.Log("Event not executed because in " + _dbgStep); } #endif }
public void OnAssemblyHpChange(SkillSystem.SkEntity caster, float hpChange) { if (mCScreator != null && mCScreator.Assembly != null && mCSnpcTeam != null) { mCSnpcTeam.OnAssemblyHpChange(caster, hpChange); } }
public void Update(SkBeModified beModified) { _pack.ExecBuffs(); int nAttribs = _raws.Count; for (int i = 0; i < nAttribs; i++) { if (_dirties[i]) { buffMul = 1.0f; buffPreAdd = 0.0f; buffPostAdd = 0.0f; _pack.ExecTmpBuffs(i); _sums[i] = buffMul * (_raws[i] + buffPreAdd) + buffPostAdd; SkEntity entity = GetModCaster(i); int casterId = 0; if (entity != null) { casterId = entity.GetId(); } _dirties[i] = false; beModified.indexList.Add(i); beModified.valueList.Add(_sums[i]); beModified.casterIdList.Add(casterId); } } }
public AttCondCtrl(SkEntity skEntity, string para) { mConds = new List <AttCond>(); string[] condStrs = para.Split(';'); foreach (string condStr in condStrs) { string[] paraStr = condStr.Split(','); switch (paraStr[0].ToLower()) { case "compare": AttCond_Compare condCompare = new AttCond_Compare(skEntity, paraStr); mConds.Add(condCompare); break; case "camp": AttCond_Camp condCamp = new AttCond_Camp(skEntity, paraStr); mConds.Add(condCamp); break; case "RunSkill": AttCond_RunSkill condSkill = new AttCond_RunSkill(skEntity, paraStr); mConds.Add(condSkill); break; } } }
public AttActionCtrl(AttRuleCtrl ctrl, SkEntity skEntity, string para) { mActions = new List <AttAction>(); string[] condStrs = para.Split(';'); foreach (string condStr in condStrs) { string[] paraStr = condStr.Split(','); switch (paraStr[0].ToLower()) { case "skill": AttAction_Skill actSkill = new AttAction_Skill(skEntity, paraStr); mActions.Add(actSkill); break; case "camp": AttAction_Att actAtt = new AttAction_Att(skEntity, paraStr); mActions.Add(actAtt); break; case "func": AttAction_Func actFunc = new AttAction_Func(skEntity, paraStr); mActions.Add(actFunc); break; case "Action": AttAction_Action actAct = new AttAction_Action(skEntity, paraStr, ctrl); mActions.Add(actAct); break; } } }
internal static SkFuncInOutPara TstColLayer(SkInst inst, System.Object strColDesc) { SkFuncInOutPara funcOut = new SkFuncInOutPara(inst, strColDesc); if (inst._colInfo == null) { return(funcOut); } SkCondColDesc cols = funcOut.GetColDesc(); cols.colTypes[0] = cols.colTypes[1] = SkCondColDesc.ColType.ColLayer; if (cols.Contain(inst._colInfo)) { SkEntity curTar = (SkEntity)inst._colInfo.hitTrans; if (curTar != null) { funcOut._para = new List <SkEntity>() { curTar }; } funcOut._ret = true; } return(funcOut); }
public void Apply(SkEntity entity, SkRuntimeInfo info) { if (_seId > 0) { entity.ApplySe(_seId, info); } if (_repelEff) { entity.ApplyRepelEff(info); } if (_emitId > 0) { entity.ApplyEmission(_emitId, info); } if (_anms.Length > 0) { entity.ApplyAnim(PickAnim(entity, info), info); } foreach (int eid in _effId) { if (eid > 0) { entity.ApplyEff(eid, info); } } if (_camEffId > 0) { entity.ApplyCamEff(_camEffId, info); } if (_procEffId > 0) { SkEffExFunc.Apply(_procEffId, entity, info); } }
public static SkCoolInfo GetSkillCoolingInfo(SkEntity caster, SkData skData) { List <SkInst> insts = SkInstPool.Instance._skInsts; foreach (SkInst it in insts) { if (it._caster == caster) { if (it._skData._id == skData._id && it._skData._coolingTime > PETools.PEMath.Epsilon) { SkCoolInfo cinfo = new SkCoolInfo(); cinfo._bShare = false; cinfo._fMaxTime = it._skData._coolingTime; cinfo._fLeftTime = it._skData._coolingTime - (Time.time - it._startTime); return(cinfo); } else if (it._skData._coolingTimeType == skData._coolingTimeType && it._skData._coolingTimeShared > PETools.PEMath.Epsilon) { SkCoolInfo cinfo = new SkCoolInfo(); cinfo._bShare = true; cinfo._fMaxTime = it._skData._coolingTimeShared; cinfo._fLeftTime = it._skData._coolingTimeShared - (Time.time - it._startTime); return(cinfo); } } } return(null); }
// Helper static bool CanDamage(SkEntity e1, SkEntity e2) { Pathea.Projectile.SkProjectile p = e1 as Pathea.Projectile.SkProjectile; if (p != null) { SkEntity caster = p.GetSkEntityCaster(); if (caster == null) { return(false); } else { e1 = p.GetSkEntityCaster(); } } int p1 = System.Convert.ToInt32(e1.GetAttribute((int)Pathea.AttribType.DefaultPlayerID)); int p2 = System.Convert.ToInt32(e2.GetAttribute((int)Pathea.AttribType.DefaultPlayerID)); int d1 = System.Convert.ToInt32(e1.GetAttribute((int)Pathea.AttribType.DamageID)); int d2 = System.Convert.ToInt32(e2.GetAttribute((int)Pathea.AttribType.DamageID)); return(PETools.PEUtil.CanDamageReputation(p1, p2) && ForceSetting.Instance.Conflict(p1, p2) && Pathea.DamageData.GetValue(d1, d2) != 0); }
public override void Attack(int index = 0, SkillSystem.SkEntity targetEntity = null) { if (null != m_MotionEquip) { m_MotionEquip.SetTarget(targetEntity); m_MotionEquip.TwoHandWeaponAttack(m_Entity.forward, index); } }
void HandleAliveEntityHpChange(SkillSystem.SkEntity caster, float hpChange) { if (hpChange < 0) { Hit(-hpChange); PeCamera.PlayShakeEffect(0, 0.2f, 0); } }
internal void TryApplyEachEffOfMain(int idx, SkEntity tar, SkRuntimeInfo skrt) { SkEffect eff = idx < _effMainEachTime.Length ? _effMainEachTime [idx] : _effMainEachTime [_effMainEachTime.Length - 1]; if (eff != null) { eff.Apply(tar, skrt); } }
public void OpenLockedDoor(SkillSystem.SkEntity caster, SkillSystem.SkEntity monster) { LockedDoor ld = generator.CurrentDungeon.LockedDoorList.Find(it => it.IsOpen == false); if (ld != null) { ld.Open(); } }
void OnPlayerVehicleBeAttack(SkillSystem.SkEntity hurt, float damage) { if (hurt == null || (mVehicle != null && mVehicle.skEntity == hurt)) { return; } mBattleBgTime = Time.time; }
private void SumSetterNet(int idx, float v) { NumList s = (NumList)_sums; float oldValue = s.Get(idx); float dValue = v - oldValue; bool bRaw = false; SkEntity entity = GetModCaster(idx); if (FromNet) { s.Set(idx, v); OnAlterNumAttribs(idx, oldValue, v); } else { bool bSendDValue = false; if (!CheckAttrNet((AttribType)idx, oldValue, v, s, out bSendDValue)) { return; } if (bSendDValue && dValue == 0) { return; } if (!bSendDValue) { v = CheckAttrMax((AttribType)idx, oldValue, v, (NumList)_sums); } if (_net != null && LockModifyBySingle) { //Debug.Log("attr was locked, please wait for net init data inx = "+idx +" , v = " +v); return; } if (!bSendDValue) { dValue = v; s.Set(idx, v); OnAlterNumAttribs(idx, oldValue, v); } if (entity != null && _net != null) { if (entity.IsController() && !_net.IsStaticNet()) { _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, entity.GetId(), bRaw, bSendDValue); } } else if (_net != null && _net.hasOwnerAuth) { _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, -1, bRaw, bSendDValue); } else if (idx == 95 && _net is MapObjNetwork) { _net.RPCServer(EPacketType.PT_InGame_SKSyncAttr, (byte)idx, dValue, -1, bRaw, bSendDValue); } } }
void OnDeath(SkillSystem.SkEntity caster, SkillSystem.SkEntity target) { PeMap.TowerMark findMask = PeMap.TowerMark.Mgr.Instance.Find(tower => itemObjectId == tower.ID); if (null != findMask) { PeMap.LabelMgr.Instance.Remove(findMask); PeMap.TowerMark.Mgr.Instance.Remove(findMask); } Invoke("TowerDestroy", 10f); }
static void DoEff2(SkEntity entity, SkRuntimeInfo info) { // Add code SkBuffInst buff = info as SkBuffInst; if (null != buff) { entity.OnBuffRemove(buff._buff._id); } }
public void Attack(int index = 0, SkillSystem.SkEntity targetEntity = null) { if (null != m_MotionEquip) { m_MotionEquip.SetTarget(targetEntity); } if (null != m_MotionMgr) { m_MotionMgr.DoAction(Pathea.PEActionType.Throw); } m_AttackRanges.ResetCD(); }
public void SetSkill(int skillId, int index, SkillSystem.SkEntity skenity = null, string icon = "", int decsId = 0) { if (icon != "") { //Debug.Log("skillId:" + skillId); //Debug.Log("技能列表:" + EffSkill.s_tblEffSkills.Count); // EffSkill skill = null; // if (EffSkill.s_tblEffSkills != null) // skill = EffSkill.s_tblEffSkills.Find(iterSkill1 => EffSkill.MatchId(iterSkill1, skillId)); string skillDes = ""; if (decsId > 0) { skillDes = PELocalization.GetString(decsId); } //int len = 0; //foreach (EffSkill es in EffSkill.s_tblEffSkills) //{ // //Debug.Log("技能列表中技能" + (++len) + ":" + es.m_iconImgPath); // Debug.Log("技能列表中技能ID" + (++len) + ":" + es.m_id); //} // foreach (EffSkill es in EffSkill.s_tblEffSkills) // { // Debug.Log(es.m_name[0]); // } // // if (skill != null && skill.m_iconImgPath != "0") // { // mItemspr.spriteName = skill.m_iconImgPath; // mItemspr.MakePixelPerfect(); // } mItemspr.spriteName = icon; mItemspr.MakePixelPerfect(); mSkillID = skillId; mGridMask = GridMask.GM_Skill; mItemIndex = index; mItemspr.enabled = true; mIsSkill = true; mSkenity = skenity; mSkillDes = skillDes; } else { mItemspr.spriteName = "Null"; mItemspr.MakePixelPerfect(); mItemspr.enabled = false; mIsSkill = false; mSkenity = null; if (null != mSkillCooldown) { mSkillCooldown.fillAmount = 0; } } }
public virtual void Attack(int index = 0, SkillSystem.SkEntity targetEntity = null) { if (null != m_MotionEquip) { m_MotionEquip.SetTarget(targetEntity); m_MotionEquip.SwordAttack(m_Entity.forward, index); } if (null != m_AttackMode && m_AttackMode.Length > index) { m_AttackMode[index].ResetCD(); } }
void OnDeath(SkillSystem.SkEntity e1, SkillSystem.SkEntity e2) { _death = true; Clear(); SceneMan.RemoveSceneObj(_agent); if (DeathEvent != null) { DeathEvent(this); } }
public static AttRule Creat(AttRuleCtrl ctrl, SkEntity skEntity, int ruleID) { AttRuleData data = AttRuleData.GetRuleData(ruleID); if (null != data) { AttRule rule = new AttRule(); rule.mFilter = new AttFilterCtrl(skEntity, data.mFilter, rule.CheckAction); rule.mCond = new AttCondCtrl(skEntity, data.mCond); rule.mAction = new AttActionCtrl(ctrl, skEntity, data.mAction); return(rule); } return(null); }
public void Attack(int index = 0, SkillSystem.SkEntity targetEntity = null) { if (null != m_MotionEquip) { m_MotionEquip.SetTarget(targetEntity); } if (null != m_MotionMgr) { m_MotionMgr.DoAction(PEActionType.BowShoot); } if (null != m_AttackMode && m_AttackMode.Length > index) { m_AttackMode[index].ResetCD(); } }
void OnHpChange(SkillSystem.SkEntity caster, float hpChange) { float hp = alive.GetAttribute(Pathea.AttribType.Hp); if (mItemObj != null) { if (mLifeLimit != null) { mLifeLimit.floatValue.current = hp; } if (mDurability != null) { mDurability.floatValue.current = hp; } } }
public static SkBuffInst Create(int buffId, ISkAttribs paraCaster = null, ISkAttribs paraTarget = null) { SkBuff buff; if (SkBuff.s_SkBuffTbl.TryGetValue(buffId, out buff)) { SkBuffInst inst = new SkBuffInst(); inst._buff = buff; SkEntity caster = SkRuntimeInfo.Current != null ? SkRuntimeInfo.Current.Caster : null; inst._paraCaster = (paraCaster == null && caster != null) ? caster.attribs : paraCaster; inst._paraTarget = paraTarget; inst._startTime = Time.time; return(inst); } return(null); }