Issues Getting Values From Armor Notetags

Hello, I'm writing a plugin to add old school AD&D style THAC0 and AC, but I'm having trouble getting the data out of my armor note tags. I've got Harold wearing cloth with <ac: 8> and a shield with <ac: 1>, so this should result in him having an AC of 7. Instead my code is giving him the default AC of 10.

Relevant Code

Does anyone know what I'm doing wrong here?

EDIT: Still not working, updated the code.
You had some errors inside that code. this.armors is a function, so you need to use () there.

Code:
Object.defineProperty(Game_Actor.prototype, "ac", {
    get: function() {
        var ac = 10;
        var bonus = 0;
        var armors = this.armors();
        for(var i = 0, length = armors.length; i < length; i++) {
            var armor = armors[i];
            // If armor is in the body slot.
            if (armor.etypeId === 4) {
                ac = armor.meta.ac || ac;
            } else {
                bonus += armor.meta.ac || 0;
            }
        }
        return ac - bonus;
    }
});
Thank you, that almost fixed everything. I knew I had to be doing something dumb.

For some really odd reason though, I had to switch to this:
Code:
if (armor.meta.ac) {
    if (armor.etypeId === 4) {
        ac = armor.meta.ac;
    } else {
         bonus += armor.meta.ac;
    }
}

When I was using armor.meta.ac || default I kept getting -2 instead of 7.

Original thread: https://forums.rpgmakerweb.com/threads/issues-getting-values-from-armor-notetags.82946/