Paste this into a new .mrc file, then save it. Type !duel to start a duel. If no one responds in 20 seconds, the duel will be cancelled. If someone replies, the duel will start. Type !attack to attack when it is your turn. And when you are being attacked you will have 5 seconds to type !block and attempt to block the strike.
on *:TEXT:!duel:%chan:{
if (!%duel.active) {
if (!%duel.1) { set %duel.1 $nick | .msg $chan 4 $+ %duel.1 7has set up a Duel. Type 1!duel 7to challenge him. | set %duel.chan $chan | set -u20 %duel 1 | .timerDUEL 1 20 duel-check }
elseif ((%duel.1 != $null || $nick) && (%duel == 1)) { set %duel.2 $nick | .msg $chan 2 $+ %duel.2 7has challenged 4 $+ %duel.1 }
}
else .notice $nick There is already an active Duel. Wait till this Duel has ended before starting another one.
}
on *:TEXT:!end:%chan:{
if (%duel.active != $null) {
if ($nick == %owner || %duel.1 || %duel.2) {
.msg $chan 7Duel ended by 4 $+ $nick
unset %duel*
unset %damage
.timers off
halt
}
else .notice $nick Only %owner or those taking part in the Duel are allowed to use this command
}
else .notice $nick There are no active Duels
}
on *:TEXT:!attack:%chan:{
if (%duel.active == 1) {
if ($nick == %duel.turn) {
attack
}
elseif (($nick == %duel.1 || %duel.2) && ($nick != %duel.turn)) .notice $nick It is not your turn yet.
}
elseif (%duel.active == $null) .notice $nick This is a Duel only command. There are no active Duels right now. Type !duel to start a Duel.
}
on *:TEXT:!block:%chan:{
if (%duel.active == 1) {
if ($nick != %duel.turn) {
defend
}
}
elseif (%duel.active == $null) .notice $nick This is a Duel only command. There are no active Duels right now. Type !duel to start a Duel.
}
alias duel-check {
if (%duel.1 && %duel.2 != $null) {
.msg %duel.chan 7Setting up duel. Duel will start in 3 seconds.
.timerSTART 1 3 startduel
}
elseif (%duel.2 == $null) { .msg %duel.chan 7No one has dared to take up 4 $+ %duel.1 $+ 's 7challenge. Duel cancelled. | unset %duel* }
}
alias hp-check {
if (%duel.2.hp <= 0) {
.msg %duel.chan 4 $+ %duel.1 7has defeated 2 $+ %duel.2 7in battle.
unset %duel*
unset %block*
unset %damage
halt
}
if (%duel.1.hp <= 0) {
.msg %duel.chan 2 $+ %duel.2 7has defeated 4 $+ %duel.1 7in battle.
unset %duel*
unset %block*
unset %damage
halt
}
}
alias startduel {
set %duel.1.hp 50
set %duel.2.hp 50
set %duel.active 1
.msg %duel.chan 7Duel start! 4 $+ %duel.1 7will face off with 2 $+ %duel.2 $+ .
set %duel.first $rand(1,10)
if (%duel.first <= 5) { .msg %duel.chan 4 $+ %duel.1 7will start first. | set %duel.turn %duel.1 }
if (%duel.first > 5) { .msg %duel.chan 4 $+ %duel.2 7will start first. | set %duel.turn %duel.2 }
unset %duel.first
}
alias attack {
if (%duel.turn == %duel.1) {
.msg %duel.chan 4 $+ %duel.1 7swings at 2 $+ %duel.2 7with his sword...
set %damage $rand(0,20)
.timerattack 1 5 hit
}
elseif (%duel.turn == %duel.2) {
.msg %duel.chan 2 $+ %duel.2 7swings at 4 $+ %duel.1 7with his sword...
set %damage $rand(0,20)
.timerattack 1 5 hit
}
}
alias hit {
if (%duel.turn == %duel.1) {
dec %duel.2.hp %damage
.msg %duel.chan 4 $+ %duel.1 7hits 2 $+ %duel.2 7for %damage damage. 2 $+ %duel.2 7has %duel.2.hp hitpoints left.
hp-check
set %duel.turn %duel.2
.msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
}
elseif (%duel.turn == %duel.2) {
dec %duel.1.hp %damage
.msg %duel.chan 2 $+ %duel.2 7hits 4 $+ %duel.1 7for %damage damage. 4 $+ %duel.1 7has %duel.1.hp hitpoints left.
hp-check
set %duel.turn %duel.1
.msg %duel.chan 7It is now 2 $+ %duel.1 $+ 's 7turn.
}
unset %damage
}
alias defend {
timerattack off
if (%duel.turn == %duel.1) {
set %block $rand(1,10)
if (%block <= 7) {
.msg %duel.chan 2 $+ %duel.2 7successfully blocks 4 $+ %duel.1 $+ 's 7attack.
set %duel.turn %duel.2
.msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
}
elseif (%block > 7) {
set %block.damage $floor($calc(%damage/2))
dec %duel.2.hp %block.damage
.msg %duel.chan 2 $+ %duel.2 7manages to block 4 $+ %duel.1 $+ 's 7attack. But the force of the blow does %block.damage damage to 2 $+ %duel.2 $+ . %duel.2 7has %duel.2.hp hitpoints left.
hp-check
set %duel.turn %duel.2
.msg %duel.chan 7It is now 2 $+ %duel.2 $+ 's 7turn.
}
if (%duel.turn == %duel.2) {
set %block $rand(1,10)
if (%block <= 7) {
.msg %duel.chan 4 $+ %duel.1 7successfully blocks 2 $+ %duel.2 $+ 's 7attack.
set %duel.turn %duel.1
.msg %duel.chan 7It is now 4 $+ %duel.1 $+ 's 7turn.
}
elseif (%block > 7) {
set %block.damage $floor($calc(%damage/2))
dec %duel.1.hp %block.damage
.msg %duel.chan 4 $+ %duel.1 7manages to block 2 $+ %duel.2 $+ 's 7attack. But the force of the blow does %block.damage damage to 4 $+ %duel.1 $+. %duel.1 7has %duel.1.hp hitpoints left.
hp-check
set %duel.turn %duel.1
.msg %duel.chan 7It is now 4 $+ %duel.1 $+ 's 7turn.
}
}
}
unset %damage
unset %block*
}