コード例 #1
0
ファイル: failures.c プロジェクト: chazu/btmux
void FailureWeaponSpike(MECH * mech, int weapnum, int weaptype,
						int section, int critical, int roll, int *modifier,
						int *type)
{
	SetPartTempNuke(mech, section, critical, failures[Conv(mech, section,
														   critical) +
													  roll].type);
	*type = POWER_SPIKE;
	if(roll == 6) {
		SetPartTempNuke(mech, section, critical, FAIL_DESTROYED);
		return;
	}
	SetRecyclePart(mech, section, critical, Number(20, 40));
}
コード例 #2
0
ファイル: failures.c プロジェクト: chazu/btmux
void FailureWeaponDud(MECH * mech, int weapnum, int weaptype, int section,
					  int critical, int roll, int *modifier, int *type)
{
	if(failures[Conv(mech, section, critical) + roll].type == FAIL_NONE) {
		SetRecyclePart(mech, section, critical, MechWeapons[weaptype].vrt);
		return;
	}
	SetPartTempNuke(mech, section, critical, failures[Conv(mech, section,
														   critical) +
													  roll].type);
	*type = WEAPON_DUD;
	if(roll == 6) {
		SetPartTempNuke(mech, section, critical, FAIL_DESTROYED);
	}
	SetRecyclePart(mech, section, critical, 30 + Number(1, 60));
}
コード例 #3
0
ファイル: failures.c プロジェクト: chazu/btmux
void FailureWeaponJammed(MECH * mech, int weapnum, int weaptype,
						 int section, int critical, int roll, int *modifier,
						 int *type)
{
	SetPartTempNuke(mech, section, critical, failures[Conv(mech, section,
														   critical) +
													  roll].type);
	*type = WEAPON_JAMMED;
	SetRecyclePart(mech, section, critical, Number(20, 40));
}
コード例 #4
0
ファイル: failures.c プロジェクト: chazu/btmux
void FailureWeaponMissiles(MECH * mech, int weapnum, int weaptype,
						   int section, int critical, int roll, int *modifier,
						   int *type)
{
	SetPartTempNuke(mech, section, critical, failures[Conv(mech, section,
														   critical) +
													  roll].type);
	*type = CRAZY_MISSILES;
	*modifier = failures[Conv(mech, section, critical) + roll].data;
}
コード例 #5
0
ファイル: mech.events.c プロジェクト: fstltna/Battletech-MUX
void mech_unjam_ammo_event(EVENT * objEvent)
{
    MECH *objMech = (MECH *) objEvent->data;	/* get the mech */
    int wWeapNum = (int) objEvent->data2;	/* and now the weapon number */
    int wSect, wSlot, wWeapStatus, wWeapIdx;
    int ammoLoc, ammoCrit, ammoLeft;
    int wRoll = 0;
    int wRollNeeded = 0;

    if (Uncon(objMech) || !Started(objMech))
	return;

    wWeapStatus =
	FindWeaponNumberOnMech(objMech, wWeapNum, &wSect, &wSlot);

    if (wWeapStatus == TIC_NUM_DESTROYED)	/* return if the weapon has been destroyed */
	return;

    wWeapIdx = FindWeaponIndex(objMech, wWeapNum);
    ammoLeft =
	FindAmmoForWeapon_sub(objMech, wSect, wSlot, wWeapIdx, 0, &ammoLoc,
	&ammoCrit, 0, 0);

    if (!ammoLeft) {
	SetPartTempNuke(objMech, wSect, wSlot, 0);

	mech_notify(objMech, MECHALL,
	    tprintf
	    ("You finish bouncing around and realize you nolonger have ammo for your %s!",
		get_parts_long_name(I2Weapon(wWeapIdx), 0)));
	return;
    }

    if (MechWeapons[wWeapStatus].special & RAC) {
	wRoll = Roll();
	wRollNeeded = FindPilotGunnery(objMech, wWeapStatus) + 3;

	mech_notify(objMech, MECHPILOT,
	    "You make a roll to unjam the weapon!");
	mech_notify(objMech, MECHPILOT,
	    tprintf("Modified Gunnery Skill: BTH %d\tRoll: %d",
		wRollNeeded, wRoll));

	if (wRoll < wRollNeeded) {
	    mech_notify(objMech, MECHALL,
		"Your attempt to remove the jammed slug fails. You'll need to try again to clear it.");
	    return;
	}
    } else {
	if (!MadePilotSkillRoll(objMech, 0)) {
	    mech_notify(objMech, MECHALL,
		"Your attempt to remove the jammed slug fails. You'll need to try again to clear it.");
	    return;
	}
    }

    SetPartTempNuke(objMech, wSect, wSlot, 0);
    mech_notify(objMech, MECHALL,
	tprintf("You manage to clear the jam on your %s!",
	    get_parts_long_name(I2Weapon(wWeapIdx), 0)));
    MechLOSBroadcast(objMech, "ejects a mangled shell!");

    SetPartData(objMech, ammoLoc, ammoCrit, GetPartData(objMech, ammoLoc,
	    ammoCrit) - 1);
}