Is there another way?

Hi there
My game’s engine is approaching completion. But right as this point, I encounter a problem.

I tried to add variation to weapons for my tank so that missiles deal more damage on heavily armoured enemies and gattling cannons deal less.

So I organized every enemy into 3 types of armours: heavy, medium and light. In order to hold these, I developed 6 arrays. 3 for buildings and 3 for mobile enemies like this:


var heavyS:Array = new Array()
var mediumS:Array = new Array()
var lightS:Array = new Array()
 
var heavyU:Array = new Array()
var mediumU:Array = new Array()
var lightU:Array = new Array()
 
var terrainO:Array = new Array()

where S stands for buildings (structures) and U stands for mobile enemies (units) and terrainO stands for “terrain objects”.

For creating variations, I will have to code 6 for-loops (and 1 for terrain objects as weapons are supposed to be stopped by rocks, trees etc.). This seriously slows down the engine. Just 4 bullets from the gattling cannon make the game slows down!

Is there any method to save some resources? Are for-loops a must?

On the other hand, if for-loops are really necessary, I have the following question: In a for-loop, what slows down the engine most?


for (i=0;i<something;i++) {
  if (what < what) {
    what
  }
  if (what < what) {
    what
  }
  if (what < what) {
    what
  }
 
  if (what < what) {
    what
  }
 
  if (what < what) {
    what
  }
 
  if (what < what) {
    what
  }
}

a) the larger the value “something”, the more resources are required
b) the longer the statements (i.e. the number of “if (what<what) {}”), the more resources are required

Which is the case?