ID:174592
 
I found Rawekwons Turn based combat which was pretty similar to mud commbat. Which I like, nay, ador. But I have some trouble. When combat commences it seems the monster mob takes on the PC mob's stats. Here is the code, but I cannot make heads nor tails of it, can anyone help me please?

mob
Move()
if(inbattle){return}
.=..()
verb
Attack(mob/M in oview(1))
if(usr==M||usr.inbattle||M.inbattle){return}
M.inbattle=1
usr.inbattle=1
view()<<"[usr] Attacks [M]!"
while(M)
if(!usr.inbattle||!M.inbattle)return
var{h=50+usr.dex;h2=h-M.agi}
if(h2>100)h2=100
if(h2<0)h= 0
var{h3=rand(1,100);e=rand(usr.str);dc=e-M.def}
if(h3<=h2)
if(dc>0){view(3)<<"[usr] Attacks [M], [dc] Damage.";M.hp-=dc;M.DeathCheck()}
else{view(3)<<"
[usr]'s attack bounced off [M]."}
else{view(3)<<"[usr] attacks [M], but misses."}
sleep(6)
if(!usr.inbattle||!M.inbattle)return
var{f=50+usr.dex;f2=f-M.agi}
if(f2>100)f2=100
if(f2<0)f= 0
var{f3=rand(1,100);j=rand(usr.str);de=j-M.def}
if(f3<=f2)
if(de>0){view(3)<<"
[M] Attacks [usr], [de] Damage.";usr.hp-=de;usr.DeathCheck()}
else{view(3)<<"[M]'s attack bounced off [usr]."}
else{view(3)<<"
[M] attacks [usr], but misses."}
sleep(6)
Flee()
if(!usr.inbattle){usr<<"Your not in a battle.";return}
switch(rand(1,2))
if(1){view(3)<<"[usr] Tried to flee, but failed."}
if(2){view(3)<<"[usr] Flees the battle!";usr.inbattle=0;for(var/mob/M in oview(1))M.inbattle=0}
proc
DeathCheck()
if(istype(src,/mob/monster))
if(src.hp<=0)
usr<<"You killed it, good work [usr]."
usr<<"Experience + [src.exp]"
usr<<"Gold + [src.gold]"
usr.gold+=src.gold
usr.exp+=src.exp
usr.inbattle=0
src.inbattle=0
usr.Levelup()
del src
if(istype(src,/mob/PC))
if(src.hp<=0)
world<<"[src] Died."
src.hp=src.hp_max
src.inbattle=0
usr.inbattle=0
Levelup()
if(usr.exp>usr.exp_to)
usr.exp=0
usr.exp_to=usr.exp_to/3
usr<<"You gained a level!"
usr.lvl++
usr.str++
usr.def++

(I was gonna add in DM tags all through it, but Im tired and I didnt want to so I just put them at the beginning and end of the code.)

Please if anyone can help me, (or tell me where to find a better one.) please do so.
</0></0>
I would try to help but that light peach color is straining my eyes :( Should probably take it off.
First of all it's much harder for me to help you without the dm tags on. Maybe I missed something I wouldn't miss otherwise. What you should fix is that in the second part of the Attack verb where it's the monsters turn to attack. Change all of usr to M, and M to usr. Example:
<bad>var{f=50+usr.dex;f2=f-M.agi}</bad>
<good>var{f=50+M.dex;f2=f-usr.agi}</good>