Skip to content

Commit

Permalink
figure out more categories of jargon
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Sep 17, 2023
1 parent ef760ec commit 62d5d92
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 75 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"scripts": {
"build": "npm run get:cards && npm run copy:headers",
"classifier:test": "ts-node scripts/classifier-test",
"copy:headers": "ts-node scripts/copy-headers",
"get:cards": "ts-node scripts/get-cards",
"check:version": "ts-node scripts/check-version"
Expand Down
10 changes: 10 additions & 0 deletions scripts/classifier-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

import * as cards from '../dist/cards.json';

const cardId = process.argv[2];

(cards as any[]).forEach(card => {
if(card.code !== cardId && !card.name.toLowerCase().includes(cardId.toLowerCase())) return;

console.log(card);
});
15 changes: 8 additions & 7 deletions scripts/helpers/card-classifier.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

import { armyNumberFromText } from './army-number-from-text';
import * as classifications from './classifications.json';
import { consistentizeText } from './consistentize-text';

const allClassifications = (classifications as any).default || classifications;

const hasAllText = (string, searches) => searches.every(search => string.toLowerCase().includes(search.toLowerCase()));
const hasAllText = (string, searches) => {
const searchText = consistentizeText(string.toLowerCase());
return searches.every(search => searchText.includes(consistentizeText(search.toLowerCase())));
}

module.exports.classify = function(card) {
card.tags = [];
Expand Down Expand Up @@ -44,19 +48,16 @@ module.exports.classify = function(card) {
}

allClassifications.forEach(({ terms, tag }) => {
if(terms.length === 0) return;

if(hasAllText(abil, terms)) {
card.tags.push(tag);
}
})

});

card.tags = [...new Set(card.tags)];

if(card.code === 'WS_LB/W21-065') {
console.log(card.tags)
console.log(card);
}
card.tags = [...new Set(card.tags)].sort();

