Mage Armor

Moderators: ALFA Administrators, NWN1 - WD DM

Post Reply
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Mage Armor

Post by Fionn »

Took a look at nw_s0_magearm. Turns out we do allow armor, we just don't allow armor better than AC4 and we have a 20 second loop checking to see if you swapped armor (and an initial check to see if it was >4). I'd need to test with the rest timer disabled, but it seems you can cast naked and have about 3 rounds in Full Plate +4 if you time it right.

Looks like there's also a pre-existing BW exploit that it removes any prior casting before you apply the effects

Code: Select all

RemoveEffectsFromSpell(oTarget, SPELL_MAGE_ARMOR);
Though I imagine if you nerf your friendly Wiz20's buffs you may find yourself all newtly.

Oddly, this code looks backwards to me. I can't imagine we ran with it for years and never noted Scale got X4 the bonus of Padded, but it sure looks like ACValue 4 (default) applies a nACBonus of 4, while ACValue 1 (Padded) only grants a +1.

Code: Select all

    switch (GetItemACValue(oChestItem))
    {
        case 3: nACBonus = 1; // ARMOR_AC_PADDED is equipped
            break;
        case 2: nACBonus = 2; // ARMOR_AC_LEATHER is equipped
            break;
        case 1: nACBonus = 3; // ARMOR_AC_STUDDED_LEATHER or ARMOR_AC_HIDE is equipped
            break;
        default: nACBonus = 4; // ARMOR_AC_CHAIN_SHIRT or ARMOR_AC_SCALE is equipped
            break;
            
        eAC = EffectACIncrease(nACBonus, AC_ARMOUR_ENCHANTMENT_BONUS);
    }
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
User avatar
Gaia_Nostra
Brown Bear
Posts: 231
Joined: Wed Jan 14, 2004 5:02 am
Location: Washington, DC

Re: Mage Armor

Post by Gaia_Nostra »

In HAKs ahp_4.01 and ahp_4.02 the codelines are identical and the Switch-Case statement reads as follows:

Code: Select all

int GetACBonus(object oChestItem)
{
    int nACBonus;

    // examine and assign the AC bonus that the spell grants depending on the
    // PC's currently equipped chest item's AC
    switch (GetItemACValue(oChestItem))
    {
        case 3: nACBonus = 1; // ARMOR_AC_STUDDED_LEATHER is equipped, so only give +1
            break;
        case 2: nACBonus = 2; // ARMOR_AC_LEATHER is equipped, so only give +2
            break;
        case 1: nACBonus = 3; // ARMOR_AC_PADDED is equipped, so give +3
            break;
        default: nACBonus = 4; // no armor is equipped, so give the full +4
            break;
    }
    return nACBonus;
}
This version is also wrong...just in another way. :wall:
If the enemy is an ass and a fool and a rating
coxcomb, is it meet, think you, that we should also,
look you, be an ass and a fool and a prating
coxcomb? in your own conscience, now?

Former Characters:
(Silverymoon): Q’arq Olafstenza Fry
(Waterdeep/Daggerford): Angus Porter, Cleric of Torm (aka the Slipshod Sergeant)
User avatar
valn99
Owlbear
Posts: 540
Joined: Tue Oct 26, 2004 1:18 pm
Location: Canada (Quebec)

Re: Mage Armor

Post by valn99 »

Does GetItemACValue return the base AC value or would it still add any enchantment bonus?
Seems overly complicated!! ;)

return the max of (0, 4-GetItemACValue) seems simpler... you get at best +4, and at worse +0?
Or however it would be coded in NWN Script

Oh if the default clause works the same as I know, that would mean any other value gets +4: no armor as well as a full plate!! ;)
NWN1 PC:
Now (2017): Bran, naive servant of Lathander, currently thinking about opening a potion shop.
circa 2000: JenWa, proud mother duck and half-crazed sorceress of Shadowdale.


NW2 PC: Kasil Trueforger, dwarven scholar of Felbarr.

Garlus Ironbeard: [d] I was sure there was a reason we brought you along.
Kevorn Trueforger: [d] I'm da funny one and ye're da smart one.
User avatar
ayergo
Penguin AKA Vile Sea Tiger
Posts: 3503
Joined: Sun Jan 11, 2004 8:50 pm
Location: Germany (But frequent world travels)

