-# Todo:
-# - highest bidder leads
-# - show card after play
-
# Functions
function sp_init(cards, tmp0, tmp1)
{
bids = sp_bids[i] + sp_bids[i+2]
tricks = sp_tricks[i] + sp_tricks[i+2]
bags = tricks - bids
- if (sp_bags(i) + bags > 10) {
+ if (sp_bags(i) + bags >= 10) {
say(sp_team(i) " bag out")
sp_scores[i] -= 100
}
delete sp_hands[$2]
for (i=3; i<=NF; i++)
sp_hands[$2][$i] = 1
- privmsg(sp_channel, FROM " is cheating for " $2)
+ say(sp_channel, FROM " is cheating for " $2)
}
# Setup
-/^\.newgame ?([0-9]+)?$/ {
+/^\.newgame ?([0-9]+)?/ {
if (sp_state != "new") {
reply("There is already a game in progress.")
} else {
sp_state = "join"
sp_channel = DST
say(sp_owner " starts a game of Spades to " sp_playto "!")
- #privmsg("#rhnoise", sp_owner " starts a game of Spades in " DST "!")
+ #say("#rhnoise", sp_owner " starts a game of Spades in " DST "!")
}
}
!sp_valid &&
(sp_state "bid" || sp_state == "play") &&
-/^\.(bid|play)\>$/ {
+/^\.(bid|play)\>/ {
if (FROM in sp_players)
say(".slap " FROM ", it is not your turn.")
else
say("Bidding goes to " sp_player "!")
} else {
for (p in sp_players)
- privmsg(p, "You have: " sp_hand(p))
+ say(p, "You have: " sp_hand(p))
sp_state = "play"
for (i=0; i<2; i++) {
if (sp_nil[i] == 2 || sp_nil[i+2] == 2) {
}
else {
sp_pass[sp_players[FROM]] = $2
- privmsg(sp_channel, FROM " passes a card")
+ say(sp_channel, FROM " passes a card")
}
if (((sp_nil[0] != 2 && sp_nil[2] != 2) || (sp_pass[0] && sp_pass[2])) &&
((sp_nil[1] != 2 && sp_nil[3] != 2) || (sp_pass[1] && sp_pass[3]))) {
delete sp_hands[sp_order[i]][card]
sp_hands[sp_order[partner]][card] = 1
}
- privmsg(sp_channel, "Cards have been passed, play starts with " sp_player "!")
+ say(sp_channel, "Cards have been passed, play starts with " sp_player "!")
for (p in sp_players)
- privmsg(p, "You have: " sp_hand(p))
+ say(p, "You have: " sp_hand(p))
sp_state = "play"
}
}
say(".slap " FROM ", you are not playing.")
} else {
sp_looked[sp_players[FROM]] = 1
- privmsg(FROM, "You have: " sp_hand(FROM))
+ say(FROM, "You have: " sp_hand(FROM))
}
}
}
else {
sp_play(card)
- privmsg(FROM, "You have: " sp_hand(FROM))
+ say(FROM, "You have: " sp_hand(FROM))
if (sp_state == "play") {
if (sp_piles)
say(sp_player ": it is your turn! " \
sp_order[3] " took " int(sp_tricks[3]) "/" int(sp_bids[3]))
}
+(TO == NICK || DST == sp_channel) &&
/^\.(score|status)$/ {
if (sp_state == "new") {
say("There is no game in progress")
}
if (sp_state == "join") {
- say("Waiting for palyers: " \
+ say("Waiting for players: " \
sp_order[0] " " sp_order[1] " " \
sp_order[2] " " sp_order[3])
}