Help W/ AS (if statements)

Okay, any clues why the third if statement is never accessed and it accesses the first one whne the statement isnt true? DOWNLOAD --> LINK

hp = 1000000;
atk = 10;
enemydef = 200;
function dmg() {
	if (_root.atk>_root.enemydef) {
		_root.damage = int(_root.atk+(Math.random()*(_root.atk/2)))-(_root.enemydef+(Math.random()*(_root.enemydef/2)));
		_root.hp -= _root.damage;
	}
	if (_root.atk == _root.enemydef) {
		_root.damage = int(((_root.atk/2)*Math.random())+(_root.atk/4));
		_root.hp -= _root.damage;
	}
	if (_root.atk<_root.enemydef) {
		// It never goes here...
		_root.damage = int(((_root.atk/2)*Math.random())-(Math.random()*(_root.enemydef-_root.atk))+(_root.atk/4));
		if (_root.damage<0) {
			_root.damage = int(Math.random()*2);
		}
		_root.hp -= _root.damage;
	}
}
stop();