Exemplo n.º 1
0
Arquivo: debug.c Projeto: chazu/btmux
void debug_setwbv(dbref player, void *data, char *buffer)
{
	char *args[3];
	int bv;
	int id, brand;

	DOCHECK(mech_parseattributes(buffer, args, 3) != 2, "Invalid arguments!");
	DOCHECK(Readnum(bv, args[1]), "Invalid value!");
	DOCHECK(bv <0, "BV needs to be >=0");
	DOCHECK(!find_matching_vlong_part(args[0], NULL, &id, &brand),
			"That is no weapon!");
	DOCHECK(!IsWeapon(id), "That is no weapon!");
	MechWeapons[Weapon2I(id)].battlevalue = bv;
	notify_printf(player, "BV for %s set to %d.",
				  MechWeapons[Weapon2I(id)].name, bv);
}
Exemplo n.º 2
0
void CheckWeaponFailed(MECH * mech, int weapnum, int weaptype, int section,
					   int critical, int *modifier, int *type)
{
	short roll;
	int l = GetPartBrand(mech, section, critical);
	int t = GetPartType(mech, section, critical);
	int i = GetBrandIndex(t), in;

	*type = FAIL_NONE;
	if(i < 0)
		return;
	if(mudconf.btech_parts) {
		if(!l)
			l = 5;
		if(MechWeapons[Weapon2I(t)].special & PCOMBAT)
			return;
	} else
		return;
	if(Number(1, 10) < 9)
		return;
	if(Number(1, 100) <= brands[(i + l - 1) * 5 / 6].success)
		return;
	roll = Number(1, 6);
	if(roll == 6)
		roll = Number(1, 6);
	in = i + roll - 1;
	if(failures[in].flag & REQ_HEAT)
		if(!MechWeapons[weaptype].heat)
			return;
	if(failures[in].message && strcmp(failures[in].message, "none"))
		mech_notify(mech, MECHALL, failures[in].message);
	failures[in].func(mech, weapnum, weaptype, section, critical, roll,
					  modifier, type);
}
Exemplo n.º 3
0
Arquivo: debug.c Projeto: chazu/btmux
void debug_setvrt(dbref player, void *data, char *buffer)
{
	char *args[3];
	int vrt;
	int id, brand;

	DOCHECK(mech_parseattributes(buffer, args, 3) != 2, "Invalid arguments!");
	DOCHECK(Readnum(vrt, args[1]), "Invalid value!");
	DOCHECK(vrt <= 0, "VRT needs to be >0");
	DOCHECK(vrt > 127, "VRT can be at max 127");
	DOCHECK(!find_matching_vlong_part(args[0], NULL, &id, &brand),
			"That is no weapon!");
	DOCHECK(!IsWeapon(id), "That is no weapon!");
	MechWeapons[Weapon2I(id)].vrt = vrt;
	notify_printf(player, "VRT for %s set to %d.",
				  MechWeapons[Weapon2I(id)].name, vrt);
    log_error(LOG_WIZARD, "WIZ", "CHANGE", "VRT for %s set to %d by #%d", 
						 MechWeapons[Weapon2I(id)].name, vrt, player);
}
Exemplo n.º 4
0
Arquivo: glue.c Projeto: chazu/btmux
void LoadSpecialObjects(void)
{
	dbref i;
	int id, brand;
	int type;
	void *tmpdat;

	init_btdb_state(get_specialobjectsize);
	init_xcode_tree();

	muxevent_initialize();
	muxevent_count_initialize();
	init_stat();
	initialize_partname_tables();
	for(i = 0; MissileHitTable[i].key != -1; i++) {
		if(find_matching_vlong_part(MissileHitTable[i].name, NULL, &id,
									&brand))
			MissileHitTable[i].key = Weapon2I(id);
		else
			MissileHitTable[i].key = -2;
	}
	/* Loop through the entire database, and if it has the special */
	/* object flag, add it to our linked list. */
	DO_WHOLE_DB(i)
		if(Hardcode(i) && !Going(i) && !Halted(i)) {
			type = WhichSpecialS(i);
			if(type >= 0) {
				if(SpecialObjects[type].datasize > 0)
					tmpdat = NewSpecialObject(i, type);
				else
					tmpdat = NULL;
			} else
				c_Hardcode(i);	/* Reset the flag */
		}
	for(i = 0; i < NUM_SPECIAL_OBJECTS; i++) {
		InitSpecialHash(i);
		if(!SpecialObjects[i].updatefunc)
			SpecialObjects[i].updateTime = 0;
	}
	init_btechstats();
	load_xcode();
	zap_unneccessary_hcode();
}
Exemplo n.º 5
0
int GetBrandIndex(int type)
{
	if(type == -1)
		return COMPUTER_INDEX;
	if(type == -2)
		return RADIO_INDEX;
	if(IsWeapon(type))
		if(type < I2Weapon(num_def_weapons)) {
			type = Weapon2I(type);
			if(MechWeapons[type].special & PCOMBAT)
				return -1;
			if(IsFlamer(type))
				return FLAMMER_INDEX;
			if(IsEnergy(type))
				return ENERGY_INDEX;
			if(IsAutocannon(type))
				return AC_INDEX;
			if(IsMissile(type))
				return MISSILE_INDEX;
			return -1;
		}
	return -1;
}
Exemplo n.º 6
0
static int check_for_scrappage(MECH * mech, int loc)
{
    int a, b;
    int ret = 1;

    if (SectIsDestroyed(mech, loc))
	return 1;

    if (SomeoneScrappingLoc(mech, loc)) {
	DAMAGE2(DETACH, loc);
	return 1;
    }
    for (a = 0; a < NUM_CRITICALS; a++) {
	if (!(b = GetPartType(mech, loc, a)))
	    continue;
	if (PartIsBroken(mech, loc, a))
	    continue;
	if (IsCrap(b))
	    continue;
	if (IsAmmo(b) && GetPartData(mech, loc, a)) {
	    DAMAGE3(UNLOAD, loc, a);
	    if (ret && !SomeoneRepairing(mech, loc, a))
		ret = 0;
	    continue;
	}
	DAMAGE3(IsWeapon(b) ? SCRAPG : SCRAPP, loc, a);
	if (ret && !SomeoneScrappingPart(mech, loc, a))
	    ret = 0;
	if (IsWeapon(b))
	    a += GetWeaponCrits(mech, Weapon2I(b)) - 1;
    }

    if (ret && !Invalid_Scrap_Path(mech, loc))
	DAMAGE2(DETACH, loc);

    return 0;
}
Exemplo n.º 7
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;
}