Ejemplo n.º 1
0
static int DS_Bay_Is_Open(MECH * mech, MECH * ds, dbref bayref)
{
	int i, j;

	for(i = 0; i < NUM_BAYS; i++)
		if(AeroBay(ds, i) > 0)
			if(AeroBay(ds, i) == bayref) {
				j = Find_DS_Bay_Dir(ds, i);
				for(i = 0; i < NUM_CRITICALS; i++) {
					if(((is_aero(mech) &&
						 GetPartType(ds, dir2loc[j],
									 i) == I2Special(DS_AERODOOR)) ||
						(!is_aero(mech)
						 && GetPartType(ds, dir2loc[j],
										i) == I2Special(DS_MECHDOOR))) &&
					   !PartIsDestroyed(ds, dir2loc[j], i))
						return 1;
				}
				return 0;
			}
	return 0;
}
Ejemplo n.º 2
0
static int check_for_damage(MECH * mech, int loc)
{
    int a, b, c, d;

    if (SectIsDestroyed(mech, loc)) {
	if (MechType(mech) != CLASS_BSUIT)
	    DAMAGE2(REATTACH, loc);
	else
	    DAMAGE2(REPLACESUIT, loc);
	return 0;
    }

    /*
       * Added by Kipsta
       * 8/4/99
     */

    if (SectIsFlooded(mech, loc)) {
	DAMAGE2(RESEAL, loc);
	return 0;
    }
    if ((a = GetSectInt(mech, loc)) != (b = GetSectOInt(mech, loc)))
	DAMAGE3(FIXINTERNAL, loc, (b - a));
    else {
	if ((a = GetSectArmor(mech, loc)) != (b =
		GetSectOArmor(mech, loc)))
	    DAMAGE3(FIXARMOR, loc, (b - a));
	if ((a = GetSectRArmor(mech, loc)) != (b =
		GetSectORArmor(mech, loc)))
	    DAMAGE3(FIXARMOR_R, loc, (b - a));
    }
    for (a = 0; a < NUM_CRITICALS; a++) {
	if (!(b = GetPartType(mech, loc, a)))
	    continue;
	if (IsAmmo(b) && !PartIsDestroyed(mech, loc, a) &&
	    (c = GetPartData(mech, loc, a)) != (d =
		FullAmmo(mech, loc, a)))
	    DAMAGE3(RELOAD, loc, a);
	if (!PartIsNonfunctional(mech, loc, a) &&
	    !PartTempNuke(mech, loc, a) && !PartIsDamaged(mech, loc, a))
	    continue;
	if (IsCrap(b))
	    continue;
	/* Destroyed / tempnuke'd part. Either case, it works for us :) */

	if (PartIsDamaged(mech, loc, a)) {
	    if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_EN_FOCUS)
		DAMAGE3(ENHCRIT_FOCUS, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_EN_CRYSTAL)
		DAMAGE3(ENHCRIT_CRYSTAL, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_BALL_BARREL)
		DAMAGE3(ENHCRIT_BARREL, loc, a);
	    else if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_BALL_AMMO)
		DAMAGE3(ENHCRIT_AMMOB, loc, a);
	    else if (GetPartDamageFlags(mech, loc,
		    a) & WEAP_DAM_MSL_RANGING)
		DAMAGE3(ENHCRIT_RANGING, loc, a);
	    else if (GetPartDamageFlags(mech, loc, a) & WEAP_DAM_MSL_AMMO)
		DAMAGE3(ENHCRIT_AMMOM, loc, a);
	    else
		DAMAGE3(ENHCRIT_MISC, loc, a);

	} else if (IsWeapon(b) && GetWeaponCrits(mech, Weapon2I(b)) > 4 &&
	    !PartIsDestroyed(mech, loc, a + 1))
	    DAMAGE3(REPAIRP_T, loc, a);
	else
	    DAMAGE3(IsWeapon(b) ? REPAIRG : REPAIRP, loc, a);

	if (IsWeapon(b))
	    a += GetWeaponCrits(mech, Weapon2I(b)) - 1;
    }
    return 1;
}