return card;
};
128 changes: 60 additions & 68 deletions scripts/helpers/classifications.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@
"terms": ["When damage dealt by this card is canceled, you may put this card into your stock"],
"tag": "Cancel Self Stock"
},
{
"terms": ["look at up to", "cards from the top of your deck", "choose up to", "put it into your hand"],
"tag": "Top Deck Swapper"
},
{
"terms": ["waiting room", "return it to your hand"],
"tag": "Drop Salvage"
Expand Down Expand Up @@ -128,239 +124,235 @@
"tag": "Riki"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "choose a level 1 or lower character in your waiting room", "return it to your hand"],
"tag": "Christa"
},
{
"terms": [],
"terms": ["put the top card of your deck into your clock", "rest", "this card", "search your deck for up to one", "put it into your hand"],
"tag": "Takitsubo"
},
{
"terms": [],
"terms": ["when this card is put into your waiting room from the stage", "look at up to 2 cards", "choose up to 2", "reveal them to your opponent", "put them into your hand"],
"tag": "Shenlin"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "search your deck for up to 1", "reveal it", "put it into your hand"],
"tag": "Ruijerd"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "look at up to 4 cards from the top of your deck", "reveal it to your opponent", "put it into your hand"],
"tag": "Azusa"
},
{
"terms": [],
"terms": ["when this card is put into your waiting room from the stage", "look at up to 4 cards from the top of your deck", "choose up to 1", "character", "put it into your hand", "put the rest into your waiting room"],
"tag": "Chiyuri"
},
{
"terms": [],
"terms": ["when this card is put into your waiting room from the stage", "look at up to 4 cards from the top of your deck", "choose up to 1 level 1 or higher card", "put it into your hand", "put the rest into your waiting room"],
"tag": "Fuka"
},
{
"terms": ["when a climax is placed on your climax area", "look at up to 4 cards from the top of your deck", "choose up to 1", "character", "put it into your hand", "put the rest into your waiting room"],
"tag": "Amagi"
},
{
"terms": [],
"terms": ["you may reveal up to 3 cards from the top of your deck", "if you reveal at least one card", "choose up to 1", "characer", "put it into your hand", "put the rest into your waiting room"],
"tag": "Rize"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "look at up to 3 cards from the top of your deck", "choose up to 1 card from among them", "put it into your hand", "put the rest into your waiting room"],
"tag": "Kazuma"
},
{
"terms": [],
"terms": ["reveal the top 4 cards from the top of your deck", "if you reveal at least one card", "choose up to 1 climax", "put it into your hand", "put the rest into your waiting room"],
"tag": "Koume"
},
{
"terms": ["when this card's battle opponent becomes", "reverse", "move it to an open position of your back stage"],
"tag": "Clean Cut"
},
{
"terms": [],
"terms": ["put 1 climax from your hand into your waiting room", "choose 1", "character", "in your waiting room", "return it to your hand"],
"tag": "Recording"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "reveal the top card of your deck", "if that card", "character", "put it into your hand", "choose 1 card from your hand", "put it into your waiting room"],
"tag": "Console"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "reveal the top card of your deck", "choose 1 level", "character in your waiting room", "return it to your hand"],
"tag": "Riko"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "if that card", "character", "put it into your hand", "choose 1 card from your hand", "put it into your waiting room"],
"tag": "Arisu"
},
{
"terms": [],
"terms": ["when this card becomes", "reverse", "reveal the top card of your deck", "if that card is level 2 or higher, you may return this card to your hand"],
"tag": "Coinflip"
},
{
"terms": [],
"terms": ["at the start of your opponent's draw phase", "reveal the top card of your deck", "level 1 or higher", "return this to your hand"],
"tag": "Joe Runner"
},
{
"terms": [],
"terms": ["at the beginning of your encore step, if you do not have any other", "rest", "characters in your center stage", "this card"],
"tag": "Haruna Encore"
},
{
"terms": [],
"tag": "Shinobu"
"terms": ["when your other", "character is attacked", "return that character to hand"],
"tag": "Counter Bounce"
},
{
"terms": [],
"terms": ["when the battle opponent", "reversed", "send this to memory", "at the start of your next draw phase", "choose", "memory and put it in a slot on the stage"],
"tag": "Time Machine"
},
{
"terms": [],
"terms": ["during the attack phase, when your character or your opponent's character is returned to hand from the waiting room", "all of that player's characters get -3 soul until end of turn"],
"tag": "Anti-salvage"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "choose up to 1 of your opponent's characters", "put it into their memory", "and your opponent puts that character from their memory on any position of their stage"],
"tag": "Blink"
},
{
"terms": [],
"terms": ["choose a", "character in your waiting room and put it in your stock"],
"tag": "Alpaca"
},
{
"terms": [],
"terms": ["when this card attacks", "choose one of your other", "characters", "power until end of turn"],
"tag": "Shimakai"
},
{
"terms": [],
"terms": ["when a climax is placed on your climax area", "choose one of your characters", "power until end of turn"],
"tag": "Married Life"
},
{
"terms": [],
"terms": ["when this card becomes", "reverse", "if the level of this card's battle opponent is higher than your opponent's level", "you may", "that character"],
"tag": "Anti-Change Bomb"
},
{
"terms": [],
"terms": ["choose one of your characters", "that character gets the following ability", "when this card's battle opponent becomes", "reverse", "you may put the top card of your opponent's clock into his or her waiting room", "put that character into your opponent's clock"],
"tag": "Makoto"
},
{
"terms": [],
"terms": ["all of your other characters named", "power", "bond"],
"tag": "Apples"
},
{
"terms": [],
"terms": ["if there is a marker underneath this card, this card gets", "level", "power"],
"tag": "Futaba"
},
{
"terms": ["this card gets", "power", "for each of your other"],
"tag": "Eli"
},
{
"terms": [],
"terms": ["choose 1 of your opponent's level 1 or higher characters", "your opponent chooses 1 level", "or lower character in their waiting room", "exchanges them"],
"tag": "Level Down"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "if your deck has", "or less cards", "return all cards in your waiting room to your deck"],
"tag": "Freefresh"
},
{
"terms": [],
"tag": "Shimakaza"
"terms": ["when this card's battle opponent becomes", "reverse", "you may search your deck for up to", "character"],
"tag": "Shimakaze"
},
{
"terms": [],
"terms": ["cxcombo", "when this card attacks", "look at up to 4 cards from the top of your deck", "choose up to 1", "character", "put it into your hand", "put the rest into your waiting room"],
"tag": "Maguro"
},
{
"terms": [],
"terms": ["when this card's battle opponent becomes", "reverse", "look at up to 4 cards from the top of your deck", "choose up to 1", "character", "put it into your hand", "put the rest into your waiting room", "choose one of your characters", "power until end of turn"],
"tag": "Minami"
},
{
"terms": [],
"terms": ["when this card is attacked", "you may return this to your hand"],
"tag": "Oboro"
},
{
"terms": [],
"terms": ["when this card attacks", "in the climax zone", "you may choose a", "character in your waiting room and put it in your stock"],
"tag": "Elly"
},
{
"terms": [],
"terms": ["when this card's battle opponent becomes", "reverse", "if a card", "climax zone", "put up to one card from the top of your deck into your stock", "reveal the top card of your deck", "if that card is level 1 or higher", "put it into your hand"],
"tag": "Yunyun"
},
{
"terms": [],
"tag": "Shiroha"
},
{
"terms": ["When damage dealt by this card is canceled, put the top card of your deck into your waiting room"],
"tag": "Musashi"
},
{
"terms": [],
"terms": ["when this card attacks", "climax area", "deal four damage to your opponent"],
"tag": "Last Shot"
},
{
"terms": [],
"terms": ["when this card attacks", "climax area", "deal one damage to your opponent"],
"tag": "Trouble Girl"
},
{
"terms": [],
"terms": ["when this card attacks", "this card gets", "power", "until end of turn", "when this card's battle opponent becomes", "reverse", "deal one damage to your opponent"],
"tag": "Misakuro"
},
{
"terms": [],
"terms": ["during this card's battle", "when the damage you received is not canceled", "deal the same damage to your opponent"],
"tag": "Revenge Burn"
},
{
"terms": [],
"terms": ["during your opponent's turn", "when the damage taken by you is not cancelled", "if this is in the front row", "look at the top card of your deck", "put it either on top of the deck or in the waiting room"],
"tag": "Damage Scry"
},
{
"terms": [],
"terms": ["when this card is placed on the stage from your hand", "your opponent chooses two climax in your opponent's waiting room", "returns all cards except those cards", "shuffles"],
"tag": "Fumio"
},
{
"terms": [],
"terms": ["put all of your opponent's stock in the waiting room", "and your opponent puts the same number of cards from", "deck in the stock"],
"tag": "Stock Swap"
},
{
"terms": [],
"terms": ["put the bottom 4 cards of your opponents library in the waiting room", "deal", "damage to your opponent"],
"tag": "Icy Tail"
},
{
"terms": [],
"terms": ["when this card deals attack damage", "deal 1 damage x times"],
"tag": "Shiki"
},
{
"terms": [],
"terms": ["when this card attacks", "all of your", "characters get", "power", "soul", "until end of turn"],
"tag": "Commanding Strength"
},
{
"terms": [],
"terms": ["look at up to four cards from the top of your deck", "choose up to one", "character", "put it into your hand", "put the rest into your waiting room"],
"tag": "Torch"
},
{
"terms": [],
"terms": ["reveal three cards from the top of your deck and put them into your waiting room", "choose one level", "character in your waiting room", "return it to your hand"],
"tag": "Warehouse"
},
{
"terms": [],
"terms": ["put the top two cards of your deck into your waiting room", "choose a level", "or lower", "return it to your hand"],
"tag": "Cigarette"
},
{
"terms": [],
"terms": ["choose a character in battle and that character", "this card cannot deal damage"],
"tag": "Anti-Damage"
},
{
"terms": [],
"terms": ["choose one of your characters", "card name", "put it into your waiting room", "put the top card of your clock into your hand", "this card into your memory"],
"tag": "Sayaka's Wish"
},
{
"terms": [],
"terms": ["when you use this card", "backup", "reveal the top card of your deck", "if that card is", "character", "put it into your hand", "choose a card in your hand", "put it into your waiting room"],
"tag": "Leafa Counter"
},
{
"terms": [],
"terms": ["choose one of your characters", "gains", "power", "turn", "stock"],
"tag": "Gloves"
},
{
"terms": [],
"tag": "Sword"
},
{
"terms": [],
"terms": ["search your deck for", "character", "put it into your hand", "put this card into your memory"],
"tag": "Mask"
}
]
12 changes: 12 additions & 0 deletions scripts/helpers/consistentize-text.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

export function consistentizeText(text: string) {
return text
.split('0').join('zero')
.split('1').join('one')
.split('2').join('two')
.split('3').join('three')
.split('4').join('four')
.split('zone').join('area')
.split('library').join('deck')
;
}

0 comments on commit 62d5d92

Please sign in to comment.