on $*:text:!cmds:*:{ 
  msg $nick 0,12 ~ Attacks ~ 
  msg $nick !upper cut 
  msg $nick !dbl punch 
  msg $Nick !fireball
  msg $Nick !kick
  msg $nick !jab
  msg $nick !skick
  msg $nick 0,12 ~ Others ~
  msg $nick !flee
  msg $nick !kombat 
  msg $nick !stopkmb
}

on *:text:!kombat*:#: { 
  if (%fight2 == active) { 
    msg $chan 4,0 a Match is already underway! Wait your turn! 
  } 
  if (%fight == active) {
    set %player2 $nick 
    if (%player2 = %player1) { halt }
    msg $chan 4,0 the match is set! 0,4 %player1 4,0 vs 0,4 %player2 
    notice %player1 Type "!tcmds" for the commands list.
    notice %player2 Type "!cmds" for the commands list.
    set %fight2 active 
    set %p1hp 99 
    set %p2hp 99 
    set %stamina1 0 
    set %stamina2 0 
    set %turn 1 
  } 
  else { 
    set %fight active 
    set %player1 $nick 
    msg $chan 4,7 $nick 7,4 has declared a challenge type !kombat to fight them 
  } 
} 
on *:text:!dbl punch*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      if (%stamina2 < 4) { 
        set %hit1 $rand(0,15) 
        set %hit2 $rand(0,15) 
        inc %stamina1 
        msg $chan 4,0 %player1 0,4 has hit 4,0 %hit1 0,4 and 4,0 %hit2 
        dec %p2hp %hit1 
        dec %p2hp %hit2 
        msg $chan 4,7 %player2 7,4 has 4,7 %p2hp 7,4 hp left 
        set %turn 2 
      } 
      if (%p2hp <= 0) { 
        msg $chan 4,1 %player1 1,4 has koed 4,1 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
    else if (%stamina1 == 4) { 
      notice %player1 you are out of stamina 
    } 
  } 
  else { 
    if (%turn == 2) { 
      if ($nick == %player2) { 
        if (%stamina2 < 4) { 
          set %hit1 $rand(0,15) 
          set %hit2 $rand(0,15) 
          inc %stamina2 
          msg $chan 4,7 %player2 7,4 has hit 4,7 %hit1 7,4 and 4,7 %hit2 
          dec %p1hp %hit1 
          dec %p1hp %hit2 
          msg $chan 4,7 %player1 7,4 has 4,7 %p1hp 7,4 hp left 
          set %turn 1 
          if (%p2hp <= 0) { 
            msg $chan 4,1 %player1 has koed 1,4 %player2
            unset %fight 
            unset %player1 
            unset %player2 
            unset %fight2 
            unset %p1hp 
            unset %p2hp 
            unset %stamina1 
            unset %stamina2 
            unset %turn 
            unset %hit1 
            unset %hit2 
          } 
          else { 
          } 
        } 
        else if (%stamina2 == 4) { 
          notice %player2 you are out of stamina 
        } 
      } 
    } 
  } 
} 
on *:text:!skick*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      if (%stamina2 < 4) { 
        set %hit1 $rand(3,32) 
        set %hit2 $rand(2,38) 
        inc %stamina1 
        msg $chan 4,0 %player1 0,4 has hit 4,0 %hit1 0,4 and 4,0 %hit2 
        dec %p2hp %hit1 
        dec %p2hp %hit2 
        msg $chan 4,7 %player2 7,4 has 4,7 %p2hp 7,4 hp left 
        set %turn 2 
      } 
      if (%p2hp <= 0) { 
        msg $chan 4,1 %player1 1,4 has koed 4,1 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
    else if (%stamina1 == 4) { 
      notice %player1 4,0 you are out of stamina 
    } 
  } 
  else { 
    if (%turn == 2) { 
      if ($nick == %player2) { 
        if (%stamina2 < 4) { 
          set %hit1 $rand(3,32) 
          set %hit2 $rand(2,28) 
          inc %stamina2 
          msg $chan 4,0 %player2 0,4 has hit 0,4 %hit1 4,0 and 0,4 %hit2 
          dec %p1hp %hit1 
          dec %p1hp %hit2 
          msg $chan 4,7 %player1 has 7,4 %p1hp 4,7 hp left 
          set %turn 1 
          if (%p2hp <= 0) { 
            msg $chan 4,1 %player1 1,4 has koed 4,1 %player2
            unset %fight 
            unset %player1 
            unset %player2 
            unset %fight2 
            unset %p1hp 
            unset %p2hp 
            unset %stamina1 
            unset %stamina2 
            unset %turn 
            unset %hit1 
            unset %hit2 
          } 
          else { 
          } 
        } 
        else if (%stamina2 == 4) { 
          notice %player2 4,0 you are out of stamina 
        } 
      } 
    } 
  } 
} 
on *:text:!kick*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      set %turn 2 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player1 has hit a 0,2 %hit 
      dec %p2hp %hit 
      msg $chan 2,0 %player2 0,2 has 2,0 %p2hp 0,2 hp left 
      if (%p2hp <= 0) { 
        msg $chan 2,0 %player1 0,2 has koed 2,0 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
  else if (%turn == 2) { 
    if ($nick == %player2) { 
      set %turn 1 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player2 has hit a 0,2 %hit 
      dec %p1hp %hit 
      msg $chan 2,0 %player1 0,2 has 2,0 %p1hp 0,2 hp left 
      if (%p1hp <= 0) { 
        msg $chan 2,0 %player2 0,2 has koed 2,0 %player1 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
}
on *:text:!fireball*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      set %turn 2 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player1 has hit a 0,2 %hit 
      dec %p2hp %hit 
      msg $chan 2,0 %player2 0,2 has 2,0 %p2hp 0,2 hp left 
      if (%p2hp <= 0) { 
        msg $chan 2,0 %player1 0,2 has koed 2,0 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
  else if (%turn == 2) { 
    if ($nick == %player2) { 
      set %turn 1 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player2 has hit a 0,2 %hit 
      dec %p1hp %hit 
      msg $chan 2,0 %player1 0,2 has 2,0 %p1hp 0,2 hp left 
      if (%p1hp <= 0) { 
        msg $chan 2,0 %player2 0,2 has koed 2,0 %player1 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
}
on *:text:!jab*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      set %turn 2 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player1 has hit a 0,2 %hit 
      dec %p2hp %hit 
      msg $chan 2,0 %player2 0,2 has 2,0 %p2hp 0,2 hp left 
      if (%p2hp <= 0) { 
        msg $chan 2,0 %player1 0,2 has koed 2,0 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
  else if (%turn == 2) { 
    if ($nick == %player2) { 
      set %turn 1 
      set %hit $rand(0,18) 
      msg $chan 2,0 %player2 has hit a 0,2 %hit 
      dec %p1hp %hit 
      msg $chan 2,0 %player1 0,2 has 2,0 %p1hp 0,2 hp left 
      if (%p1hp <= 0) { 
        msg $chan 2,0 %player2 0,2 has koed 2,0 %player1 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
} 
on *:text:!upper cut*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      set %turn 2 
      set %hit $rand(0,26) 
      msg $chan 7,14 %player1 has hit a 14,7 %hit 
      dec %p2hp %upper cut 
      msg $chan 7,14 %player2 has 14,7 %p2hp 7,14 hp left 
      if (%p2hp <= 0) { 
        msg $chan 7,14 %player1 14,7 has koed 7,14 %player2 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
  if (%turn == 2) { 
    if ($nick == %player2) { 
      set %turn 1 
      set %hit $rand(0,26) 
      msg $chan 7,14 %player2 has hit a 14,7 %hit 
      dec %p1hp %upper cut 
      msg $chan 7,14 %player1 14,7 has 7,14 %p1hp 14,7 hp left 
      if (%p1hp <= 0) { 
        msg $chan 7,14 %player2 14,7 has koed 7,14 %player1 
        unset %fight 
        unset %player1 
        unset %player2 
        unset %fight2 
        unset %p1hp 
        unset %p2hp 
        unset %stamina1 
        unset %stamina2 
        unset %turn 
        unset %hit1 
        unset %hit2 
      } 
      else { 
      } 
    } 
  } 
}
on *:text:!flee*:#: { 
  if (%turn == 1) { 
    if ($nick == %player1) { 
      msg $chan msg $chan 4,1 %player2 1,4 has won the match by default 
      unset %fight 
      unset %player1 
      unset %player2 
      unset %fight2 
      unset %p1hp 
      unset %p2hp 
      unset %stamina1 
      unset %stamina2 
      unset %turn 
      unset %hit1 
      unset %hit2 
    }
    else{
  }
  if (%turn == 2) { 
    if ($nick == %player2) { 
      msg $chan 4,1 %player1 1,4 has won the match by default 
      unset %fight 
      unset %player1 
      unset %player2 
      unset %fight2 
      unset %p1hp 
      unset %p2hp 
      unset %stamina1 
      unset %stamina2 
      unset %turn 
      unset %hit1 
      unset %hit2 
    }
  }
}
on *:text:!stopkmb*:#: { 
  msg $chan 12KOMBAT STOPPED
  unset %fight 
  unset %player1 
  unset %player2 
  unset %fight2 
  unset %p1hp 
  unset %p2hp 
  unset %stamina1 
  unset %stamina2 
  unset %turn 
  unset %hit1 
  unset %hit2 
}
