mob
verb
Attack()
if(src.canAttack==1&&src.isAttacking==0)//Checks if they can attack, will likely need to add more to this later
isAttacking=1 //Sets it so they are attacking
Range=list()//All the Range stuff here checks to see how far they can reach
if(Reach>=2)
Range=oview(Reach, src)
else
Range=get_step(src,dir)
for(var/mob/M in Range)//For the creature in range...
if(istype(M,/mob))//...if it's a mob...
usr.icon_state="attack"
usr.Damage=round((((usr.Str*1.2)+(usr.Agi*0.8)/2)*usr.AAMod),1)
usr.Damage=usr.Damage-M.totalArmor
/* if(usr.Damage<=1)
M.Hp-=1
Deathcheck()
usr << "[Damage]"
else
M.Hp-=usr.Damage
Deathcheck()
usr << "[Damage]"
Will do all this in a proc
*/
spawn(4)
usr.icon_state=""
GetattackDelay() //Checks to see delay between attacks
sleep(attackDelay) //sleeps for the time set by the proc
isAttacking=0
Defend()
if(src.canAttack==1&&src.isAttacking==0) //Can they attack, or are they attacking currently?
if(canDefend==0) //can they defend? Only thing currently stopping them is this, might change it a bit if I add more ways to not be able to defend
usr << "Defend is on Cooldown!"
else
canAttack=0 //Can't attack..
canMove=0 //...or move...
canDefend=0 //...or defend again
DR+=50 //reduces damage by 50%
usr.icon_state="Defend" //Changes icon
sleep(10) //Defends for 1 second, then undefends
canAttack=1
canMove=1
DR-=50
usr.icon_state=""
spawn(30) //3 second cooldown after defending is done
canDefend=1
Problem description:
(Sorry if this isn't normally allowed, but I'm kinda new at this and want to make sure I'm on the right track...)
So I'm working on making a basic attack/defend thing, where your attacking speed changes with agility(To a max of .1 seconds, starting at 1 second), and when you defend you take 50% less damage but can't move.
What I have 'works'(Or seems to, works on a testmob at least), but it looks sloppy and stuff...so yeah. Is there a cleaner way to do this? Especially the variables in the defend verb...