Exemple #1
0
        IEnumerator EvadeAll()
        {
            Zone              zoneToStayEnemies  = ThisCard.VisualOwner.CurrentLocation.MyOwnZone;
            LocationSymbol    thisLocationSymbol = ((CardLocation)GameControl.ActiveInvestigator.CurrentLocation.CardLogic).MySymbol;
            List <CardEffect> chooseToMove       = new List <CardEffect>();

            foreach (CardComponent location in GameControl.AllCardComponents.FindAll(c => c.CardType == CardType.Location && c.IsInPlay && ((CardLocation)c.CardLogic).CanMoveToThis(ThisCard.VisualOwner)))
            {
                chooseToMove.Add(new CardEffect(
                                     card: location,
                                     effect: () => Moving(location),
                                     type: EffectType.Choose,
                                     name: "Moverse aquí",
                                     investigatorImageCardInfoOwner: ThisCard.VisualOwner));
            }
            yield return(new ChooseCardAction(chooseToMove, cancelableCardEffect: ref evadeAll).RunNow());

            IEnumerator Moving(CardComponent location)
            {
                foreach (CardComponent enemy in ThisCard.VisualOwner.AllEnemiesInMyLocation)
                {
                    enemy.MoveTo(zoneToStayEnemies);
                }
                yield return(new MoveCardAction(ThisCard.VisualOwner.PlayCard, location.MyOwnZone).RunNow());

                foreach (CardComponent enemy in ThisCard.VisualOwner.AllEnemiesInMyLocation)
                {
                    yield return(new MoveCardAction(enemy, zoneToStayEnemies, withPreview: false).RunNow());
                }
            }
        }
        protected override IEnumerator LogicEffect()
        {
            List <CardComponent> locationsToChoose;
            List <CardEffect>    locationsToEffect  = new List <CardEffect>();
            LocationSymbol       thisLocationSymbol = ((CardLocation)ThisCard.VisualOwner.CurrentLocation.CardLogic).MySymbol;

            locationsToChoose = GameControl.AllCardComponents.FindAll(c => c.CardType == CardType.Location && c.IsInPlay && ((CardLocation)c.CardLogic).MovePosibilities.HasFlag(thisLocationSymbol));
            locationsToChoose.Add(ThisCard.VisualOwner.CurrentLocation);
            foreach (CardComponent location in locationsToChoose)
            {
                locationsToEffect.Add(new CardEffect(
                                          card: location,
                                          effect: () => Explosion(location),
                                          type: EffectType.Choose,
                                          name: "Lanzar dinamita a " + location.Info.Name,
                                          investigatorImageCardInfoOwner: ThisCard.VisualOwner));
            }
            yield return(new ChooseCardAction(locationsToEffect, cancelableCardEffect: ref playFromHand).RunNow());

            IEnumerator Explosion(CardComponent location)
            {
                foreach (CardComponent enemy in GameControl.AllCardComponents.FindAll(c => c.CardType == CardType.Enemy && ((CardEnemy)c.CardLogic).CurrentLocation == location))
                {
                    yield return(new DamageEnemyAction(enemy, 3).RunNow());
                }
                foreach (InvestigatorComponent investigator in GameControl.AllInvestigatorsInGame.FindAll(i => i.CurrentLocation == location))
                {
                    yield return(new AssignDamageHorror(investigator, damageAmount: 3).RunNow());
                }
            }
        }
Exemple #3
0
        protected override IEnumerator ThisCardEffect()
        {
            Zone       zoneToStayEnemies = GameControl.ActiveInvestigator.CurrentLocation.MyOwnZone;
            CardEffect thisCardEffect    = new CardEffect(
                card: ThisCard,
                effect: ConfirmDesenganged,
                type: EffectType.Choose,
                name: "Dejar de estar enfrentado a todos los enemigos");

            yield return(new ChooseCardAction(thisCardEffect, isOptionalChoice: true).RunNow());

            LocationSymbol    thisLocationSymbol = ((CardLocation)GameControl.ActiveInvestigator.CurrentLocation.CardLogic).MySymbol;
            List <CardEffect> chooseToMove       = new List <CardEffect>();

            foreach (CardComponent location in GameControl.AllCardComponents.FindAll(c => c.CardType == CardType.Location && c.IsInPlay && ((CardLocation)c.CardLogic).MovePosibilities.HasFlag(thisLocationSymbol)))
            {
                chooseToMove.Add(new CardEffect(
                                     card: location,
                                     effect: () => ConfirmMove(location),
                                     type: EffectType.Choose | EffectType.Move,
                                     name: "Moverse aquí"));
            }
            yield return(new ChooseCardAction(chooseToMove, isOptionalChoice: true).RunNow());

            if (desenganged)
            {
                foreach (CardComponent enemy in ThisCard.VisualOwner.AllEnemiesEnganged)
                {
                    enemy.MoveTo(zoneToStayEnemies);
                }
            }
            if (locationToMove != null)
            {
                yield return(new MoveCardAction(GameControl.ActiveInvestigator.PlayCard, locationToMove.MyOwnZone).RunNow());
            }
            if (desenganged)
            {
                foreach (CardComponent enemy in ThisCard.VisualOwner.AllEnemiesEnganged)
                {
                    yield return(new MoveCardAction(enemy, enemy.CurrentZone, withPreview: false).RunNow());
                }
            }
            desenganged    = false;
            locationToMove = null;

            IEnumerator ConfirmDesenganged()
            {
                desenganged = true;
                yield return(null);
            }

            IEnumerator ConfirmMove(CardComponent location)
            {
                locationToMove = location;
                yield return(null);
            }
        }
Exemple #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="location">Location object to show.</param>
        private LocationGraphicObject(Location location)
            : base(location)
        {
            _location = location;
            _location.PropertyChanged += new PropertyChangedEventHandler(_LocationPropertyChanged);

            Geometry = _CreatePoint(location);

            Symbol = new LocationSymbol();
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="stop">Source stop for graphic object.</param>
        private StopGraphicObject(Stop stop)
            : base(stop)
        {
            _stop  = stop;
            _route = stop.Route;

            Geometry = _CreatePoint(stop);

            IsVisible = stop.Route.IsVisible;

            stop.PropertyChanged += new PropertyChangedEventHandler(_StopPropertyChanged);

            if (stop.AssociatedObject is Order)
            {
                Order order = (Order)stop.AssociatedObject;
                order.PropertyChanged += new PropertyChangedEventHandler(_StopAssociatedObjectPropertyChanged);

                _SetOrderAttributes(stop);
                _CreateOrderSymbol(stop);
                App.Current.MapDisplay.LabelingChanged += new EventHandler(_MapDisplayLabelingChanged);
            }
            else if (stop.AssociatedObject is Location)
            {
                Location location = (Location)stop.AssociatedObject;
                location.PropertyChanged += new PropertyChangedEventHandler(_StopAssociatedObjectPropertyChanged);

                App.Current.MapDisplay.ShowLeadingStemTimeChanged  += new EventHandler(_MapDisplayShowStemTimeChanged);
                App.Current.MapDisplay.ShowTrailingStemTimeChanged += new EventHandler(_MapDisplayShowStemTimeChanged);

                Symbol    = new LocationSymbol();
                IsVisible = _IsLocationVisible();
            }
            else
            {
                Debug.Assert(false);
            }

            stop.Route.PropertyChanged += new PropertyChangedEventHandler(_StopRoutePropertyChanged);
        }