mob
verb
Attack()
set category = "Battle"
if(attack == 1)
for(var/mob/M in get_step(src,src.dir))
if(M.key == usr.key) continue
if(M.defensive == 0)
view() << "[usr] attacks [M]!"
M.Health -= Strength
Attack_Delay()
AttackGain()
M.attacked = 1
M.Attacked_Gain()
else
return
proc
AttackGain()
if(Strength <= 150*(StrMod))
StrEXP += (StrMod*rand(1,5))/StrLvl
if(StrEXP >= 100)
StrEXP -= 100
Strength += rand(1,5)*StrMod
StrLvl += 1
usr << "<font size = 4><font color = green>Your strength has gone up!</font>"
else if(Strength <= 300*(StrMod))
StrEXP += (StrMod*rand(1,5))/(StrLvl/2)
if(StrEXP >= 100)
StrEXP -= 100
Strength += rand(1,4)*StrMod
StrLvl += 1
usr << "<font size = 4><font color = green>Your strength has gone up!</font>"
else if(usr.Strength <= 600*(usr.StrMod))
StrEXP += (StrMod*rand(1,5))/(StrLvl/3)
if(StrEXP >= 100)
StrEXP -= 100
Strength += rand(1,3)*StrMod
else if(usr.Strength <= 1200*(StrMod))
usr.StrEXP += (usr.StrMod*rand(1,5))/(usr.StrLvl/4)
if(usr.StrEXP >= 100)
usr.StrEXP -= 100
usr.Strength += rand(1,2)*StrMod
else
return
Attacked_Gain()
if(Endurance <= 150*(EndMod) && attacked == 1)
EndEXP += (EndMod*rand(1,5))/EndLvl
if(EndEXP >= 100)
EndEXP -= 100
Endurance += rand(1,5)*EndMod
EndLvl += 1
usr << "<font size = 4><font color = green>Your endurance has gone up!</font>"
else if(Endurance >= 300*(EndMod) && attacked == 1)
EndEXP += (EndMod*rand(1,5))/(EndLvl/2)
if(EndEXP >= 100)
EndEXP -= 100
Endurance += rand(1,4)*EndMod
EndLvl += 1
usr << "<font size = 4><font color = green>Your endurance has gone up!</font>"
else if(Endurance >= 600*(EndMod) && attacked == 1)
EndEXP += (EndMod*rand(1,5))/(EndLvl/3)
if(EndEXP >= 100)
EndEXP -= 100
Endurance += rand(1,3)*src.EndMod
EndLvl += 1
usr << "<font size = 4><font color = green>Your endurance has gone up!</font>"
else if(Endurance >= 1200*(EndMod) && attacked == 1)
EndEXP += (EndMod*rand(1,5))/(EndLvl/4)
if(EndEXP >= 100)
EndEXP -= 100
Endurance += rand(1,2)*EndMod
EndLvl += 1
usr << "<font size = 4><font color = green>Your endurance has gone up!</font>"
else
return
if(Health <= 150*(src.HealthMod) && attacked == 1)
HealthEXP +=(HealthMod*rand(1,5))/HealthLvl
attacked = 0
if(HealthEXP >= 100)
HealthEXP -= 100
Health += rand(10,50)*HealthMod
HealthLvl += 1
else if(Health >= 300*(HealthMod) && attacked == 1)
HealthEXP +=(HealthMod*rand(1,5))/(HealthLvl/2)
attacked = 0
if(HealthEXP >= 100)
HealthEXP -= 100
Health += rand(10,40)*HealthMod
HealthLvl += 1
else if(Health >= 600*(HealthMod) && attacked == 1)
HealthEXP +=(HealthMod*rand(1,5))/(HealthLvl/3)
attacked = 0
if(HealthEXP >= 100)
HealthEXP -= 100
Health += rand(10,30)*HealthMod
HealthLvl += 1
else if(Health >= 1200*(HealthMod) && attacked == 1)
HealthEXP +=(HealthMod*rand(1,5))/(HealthLvl/4)
attacked = 0
if(HealthEXP >= 100)
HealthEXP -= 100
Health += rand(10,20)*HealthMod
HealthLvl += 1
else
return
Problem description: The code is supposed to attack whatever is in front of it, and then add some stats to the attacker and the attacked person. However, when I try to run it, I get a runtime error. The run-time error is below.
runtime error: Undefined operation: null / null
proc name: Attacked Gain (/mob/proc/Attacked_Gain)
usr: XeroXen (/mob)
src: the mob (/mob)
call stack:
the mob (/mob): Attacked Gain()
XeroXen (/mob): Attack()
XeroXen attacks the mob!
Apparantly, the mob I'm attacking still loses HP, and I'm unsure if the other mob's stats go up either. But I know my Strength stat still goes up as normal.
Also, a second run-time error began appearing, after a while.
runtime error: Undefined operation: null / null
proc name: Attacked Gain (/mob/proc/Attacked_Gain)