Beispiel #1
0
 public void CheckReinforcement(int numberOfTroops)
 {
     if (!this.IsInitialSpawnOver)
     {
         return;
     }
     for (int index = 0; index < 2; ++index)
     {
         int val1 = numberOfTroops;
         if (val1 > 0 && this._numberOfTroopsInQueueForReinforcement[index] > 0 && this._missionSides[index].TroopSpawningActive)
         {
             int number = Math.Min(MBMath.Floor((float)val1 * this.BattleSizeEffect), this._numberOfTroopsInQueueForReinforcement[index]);
             this._missionSides[index].SpawnTroops(number, true);
             InformationManager.AddQuickInformation(this._missionSides[index].IsPlayerSide ? GameTexts.FindText("str_new_reinforcements_have_arrived_for_ally_side") : GameTexts.FindText("str_new_reinforcements_have_arrived_for_enemy_side"));
             MatrixFrame cameraFrame = Mission.Current.GetCameraFrame();
             Vec3        position    = cameraFrame.origin + cameraFrame.rotation.u;
             MBSoundEvent.PlaySound(this._missionSides[index].IsPlayerSide ? SoundEvent.GetEventIdFromString("event:/alerts/report/reinforcements_ally") : SoundEvent.GetEventIdFromString("event:/alerts/report/reinforcements_enemy"), position);
             int num1 = Math.Min(val1, this._numberOfTroopsInQueueForReinforcement[index]);
             this._numberOfTroopsInQueueForReinforcement[index] -= num1;
             int num2 = num1 - number;
             this.GetActivePhaseForSide((BattleSideEnum)index).RemainingSpawnNumber += num2;
             Debug.Print("Side: " + (object)(BattleSideEnum)index, color: Debug.DebugColor.Green, debugFilter: 64UL);
             Debug.Print("NumberOfTroopsRemovedFromQueue: " + (object)num1, color: Debug.DebugColor.Green, debugFilter: 64UL);
             Debug.Print("NumberOfTroopsAddedToRemainingPool: " + (object)num2, color: Debug.DebugColor.Green, debugFilter: 64UL);
         }
     }
 }
        private int GetEstimatedRelationValue()
        {
            var baseRelation     = GetBaseRelationValueOfCurrentGoldCost();
            var adjustedRelation = Campaign.Current.Models.DiplomacyModel.GetRelationIncreaseFactor(Hero.MainHero, _clan.Leader, baseRelation);

            return(MBMath.Floor(adjustedRelation));
        }
        private int GetEstimatedRelationValue()
        {
            ExplainedNumber explainedNumber = new ExplainedNumber((float)GetBaseRelationValueOfCurrentGoldCost(), new StatExplainer(), null);

            Campaign.Current.Models.DiplomacyModel.GetRelationIncreaseFactor(Hero.MainHero, _clan.Leader, ref explainedNumber);
            return(MBMath.Floor(explainedNumber.ResultNumber));
        }
 public override void OnMissionTick(float dt)
 {
     if (!this.CheckTimer(dt))
     {
         return;
     }
     this._missionAgentSpawnLogic.CheckReinforcement(Math.Max(MBMath.Floor((float)this._battleCombatants[1].NumberOfHealthyMembers * 0.07f), 5));
 }
        public static int RoundRandomized(float f)
        {
            int num = MBMath.Floor(f);

            if ((double)MBRandom.RandomFloat < (double)(f - (float)num))
            {
                ++num;
            }
            return(num);
        }
        public override void AfterStart()
        {
            int ofHealthyMembers1    = this._battleCombatants[0].NumberOfHealthyMembers;
            int ofHealthyMembers2    = this._battleCombatants[1].NumberOfHealthyMembers;
            int defenderInitialSpawn = MBMath.Floor((float)ofHealthyMembers1);
            int attackerInitialSpawn = MBMath.Floor((float)ofHealthyMembers2 * 0.1f);

            this._missionAgentSpawnLogic.SetSpawnHorses(BattleSideEnum.Defender, true);
            this._missionAgentSpawnLogic.SetSpawnHorses(BattleSideEnum.Attacker, true);
            this._missionAgentSpawnLogic.InitWithSinglePhase(ofHealthyMembers1, ofHealthyMembers2, defenderInitialSpawn, attackerInitialSpawn, false, false);
            this._missionAgentSpawnLogic.ReserveReinforcement(BattleSideEnum.Attacker, ofHealthyMembers2 - attackerInitialSpawn);
        }
        protected int GetMaximumDepth(int unitCount)
        {
            int val1 = 0;
            int num  = 0;

            while (num < unitCount)
            {
                int val2 = MBMath.Floor((float)(6.28318548202515 * (double)((float)val1 * (this.Distance + this.UnitDiameter)) / ((double)this.Interval + (double)this.UnitDiameter)));
                num += Math.Max(1, val2);
                ++val1;
            }
            return(Math.Max(val1, 1));
        }
        public override void AfterStart()
        {
            Scene             scene = base.Mission.Scene;
            List <GameEntity> list  = base.Mission.Scene.FindEntitiesWithTag("sp_special_item").ToList <GameEntity>();

            int num  = MBMath.Floor((float)this._mapEvent.GetNumberOfInvolvedMen(BattleSideEnum.Defender));
            int num2 = MBMath.Floor((float)this._mapEvent.GetNumberOfInvolvedMen(BattleSideEnum.Attacker));
            int defenderInitialSpawn = num;
            int attackerInitialSpawn = num2;

            this._missionAgentSpawnLogic.SetSpawnHorses(BattleSideEnum.Defender, false);
            this._missionAgentSpawnLogic.SetSpawnHorses(BattleSideEnum.Attacker, false);
            this._missionAgentSpawnLogic.InitWithSinglePhase(num, num2, defenderInitialSpawn, attackerInitialSpawn, true, true, 1f);
        }
        private static int GetMaximumDepth(int unitCount, float distance, float interval, float unitDiameter)
        {
            int val1 = 0;
            int num  = 0;

            while (num < unitCount)
            {
                int val2 = MBMath.Floor((float)(6.28318548202515 *
                                                (val1 * (distance + unitDiameter)) /
                                                (interval + (double)unitDiameter)));
                num += Math.Max(1, val2);
                ++val1;
            }
            return(Math.Max(val1, 1));
        }
 private int GetUnitCountOfRank(int rankIndex) => rankIndex == 0 ? this.FileCount : Math.Max(1, MBMath.Floor((float)(6.28318548202515 * (double)this.GetDistanceFromCenterOfRank(rankIndex) / ((double)this.Interval + (double)this.UnitDiameter))));
 private int GetEstimatedRelationValue()
 {
     return(MBMath.Floor(Campaign.Current.Models.DiplomacyModel.GetRelationIncreaseFactor(Hero.MainHero, _clan.Leader, GetBaseRelationValueOfCurrentGoldCost())));
 }