on *:TEXT:!tell*:#:{
if ($2 == inf) && (%p1inf == 0) && (%turn == 1) { notice %player1 You have no cavalry left to attack with! | halt }
if ($3 == inf) && (%p2inf == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! | halt }
if ($2 == inf) && (%p2inf == 0) && (%turn == 1) { notice %player1 You have no cavalry left to attack with! | halt }
if ($3 == inf) && (%p1inf == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! | halt }
if ($2 == inf) && ($3 == inf) && (%turn == 1) {
if (%p1inf >= %p2inf) && (%turn == 1) {
set %p1inf $calc((%p1inf) - $r($calc(%p2inf /5 *2),$calc(%p2inf /5*4)))
set %p2inf 0
msg $chan %player1 defeated all of %player2 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 2
msg $chan It is now %player2 $+ 's turn.
halt
}
if (%p2inf > %p1inf) && (%turn == 1) {
set %p2inf $calc((%p2inf) - $r($calc(%p1inf /5 *2),$calc(%p1inf /5*4))))
set %p1inf 0
msg $chan %player2 defended successfully, and destroyed all of %player1 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 2
msg $chan It is now %player2 $+ 's turn.
halt
}
if ($2 == inf) && ($3 == inf) && (%turn == 2) {
if (%p2inf > %p1inf) {
set %p2inf $calc((%p1inf) - $r($calc(%p1inf /5 *2),$calc(%p1inf /5*4)))
set %p1inf 0
msg $chan %player2 defeated all of %player1 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 1
msg $chan It is now %player1 $+ 's turn.
halt
}
if (%p1inf > %p2inf) && (%turn == 2) {
set %p1inf $calc((%p2inf) - $r($calc(%p2inf /5 *2),$calc(%p2inf /5*4))))
set %p2inf 0
msg $chan %player1 defended successfully, and destroyed all of %player2 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 1
msg $chan It is now %player1 $+ 's turn.
halt
}
}
}
}
on *:TEXT:!tell*:#:{
if ($2 == cav) && (%p1cav == 0) && (%turn == 1) && ($nick == %player1) { notice %player1 You have no cavalry left to attack with! | halt }
if ($3 == cav) && (%p2cav == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! | halt }
if ($2 == cav) && (%p2cav == 0) && (%turn == 2) { notice %player2 You have no cavalry left to attack with! | halt }
if ($3 == cav) && (%p1cav == 0) && (%turn == 2) { notice %player2 You opponent has no cavalry to attack! | halt }
if ($2 == cav) && ($3 == cav) && (%turn == 1) {
if (%p1cav > %p2cav) && (%turn == 1) {
set %p1cav $calc((%p1cav) - $r($calc(%p2cav /5 *2),$calc(%p2cav /5*4)))
set %p2cav 0
msg $chan %player1 defeated all of %player2 $+ 's cavalry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 2
msg $chan It is now %player2 $+ 's turn.
halt
}
if (%p2cav > %p1cav) && (%turn == 1) {
set %p2cav $calc((%p1cav) - $r($calc(%p2cav /5 *2),$calc(%p2cav /5*4)))
set %p1cav 0
msg $chan %player2 defended successfully, and destroyed all of %player1 $+ 's cavalry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 2
msg $chan It is now %player2 $+ 's turn.
halt
}
if ($2 == cav) && ($3 == cav) && (%turn == 2) {
if (%p2cav >= %p1cav) {
set %p2cav $calc((%p2cav) - $r($calc(%p1cav /5 *2),$calc(%p1cav /5*4)))
set %p1cav 0
msg $chan %player2 defeated all of %player1 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 1
msg $chan It is now %player1 $+ 's turn.
halt
}
if (%p1cav > %p2cav) && (%turn == 2) {
set %p1cav $calc((%p2cav) - $r($calc(%p2cav /5 *2),$calc(%p2cav /5*4))))
set %p2cav 0
msg $chan %player1 defended successfully, and destroyed all of %player2 $+ 's infantry!
notice %player1 You have %p1inf infantry, %p1drag dragoons, and %p1cav cavalry remaining.
notice %player2 You have %p2inf infantry, %p2drag dragoons, and %p2cav cavalry remaining.
set %turn 1
msg $chan It is now %player1 $+ 's turn.
halt
}
}
}
}