private int SelectLevel(ref PoolObjHandle <ActorRoot> HostActor, ref ResCallMonster CallMonsterCfg, ref SkillUseContext SkillContext) { if (CallMonsterCfg.bDependencyType == 1) { return(HostActor.handle.ValueComponent.actorSoulLevel); } if (CallMonsterCfg.bDependencyType == 2) { return(HostActor.handle.SkillControl.SkillSlotArray[(int)SkillContext.SlotType].GetSkillLevel()); } return(0); }
private void CheckCallMonsterSkill(CActorInfo InActorInfo, ref List <ActorPreloadTab> InPreloadListRef, ref ActorMeta InParentActorMetaRef, int markID) { if (InActorInfo != null && InActorInfo.callMonsterConfigID > 0) { ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)InActorInfo.callMonsterConfigID); if (dataByKey != null) { ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, 1); if (dataCfgInfo != null) { ActorMeta actorMeta = default(ActorMeta); actorMeta.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta.ActorCamp = InParentActorMetaRef.ActorCamp; actorMeta.ConfigId = dataCfgInfo.iCfgID; this.AddPreloadActor(ref InPreloadListRef, ref actorMeta, 2f, markID); } } } }
private int GetAddValue(ref PoolObjHandle <ActorRoot> OrignalHost, ref PoolObjHandle <ActorRoot> Monster, ref ResCallMonster CallMonsterCfg, RES_FUNCEFT_TYPE type) { int num = 0; byte bAddType = CallMonsterCfg.bAddType; if ((CallMonsterCfg.bAddType & 1) != 0) { num += OrignalHost.handle.ValueComponent.mActorValue[RES_FUNCEFT_TYPE.RES_FUNCEFT_PHYATKPT].totalValue; } if ((CallMonsterCfg.bAddType & 2) != 0) { num += OrignalHost.handle.ValueComponent.mActorValue[RES_FUNCEFT_TYPE.RES_FUNCEFT_MGCATKPT].totalValue; } if ((CallMonsterCfg.bAddType & 4) != 0) { num += OrignalHost.handle.ValueComponent.mActorValue[type].totalValue; } return(num); }
private void ApplyMonsterAdditive(ref PoolObjHandle <ActorRoot> OrignalHost, ref PoolObjHandle <ActorRoot> Monster, ref ResCallMonster CallMonsterCfg) { this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_PHYATKPT, (int)CallMonsterCfg.dwAddAttack, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_PHYATKPT)); this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_MGCATKPT, (int)CallMonsterCfg.dwAddMagic, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_MGCATKPT)); this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_PHYDEFPT, (int)CallMonsterCfg.dwAddArmor, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_PHYDEFPT)); this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_MGCDEFPT, (int)CallMonsterCfg.dwAddResistant, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_MGCDEFPT)); this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP, (int)CallMonsterCfg.dwAddHp, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_MAXHP)); if ((CallMonsterCfg.bAddType & 4) != 0) { Monster.handle.ValueComponent.actorHp = (Monster.handle.ValueComponent.actorHpTotal * OrignalHost.handle.ValueComponent.actorHp) / OrignalHost.handle.ValueComponent.actorHpTotal; Monster.handle.ValueComponent.mActorValue[RES_FUNCEFT_TYPE.RES_PROPERTY_MAXEP].addValue = OrignalHost.handle.ValueComponent.actorEpTotal; Monster.handle.ValueComponent.actorEp = OrignalHost.handle.ValueComponent.actorEp; } else { Monster.handle.ValueComponent.actorHp = Monster.handle.ValueComponent.actorHpTotal; } this.ApplyProperty(ref Monster, RES_FUNCEFT_TYPE.RES_FUNCEFT_MOVESPD, (int)CallMonsterCfg.dwAddSpeed, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, RES_FUNCEFT_TYPE.RES_FUNCEFT_MOVESPD)); }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (((refParamObject == null) || (refParamObject.Originator == 0)) || (refParamObject.Originator.handle.ActorControl == null)) { object[] inParameters = new object[] { _action.name }; DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", inParameters); } else if (!refParamObject.Originator.handle.ActorControl.IsDeadState) { DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey(this.ConfigID); object[] objArray2 = new object[] { this.ConfigID, _action.name }; DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", objArray2); if (dataByKey != null) { int diffLevel = Math.Min(MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, diffLevel); object[] objArray3 = new object[] { dataByKey.dwMonsterID, diffLevel, _action.name }; DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", objArray3); if (dataCfgInfo != null) { string fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo content = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo; if (content != null) { ActorMeta actorMeta = new ActorMeta { ConfigId = (int)dataByKey.dwMonsterID, ActorType = ActorTypeDef.Actor_Type_Monster, ActorCamp = this.SelectCamp(ref refParamObject.Originator), EnCId = (CrypticInt32)dataByKey.dwMonsterID, Difficuty = (byte)diffLevel, SkinID = refParamObject.Originator.handle.TheActorMeta.SkinID }; VInt3 location = tarActor.handle.location; VInt3 forward = tarActor.handle.forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location)) { location = refParamObject.Originator.handle.location; forward = refParamObject.Originator.handle.forward; } PoolObjHandle <ActorRoot> monster = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (monster != 0) { monster.handle.InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref monster, ref dataByKey); MonsterWrapper actorControl = monster.handle.ActorControl as MonsterWrapper; if (actorControl != null) { actorControl.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo); if (this.wayPoint != null) { actorControl.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { actorControl.LifeTime = this.LifeTime; } } monster.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(monster); monster.handle.StartFight(); monster.handle.ObjLinker.Invincible = this.Invincible; monster.handle.ObjLinker.CanMovable = this.Moveable; monster.handle.Visible = refParamObject.Originator.handle.Visible; monster.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel; refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } } } } }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.get_handle().ActorControl == null) { DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[] { _action.name }); return; } if (refParamObject.Originator.get_handle().ActorControl.IsDeadState) { return; } DebugHelper.Assert(refParamObject.Originator.get_handle().ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID); DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[] { this.ConfigID, _action.name }); if (dataByKey == null) { return; } int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num); DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[] { dataByKey.dwMonsterID, num, _action.name }); if (dataCfgInfo == null) { return; } string text = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(text, typeof(CActorInfo), 0, false, false).m_content as CActorInfo; if (exists) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ConfigId = (int)dataByKey.dwMonsterID; actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator); actorMeta2.EnCId = (int)dataByKey.dwMonsterID; actorMeta2.Difficuty = (byte)num; actorMeta2.SkinID = refParamObject.Originator.get_handle().TheActorMeta.SkinID; actorMeta = actorMeta2; VInt3 location = tarActor.get_handle().location; VInt3 forward = tarActor.get_handle().forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), location)) { location = refParamObject.Originator.get_handle().location; forward = refParamObject.Originator.get_handle().forward; } PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (poolObjHandle) { poolObjHandle.get_handle().InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey); MonsterWrapper monsterWrapper = poolObjHandle.get_handle().ActorControl as MonsterWrapper; if (monsterWrapper != null) { monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo); if (this.wayPoint != null) { monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { monsterWrapper.LifeTime = this.LifeTime; } } poolObjHandle.get_handle().PrepareFight(); Singleton <GameObjMgr> .get_instance().AddActor(poolObjHandle); poolObjHandle.get_handle().StartFight(); poolObjHandle.get_handle().ObjLinker.Invincible = this.Invincible; poolObjHandle.get_handle().ObjLinker.CanMovable = this.Moveable; poolObjHandle.get_handle().Visible = refParamObject.Originator.get_handle().Visible; poolObjHandle.get_handle().ValueComponent.actorSoulLevel = refParamObject.Originator.get_handle().ValueComponent.actorSoulLevel; refParamObject.Originator.get_handle().ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } }
private void ApplyMonsterAdditive(ref PoolObjHandle <ActorRoot> OrignalHost, ref PoolObjHandle <ActorRoot> Monster, ref ResCallMonster CallMonsterCfg) { this.ApplyProperty(ref Monster, 1, (int)CallMonsterCfg.dwAddAttack, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 1)); this.ApplyProperty(ref Monster, 2, (int)CallMonsterCfg.dwAddMagic, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 2)); this.ApplyProperty(ref Monster, 3, (int)CallMonsterCfg.dwAddArmor, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 3)); this.ApplyProperty(ref Monster, 4, (int)CallMonsterCfg.dwAddResistant, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 4)); this.ApplyProperty(ref Monster, 5, (int)CallMonsterCfg.dwAddHp, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 5)); if ((CallMonsterCfg.bAddType & 4) != 0) { Monster.get_handle().ValueComponent.actorHp = Monster.get_handle().ValueComponent.actorHpTotal *OrignalHost.get_handle().ValueComponent.actorHp / OrignalHost.get_handle().ValueComponent.actorHpTotal; Monster.get_handle().ValueComponent.mActorValue[32].addValue = OrignalHost.get_handle().ValueComponent.actorEpTotal; Monster.get_handle().ValueComponent.actorEp = OrignalHost.get_handle().ValueComponent.actorEp; } else { Monster.get_handle().ValueComponent.actorHp = Monster.get_handle().ValueComponent.actorHpTotal; } this.ApplyProperty(ref Monster, 15, (int)CallMonsterCfg.dwAddSpeed, this.GetAddValue(ref OrignalHost, ref Monster, ref CallMonsterCfg, 15)); }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.handle.ActorControl == null) { DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[] { _action.name }); return; } if (refParamObject.Originator.handle.ActorControl.IsDeadState) { return; } DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID); DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[] { this.ConfigID, _action.name }); if (dataByKey == null) { return; } int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num); DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[] { dataByKey.dwMonsterID, num, _action.name }); if (dataCfgInfo == null) { return; } string fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo; if (exists) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ConfigId = (int)dataByKey.dwMonsterID; actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator); actorMeta2.EnCId = (int)dataByKey.dwMonsterID; actorMeta2.Difficuty = (byte)num; actorMeta2.SkinID = refParamObject.Originator.handle.TheActorMeta.SkinID; actorMeta = actorMeta2; VInt3 location = tarActor.handle.location; VInt3 forward = tarActor.handle.forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location)) { location = refParamObject.Originator.handle.location; forward = refParamObject.Originator.handle.forward; } PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (poolObjHandle) { poolObjHandle.handle.InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey); MonsterWrapper monsterWrapper = poolObjHandle.handle.ActorControl as MonsterWrapper; if (monsterWrapper != null) { monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo, this.bSuicideWhenHostDead, this.bDrageToHostWhenTooFarAway, this.bUseHostValueProperty); if (this.wayPoint != null) { monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { monsterWrapper.LifeTime = this.LifeTime; } } if (this.bUseHostValueProperty) { refParamObject.Originator.handle.ValueComponent.mActorValue.SetChangeEvent(RES_FUNCEFT_TYPE.RES_FUNCEFT_MOVESPD, new ValueChangeDelegate(poolObjHandle.handle.ActorControl.OnMoveSpdChange)); } refParamObject.Originator.handle.SkillControl.SetSkillIndicatorToCallMonster(); poolObjHandle.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(poolObjHandle); poolObjHandle.handle.StartFight(); poolObjHandle.handle.ObjLinker.Invincible = this.Invincible; poolObjHandle.handle.ObjLinker.CanMovable = this.Moveable; poolObjHandle.handle.Visible = (!this.bInitialVisibility || refParamObject.Originator.handle.Visible); poolObjHandle.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel; poolObjHandle.handle.DefaultAttackModeControl = poolObjHandle.handle.CreateLogicComponent <DefaultAttackMode>(poolObjHandle.handle); if (FogOfWar.enable && poolObjHandle.handle.HorizonMarker != null) { poolObjHandle.handle.HorizonMarker.SightRadius = Horizon.QuerySoldierSightRadius(); } refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } }