ID:165365
 
Hey,
I was wondering if anyone could help me out. I'm in need of a good attack equation which involves the attackers magic, level, attack strength and the person being attacked's defense and hp... How would I go about this? I'm not really sure what numbers to add together the only thing im sure of is that I need an equation to combine all the attackers stats minus the attackees stats and leaving the person being attacked with more than 0 hp (unless of course their defense and hp sucks...lol) Any help would be great, or at least a point in the right direction =D
well that really depends but something like this would work i suppose.. ( you could edit to your liking)

attackers magic + strength = (some variable)
attackees defense + hp/10 = (another variable)

damage = (var1 - var 2)
hp - damage

so it would work out like this

Attacker magic = 50
Attacker Strenght = 20
attakckees defense = 40
attackees hp = 300

var1 = 70
var2 = 70

damage would be 0

you would really have to fine tune your own equation depending on how your training system works out. (How fast you gain your stats, and how close the stats are together, etc.)

QNom

PS. Hope the helped, i didn't put it into code, i figued i'd let you do that.

is attackee a word? o.O
In response to Quixnom
thanks a lot. =D I dunno why but for some reason when it comes to the attacking and defense my brain starts to hurt =/ lol And I'm not so sure attackee is a word but it worked for wat we needed to say lol thanks again =P

When I finish all of the attack and training stuff I'll post the finished attack code on here with the equation I came up with from ur help =D
In response to JoEn00b
Your welcome, and yes your almost going to have to edit that some how to make it fit your game.
In response to Quixnom
Current attack equation (derived from Quixnom's):

(attacker level + attacker strength + attacker magic) -
((attackee level + attackee defense + attackee magic)/1.25) = damage

so:

(50 + 175 + 1300) - ((50 + 175 + 1300)/1.2) = 1525 - 1270 = 255 damage

So basically, if 2 people were the same in every stat (highly unlikely because most stats are randomized on level gain and race, etc.) whoever attacked first would win basically. I might make the division a little different, but that's fine for now =D. Every time I change the equation I'll post it here though. Thanks again Quixnom.

P.S. if you want the code, make it yourself =D I gave you the equation already!
In response to JoEn00b
New attack equation:

(attacker level + attacker strength + (attacker magic/10)) -
((attackee level + attackee defense + (attackee magic/10))/1.25) = damage

so:

(50 + 175 + (1300/10)) - ((50 + 175 + (1300/10))/1.2) =
355 - 296 = 59 damage

Now hopefully the person you're fighting doesn't have the same level, strength, defense, and magic as you do, otherwise that'll be a real long fight.

Say you're 20 levels higher than someone else though:

(70 + 275 + (2600/10)) - ((50 + 175 + (1300/10))/1.2) =
605 - 296 = 309 damage

Works out pretty well if you ask me. Of course those are just random stats though, so who knows how it will really turn out.