Пример #1
0
 public void AddNeutralExpConfig(NeutralExpConfig config)
 {
     neutralExpConfigs.Add(config.level, config);
 }
Пример #2
0
        /** 生成数据--势力 */
        public void GenerationLegions()
        {
            // 占用自己颜色的势力
            LegionData occupyMainLegionData = null;

            War.realPlayerCount = 0;

            // 创建势力数据LegionData
            foreach (KeyValuePair <int, StageLegionConfig> kvp in stageConfig.legionDict)
            {
                StageLegionConfig legionConfig = kvp.Value;
                LegionData        legionData;
                if (legionConfig.type == LegionType.Player)
                {
                    legionData = new LegionData(legionConfig.legionId, "Player-" + legionConfig.legionId, LegionType.Player, legionConfig.aiSendArm, legionConfig.aiUplevel, legionConfig.aiSkill, legionConfig.produce);
                    if (enterData.vsmode == VSMode.PVP && legionData.legionId != ownLegionID)
                    {
                        legionData.aiSendArm = false;
                        legionData.aiSkill   = false;
                        legionData.aiUplevel = false;
                    }
                }
                else if (legionConfig.type == LegionType.Computer)
                {
                    legionData = new LegionData(legionConfig.legionId, "Player-" + legionConfig.legionId, LegionType.Computer, legionConfig.aiSendArm, legionConfig.aiUplevel, legionConfig.aiSkill, legionConfig.produce);
                    if (enterData.vsmode == VSMode.PVP && !War.isMainLegion)
                    {
                        legionData.aiSendArm = false;
                        legionData.aiSkill   = false;
                        legionData.aiUplevel = false;
                    }
                }
                else
                {
                    legionData = new LegionData(legionConfig.legionId, "Player-" + legionConfig.legionId, LegionType.Neutral, legionConfig.aiSendArm, legionConfig.aiUplevel, legionConfig.aiSkill, legionConfig.produce);
                    if (enterData.vsmode == VSMode.PVP && !War.isMainLegion)
                    {
                        legionData.aiSendArm = false;
                        legionData.aiSkill   = false;
                        legionData.aiUplevel = false;
                    }
                }



                legionData.produceLimit = legionConfig.produceLimit;
                legionData.colorId      = legionConfig.color;
                legionDict.Add(legionData.legionId, legionData);

                if (legionData.colorId == War.config.ownDefaultColor)
                {
                    occupyMainLegionData = legionData;
                }

                legionData.roleId = enterData.GetRoleId(legionData.legionId);
                if (!roleDict.ContainsKey(legionData.roleId))
                {
                    roleDict.Add(legionData.roleId, legionData);
                }

                legionData.expeditionTotalMaxHP = enterData.GetTotalMaxHP(legionData.legionId);
                legionData.expeditionTotalHP    = enterData.GetTotalHP(legionData.legionId);
                legionData.expeditionInitHP     = legionData.expeditionTotalHP;
                legionData.expeditionLeftHP     = legionData.expeditionTotalHP;


                WarEnterLegionData enterLegionData = enterData.GetEnterLegionData(legionData.legionId);
                if (enterLegionData != null)
                {
                    legionData.name                      = enterLegionData.name;
                    legionData.headAvatarId              = enterLegionData.headAvatarId;
                    legionData.levelData.intBattleForce  = enterLegionData.totalAtk;
                    legionData.levelData.intProduceSpeed = enterLegionData.totalProduceSpeed;
                    legionData.levelData.intMoveSpeed    = enterLegionData.totalMoveSpeed;
                    legionData.levelData.initHP          = enterLegionData.initHP;

                    legionData.levelData.maxBattleForce  = enterLegionData.maxAtk;
                    legionData.levelData.maxProduceSpeed = enterLegionData.maxProduceSpeed;
                    legionData.levelData.maxMoveSpeed    = enterLegionData.maxMovespeed;


                    legionData.levelData.subBattleForce  = enterLegionData.subAtk;
                    legionData.levelData.subProduceSpeed = enterLegionData.subProduceSpeed;
                    legionData.levelData.subMoveSpeed    = enterLegionData.subMoveSpeed;

                    legionData.sendArmRate = enterLegionData.sendArmRate;

                    if (enterLegionData.isRobot)
                    {
                        if (enterData.vsmode == VSMode.PVP && War.isMainLegion && legionData.colorId != 0)
                        {
                            legionData.aiSendArm = true;
                            legionData.aiSkill   = true;
                            legionData.aiUplevel = true;
                        }
                        legionData.type = LegionType.Computer;

                        if (legionData.colorId == 0)
                        {
                            legionData.type = LegionType.Neutral;
                        }
                    }
                    else
                    {
                        legionData.type      = LegionType.Player;
                        legionData.aiSendArm = false;
                        legionData.aiSkill   = false;
                        legionData.aiUplevel = false;
                    }


                    if (enterLegionData.ai > 0)
                    {
                        legionData.aiConfig = War.model.GetAIConfig(enterLegionData.ai);;
                    }
                }
                else
                {
                    NeutralExpConfig roleExpConfig = War.model.GetNeutralExpConfig(stageConfig.neutralRoleLevel);

                    legionData.levelData.intBattleForce  = roleExpConfig.props[PropId.BattleForceAdd];
                    legionData.levelData.intProduceSpeed = roleExpConfig.props[PropId.ProduceSpeedAdd];
                    legionData.levelData.intMoveSpeed    = roleExpConfig.props[PropId.MoveSpeedAdd];
                    legionData.levelData.initHP          = roleExpConfig.props[PropId.HpAdd];


                    if (legionData.colorId == 0)
                    {
                        legionData.type = LegionType.Neutral;
                    }
                    else
                    {
                        legionData.type = LegionType.Computer;
                    }
                }

                if (legionConfig.type == LegionType.Player)
                {
                    War.realPlayerCount++;
                }


                if (War.isEditor)
                {
                    legionData.aiSendArm = false;
                    legionData.aiSkill   = false;
                    legionData.produce   = false;
                    legionData.aiUplevel = false;
                }


                if (War.isTest)
                {
                    if (legionData.type == LegionType.Computer || (legionData.type == LegionType.Player && legionData.legionId != War.ownLegionID))
                    {
                        legionData.aiSendArm = true;
                        legionData.aiSkill   = true;
                        legionData.produce   = true;
                        legionData.aiUplevel = true;
                        legionData.aiConfig  = stageConfig.id >= 71 && stageConfig.id <= 80 ? War.model.GetAIConfig(102) : War.model.GetAIConfig(302);
                    }
                }

                if (War.isRecord)
                {
                    legionData.aiSendArm = false;
                    legionData.aiSkill   = false;
                    legionData.aiUplevel = false;
                }


                int id = GetPlayerUID(legionData.legionId);

                // 势力单位数据
                UnitData unitData = new UnitData();
                unitData.id       = id;
                unitData.legionId = legionData.legionId;
                unitData.unitType = UnitType.Player;
                float x = 5 * Mathf.FloorToInt((legionData.legionId + 1) / 2) * (legionData.legionId % 2 == 0 ? 1 : -1);
                unitData.position   = new Vector3(x, 0f, -11F);
                legionData.unitData = unitData;

                /** 战前势力--怒气上限 */
                legionData.legionInitProp[PropId.InitMaxMage] = WarFormula.WF_Legion_MaxMage();
                /** 战前势力--怒气 */
                legionData.legionInitProp[PropId.MagAdd] = legionData.legionInitProp[PropId.InitMag] = enterData.vsmode != VSMode.PVE_Expedition ? WarFormula.WF_Legion_Mage() : enterData.GetMag(legionData.legionId);
                /** 战前势力--怒气 */
                legionData.legionInitProp[PropId.InitMageSpeed] = ConstConfig.GetFloat(ConstConfig.ID.War_DV_Mag_Recovery_Ratio);



                //TODO Test
                //legionData.aiSendArm = true;
                //legionData.aiSkill = true;
                //legionData.aiConfig = War.model.GetAIConfig(302);
            }

            // 获取自己势力数据
            ownLegion = legionDict[ownLegionID];


            // 交换势力颜色
            if (occupyMainLegionData != null && occupyMainLegionData != ownLegion)
            {
                int tempColorId = ownLegion.colorId;
                ownLegion.colorId            = occupyMainLegionData.colorId;
                occupyMainLegionData.colorId = tempColorId;
            }
            else
            {
                ownLegion.colorId = War.config.ownDefaultColor;
            }


            // 创建势力联盟数据LegionGroupData
            foreach (StageLegionGroupConfig groupConfig in stageConfig.legionGroups)
            {
                LegionGroupData groupData = new LegionGroupData(groupConfig.id);
                legionGroupDict.Add(groupData.id, groupData);

                foreach (StageLegionConfig legionConfig in groupConfig.list)
                {
                    groupData.AddLegion(legionDict[legionConfig.legionId]);
                }
            }


            List <int> colorIdList = new List <int>();

            foreach (KeyValuePair <int, LegionData> legionKVP in War.sceneData.legionDict)
            {
                colorIdList.Add(legionKVP.Value.colorId);
            }

            colorIds = colorIdList.ToArray();
        }