Jump to content
MakeWebGames

In Production - Attack.php


Recommended Posts

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!)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...