]> Pileus Git - ~andy/rhawk/blobdiff - spades.awk
Fix broken playto scores
[~andy/rhawk] / spades.awk
index 5cf5c05ec98d8dd6134fd00eadad965a482f7f05..8475bf9036fece6785b410f4f4e8253018ba71bf 100644 (file)
@@ -313,12 +313,10 @@ function sp_play(card,    winner, pi)
                        say("Game over!")
                        winner = sp_scores[0] > sp_scores[1] ? 0 : 1
                        looser = !winner
-                       say(sp_team(winner) " wins the game " \
+                       say(CHANNEL, sp_team(winner) " wins the game " \
                            sp_scores[winner] " to " sp_scores[looser])
-                       say(sp_order[winner+0] "++")
-                       say(sp_order[winner+2] "++")
-                       say(sp_order[looser+0] "--")
-                       say(sp_order[looser+2] "--")
+                       say(CHANNEL, sp_order[winner+0] "++")
+                       say(CHANNEL, sp_order[winner+2] "++")
                        sp_reset(2)
 
                } else {
@@ -397,7 +395,7 @@ AUTH == OWNER &&
 
 AUTH == OWNER &&
 sp_state == "play" &&
-/^\.play (\w+) (\S+)$/ {
+/^\.force (\w+) (\S+)$/ {
        say(sp_channel, FROM " is cheating for " $2)
        sp_from = $2
        sp_play($3)
@@ -406,7 +404,7 @@ sp_state == "play" &&
 
 
 # Setup
-/^\.newgame ?([0-9]+)?/ {
+/^\.newgame ?([0-9]+)?$/ {
        if (sp_state != "new") {
                reply("There is already a game in progress.")
        } else {
@@ -551,8 +549,9 @@ sp_state ~ "(bid|pass|play)" &&
 
 sp_valid &&
 sp_state == "play" &&
-/^\.play (\S+)$/ {
+/^\.play (\S+)/ {
        _card = $2
+       gsub(/[^A-Za-z0-9]/, "", _card);
        if (!(_card in sp_deck)) {
                reply("Invalid card")
        }