boionfire81 Posted August 25, 2016 Share Posted August 25, 2016 Ok, so I thought I'd post this here, and let everyone see how it's coming along and add comments if you want. This is probably the biggest remod I've done yet. So give it time to finish. But in the mean time.... yeah :) $mwepdamage = ($r1['weapon'] * $mdata['strength'] / 100); if($area['stat'] === 'Agility') { $mdhitboost = (($mdata['agility'] * $area['chance']) - ($odata['speed'] * (100 - $area['chance']))); $odhitboost = (($odata['agility'] * $area['chance']) - ($mdata['speed'] * (100 - $area['chance']))); } if($area['stat'] === 'Speed') { $mdhitboost = (($mdata['speed'] * $area['chance']) - ($odata['agility'] * (100 - $area['chance']))); $odhitboost = (($odata['speed'] * $area['chance']) - ($mdata['agility'] * (100 - $area['chance']))); } $where = rand(1,5); $owepdamage = ($r2['weapon'] * $mdata['strength'] / 100); if($where == 1) { $mdefense = ($mdata['guard'] * $mdata['head'] / 100); $odefense = ($odata['guard'] * $odata['head'] / 100); } else if($where == 2) { $odefense = ($odata['guard'] * $odata['torso'] / 100); $mdefense = ($mdata['guard'] * $mdata['torso'] / 100); $place = rand(1,3); if($place == 1) { $spot = 'left side'; } else if($place == 2) { $spot = 'right side'; } else { $spot = 'stomach'; } } else if($where == 3) { $odefense = ($odata['guard'] * $odata['hands'] / 100); $mdefense = ($mdata['guard'] * $mdata['hands'] / 100); $place = rand(1,2); if($place == 1) { $spot = 'left hand'; } else { $spot = 'right hand'; } } else if($where == 4) { $odefense = ($odata['guard'] * $odata['legs'] /100); $mdefense = ($mdata['guard'] * $mdata['legs'] /100); $place = rand(1,2); if($place == 1) { $spot = 'left leg'; } else { $spot = 'right leg'; } } else { $odense = ($odata['guard'] * $odata['feet'] / 100); $mdense = ($mdata['guard'] * $mdata['feet'] / 100); $place = rand(1,2); if($place == 1) { $spot = 'left foot'; } else { $spot = 'right foot'; } } That's just deciding the damage vs defense and random hit location/side. Weapon hit phrase like "sliced" or "clubbed" are actually defined in the sql for a more creative touch. The "area" portion is just one of the unique features I have on my game. But in the end it only applies a small portion in the attack page. Still to decide first hit, to start the hp updates, and develop armor damage/weapon breaks. Not really sure where to go with the hp thing here. Just because I hate one hitter quitters. Much nicer to torture right? lol. Just can't decide how to turn this around to atleast 2-3 hits. Overall I think this will turn out to be a nice attack page. All be it, a massive amount of work in progress. (Please hold all 'security' comments until it actually near finish!) Quote Link to comment Share on other sites More sharing options...
NonStopCoding Posted August 26, 2016 Share Posted August 26, 2016 there is no security issues in it but i do notice you use the rand() function you could get better random results using mt_rand() Quote Link to comment Share on other sites More sharing options...
boionfire81 Posted August 27, 2016 Author Share Posted August 27, 2016 Yeah, I still don't know the exact difference between mt_rand and rand. Also currently trying to find the difference between require and require_once. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.