Will this coding work? How do I make it less messy? in Developer Help
|
|
I wrote my battle system
My battle system:
-Damage= strength - defense
-Luck may increase damage by three depending on the luck points, the
probability rises
-If the speed is twice is high than the attacker, only 25% of the
damage gets through. If its three times higher or more, only 16%
of the damage gets through. If its four, the victim dodges the
attack.
But this coding, not surprisingly, has many problems and doesn't do what I want it to do.
mob/verb/CAttack3(mob/M as mob) dmg=usr.str-M.def if(usr.luck<=10) M.hp-=dmg if(usr.luck==20|19|18|17|16|15|14|13|12|11) if(prob(25)) dmg*=3 if(usr.luck==30|29|28|27|26|25|24|23|22|21) if(prob(35)) dmg*=3 if(usr.luck==40|39|38|37|36|35|34|33|32|31) if(prob(50)) dmg*=3 if(M.luck<=10) M.speed=M.speed if(M.speed==usr.speed*2) dmg/=4 if(M.speed==usr.speed*3) dmg/=6 if(M.speed>=usr.speed*4) dmg=0 usr << "[M] has dodged your attack" if(M.luck==20|19|18|17|16|15|14|13|12|11) if(prob(25)) M.speed*=2 if(M.luck==30|29|28|27|26|25|24|23|22|21) if(prob(35)) M.speed*=2 if(M.luck==40|39|38|37|36|35|34|33|32|31) if(prob(50)) M.speed*=2 if(M.hp<=0) usr.r=1 usr.exp+=M.exp usr.level_up(usr) usr.wn=0 M.hp-=dmg usr << "[M] was hit for [dmg] damage!" if(usr.luck<=10) M.hp-=dmg if(usr.luck==2) dmg/=3 M.hp-=dmg if(usr.luck==3) dmg/=3 M.hp-=dmg if(M.luck==20|19|18|17|16|15|14|13|12|11) if(prob(25)) M.speed/=2 if(M.luck==30|29|28|27|26|25|24|23|22|21) if(prob(35)) M.speed/=2 if(M.luck==40|39|38|37|36|35|34|33|32|31) if(prob(50)) speed/=2
|
|