All pastes #491375 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-16 16:54 UTC
rendered paste body
on *:TEXT:!vd*:#: {
  if (%vd == 1) && (%vdplay !== 1) {
    if (!$4) { notice $nick Specify the troops please. | halt }
    if ($calc($2 + ($3*2) + ($4*4)) >= 20000) { notice $nick You have spent too many points. Please see !vdrules to see how much you can spend. | halt }
    if (%play == 1) { notice $nick A game is already being played. | halt }
    if (%vd == 0) { notice $nick Violent Diplomacy is not currently on. Please contact Jcfc so he can turn it on. | halt }
    if ($calc($2 + ($3*2) + ($4*4)) <= 20000) {
      msg $chan $nick wants to play Violent Diplomacy! Type !vd [INFANTRY] [DRAGOONS] [CAVALRY] to play with him.
      set %vdplay 1
      set %p1inf $2
      set %p1drag $3
      set %p1cav $4
      set %player1 $nick
      halt
    }
  }
  if (%vdplay == 1) && (%vd == 1) {
    if (!$4) { notice $nick Specify the troops please. | halt }
    if ($calc($2 + ($3 * 2) + ($4 * 4)) >= 20000) { notice $nick You have spent too many points. Please see !vdrules to see how much you can spend. | halt }
    if (%play == 1) { notice $nick A game is already being played. | halt }
    if (%vd == 0) { notice $nick Violent Diplomacy is not currently on. Please contact Jcfc so he can turn it on. | halt }
    if ($calc($2 + ($3 * 2) + ($4 * 4)) <= 20000) {
      set %vdplay 1
      set %p2inf $2
      set %p2drag $3
      set %p2cav $4
      set %player2 $nick
      msg $chan The game is on! %player1 vs. %player2 $+ .
      msg $chan It is %player1 $+ 's go first.
      set %turn 1
      halt
    }
    if (%vd == 0) { notice $nick Violent Diplomacy is not currently on. Please contact Jcfc so he can turn it on. | halt }
  }
}

on *:TEXT:!tell*:#:{
  if ($2 == cav) && (%p1cav == 0) && (%turn == 1) { notice %player1 You have no cavalry left to attack with! }
  if ($3 == cav) && (%p2cav == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! }
  if ($2 == cav) && (%p2cav == 0) && (%turn == 2) { notice %player2 You have no cavalry left to attack with! }
  if ($3 == cav) && (%p1cav == 0) && (%turn == 2) { notice %player2 You opponent has no cavalry to attack! }
  if ($2 == cav) && ($3 == cav) && (%turn == 1) {
    if (%p1cav >= %p2cav) {
      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.
    }
    if (%p2cav >= %p1cav) {
      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.
    }
    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.
      }
      if (%p1cav >= %p2cav) {
        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.
      }
    }
    if ($2 == inf) && (%p1inf == 0) && (%turn == 1) { notice %player1 You have no cavalry left to attack with! }
    if ($3 == inf) && (%p2inf == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! }
    if ($2 == inf) && (%p2inf == 0) && (%turn == 1) { notice %player1 You have no cavalry left to attack with! }
    if ($3 == inf) && (%p1inf == 0) && (%turn == 1) { notice %player1 You opponent has no cavalry to attack! }
    if ($2 == inf) && ($3 == inf) && (%turn == 1) {
      if (%p1inf >= %p2inf) {
        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.
      }
      if (%p2inf >= %p1inf) {
        set %p2inf $calc((%p2inf) - $r($calc(%p1inf /5 *2),$calc(%p1inf /5*4))))
        set %p1cav 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.
      }
      if ($2 == cav) && ($3 == cav) && (%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.
        }
        if (%p1inf >= %p2inf) {
          set %p1inf $calc((%p2inf) - $r($calc(%p2inf /5 *2),$calc(%p2cav /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.
        }
      }
    }
  }
}