This commit is contained in:
parent
92ef0041ff
commit
b848629f8d
5 changed files with 19 additions and 15 deletions
|
@ -5,8 +5,6 @@ import Series from "../database/entities/card/Series";
|
|||
|
||||
export default class CardDropHelper {
|
||||
public static async GetRandomCard(): Promise<Card> {
|
||||
const seriesRepository = CardDataSource.getRepository(Series);
|
||||
|
||||
const allSeries = await Series.FetchAll(Series, [ "Cards", "Cards.Series" ]);
|
||||
const allSeriesWithCards = allSeries.filter(x => x.Cards.length > 0);
|
||||
|
||||
|
@ -27,7 +25,7 @@ export default class CardDropHelper {
|
|||
else if (randomRarity < goldChance) cardRarity = CardRarity.Gold;
|
||||
else cardRarity = CardRarity.Legendary;
|
||||
|
||||
const allCards = randomSeries.Cards.filter(x => x.Rarity == cardRarity);
|
||||
const allCards = randomSeries.Cards.filter(x => x.Rarity == cardRarity && x.Path && x.FileName);
|
||||
|
||||
const randomCardIndex = Math.floor(Math.random() * allCards.length);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue