Compare commits
3 Commits
ea2285ed1d
...
dont-resol
Author | SHA1 | Date | |
---|---|---|---|
d9d8151c74
|
|||
5f5603fff7
|
|||
ce70a9fb4d
|
10
README.md
10
README.md
@@ -43,3 +43,13 @@ whatever SQL queries against the data file (default `data.db`) you want.
|
|||||||
- calculate gametime based on active turns rather than moves used
|
- calculate gametime based on active turns rather than moves used
|
||||||
- also solves the issue where paralyzed/confused turns are not counted
|
- also solves the issue where paralyzed/confused turns are not counted
|
||||||
- use asyncio in bot
|
- use asyncio in bot
|
||||||
|
- allow for entering unplayed forfeits
|
||||||
|
- easy correction of game drift (e.g., two games played for a single team in a week)
|
||||||
|
- collect stats on teras and megas
|
||||||
|
- inline common queries into the base database as views
|
||||||
|
- channel filtering for replay collection
|
||||||
|
- move/damage tracking:
|
||||||
|
- delayed damage (Future Sight and co)
|
||||||
|
- self-damage misattribution (Belly Drum, possibly Explosion)
|
||||||
|
- indirect status (Toxic Spikes)
|
||||||
|
- weather?
|
||||||
|
5
bot.py
5
bot.py
@@ -101,8 +101,11 @@ class BotClient(discord.Client):
|
|||||||
proc = sp.run(
|
proc = sp.run(
|
||||||
["node", "calc_main.js", "--"] + args, stdout=sp.PIPE, stderr=sp.PIPE
|
["node", "calc_main.js", "--"] + args, stdout=sp.PIPE, stderr=sp.PIPE
|
||||||
)
|
)
|
||||||
|
stderr = proc.stderr.decode().strip()
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
raise Exception(proc.stderr.decode())
|
raise Exception(stderr)
|
||||||
|
if stderr:
|
||||||
|
_log.warning(f"running calculation '{args}': {stderr}")
|
||||||
return proc.stdout.decode()
|
return proc.stdout.decode()
|
||||||
|
|
||||||
def is_replay(self, message: discord.Message) -> bool:
|
def is_replay(self, message: discord.Message) -> bool:
|
||||||
|
11
calc.js
11
calc.js
@@ -63,7 +63,10 @@ function buildLexer() {
|
|||||||
const Move = createToken({
|
const Move = createToken({
|
||||||
name: "Move",
|
name: "Move",
|
||||||
pattern: new RegExp(
|
pattern: new RegExp(
|
||||||
[...gen.moves].map((m) => escapeRegExp(m.name)).join("|")
|
[...gen.moves]
|
||||||
|
.map((m) => escapeRegExp(m.name))
|
||||||
|
.sort((a, b) => b.length - a.length)
|
||||||
|
.join("|")
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -350,6 +353,12 @@ function test() {
|
|||||||
|
|
||||||
res = parseAndCalculate("Zoroark-Hisui Night Slash vs Golem");
|
res = parseAndCalculate("Zoroark-Hisui Night Slash vs Golem");
|
||||||
assert(res.attacker.name === "Zoroark-Hisui", "should parse regional forme");
|
assert(res.attacker.name === "Zoroark-Hisui", "should parse regional forme");
|
||||||
|
|
||||||
|
res = parseAndCalculate("Ditto Thunder Punch vs. Avalugg");
|
||||||
|
assert(
|
||||||
|
res.move.name === "Thunder Punch",
|
||||||
|
"should match entire move that is a superset of another move"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { parseAndCalculate, test };
|
export { parseAndCalculate, test };
|
||||||
|
Reference in New Issue
Block a user