コード例 #1
0
ファイル: Rater3.cs プロジェクト: madddmax/jackal
        /// <summary>
        /// Уход от удара
        /// </summary>
        /// <param name="moveRate"></param>
        protected override void MoveFromAtack(MoveRate moveRate)
        {
            //Не боимся слазить с корабля стоя на нем
            if (moveRate.Move.From.Position == MyShip.Position)
            {
                return;
            }

            if (AllEnemies.Any(e => Distance(e.Position.Position, moveRate.Move.From.Position) == 1) &&
                AllEnemies.All(e => Distance(e.Position.Position, moveRate.Move.To.Position) != 1))
            {
                moveRate.AddRate("MoveFromAtack", Coef.MoveFromAtack
                                 * (moveRate.Move.WithCoins ? 1.3 : 1)
                                 * (GoldOnPosition(moveRate.Move.To.Position) > 0 ? 1.2 : 1)
                                 * (Distance(moveRate.Move.From.Position, MyShip.Position) > Distance(moveRate.Move.To.Position, MyShip.Position) ? 1.1 : 1)
                                 * (Distance(moveRate.Move.From.Position, MyShip.Position) < Distance(moveRate.Move.To.Position, MyShip.Position) ? 0.9 : 1)
                                 );
                moveRate.AddApplyToAllRate("MoveFromAtackToAll", Coef.MoveFromAtackToAll);
            }
        }