Mercurial > hg > batmud > misc
changeset 200:fb8a0390158b misc
Added script for data-mining spell names from cast fumbles.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 26 Mar 2011 15:14:54 +0200 |
parents | 6994c88ef1cd |
children | 36069ac5b0d2 |
files | spellnames.pl |
diffstat | 1 files changed, 59 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spellnames.pl Sat Mar 26 15:14:54 2011 +0200 @@ -0,0 +1,59 @@ +#!/usr/bin/perl -w +use strict; + +# Define the various spell chant prefixes here, we need them +# for matching the spell cast lines themselves. +my @spellchants = ( +"claps its hands and says", +"claps his hands and whispers", +"fills up his cheeks with air and exhales", +"booms in sinister voice", +"throws a pinch of magic dust in air and chants", +"rolls her eyes wildly and exclaims", +"rolls its eyes frantically and states", +"utters the magic words", +"spreads her fingers and whispers", +"waves its index finger while uttering", +"points an accusing finger and cries", +"gets an evil gleam in its eyes and chants", +"flaps arms and utters the magic words", +"flaps his arms and utters the magic words", +"taps its foot three times and utters the words", +"is surrounded by blue waves as you hear the words:", +"closes his eyes and with a dry, dark voice entones", +"shakes with firey rage and yells", +"traces fiery demonic night runes in the air", +"weaves a mystic matrix with glowing red lines in arcane ways and chants", +#"", +); + +### Convert spellchants array to regexp +my $spellregexps = join("|", map { s/ (his|its|her) / ... /g; $_ } @spellchants); + +my $sp_words = ""; +my $sp_mob = ""; +my $sp_flag = 0; +my $line = 0; +my %spells = (); + +while (defined(my $s = <STDIN>)) { + $line++; + chomp($s); + if ($s =~ /^([A-Za-z][A-Za-z\ -]+?)\ ($spellregexps)\ '(.+)'$/o) { + $sp_mob = $1; + $sp_words = $3; + $sp_flag = 1; + } + elsif ($s =~ /^([A-Za-z][A-Za-z\ -]+?) hesitates as (he|she|it) casts (.+?)\.$/o) { + my $sp_name = $3; + if ($sp_flag && $1 eq $sp_mob && $sp_words =~ /^[^\(].+[^\)]$/) { + $spells{$sp_words} = $sp_name; + $sp_flag = 0; + } + } +} + + +foreach my $words (sort { $a cmp $b } keys %spells) { + printf "%-25s | %s\n", $words, $spells{$words}; +} \ No newline at end of file