Example #1
0
 private int GetWavesUnitID(int randomNum, EndlessWavesProto.EndlessWaves currentWave)
 {
     if (randomNum <= currentWave.Chance_1)
     {
         return(currentWave.UnitID_1);
     }
     else if (randomNum <= currentWave.Chance_2)
     {
         return(currentWave.UnitID_2);
     }
     else if (randomNum <= currentWave.Chance_3)
     {
         return(currentWave.UnitID_3);
     }
     else if (randomNum <= currentWave.Chance_4)
     {
         return(currentWave.UnitID_4);
     }
     else if (randomNum <= currentWave.Chance_5)
     {
         return(currentWave.UnitID_5);
     }
     else if (randomNum <= currentWave.Chance_6)
     {
         return(currentWave.UnitID_6);
     }
     else if (randomNum <= currentWave.Chance_7)
     {
         return(currentWave.UnitID_7);
     }
     else if (randomNum <= currentWave.Chance_8)
     {
         return(currentWave.UnitID_8);
     }
     else if (randomNum <= currentWave.Chance_9)
     {
         return(currentWave.UnitID_9);
     }
     else if (randomNum <= currentWave.Chance_10)
     {
         return(currentWave.UnitID_10);
     }
     else
     {
         DebugUtils.LogError(DebugUtils.Type.Endless, "EndlessMode soldier spwan all chance is not happend, Check the design!");
         return(-1);
     }
 }
Example #2
0
        //TODO:If EndlessMode soldier value change roles confirm, modify this function.Dwayne.
        private BattleUnit UnitLevelPropertyRatio(BattleUnit unitData, EndlessWavesProto.EndlessWaves currentWave)
        {
            for (int i = 0; i < unitData.props.Count; i++)
            {
                if (unitData.props[i].propertyType == PropertyType.MaxHealth)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * currentWave.Wave_Level;
                }
                else if (unitData.props[i].propertyType == PropertyType.HealthRecover)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * currentWave.Wave_Level;
                }
                else if (unitData.props[i].propertyType == PropertyType.PhysicalAttack)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_PropertyRatio * currentWave.Wave_Level;
                }
                //else if( unitData.props[ i ].propertyType == PropertyType.RangedDmgBase )
                //{
                //	unitData.props[ i ].propertyValue += unitData.props[ i ].propertyValue * currentWave.UnitLevel_PropertyRatio * currentWave.Wave_Level;
                //}
                else if (unitData.props[i].propertyType == PropertyType.AttackRange)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_RangeRatio * currentWave.Wave_Level;
                }
                else if (unitData.props[i].propertyType == PropertyType.AttackRange)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_DamageRadiusRatio * currentWave.Wave_Level;
                }
                else if (unitData.props[i].propertyType == PropertyType.Speed)
                {
                    unitData.props[i].propertyValue = unitData.props[i].propertyValue * currentWave.UnitLevel_SpeedRatio * currentWave.Wave_Level;
                }
                else
                {
                    DebugUtils.Log(DebugUtils.Type.Endless, "This prop not need modify value about TrainingWaves table");
                    continue;
                }
            }

            return(unitData);
        }
Example #3
0
        private void InitEndlessModeUnitData(EndlessWavesProto.EndlessWaves sampleData)
        {
            List <int>             EndlessModeUnitUIDList = new List <int>();
            List <UnitsProto.Unit> unitsTempDatas         = DataManager.GetInstance().unitsProtoData;

            EndlessModeUnitUIDList.Add(sampleData.UnitID_1);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_2);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_3);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_4);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_5);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_6);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_7);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_8);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_9);
            EndlessModeUnitUIDList.Add(sampleData.UnitID_10);

            for (int i = 0; i < EndlessModeUnitUIDList.Count; i++)
            {
                if (EndlessModeUnitUIDList[i] > 0)
                {
                    BattleUnit      model = new BattleUnit();
                    UnitsProto.Unit data  = DataManager.GetInstance().unitsProtoData.Find(p => p.ID == EndlessModeUnitUIDList[i]);

                    if (data == null)
                    {
                        DebugUtils.LogError(DebugUtils.Type.Training, string.Format("The Endless mode unit id error, can't find this unit id {0} unit, please check this.", EndlessModeUnitUIDList[i]));
                    }

                    PropertyInfo physicalAttack = new PropertyInfo();
                    physicalAttack.propertyType  = PropertyType.PhysicalAttack;
                    physicalAttack.propertyValue = data.PhysicalAttack;
                    model.props.Add(physicalAttack);

                    PropertyInfo magicAttackValue = new PropertyInfo();
                    magicAttackValue.propertyType  = PropertyType.MagicAttack;
                    magicAttackValue.propertyValue = data.MagicAttack;
                    model.props.Add(magicAttackValue);

                    PropertyInfo armor = new PropertyInfo();
                    armor.propertyType  = PropertyType.ArmorPro;
                    armor.propertyValue = data.Armor;
                    model.props.Add(armor);

                    PropertyInfo magicResist = new PropertyInfo();
                    magicResist.propertyType  = PropertyType.MagicResist;
                    magicResist.propertyValue = data.MagicResist;
                    model.props.Add(magicResist);

                    PropertyInfo criticalChance = new PropertyInfo();
                    criticalChance.propertyType  = PropertyType.CriticalChance;
                    criticalChance.propertyValue = data.CriticalChance;
                    model.props.Add(criticalChance);

                    PropertyInfo criticalDamage = new PropertyInfo();
                    criticalDamage.propertyType  = PropertyType.CriticalDamage;
                    criticalDamage.propertyValue = data.CriticalDamage;
                    model.props.Add(criticalDamage);

                    PropertyInfo moveSpeed = new PropertyInfo();
                    moveSpeed.propertyType  = PropertyType.Speed;
                    moveSpeed.propertyValue = data.MoveSpeed;
                    model.props.Add(moveSpeed);

                    PropertyInfo rangedMitigation = new PropertyInfo();
                    rangedMitigation.propertyType  = PropertyType.AttackSpeed;
                    rangedMitigation.propertyValue = data.AttackInterval;
                    model.props.Add(rangedMitigation);

                    PropertyInfo attackRange = new PropertyInfo();
                    attackRange.propertyType  = PropertyType.AttackRange;
                    attackRange.propertyValue = data.AttackRange;
                    model.props.Add(attackRange);

                    PropertyInfo health = new PropertyInfo();
                    health.propertyType  = PropertyType.MaxHealth;
                    health.propertyValue = data.Health;
                    model.props.Add(health);

                    PropertyInfo healthRegen = new  PropertyInfo();
                    healthRegen.propertyType  = PropertyType.HealthRecover;
                    healthRegen.propertyValue = data.HealthRegen;
                    model.props.Add(healthRegen);

                    endlessModeUnitData.Add(EndlessModeUnitUIDList[i], model);
                }
            }
        }