All pastes #708521 Raw Edit

BY COUCH

public text v1 · immutable
#708521 ·published 2007-09-23 22:00 UTC
rendered paste body
on *:Text:*:#: {
  halt
  if ($left($1,1) !isin .!@) halt
  tokenize 32 $right($1-,-1)
  var %weapons = dds|0-23|25 dbow|2-42|100 msb|5-23|25 anchor|5-35|0 cbow|10-25|0 whip|0-30|0 dh|10-70|0 guthan|0-30|0
  var %h = $+(Duel.,$chan)
  if ($regex($1,/d(uel)m(atch)?/Si)) {
    if ($hget(Duels,$chan)) {
      msg $chan You have to wait $timer($chan).secs left.
      halt
    }
    if ($hget(%h,duel2) == active) { 
      msg $chan a DM is already active please wait for it to end. 
    } 
    if ($hget(%h,duel) == active) { 
      hadd -m %h player2 $nick
      msg $chan the match is set! %player1 vs %player2 
      notice $hget(%h,player1) Type "!commands" for the commands list.
      notice $nick Type "!commands" for the commands list.
      hadd -m %h duel2 active 
      hadd -m %h hp1 99 
      hadd -m %h hp2 99 
      hadd -m %h spec1 100
      hadd -m %h spec2 100
      hadd -m %h turn 1 
    } 
    else { 
      hadd -m %h duel active 
      hadd -m %h player1 $nick 
      msg $chan $nick has initiated a DM type !DM to fight them 
    } 
    halt
  }
  elseif ($1 == commands) {
    var %x = 1
    while ($token(Attacks !whip dds !dh !eat !msb !anchor !guthan !cbow !other !dbow Others !tele !dm !stopdm,%x,32)) {
      .timer 1 %x msg $nick $v1
      inc %x
    }
    halt
  }
  if ($nick != $hget(%h,player1)) && ($nick != $hget(%h,player2)) halt
  var %n = $iif($hget(%h,player1) == $nick,1,2)
  if ($hget(%h,turn) != %n) halt
  if ($1 == eat) {
    hinc -m %h $+(hp,%n) 20
    hadd -m %h $iif($hget(%h,$+(hp,%n)) > 99,99,$v1)
    msg $chan $nick eats a shark and gains 20hp!
    msg $chan $nick now has $hget(%h,$+(hp,%n)) $+ hp!
    halt
  }
  if ($1 == tele) {
    msg $chan $hget(%h,player,$iif(%n == 1,2,1)) has defeated $nick
    hfree %h
    hadd -m Duels $chan $true
    $+(.timerduel,$chan) 1 30 hdel Duels $chan
    halt
  }
  var %x = 1
  while ($token(%weapons,%x,32)) {
    if ($token($v1,1,124) == $1) var %y = %x
    inc %x
  }
  if (!%y) halt
  tokenize 124 $token(%weapons,%y,32)
  var %player = $nick,%hit1 = $r($token($2,1,45),$token($2,2,45)),%hit2 = $r($token($2,1,45),$token($2,2,45)), $&
    %n = $iif($hget(%h,player1) == $nick,1,2),%o = $+(player,$iif(%n == 1,2,1)),%no = $iif(%n == 1,2,1)
  if ($hget(%h,$+(spec,%n)) < $3) {
    notice $nick You do not have enough special power do this.
    halt
  }
  msg $chan %player1 has hit %hit1 $iif($istok(dds dbow,$1,32),and %hit2)
  if ($3 > 0) hinc -m %h $+(spec,%n) $3
  hadd -m %h $+(hp,%no) $calc($hget(%h,$+(hp,%no)) - %hit1)
  if ($istok(dds dbow,$1,32)) hadd -m %h $+(hp,%no) $calc($hget(%h,$+(hp,%no)) - %hit2)
  msg $chan $hget(%h,%o) has $iif($hget(%h,$+(hp,%no)) < 0,0,$v1) hp left 
  hadd -m %h turn $iif(%n == 1,2,1)
  if ($hget(%h,$+(hp,%no)) <= 0) {
    msg $chan $hget(%h,$+(player,%n)) has defeated $hget(%h,%o) $+ !
    hfree %h
    hadd -m Duels $chan $true
    $+(.timerduel,$chan) 1 30 hdel Duels $chan
    halt
  }
}