Exemplo n.º 1
0
        private void UpdateValue(BoardGameLayer layer, StarEntity starEntity)
        {
            HashSet <StarLinkEntity> starLinkEntities = layer.StarToLinks[starEntity];

            List <CardEntity> currentAffectedStarEntity = new List <CardEntity>();

            if (starEntity.CardSocketed.Card.Constellation != null)
            {
                IConstellation constellation = starEntity.CardSocketed.Card.Constellation;

                currentAffectedStarEntity.AddRange(constellation.NodeToStarEntity.Values.Where(pElem => pElem.CardSocketed != null && pElem.CardSocketed.Card.CurrentOwner == starEntity.CardSocketed.Card.CurrentOwner).Select(pElem => pElem.CardSocketed));
            }

            IEnumerable <CardEntity> noMoreAffected = this.affectedCardEntities.Except(currentAffectedStarEntity);
            IEnumerable <CardEntity> newAffected    = currentAffectedStarEntity.Except(this.affectedCardEntities);

            foreach (CardEntity cardEntity in noMoreAffected)
            {
                layer.PendingActions.Add(new ClearCardValueModifier(cardEntity, this));
            }

            foreach (CardEntity cardEntity in newAffected)
            {
                layer.PendingActions.Add(new SetCardValueModifier(cardEntity, this, this.Value));
            }

            this.affectedCardEntities = currentAffectedStarEntity;
        }
Exemplo n.º 2
0
 private void InitConstellations()
 {
     if (this.cardTemplate.Constellation != null)
     {
         this.constellation = this.cardTemplate.Constellation.Clone(this);
     }
     else
     {
         this.constellation = null;
     }
 }
Exemplo n.º 3
0
        public CardTemplate(string name, string nameIdLoc, string poemIdLoc, string effectIdLoc, int defaultValue)
        {
            this.DefaultValue = defaultValue;
            //this.BonusValue = bonusValue;

            this.Name = name;

            this.NameIdLoc   = nameIdLoc;
            this.PoemIdLoc   = poemIdLoc;
            this.EffectIdLoc = effectIdLoc;

            this.CanBeMoved         = true;
            this.CanBeValueModified = true;

            this.CardBehaviors = new List <ICardBehavior>();

            this.Constellation = null;
        }
Exemplo n.º 4
0
        private void AddCardFocusedFillLink()
        {
            CardEntity cardEntity = this.object2DToObjects[this.CardFocused] as CardEntity;

            if (cardEntity.Card.IsAwakened)
            {
                this.linksFocused.Clear();
                if (cardEntity.Card.Constellation != null)
                {
                    IConstellation constellation = cardEntity.Card.Constellation;

                    foreach (List <StarLinkEntity> listStarLinks in constellation.LinkToStarLinkEntity.Values)
                    {
                        this.linksFocused.AddRange(listStarLinks.Select(pElem => this.objectToObject2Ds[pElem] as StarLinkEntity2D));
                    }
                }

                foreach (StarLinkEntity2D starLinkEntity2D in this.linksFocused)
                {
                    starLinkEntity2D.IsFocused = true;
                }
            }
        }
Exemplo n.º 5
0
        public static ConstellationPattern CreateAssociatedCardsPatternFrom(ConstellationPattern modelPattern, IConstellation constellation)
        {
            ConstellationPattern patternToCreate = new ConstellationPattern();

            Dictionary <ConstellationNode, ConstellationNode> nodeToNewNode = new Dictionary <ConstellationNode, ConstellationNode>();

            ConstellationNode newNode;

            foreach (ConstellationNode node in modelPattern.ConstellationNodeSystem)
            {
                if (node != modelPattern.NodeSelf)
                {
                    StarEntity associatedStarEntity = constellation.NodeToStarEntity[node];

                    newNode = new ConstellationCardEntityNode(associatedStarEntity.CardSocketed);
                    nodeToNewNode.Add(node, newNode);

                    patternToCreate.AddNode(newNode);
                }
            }

            newNode = new ConstellationNodeSelf();
            nodeToNewNode.Add(modelPattern.NodeSelf, newNode);
            patternToCreate.AddNode(newNode);

            foreach (ConstellationLink link in modelPattern.ConstellationLinkSystem)
            {
                patternToCreate.AddNodeLink(new ConstellationLink(nodeToNewNode[link.Node1], nodeToNewNode[link.Node2]));
            }

            return(patternToCreate);
        }
Exemplo n.º 6
0
 internal void OnConstellationUnawakened(IConstellation constellationUnawakened)
 {
     this.IsAwakened = false;
 }
Exemplo n.º 7
0
 internal void OnConstellationAwakened(IConstellation constellationAwakened)
 {
     this.IsAwakened = true;
 }