ID:1611235
 
(See the best response by Ter13.)
Code:
        doDefense(attack, mob/user=mobRef,mob/target=lastTarget,Command/Technique/c){
if(user.unconscious || target.unconscious){
return TRUE;
}
if(c.tType == MELEE && a_get_dist(user,target) > user.calcMeleeRange(c._maxDistance) || c.tType == MELEE && !user.calcMeleeRange(c._maxDistance) && (user.density && !target.density || target.density && !user.density) || user.z != target.z){
send("Your [attack] misses [target.raceColor(target.name)]!",user)
send("[user.raceColor(user.name)]'s [attack] misses you!",target)
send("[user.raceColor(user.name)]'s [attack] misses [target.raceColor(target.name)]!",ohearers(0,user))
return TRUE;
}
logger.debug("[view_list(c.defenses, "comma")] [target.defenseType]");
if(PARRY_HIGH in c.defenses && target.defenseType == PARRY_HIGH || PARRY_LOW in c.defenses && target.defenseType == PARRY_LOW){
send("You have parried [user.name]'s [attack]!",target)
send("[target.name] has parried your [attack]!",user)
send("[target.name] has parried [user.name]'s [attack]!",ohearers(0,target))
target.doDefense = 0;
target.defenseType = null;
return TRUE;
}
}


Problem description:

the if statement to check if the attack is parried isnt working but the debug logger confirms that all variables are present and correct yet the if statement doesnt pass.

Best response
if((PARRY_HIGH in c.defenses) && target.defenseType == PARRY_HIGH || (PARRY_LOW in c.defenses) && target.defenseType == PARRY_LOW)


You needed some parentheses in there because in has a very low order of operations. The || and && operators are occuring before the "in" operator.
Put your "item in list" checks inside parenthesis and try again.

Edit: Ter beat me to it.
Ah derp thanks guys I took a break from BYOND for like 7 months lol kinda rusty again.
This is a very common mistake and it often goes unnoticed. It'll be "fixed" in a future version, according to this bug report:

http://www.byond.com/forum/?post=1605373