# Attack Vs Defense in text based games

I'm trying to come up with a formula for the computer to determine who should win a match between an attacker and a defender, in a way that would improve how engaging the battle rules would be in a Player Vs Player scenario.

In short, what should the math be where I can build a character in a certain way, without having a clear-cut winner when my build goes up another build each time I attack.

# Example

Attacker 15 strength - would this be a function of Attack and Stamina? 60% chance of a critical hit

Defender 7 Agility - would this be a function of Energy and Defense? 10 defense

The outcome should have the following: Who wins, how much damage dealt, health lost (health is normally 100)

Any play between Attack, Defense, Stamina, Energy and Crit Chance would be good for us to discuss as well.

Any help would be appreciated.

Extra info

It's a simple text based game where people can hit each other. Just a single hit not multiple.

A person has Stamina, Attack, Defense. Depending on the weapons equiped also increase your defense and attack.

At first comparing the attacks Attack vs defenders Defense was considered. But it results in to many draws. So we added in chance of a critical hit and change do dodging.

Attack = Users attack stat + weapons attack stat * {crit=2, hard=1.5, normal=1}(Chance) Defense = Users defense stat + weapson defense stat * {dodge=2, sway=1.5, normal=1}(Chance)

if draw who has the better chance wins.

It just seems to easy.

-
Some more informations about the goals of your model may help us to give you some useful ralation. – FxIII Dec 29 '11 at 14:15
Maybe related: This question and this question. – bummzack Dec 29 '11 at 14:27
You ask a tough question. The short answer is "it dependes 100% on the (unique) characteristics of your game." I recommend trying to simulate the most probable outcome and using that result. – ashes999 Dec 29 '11 at 14:32
This question is way too broad to be answered in its current form. You need to tell us what kind of gameplay you're trying to create. How you want the game to play out, what you intend for the player to learn as they advance, what you intend for these stats to mean and do, etc. – Nicol Bolas Dec 29 '11 at 19:33
This is a QA site, not a discussion forum. – Jari Komppa Dec 29 '11 at 20:43