39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Print the implicit-self channel catalogue used by the native cast host test."""
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from turtle_data import DBC, spell_layout
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("spell_dbc", type=Path)
|
|
spells = DBC(parser.parse_args().spell_dbc, fields=173)
|
|
fields = spell_layout()
|
|
selected = []
|
|
channels = 0
|
|
for row in spells.rows:
|
|
if not row[fields["AttributesEx"]] & 0x44:
|
|
continue
|
|
channels += 1
|
|
if row[fields["Targets"]]:
|
|
continue
|
|
targets = {
|
|
row[fields[column] + i]
|
|
for i in range(3) if row[fields["Effect"] + i]
|
|
for column in ("ImplicitTargetA", "ImplicitTargetB")
|
|
}
|
|
if targets - {0} == {1}:
|
|
selected.append((row[fields["ID"]], spells.string(row[fields["Name_lang"]])))
|
|
|
|
print("// Generated by ops/channelled_self_cast_fixture.py from Octo Spell.dbc.")
|
|
print(f"// SHA-256 {spells.digest()}")
|
|
print(f"// {len(spells.rows)} spells, {channels} channelled, {len(selected)} implicit-self channels.")
|
|
for spell, name in sorted(selected):
|
|
print(f"{spell}, // {name}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|