Jump to content

Logic Help.


Michdd

Recommended Posts

I'm making a simple browser based game which is an add-on to my website for a game that I made in C++. On this you can get pets, and they have different stats, you can level them up, etc.. I have that all working fine. Now, I defined the base stats for these monsters in 3 ways. HP/Attack/Defense. Then in the Database for each monster if they have extra stats added on they're there. Then I add the database value, with the base stats for each monster.

 

Now I'm trying to add a battle script. So I need something that will factor in Defense, HP, and Attack, with a little random factor for any of elements. And also, something so that higher level's stats are boosted a little. Like. Defense = Defense + (level / 100) or something.

 

Then I need it to choose a winner somehow.

 

I currently have all the variables in the end after getting them from the database and such stored in this:

 

For one monster, that's basically the stats added from base + bonus:

									$Shp = $Shp + $hp2; 
									$Sattack = $Sattack + $attack2;
									$Sdef = $Sdef + $def2;

 

Second monster:

									$Ohp = $Ohp + $hp1; 
									$Oattack = $Oattack + $attack1;
									$Odef = $Odef + $def1;

 

And the level is stored as $Slevel for the first one, and $Olevel for the other one.

Link to comment
https://forums.phpfreaks.com/topic/134325-logic-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.