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; }
private void InitConstellations() { if (this.cardTemplate.Constellation != null) { this.constellation = this.cardTemplate.Constellation.Clone(this); } else { this.constellation = null; } }
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; }
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; } } }
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); }
internal void OnConstellationUnawakened(IConstellation constellationUnawakened) { this.IsAwakened = false; }
internal void OnConstellationAwakened(IConstellation constellationAwakened) { this.IsAwakened = true; }