private IntelligentCard getCard(int multiverseID) { if (!Cards.ContainsKey(multiverseID)) { var newCard = new IntelligentCard(multiverseID); var gotCard = newCard.LoadData(); if (!gotCard) { return(null); } Cards.Add(multiverseID, newCard); NameToID.Add(newCard.Name.ToLowerInvariant(), multiverseID); } var card = Cards[multiverseID]; return(card); }
private IntelligentCard getCardByName(string cardName) { var name = cardName.ToLowerInvariant(); if (NameToID.ContainsKey(name)) { int multiverseID = NameToID[name]; return(Cards[multiverseID]); } var newCard = new IntelligentCard(); var gotCard = newCard.LoadData(name); if (!gotCard) { return(null); } Cards.Add(newCard.MultiverseID, newCard); NameToID.Add(name, newCard.MultiverseID); return(newCard); }