Пример #1
0
        public bool CanMoveTo(PawnModel unitMoved, MyHexPosition target, MyHexPosition magicSelector, MyPlayer player)
        {
            if (!unitMoved.PossibleMoveTargets.Contains(target))
            {
                return(false);
            }
            else if (IsTileMovable(target))  //empty!
            {
                if (magicSelector == null)
                {
                    return(true);
                }
                if (GetPlayerMagicType(player) != MagicType.Wind)
                {
                    return(!magicSelector.Equals(target));
                }

                return(true);
            }
            else
            {
                if (Units.IsPawnAt(target))
                {
                    var tempUnitsContainer       = Units.Clone();
                    var tempProjectilesContainer = Projectiles.Clone();
                    var tempMapModel             = MapModel.Clone();

                    var newOrientation = unitMoved.Position.NeighboursWithDirections.Where(c => c.NeighbourPosition.Equals(target))
                                         .Select(c => c.NeighbourDirection).First();

                    var tempUnitModel = tempUnitsContainer.GetPawnAt(unitMoved.Position);
                    tempUnitsContainer.OrientPawn(tempUnitModel.Position, newOrientation);

                    var arbiter       = new BattleArbiter(tempUnitsContainer, tempProjectilesContainer, tempMapModel);
                    var battleResults = arbiter.PerformBattleAtPlace(unitMoved.Position, BattleCircumstances.Director);
                    return(battleResults.PositionWasFreed(target));
                }
            }
            return(false);
        }
Пример #2
0
        public BattleResults PerformBattleAtPlace(MyHexPosition battleActivatorPosition, BattleCircumstances battleCircumstances)
        {
            var arbiter = new BattleArbiter(Units, Projectiles, MapModel);

            return(arbiter.PerformBattleAtPlace(battleActivatorPosition, battleCircumstances));
        }