'************************************************************************************************
'************************************************************************************************
'********************************** PLAYER ATTACK ***********************************************
'************************************************************************************************
'************************************************************************************************
define procedure <playerattackproc>
set numeric <attackpower; %STR% / 2>
set numeric <damage; %attackpower% + $rand(1;10)$>
set numeric <attackhit; %DEX% / 2>
set numeric <attackhit; %attackhit% + $rand(1;20)$>
' set numeric <attackhit; %attackhit% - $rand(1;10)$>
set interval <playerattack; %attackspeed%>
set numeric <battle; 1>
set numeric <ARTDAMAGE; %INT% + %CHR%>
set numeric <ARTDAMAGE; %ARTDAMAGE% / 2>
set numeric <ARTDAMAGE; %ARTDAMAGE% + $rand(%ARTDAMAGELOW%;%ARTDAMAGEHIGH%)$>
if (%HP% <=0) then {
do <turnoffalltimers>
}
if not here <#lastenemy#> then do <createexits>
'1: Check to see if mob is here.
if here <#lastenemy#> then {
' 2: If you don't have art, then attack with this code.
if (%ARTONOFF% = 0) and (%EHP% > 0) then {
' 3: Check to see if you hit the mob or not.
if ( %attackhit% > #(lastenemy):armor# ) or ($rand(1;20)$ = 20) then {
' 10: Do this stuff for damage to armor and such
if (%enemytempARMOR% > 0) and ($rand(1;#(lastenemy):armor#)$ >= 10) then {
set numeric <damage; %damage% / 2>
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <attack |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
if ($rand(1;20)$ = 20) then {
set numeric <damage; %damage% * 2>
msg <with a |i|cymighty blow|cb|xi for |cr|b%damage%|xb|cb points of damage!>}
else msg <for |cr|b%damage%|xb|cb points of damage.>
dec <EHP; %damage%>
dec <enemytempARMOR; %damage%>
set numeric <deflect; $rand(1;3)$>
if (%deflect% = 1) then {
if (#(lastenemy):article# = it) then msg <Its tough armour deflects the rest.>
else msg <$capfirst(#(lastenemy):article#)$ armour deflects the rest.>
}
if (%deflect% = 2) then {
msg <You are weakening |xn>
if (#(lastenemy):article# = it) then msg <its defenses.|xi|cb>
if (#(lastenemy):article# = him) then msg <his defenses.|xi|cb>
if (#(lastenemy):article# = her) then msg <her defenses.|xi|cb>
}
if ( %enemytempARMOR% <= 0) then {
msg <|i|cyYou have broken through |xn>
if (#(lastenemy):article# = it) then msg <its defenses!|xi|cb>
if (#(lastenemy):article# = him) then msg <his defenses!|xi|cb>
if (#(lastenemy):article# = her) then msg <her defenses!|xi|cb>
}
}
else {
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <attack |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
if ($rand(1;20)$ >= 19) then {
set numeric <damage; %damage% * 2>
msg <with a |i|cymighty blow|cb|xi for |cr|b%damage%|xb|cb points of damage!>}
else msg <for |cr|b%damage%|xb|cb points of damage.>
dec <EHP; %damage%>
}
' 10: end----------
if (%EHP% > 0) then do <battlehps>
' 4: If weapon has double damage, run this.
if ( %doubledamage% > 1) and (%EHP% > 0) then {
set numeric <damage; $rand(3;13)$>
msg <|b|cgYour|cb|xb weapon deals out an extra |cr|b%damage%|xb|cb damage!>
dec <EHP; %damage%>
' if (%EHP% > 0) then do <battlehps>
} ' 4: end ---------------
' 5: If you can [ knock ] enemy down, run this.
if ( %knock% > 0 ) and ($rand(1;20)$ > 18) then {
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <|i|cyknock|cb|xi your opponent down and |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <loses a turn!>
set numeric <e_loseturn; 1>
} ' 5: end ---------------
5.5: If you can [ disarm ] enemy, run this.
if ( %disarm% > 0 ) and ($rand(1;20)$ > 18) then {
if not flag <disarm> then {
do <disarm>
set string <disarmed_weapon; #(lastenemy):weapon#>
set string <disarmed_mob; $getobjectname(#lastenemy#)$>
if (#(lastenemy):article# = her) then property <$getobjectname(#lastenemy#)$; weapon=her fists>
if (#(lastenemy):article# = him) then property <$getobjectname(#lastenemy#)$; weapon=his fists>
if (#(lastenemy):article# = it) then property <$getobjectname(#lastenemy#)$; weapon=its fists>
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <|i|cydisarm|cb|xi your opponent!>
do <bounty>}
flag on <disarm>
set numeric <e_disarm; 1>
}
' 6: If you successfully knocked your opponent out, run this.
if (%e_loseturn%=0) then timeron <enemyattack>
else { timeroff <enemyattack>
set numeric <e_loseturn; 0>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <fumbles around, trying to regain composure.>
} ' 6: end---------------
} ' 3: cont.------ Run this if you missed the mob.!!!!!!!!!!!!
else { set numeric <damage; $rand(3;13)$>
dec <wieldability; $rand(0;5)$>
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <attack |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <but miss!>
' 7: If you missed and weapon is unsafe (i.e. whip), run this
if (%unsafe% > 0) and ($rand(1;%wieldability%)$ > %attackhit%) then {
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <end up hurting yourself for |cr|b%damage%|xb|cb damage!>
dec <HP; %damage%>
} ' 7: end---------------
timeron <enemyattack>
} ' 3: end---------------
} ' 2: end---------------
' 2: If you have "the art" (spiritual attack), attack with this code.
if (%ARTONOFF% = 1) and (%ART% > 0) and (%EHP% > 0) then {
set numeric <attackhit; %attackhit% + %ART%)>
if ( %attackhit% > #(lastenemy):armor# ) then {
set string <ARTSTR[1]; Void>
set string <ARTSTR[2]; Gravity>
set string <ARTSTR[3]; Annihilation>
set string <ARTSTR[4]; Suffering>
set string <ARTSTR[5]; Despair>
set string <ARTSTR[6]; Horror>
set string <ARTSTR[7]; Disease>
set string <ARTSTR[8]; Chaos>
set string <ARTSTR[9]; Spirit>
set string <ARTSTR[10]; Time>
set string <ARTSTR[11]; Anguish>
set numeric <ARTNUM; $rand(1;11)$>
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <attack |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <using |b|crthe art of #ARTSTR[ARTNUM]#!|cb|xb for |cr|b%ARTDAMAGE%|xb|cb points of damage.>
set numeric <ARTONOFF; 0>
timeron <arttimer>
dec <EHP; %ARTDAMAGE%>
' if (%EHP% > 0) then do <battlehps>
}
else {
foreground <&H779999>
msg <You |xn>
foreground <white>
msg <attack |xn>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <the |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <using your |b|crArt|cb|xb but fail!>}
if (%EHP% > 0) then timeron <enemyattack>
else { do <turnoffattacktimers>
set numeric <battle; 0>
if (%COMBO% > 0) then set numeric <COMBOONOFF; 1>
if (%ART% > 0) then set numeric <ARTONOFF; 1>
}
} ' 2: end---------------
}
else { do <turnoffattacktimers>
if (%COMBO% > 0) then set numeric <COMBOONOFF; 1>
if (%ART% > 0) then set numeric <ARTONOFF; 1>
set numeric <battle; 0>
} '1: end---------------
set numeric <ehp10; %ehpmax% / 10>
set numeric <ehp80; %ehp10% * 8>
set numeric <ehpdiff; %ehpmax% - %EHP%>
if (%ehp80% < %ehpdiff%) and (%EHP > 0 ) then do <enemyhps>
'8: Training bot stuff. not really a part of the stuff above.
if (#lastenemy# = trainingbot) and (%hp75% < %hpdiff%) and (%HP% <> %HPMAX%) and (%EHP% > 0) then {
msg <|cgGood show! |b|cgYou|cg|xb should take a rest now.|cb>
do <turnoffattacktimers>
if (%COMBO% > 0) then set numeric <COMBOONOFF; 1>
if (%ART% > 0) then set numeric <ARTONOFF; 1>
set numeric <battle; 0>
} '8: end---------------
end define
'************************************************************************************************
'************************************************************************************************
'********************************** ENEMY ATTACK ************************************************
'************************************************************************************************
'************************************************************************************************
define procedure <enemyattackproc>
set numeric <tohit; %DEX% / 2>
set numeric <tohit; %tohit% + $rand(1;20)$>
set numeric <enemyattempt; #(lastenemy):dexterity# / 2>
set numeric <enemyattempt; #(lastenemy):dexterity# + $rand(1;20)$>
' set numeric <enemyattempt; %enemyattempt% - $rand(1;10)$>
set numeric <e_damage; #(lastenemy):strength# + $rand(1;10)$>
if (%parry% = 0) then set numeric <enemyattempt; %enemyattempt% - $rand(1;7)$>
if not (#lastenemy# = trainingbot) then {
set numeric <taunting; $rand(1;4)$>
' if (%taunting% = 1) then msg <#(lastenemy):taunt#>
' if (%taunting% = 2) then msg <#(lastenemy):taunt2#>
' if (%taunting% = 3) then msg <#(lastenemy):taunt3#>
' if (%taunting% = 4) then msg <#(lastenemy):taunt4#>
}
set interval <enemyattack; #(lastenemy):speed#>
if (%EHP% < 1) then {
do <turnoffattacktimers>
if (%COMBO% > 0) then set numeric <COMBOONOFF; 1>
if (%ART% > 0) then set numeric <ARTONOFF; 1>
}
If not here <#lastenemy#> then {
do <createexits>
do <turnoffattacktimers>
if (%COMBO% > 0) then set numeric <COMBOONOFF; 1>
if (%ART% > 0) then set numeric <ARTONOFF; 1>
}
set numeric <firstenemyattempt; $rand(1;20)$>
if (%battle% = 1) then {
'1: Check to see if you the enemy DOESN'T roll a 1.
if ( %firstenemyattempt% > 1 ) then {
' 2: Check to see if the mob hits naturally, or on a random natural 20.
if ( %enemyattempt% > %DEX%) or ($rand(1;20)$ = 20) then {
if (%parry% = 1) then set <parryrandom; $rand(1;20)$ >
if (%riposte% = 1) and (%parryrandom% > 10) and (%parry% = 1) then set <riposterandom; $rand(1;30)$>
do <badassmobs>
' 3: If you can riposte, and you rolled to get the riposte, run this.
if (%riposterandom% > 20) and (%tohit% > #(lastenemy):armor#) and (%tohit% > #(lastenemy):dexterity#) and (%riposte% = 1) and (%parry% = 1) and (%EHP% > 0) then {
set numeric <e_damage; %e_damage% / 2>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon#, but you |cyriposte|cb the attack doing |cr|b%e_damage%|xb|cb damage!>
dec <EHP; %e_damage%>
}
else {
' 4: If riposte failed, and you can parry then try to parry instead.
if (%parryrandom% > 10) and (%parry% = 1) and (%tohit% > #(lastenemy):dexterity#) then {
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon#, but you |cyparry|cb the attack!>
}
else {
' 5: If you failed to parry, then have the enemy do damage!
if (#lastenemy# = trainingbot) then {set numeric <e_damage; %HPMAX% / 10>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon# for |cr|b%e_damage%|xb|cb points of damage.>
dec <HP; %e_damage%>}
else {
' 6: Do this stuff for damage to armor and such
if (%tempARMOR% > 0) then {
set numeric <e_damage; %e_damage% / 2>
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else msg <The |b$displayname(#lastenemy#)$|xb |xn>
foreground <white>
msg <attacks you with #(lastenemy):weapon# for |cr|b%e_damage%|xb|cb points of damage, while your armour |cyabsorbs|cb some of the blow.>
dec <HP; %e_damage%>
dec <tempARMOR; %e_damage%>
if ( %tempARMOR% <= 0) then {
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
msg <|i|cyhas broken through your armour!|cb|xi>
foreground <&H00FFFF>
pause <100>
foreground <white>
pause <50>
foreground <&H00FFFF>
pause <100>
foreground <white>
}
}
else {
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <The |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon# for |cr|b%e_damage%|xb|cb points of damage.>
dec <HP; %e_damage%>
}
' 6: end----------
}
' 5: end----------
set numeric <hp10; %HPMAX% / 10>
set numeric <hp90; %hp10% * 9>
set numeric <hp80; %hp10% * 8>
set numeric <hpdiff; %HPMAX% - %HP%>
if (%hp80% < %hpdiff%) and (%HP% > 0) then {
msg <|b|cr|iYou are close to death!|xi|cb|xb>
foreground <&H0000FF>
pause <100>
foreground <white>
pause <50>
foreground <&H0000FF>
pause <100>
foreground <white>
}
if (%EHP% > 0) then do <battlehps>
}
' 4: end----------
}
' 3: end----------
}
' 2: end / else----------
else {
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <$capfirst(#(lastenemy):prefix#)$ |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon# but misses!>
}
' 2: end-----------
}
'1: end / else-----------
else {
foreground <&H2266F2>
if ($lengthof(#(lastenemy):prefix#)$ = 0) then msg <|b$displayname(#lastenemy#)$|xb |xn>
else {msg <$capfirst(#(lastenemy):prefix#)$ |b$displayname(#lastenemy#)$|xb |xn>}
foreground <white>
msg <attacks you with #(lastenemy):weapon# but misses horribly!>
} '1: end-----------
}
end define
'************************************************************************************************
'************************************************************************************************
'********************************** COMBAT TIMERS ***********************************************
'************************************************************************************************
'************************************************************************************************
define timer <arttimer>
interval <10>
action {if (%ART% > 0) and (%ARTONOFF% = 0) then {
set numeric <ARTONOFF; 1>
timeroff <arttimer>}
} else timeroff <arttimer>
disabled
end define
define timer <combotimer>
interval <15>
action {if (%COMBO% > 0) and (%COMBOONOFF% = 0) then {
set numeric <COMBOONOFF; 1>
timeroff <combotimer>
exec <combo> }
}
disabled
end define
'************************************************************************************************
'********************************** PLAYER ATTACK ***********************************************
'************************************************************************************************
define timer <playerattack>
interval <1>
action {
if (%EHP% > 0) and (%HP% > 0) then do <playerattackproc>
else {
do <nothing>
set numeric <battle; 0>
timeroff <playerattack>
timeroff <enemyattack>
}
}
disabled
end define
'************************************************************************************************
'********************************** ENEMY ATTACK ************************************************
'************************************************************************************************
define timer <enemyattack>
interval <2>
action {
if (%EHP% > 0) and (%HP% > 0) then {
do <enemyattackproc>
if flag <arrest> and (%hp60% < %hpdiff%) and (%HP% > 0) then {
msg <You are overtaken and arrested.>
do <turnoffalltimers>
goto <Morulan Information Center Lobby>
}
}
else {
do <lastdyingmove>
do <nothing>
set numeric <battle; 0>
timeroff <enemyattack>
timeroff <playerattack>
}
} 'END ACTION
disabled
end define' *************** ATTACK PHASE *********************
command <attack #@object#> {
if ( #(object):combat# > 0 ) then {
set numeric <espeed; 10>
' *************** TURN OFF TIMERS ******************
' timeroff your relavent timers
' *************** SET FIGHTING VARIABLES ************
' most of this sets up the enemies hitpoints and strength and such.
set numeric <enemyattempt; #(object):dexterity#>
set numeric <enemytempARMOR; #(object):armor#>
set numeric <tempARMOR; %ARM%>
set numeric <attackspeed; 20 / %DEX% >
set interval <playerattack; 2>
set numeric <espeed; #(object):speed#>
' set numeric <attackpower; %STR% / 2>
' set numeric <attackhit; %DEX%>
do <enemylifeproc>
timeron <playerattack>
do <getexits>
'this procedure destroyed the exits in the room temporarily
'while you fought, so you had to type a specific command to
'try and escape.
do <removeexits>
}
else msg <You can't attack that.>}
end define
set numeric <CHR; 5>
set numeric <INT; 5>
set numeric <DEX; 5>
set numeric <STR; 5>
set numeric <drunkenness; 0>
set string <drunkLEVEL; sober>
' *********** and when performing the attack command, set the enemy to the "enemy string" **********
set string <enemy; $getobjectname(#quest.lastobject#)$>define object <Sorcerer>
suffix <of Drunkenness>
' *********************fight properties***********************
properties <weapon=his spellbook; drunk_spell=4; combat=1; intelligence=17; aggro=2; hitpoints=70; dexterity=35; speed=1; strength=12; charisma=23; armor=16; exp=100; prefix=; taunt=; taunt2=-hiccup-; taunt3="Get drunk!"; taunt4=; align=4>
' ******************* REGULAR *******************************
prefix <a>
alt <Sorcerer; Drunkenness; Sorcerer of Drunkenness; man; wizzard; enemy>
look <It's a sorcerer that wants to see you drunk. You want to see him dead.>
speak <He hiccups at you.>
examine <He's carrying a spellbook of drunkenness.>
article <him>
gender <he>
end definedefine procedure <drunk spell>
msg <The Sorcerer casts a spell of drunkenness on you.>
inc <drunkenness; #(enemy):drunk_spell#>
inc <CHR; #(enemy):drunk_spell#>
inc <STR; #(enemy):drunk_spell#>
dec <DEX; #(enemy):drunk_spell#>
dec <INT; #(quest):drunk_spell#>
set string <drunkLEVEL; drunk>
flag on <drunk>
timeron <sober>
end definedefine timer <sober>
interval <10>
action {
if (%drunkenness% <= 0 ) then {
msg <You are feeling sober again.>
timeroff <sober>
set string <drunkLEVEL; sober>
}
else {
dec <drunkenness>
dec <CHR; 1>
dec <STR; 1>
inc <DEX; 1>
inc <INT; 1>
if (%drunkenness% < 10) and (%drunkenness% > 1) then {
msg <You are sobering up.>
set string <drunkLEVEL; buzzed>
flag off <drunk>
}
}
}
disabled
end define