Skip to content

Commit

Permalink
implement card attributes generator to collection view
Browse files Browse the repository at this point in the history
  • Loading branch information
yaspo committed Aug 28, 2024
1 parent af5287a commit 54188db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ export class CollectionCommand extends Command {
wishlist = ` · ◆${card.mapper.wishlistEntries.length} `;
}

return `\`${card.id}\` · ${conditionEmoji} ${wishlist}· ${card.mapper.username} (${card.burnValue} gold)`;
let attributes = [...card.getAttributes()].map(it => `\`${it}\``).join(' · ')
attributes = attributes ? ' · ' + attributes : ''

return `\`${card.id}\` · ${conditionEmoji} ${wishlist}· ${card.mapper.username} (${card.burnValue} gold) ${attributes}`;
})
.join('\n') + `\n\nSorting by: \`${orderByReadable}\``
);
Expand Down
7 changes: 7 additions & 0 deletions src/entities/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export class Card {
return attributes;
}

* getAttributes(): Generator<string> {
if (this.foil)
yield 'foil'
if (this.jobMindblocked)
yield 'mindblocked'
}

get jobEffort() {
return Math.round(
this.jobBaseEffort * this.jobMotivation * 0.1 * (this.jobMindblocked ? 0.5 : 1)
Expand Down

0 comments on commit 54188db

Please sign in to comment.