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)); }
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)); }
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)); }
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; }
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); }