Ejemplo n.º 1
0
    // Setup initial relation value.
    public void SetupInitialRelations(CardManager manager, IEnumerable<long> cards)
    {
        foreach (long cardType in cards) {
            CardBaseData data = manager.GetCardBaseData(cardType);
            if (data.Equals(CardBaseData.EmptyCard)) {
                continue;
            }

            if (data.Relations != null) {
                foreach (RelationBaseData relation in data.Relations) {
                    var otherCards = manager.FindCardsWithName(relation.OtherName);
                    foreach (CardBaseData otherCardData in otherCards) {
                        // Can be optimized (doesn't need to do fromCard lookup every time), but oh well.
                        ApplyRelationshipChange(data.CardType, otherCardData.CardType, relation.Relationship);
                    }
                }
            }
        }
    }