Attack and Defense greatly affect damage.
There is an equation used by the game, but it never reveals exactly what that formula is. However, after lots of testing I believe we've finally figured out what that formula is. You can see how it was done on Reddit here!
Damage = Floor(0.5 * (Attack / Defense) * (CpM_Atk / CpM_Def) * STAB * Type * Power) + 1
- Floor(...) : This is a math function were the result is always rounded down.
- Attack : This is the total attack stat of the attacker (base attack + attack IV).
- Defense : This is the total defense stat of the defender (base defense + defense IV).
- CpM_Atk : This is the CP_Multiplier based on the level of the attacker.
- CpM_Def : This is the CP_Multiplier based on the level of the defender.
- STAB : This is the Same-Type Attack Bonus, which is equal to 1.25. It is only applied if the type of the attack move is the same as one of the attacker's types.
- Type : This is the type effectiveness of the attack, which can be either 0.64, 0.8, 1.0, 1.25, or 1.5625, depending on whether the attack is "super effective" or "not very effective".
- Power : This is the base power of the move used by the attacker.
Note: Testing has determined that critical damage is not currently implemented in Pokemon GO, so it is not included in the formula.
Note: Some versions of the formula do not have "CpM_Atk / CpM_Def". This means that those numbers were already factored into "Attack / Defense". I choose to separate these so that it is more clear how a pokemon's level affects damage.
Extra Information
The base Attack and Defense stats for all pokemon: here.
The CP_Multiplier for each pokemon level: here.
The type effectiveness for all 18 types: here
Information about what IV's are: here.
Example #1
Attack = 100
Defense = 50
CpM_Atk = 0.7317 (level 30)
CpM_Def = 0.5974 (level 20)
STAB = 1.25
Effectiveness = 1.25
Power = 25
Damage = Floor(0.5 * (100 / 50) * (0.7317 / 0.5974) * 1.25 * 1.25 * 25) + 1
Damage = Floor(0.5 * (2) * (1.2248) * 1.5625 * 25) + 1
Damage = Floor(1.9138 * 25) + 1
Damage = Floor(47.845) + 1
Damage = 47 + 1
Damage = 48
Example #2
Now for a real example, and I will go into much more detail this time. Let's say a level 20 Venusaur attacks level 20 Bulbasaur with Razor Leaf. Let's also assume Venusaur's IV's are all 12, and Bulbasaur's IV's are all 9.
Attack = 210
Venusaur's base attack stat is 198. Its Attack IV is 12, so we add those together to have a combined attack stat of 210 (198 + 12).
Defense = 135
Bulbasaur's base defense stat is 126. Its Defense IV is 9, so we add those together to have a combined defense stat of 135 (126 + 9).
CpM_Atk = 0.5974
Venusaur is level 20, and the CP_Multiplier for that level is 0.5974.
CpM_Def = 0.5974
Bulbasaur is level 20, and the CP_Multiplier for that level is 0.5974.
STAB = 1.25
Venusaur is a Grass/Poison type pokemon. Razor Leaf is a Grass type attack. Since the attack type matches one of Venusaur's types, the attack deals bonus damage.
Type = 0.64
Vine Whip is a Grass type attack being used against a Grass/Poison type pokemon.
Grass type attacks are not very effective against Grass type pokemon (x0.8).
They are also not very effective against Poison type pokemon (x0.8).
These two damage multipliers combine to make the attack double ineffective. 0.8 * 0.8 = 0.64.
Power = 15
The base damage for Razor Leaf is 15.
Damage = Floor(0.5 * (210/135) * (0.5974 / 0.5974) * 1.25 * 0.64 * 15) + 1
Damage = Floor(0.5 * (1.5556) * (1) * 0.8 * 15) + 1
Damage = Floor(0.6222 * 15) + 1
Damage = Floor(9.333) + 1
Damage = 9 + 1
Damage = 10
Example #3
Now let's do the reverse of the above: Bulbasaur attacks Venusaur with Razor Leaf.
Attack = 135 (126 + 9)
Defense = 212 (200 + 12)
CpM_Atk = 0.5974 (level 20)
CpM_Def = 0.5974 (level 20)
STAB = 1.25
Type = 0.64
Power = 15
Damage = Floor(0.5 * (135 / 212) * (0.5974 / 0.5974) * 1.25 * 0.64 * 15) + 1
Damage = Floor(0.5 * (0.6368) * (1) * 0.8 * 15) + 1
Damage = Floor(0.2547 * 15) + 1
Damage = Floor(3.8205) + 1
Damage = 3 + 1
Damage = 4
Summary
Example 1 showed how both attack/defense and level affect damage.
Example 2 & 3 showed that when pokemon are the same level, attack and defense play a large role in damage. Venusaur did 10 damage to Bulbasaur with Razor Leaf, while Bulbasaur only did 4 damage with the same attack.
The formula also shows why Magikarp deals damage even though Splash has a base damage of 0. One damage is always added onto the end of every attack.
Best Answer
Given the same sum of individual values, the most powerful distribution is the one that compensates for a Pokémon's weakest base stats.
Let me begin by introducing two premises:
Every Pokémon species is characterized by base statistics. For example, Pidgeys have a base attack of 94, base defense of 90, and base stamina of 80. Any particular Pokémon's stats are the three sums of its individual value plus its species' base stat, so the actual stats of a Pidgey with IVs of 10-10-10 would be 104, 100, and 90.
Attack, Defense, and Stamina have almost* strictly proportional importance. Regardless of the numeral value of a particular stat, doubling it will make you twice as effective and halving it will make you half as effective. Defeating your opponent twice as quickly, taking half the damage from their attacks, or being able to take twice the damage on the nose all result in the same capacity to fight and win against an opponent who is 200% as strong as otherwise.
* (I say "almost" because stamina actually has a knock-on effect that results in more energy for charge attacks. Also, while defense and HP will enable you to win a more difficult fight, attack will help you finish it faster, and I assume your time has value.)
Observe that though the first premise describes an additive relationship, the second describes a multiplicative one. The magnitude of these values is all relative. What you want are not the biggest numerical additions, but the greatest percent increases.
By way of example: Chansey is a Pokémon with extremely unbalanced base stats; she has only 40 base attack and 60 defense, but a phenomenal 500 base stamina. Getting an attack IV of 15 would constitute a 37.5% gain in actual power over the having an attack IV of 0, but a stamina IV of 15 would only be a 3% gain over the base. Literally, just two points of attack IV will eclipse the worth of a maxed out stamina IV. Same goes for defense. Yes, that means a 10-0-0 Chansey rated at only 22% "perfection" will outshine a 0-5-15 specimen rated 44% "perfect."
HP and Defense are more important for Pokémon you intend to train at friendly gyms.
In this, there are, again, two premises:
More Prestige is awarded for using a Pokémon with less CP. Ideally, you want your Pokémon to have half the CP of the defender for the greatest prestige gains. You're assisted in this endevour by dodging, exploiting type weaknesses, deliberately placing a defender who sucks, and by understanding that...
The CP formula overvalues attack quadratically, compared to stamina and defense, and, um... cube-root-zenzically, compared to the level coeffecient. The CP formula question is
(ATK*sqrt(DEF*STM)*CPm^2)/10
, but a better approximation of a Pokemon's power would beATK*DEF*STM*CPm^3
, where CPm is the level coefficient.I dunno why Niantic based CP on such a skewed approximation, but you can exploit it by favoring stamina and defense and minimizing attack, which will result in the greatest (favorable) disparity between your CP and your actual combat viability. Yes, this means a 0-15-15 Pokémon, rated only 66% "perfection," is actually the ideal candidate for raising prestige.
Among your Magnificent Six, Attack has the greatest utility.
When you attack an enemy gym, you get to bring six entire Pokémon and there is literally no single defender who can stand up to that kind of heat. With enough potions and time, you and your boys can raze absolutely any enemy gym, period.
Since merely winning is assured, the strategy is in minimizing the resources you're burning, which, as stated, are potions and time. To to this, you need to shorten the fights, which you can achieve by emphasizing offensive power.