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.
You needed some parentheses in there because in has a very low order of operations. The || and && operators are occuring before the "in" operator.