Re: Mage Armor

Post by ayergo »

Yeah, many broken spells. Gaia has been doing a review, I hope to do a big hak update sometime in the next year to correct and consolidate.
There's a place I like to hide
A doorway that I run through in the night
Relax child, you were there
But only didn't realize and you were scared
It's a place where you will learn
To face your fears, retrace the years
And ride the whims of your mind
User avatar
Cleasor
Gelatinous Cube
Posts: 328
Joined: Mon Feb 27, 2017 12:18 am
Location: Colorado MST

Re: Mage Armor

Post by Cleasor »

I'm thinking of taking a level of wizard for possible arcane archer in the future. If I am wearing studded leather +1, does this mean Mage Armor will give no benefit? Take the spell Shield instead?
"Having an adventure shows that someone is incompetent, that something has gone wrong. An adventure is interesting enough in retrospect, especially to the person who didn't have it; at the time it happens it usually constitutes an exceedingly disagreeable experience." Vilhjalmur Stefansson
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Re: Mage Armor

Post by Fionn »

Cleasor wrote:I'm thinking of taking a level of wizard for possible arcane archer in the future. If I am wearing studded leather +1, does this mean Mage Armor will give no benefit? Take the spell Shield instead?
As I read it, you *may* get +1 until you get the +1 armor. After that, GetItemACValue will return 4, so the spell aborts.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
User avatar
Senor T
Ogre
Posts: 629
Joined: Mon Jan 05, 2004 7:42 pm
Location: Durham, NC (US Eastern)
Contact:

Re: Mage Armor

Post by Senor T »

Pretty sure mage armor gives a +1 bonus to some of the variable types of armor, which do not stack. So if you have a +1 to armor, then you won’t get the armor bonus.

Shield should just give you +4. It’s useful even with bonus items, but had a relatively short duration compared to mage armor.
Currently laying the smackdown on Faerun as: Keryn Tel'Jora, who is XXX-TREME!!!.
Currently explaining the meaninglessness of it all as Vizian Nazyr.
Currently pointing out all other characters' shortcomings as Stephen the Archer.
User avatar
Gaia_Nostra
Brown Bear
Posts: 231
Joined: Wed Jan 14, 2004 5:02 am
Location: Washington, DC

Re: Mage Armor

Post by Gaia_Nostra »

BTW...

I just double checked this codeline and realized that the Default case statement only gets executed if the AC is less than or equal to 4. So the code is fine, but the comment // ARMOR_AC_CHAIN_SHIRT or ARMOR_AC_SCALE is equipped is misleading/wrong.

Code: Select all

    int ARMOR_AC_CHAIN_SHIRT = 4;       // includes ARMOR_AC_SCALE >> this is being used
    
    ...

    if (GetItemACValue(oChestItem) >= ARMOR_AC_CHAIN_SHIRT) // <=====  When AC is 4 or greater...do not adjust AC
    {
        SendMessageToPC(oCaster, GetName(oTarget) + " will not benefit from this spell.");
        return;
    }
    else 
    {
        nACBonus = GetACBonus(oChestItem);
    }
    
 ...
 
 int GetACBonus(object oChestItem)
{
    int nACBonus;

    // examine and assign the AC bonus that the spell grants depending on the
    // PC's currently equipped chest item's AC
    switch (GetItemACValue(oChestItem))
    {
        case 3: nACBonus = 1; // ARMOR_AC_PADDED is equipped
            break;
        case 2: nACBonus = 2; // ARMOR_AC_LEATHER is equipped
            break;
        case 1: nACBonus = 3; // ARMOR_AC_STUDDED_LEATHER or ARMOR_AC_HIDE is equipped
            break;
        default: nACBonus = 4; // ARMOR_AC_CHAIN_SHIRT or ARMOR_AC_SCALE is equipped
            break;
    }
    return nACBonus;
}    
If the enemy is an ass and a fool and a rating
coxcomb, is it meet, think you, that we should also,
look you, be an ass and a fool and a prating
coxcomb? in your own conscience, now?

Former Characters:
(Silverymoon): Q’arq Olafstenza Fry
(Waterdeep/Daggerford): Angus Porter, Cleric of Torm (aka the Slipshod Sergeant)
Post Reply