I have searched everywhere and have found no current thread discussing the details of attacking or raiding. I hope to start a discussion here about what people have discovered in their attacks or defenses.
PLEASE NO ALLY NUMBERS... There are PLENTY of threads for that!!!
From what I have gathered, raiding and attacking are quite similar as far as the actual calculations goes to determine the winner or loser, but have gotten no response from FUNZIO about explaining it in great detail so this is just an opinion thus far. If anyone has gotten an official response, I would love to hear it!
I won't go into the number of troops brought in by allies, I am only concerned with the end attack and defense numbers used in the actual raid/attack/defense (which I know is based on the number of allies, usually more is better but arguments can be made to the converse).
You choose a building to raid in your enemy's base. The higher the level of the building, the more you get. The raided money does not come out of the enemy's cash-on-hand, merely a measure of the building and level of building. Also, the greater output from the building, the more you get. For example, a level 5 Munitions Stockpile will net a raider more than a level 5 Command Center because the Munitions Stockpile nets more cash each time it is collected. Thus raiding a Supply Depot will almost always be a waste of stamina (and conversely you should always be looking out for high level Stockpiles, Ore Mines, Oil Rigs, etc.) You can raid a building (if it hasn't already been "depleted") three times before you can't raid it anymore. The last raid will net 2x the value of the first two raids. The owner has to repair the building before it can be raided again. Correct me if I'm wrong up to this point.
Now, your attack is measured against the enemy's defense + any enemy's defense building which protects the building being raided. It is not 100% given that you will win if your attack is higher, but the higher your attack against their combined defense, the greater chance you have of winning the raid. You can lose troops during the raid, as can the enemy. You get a little experience and valor in addition to any funds for a successful raid. I have seen people level up almost solely by raiding (usually people who spend $$ on gold and thus have indestructible troops and a decent attack/defense).
Very similar to raiding, except there is no "defense building" bonus. Also, you can only obtain un-protected money (usually 10% of it) if you win an attack, in addition to experience but no valor. Is the "strong against _____ " more of a role in attacking than in raiding? Also, what does that exactly "do": boost their attack/defense against their rival unit type? If so, by how much?
Detailing the numbers a bit more, I "think" that if your attack = enemy defense, you have 50% chance to win (if you have no "strong against ___ " troops). If you do have those troops, then your attack is different than what is showed. Similarly, your defense is altered based on the makeup of your enemy's troops. This is my base guess but have no real clue if that is true, just experience-based. I've lost some battles where my attack was greater than their defense, and vice-versa. I know the numbers only because if you lose on a defense you can choose "revenge" and view the enemy's stats, and if you were attacking, you can always raid first to see the enemy's stats and troop makeup. However, once your attack starts to get higher, your % of winning increases as well, but think it might be capped somewhere (95%?). Thus you never have 100% chance to win, or lose.
My own odd experience:
I usually keep a decent spread of unit types strong against all others (infantry/ground/air/sea) to provide a good defense in general, but I was attacked by someone with 20% less attack than my defense, and oddly they still won. Were they just really lucky? I hit "revenge" to see their inventory, and noticed that they had bought troops via gold and I wonder if those troops are somehow inherently favored or provide yet another bonus. An attack that much less than a defense doesn't make sense to win, unless it was a fluke (always have a 1-10% chance of winning, etc) or they were hacking. I've always thought, regardless of the method purchased (gold, valor, cash), the troops still only provide certain numbers to the overall combat (with perhaps the unknown bonus of "strong against ____" ).
So that's what I have gathered so far about attacking, defending and defense buildings. There are new buildings that help boost those numbers, but they are pretty self-explanatory and don't feel that they need explained here (they add to your total stats, so it should be clear what bonus they provide if you see your enemy's stats).
Feel free to fix any mistakes, I hope to hear any clarification of points on which I am misinformed (or to hear from FUNZIO the exact number crunching).