#include <math.h>
#include "mech.h"
#include "mech.events.h"
#include "p.mech.utils.h"
#include "p.mech.combat.h"
#include "p.mech.damage.h"
#include "p.mech.los.h"
#include "p.mech.move.h"
#include "p.crit.h"
#include "p.mech.bth.h"
#include "p.mech.update.h"
Include dependency graph for bsuit.c:
Go to the source code of this file.
Defines | |
#define | MyHiddenTurns(mech) ((MechType(mech) == CLASS_MW ? 1 : MechType(mech) == CLASS_BSUIT ? 3 : MechType(mech) == CLASS_VTOL ? 4 : 5) * ((MechSpecials2(mech) & CAMO_TECH) ? 1 : 2)) |
#define | RECYCLE_SWARM (PHYSICAL_RECYCLE_TIME / 3) |
#define | RECYCLE_ATTACKLEG (PHYSICAL_RECYCLE_TIME / 2) |
#define | RECYCLE_INT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 3) |
#define | RECYCLE_UNINT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 2) |
#define | RECYCLE_FALL_STOPSWARM ((PHYSICAL_RECYCLE_TIME / 4) * 3) |
Functions | |
char * | GetBSuitName (MECH *mech) |
char * | GetLCaseBSuitName (MECH *mech) |
void | StartBSuitRecycle (MECH *mech, int time) |
void | StopSwarming (MECH *mech, int intentional) |
int | IsMechSwarmed (MECH *mech) |
int | IsMechMounted (MECH *mech) |
int | CountSwarmers (MECH *mech) |
MECH * | findSwarmers (MECH *mech) |
void | StopBSuitSwarmers (MAP *map, MECH *mech, int intentional) |
void | BSuitMirrorSwarmedTarget (MAP *map, MECH *mech) |
int | doBSuitCommonChecks (MECH *mech, dbref player) |
int | CountBSuitMembers (MECH *mech) |
int | FindBSuitTarget (dbref player, MECH *mech, MECH **target, char *buffer) |
int | doJettisonChecks (MECH *mech) |
void | bsuit_swarm (dbref player, void *data, char *buffer) |
void | bsuit_attackleg (dbref player, void *data, char *buffer) |
static void | mech_hide_event (MUXEVENT *e) |
void | bsuit_hide (dbref player, void *data, char *buffer) |
void | JettisonPacks (dbref player, void *data, char *buffer) |
#define MyHiddenTurns | ( | mech | ) | ((MechType(mech) == CLASS_MW ? 1 : MechType(mech) == CLASS_BSUIT ? 3 : MechType(mech) == CLASS_VTOL ? 4 : 5) * ((MechSpecials2(mech) & CAMO_TECH) ? 1 : 2)) |
Definition at line 33 of file bsuit.c.
Referenced by mech_hide_event().
#define RECYCLE_ATTACKLEG (PHYSICAL_RECYCLE_TIME / 2) |
#define RECYCLE_FALL_STOPSWARM ((PHYSICAL_RECYCLE_TIME / 4) * 3) |
#define RECYCLE_INT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 3) |
#define RECYCLE_SWARM (PHYSICAL_RECYCLE_TIME / 3) |
#define RECYCLE_UNINT_STOPSWARM (PHYSICAL_RECYCLE_TIME / 2) |
void bsuit_attackleg | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 459 of file bsuit.c.
References ArmorStringFromIndex(), cch, CountBSuitMembers(), DamageMech(), DestroySection(), doBSuitCommonChecks(), DOCHECK, doJettisonChecks(), Fallen, FindBSuitTarget(), GetMechToMechID(), GetSectInt, HandleCritical(), HIDDEN, Immobile, INF_ANTILEG_TECH, IsMechLegLess(), LARM, LLEG, MadePilotSkillRoll(), mech_notify(), mech_printf(), MECH_USUALO, MECHALL, MechCritStatus, MechInfantrySpecials, MechIsQuad, MechLOSBroadcast(), MechLOSBroadcasti(), MechMove, MechPilot, MechTeam, MechType, Number, RARM, RECYCLE_ATTACKLEG, RLEG, Roll(), StartBSuitRecycle(), TargetMovementMods(), and tprintf().
00460 { 00461 MECH *mech = data; 00462 MECH *target; 00463 int baseToHit = 0; 00464 int wLegTemp = -1; 00465 int wLegID = -1; 00466 int wCritRoll = 0; 00467 char strAttackLoc[50]; 00468 00469 cch(MECH_USUALO); 00470 00471 if(!(MechInfantrySpecials(mech) & INF_ANTILEG_TECH)) { 00472 mech_notify(mech, MECHALL, 00473 "These battlesuits are not capable of performing leg attacks!"); 00474 return; 00475 } 00476 00477 if(doBSuitCommonChecks(mech, player)) 00478 return; 00479 00480 if(doJettisonChecks(mech)) 00481 return; 00482 00483 if(FindBSuitTarget(player, mech, &target, buffer)) 00484 return; 00485 00486 DOCHECK(IsMechLegLess(mech), "That mech has no legs to grab!"); 00487 DOCHECK((MechTeam(mech) == MechTeam(target)), 00488 "You can't attack the leg of a friendly mech!"); 00489 00490 switch (CountBSuitMembers(mech)) { 00491 case 1: 00492 baseToHit = 7; 00493 break; 00494 00495 case 2: 00496 baseToHit = 5; 00497 break; 00498 00499 case 3: 00500 baseToHit = 2; 00501 break; 00502 00503 default: 00504 baseToHit = -1; 00505 break; 00506 } 00507 00508 if(MechCritStatus(mech) & HIDDEN) { 00509 if(Immobile(target)) 00510 baseToHit -= 4; 00511 00512 if(Fallen(target)) 00513 baseToHit -= 2; 00514 } else { 00515 baseToHit += TargetMovementMods(mech, target, 0.0); 00516 } 00517 00518 if(MechIsQuad(target)) { 00519 do { 00520 switch (Number(0, 3)) { 00521 case 0: 00522 wLegTemp = RLEG; 00523 break; 00524 00525 case 1: 00526 wLegTemp = LLEG; 00527 break; 00528 00529 case 2: 00530 wLegTemp = RARM; 00531 break; 00532 00533 case 3: 00534 wLegTemp = LARM; 00535 break; 00536 } 00537 00538 if(GetSectInt(target, wLegTemp)) 00539 wLegID = wLegTemp; 00540 00541 } while (wLegID == -1); 00542 } else { 00543 wLegTemp = (Number(0, 1)) ? RLEG : LLEG; 00544 00545 if(GetSectInt(target, wLegTemp) == 0) { 00546 wLegID = (wLegTemp == RLEG) ? LLEG : RLEG; 00547 } else { 00548 wLegID = wLegTemp; 00549 } 00550 } 00551 00552 ArmorStringFromIndex(wLegID, strAttackLoc, MechType(target), 00553 MechMove(target)); 00554 00555 mech_printf(mech, MECHALL, 00556 "You go for %s's %s, placing explosives in the joints!", 00557 GetMechToMechID(mech, target), strAttackLoc); 00558 00559 if(MadePilotSkillRoll(mech, baseToHit)) { 00560 mech_printf(target, MECHALL, 00561 "%s swarms your %s putting small packets of explosives all over it!", 00562 GetMechToMechID(target, mech), strAttackLoc); 00563 00564 MechLOSBroadcasti(mech, target, "attacks %s's legs!"); 00565 00566 /* find out if we do a crit or damage */ 00567 wCritRoll = Roll(); 00568 00569 if(wCritRoll >= 8) { 00570 mech_printf(target, MECHALL, 00571 "The explosives manage to rip into the internals of your %s!", 00572 strAttackLoc); 00573 00574 switch (wCritRoll) { 00575 case 8: 00576 case 9: 00577 HandleCritical(target, mech, 1, wLegID, 1); 00578 break; 00579 case 10: 00580 case 11: 00581 HandleCritical(target, mech, 1, wLegID, 2); 00582 break; 00583 case 12: 00584 switch (wLegID) { 00585 case RARM: 00586 case LARM: 00587 case RLEG: 00588 case LLEG: 00589 /* Limb blown off */ 00590 mech_notify(target, MECHALL, "%ch%cyCRITICAL HIT!!%c"); 00591 00592 MechLOSBroadcast(target, 00593 tprintf 00594 ("'s %s is blown off in a shower of sparks and smoke!", 00595 strAttackLoc)); 00596 DestroySection(target, mech, 1, wLegID); 00597 default: 00598 HandleCritical(target, mech, 1, wLegID, 3); 00599 } 00600 break; 00601 default: 00602 break; 00603 } 00604 } else { 00605 mech_printf(target, MECHALL, 00606 "The explosives explode on the surface of your %s!", 00607 strAttackLoc); 00608 DamageMech(target, mech, 1, MechPilot(mech), wLegID, 0, 1, 4, 00609 0, -1, 0, -1, 0, 1); 00610 } 00611 } else { 00612 mech_printf(target, MECHALL, 00613 "%s attempts to attacks your legs, but misses miserably.", 00614 GetMechToMechID(target, mech)); 00615 00616 mech_printf(mech, MECHALL, 00617 "You realize that this is harder than it looks and fail in your attempt at hitting %s's legs!", 00618 GetMechToMechID(mech, target)); 00619 00620 MechLOSBroadcasti(mech, target, 00621 "attacks to climb %s's legs, but fails miserably!"); 00622 } 00623 00624 StartBSuitRecycle(mech, RECYCLE_ATTACKLEG); 00625 }
void bsuit_hide | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 673 of file bsuit.c.
References cch, CLASS_BSUIT, CLASS_MW, DOCHECK, EVENT_HIDE, FindObjectsData(), GetRTerrain, HasCamo, Hiding, IsBuilding, IsForest, IsMountains, IsRough, Jumping, Landed, MECH::mapindex, mech_hide_event(), mech_notify(), MECH_USUALO, MECHALL, MECHEVENT, MechMove, MechSpeed, MechType, MechX, MechY, MOVE_VTOL, MP1, OODing, and Wizard.
Referenced by auto_radio_command_hide().
00674 { 00675 int i; 00676 MECH *mech = data; 00677 MECH *t; 00678 MAP *map = FindObjectsData(mech->mapindex); 00679 int terrain; 00680 00681 cch(MECH_USUALO); 00682 DOCHECK(((HasCamo(mech)) 00683 || (Wizard(player))) ? 0 : MechType(mech) != CLASS_BSUIT 00684 && MechType(mech) != CLASS_MW, 00685 "You aren't capable of such curious things."); 00686 00687 if(!map) { 00688 mech_notify(mech, MECHALL, "You are not on a map!"); 00689 return; 00690 } 00691 00692 DOCHECK(Jumping(mech) || OODing(mech), "Hide where? Up here?"); 00693 DOCHECK((fabs(MechSpeed(mech)) > MP1), "Come to a complete stop first."); 00694 DOCHECK(Hiding(mech), "You are looking for cover already!"); 00695 DOCHECK(MechMove(mech) == MOVE_VTOL 00696 && !Landed(mech), "You must be landed!"); 00697 00698 terrain = GetRTerrain(map, MechX(mech), MechY(mech)); 00699 00700 if(IsForest(terrain)) { 00701 mech_notify(mech, MECHALL, "You start to hide amongst the trees..."); 00702 } else if(IsMountains(terrain)) { 00703 mech_notify(mech, MECHALL, 00704 "You start to hide behind some rocky outcroppings..."); 00705 } else if(IsRough(terrain)) { 00706 mech_notify(mech, MECHALL, 00707 "You find some boulders to try to hide behind..."); 00708 } else if((IsBuilding(terrain)) && (MechType(mech) == CLASS_BSUIT)) { 00709 mech_notify(mech, MECHALL, 00710 "You break into a building and look for a spot to hide..."); 00711 } else { 00712 mech_notify(mech, MECHALL, "You begin to hide in this terrain..."); 00713 mech_notify(mech, MECHALL, 00714 "... then realize that just isn't going to work!"); 00715 return; 00716 } 00717 00718 MECHEVENT(mech, EVENT_HIDE, mech_hide_event, 1, 0); 00719 }
void bsuit_swarm | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 337 of file bsuit.c.
References cch, CountBSuitMembers(), CountSwarmers(), doBSuitCommonChecks(), doJettisonChecks(), Fallen, FindBSuitTarget(), GetMechToMechID(), HIDDEN, Immobile, INF_SWARM_TECH, MadePilotSkillRoll(), mech_notify(), mech_printf(), MECH_USUALO, MECHALL, MechCritStatus, MechDesiredFacing, MechDesiredSpeed, MechInfantrySpecials, MechLOSBroadcasti(), MechSpeed, MechStatus2, MechSwarmer, MechSwarmTarget, MechTeam, MirrorPosition, MECH::mynum, RECYCLE_SWARM, SetFacing, skipws, StartBSuitRecycle(), StopLock, StopSwarming(), TargetMovementMods(), UNIT_MOUNTED, and UNIT_MOUNTING.
00338 { 00339 MECH *mech = data; 00340 MECH *target; 00341 int baseToHit = 4; 00342 int tIsMount = 0; 00343 00344 cch(MECH_USUALO); 00345 skipws(buffer); 00346 00347 /* Stop swarming... */ 00348 if(!strcmp(buffer, "-")) { 00349 if(MechSwarmTarget(mech) > 0) { 00350 StopSwarming(mech, 1); 00351 return; 00352 } 00353 } 00354 00355 if(doBSuitCommonChecks(mech, player)) 00356 return; 00357 00358 if(FindBSuitTarget(player, mech, &target, buffer)) 00359 return; 00360 00361 /* See if we're 'swarming' or 'mounting' */ 00362 if(MechTeam(target) == MechTeam(mech)) { 00363 /* Make sure this type of bsuit has the ability to mount */ 00364 if(!(MechInfantrySpecials(mech) & INF_SWARM_TECH)) { 00365 mech_notify(mech, MECHALL, 00366 "These battlesuits are not capable of mounting mechs!"); 00367 return; 00368 } 00369 00370 tIsMount = 1; 00371 } else { 00372 if(doJettisonChecks(mech)) 00373 return; 00374 00375 /* Make sure this type of bsuit has the ability to swarm */ 00376 if(!(MechInfantrySpecials(mech) & INF_SWARM_TECH)) { 00377 mech_notify(mech, MECHALL, 00378 "These battlesuits are not capable of performing swarm attacks!"); 00379 return; 00380 } 00381 } 00382 00383 /* Make sure there are no suits already on us */ 00384 if(CountSwarmers(mech) > 0) { 00385 mech_notify(mech, MECHALL, 00386 "That target already have battlesuits crawling all over it! There's no room for you!"); 00387 00388 return; 00389 } 00390 00391 /* get our BTH... we make it easier for mounting */ 00392 switch (CountBSuitMembers(mech)) { 00393 case 1: 00394 case 2: 00395 case 3: 00396 baseToHit = 5; 00397 break; 00398 00399 default: 00400 baseToHit = 2; 00401 break; 00402 } 00403 00404 if(tIsMount) 00405 baseToHit -= 4; 00406 00407 if(MechCritStatus(mech) & HIDDEN) { 00408 if(Immobile(target)) 00409 baseToHit -= 4; 00410 00411 if(Fallen(target)) 00412 baseToHit -= 4; 00413 } else { 00414 baseToHit += TargetMovementMods(mech, target, 0.0); 00415 00416 if(Fallen(target)) 00417 baseToHit -= 2; 00418 } 00419 00420 /* Well, we're here. Let's see if it works. */ 00421 if(MadePilotSkillRoll(mech, baseToHit)) { 00422 mech_printf(target, MECHALL, "%s %s you!", 00423 GetMechToMechID(target, mech), 00424 (tIsMount ? "mounts" : "swarms")); 00425 mech_printf(mech, MECHALL, "You %s %s!", 00426 (tIsMount ? "mount" : "swarm"), GetMechToMechID(mech, 00427 target)); 00428 00429 MechSwarmTarget(mech) = target->mynum; 00430 MechSwarmer(target) = mech->mynum; 00431 MechStatus2(mech) |= UNIT_MOUNTING; 00432 MechStatus2(target) |= UNIT_MOUNTED; 00433 00434 if(tIsMount) { 00435 MechLOSBroadcasti(mech, target, "mounts %s!"); 00436 } else { 00437 MechLOSBroadcasti(mech, target, "swarms %s!"); 00438 } 00439 00440 MechSpeed(mech) = 0.0; 00441 MechDesiredSpeed(mech) = 0.0; 00442 SetFacing(mech, 270); 00443 MechDesiredFacing(mech) = 270; 00444 MirrorPosition(target, mech, 1); 00445 StopLock(mech); 00446 } else { 00447 mech_printf(target, MECHALL, "%s attempts to %s you!", 00448 GetMechToMechID(target, mech), 00449 (tIsMount ? "mount" : "swarm")); 00450 mech_printf(mech, MECHALL, 00451 "Nice try, but you don't succeed in your attempt at %s %s!", 00452 (tIsMount ? "mounting" : "swarming"), 00453 GetMechToMechID(mech, target)); 00454 } 00455 00456 StartBSuitRecycle(mech, RECYCLE_SWARM); 00457 }
Definition at line 222 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, MirrorPosition, and MECH::mynum.
Referenced by move_mech().
00223 { 00224 int i, j; 00225 MECH *t; 00226 00227 for(i = 0; i < map->first_free; i++) 00228 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00229 if(!(t = FindObjectsData(j))) 00230 continue; 00231 if(MechSwarmTarget(t) != mech->mynum) 00232 continue; 00233 MirrorPosition(mech, t, 1); 00234 } 00235 }
int CountBSuitMembers | ( | MECH * | mech | ) |
Definition at line 258 of file bsuit.c.
References GetSectInt, and NUM_BSUIT_MEMBERS.
Referenced by bsuit_attackleg(), bsuit_swarm(), DamageMech(), DestroySection(), JettisonPacks(), TECHCOMMANDH(), and update_specials().
00259 { 00260 int i, j = 0; 00261 00262 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) 00263 if(GetSectInt(mech, i)) 00264 j++; 00265 return j; 00266 }
int CountSwarmers | ( | MECH * | mech | ) |
Definition at line 164 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapindex, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, and MECH::mynum.
Referenced by bsuit_swarm(), DamageMech(), LandMech(), mech_drop(), and MechFalls().
00165 { 00166 MAP *map = FindObjectsData(mech->mapindex); 00167 int count = 0, i, j; 00168 MECH *t; 00169 00170 if(!map) 00171 return 0; 00172 for(i = 0; i < map->first_free; i++) 00173 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00174 if(!(t = FindObjectsData(j))) 00175 continue; 00176 if(MechSwarmTarget(t) != mech->mynum) 00177 continue; 00178 count++; 00179 } 00180 return count; 00181 }
Definition at line 237 of file bsuit.c.
References DOCHECK1, Jumping, MechSections, MechSwarmTarget, MoveModeLock, NUM_BSUIT_MEMBERS, SectHasBusyWeap(), SectIsDestroyed, and tprintf().
Referenced by bsuit_attackleg(), and bsuit_swarm().
00238 { 00239 int i; 00240 00241 DOCHECK1(Jumping(mech), "Unavailable when jumping - sorry."); 00242 DOCHECK1(MechSwarmTarget(mech) > 0, 00243 "You are already busy with a special attack!"); 00244 #ifdef BT_MOVEMENT_MODES 00245 DOCHECK1(MoveModeLock(mech), 00246 "Unavailable when performing movement modes - deal."); 00247 #endif 00248 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) { 00249 DOCHECK1(!SectIsDestroyed(mech, i) && 00250 MechSections(mech)[i].recycle, 00251 tprintf("Suit %d is still recovering from attack.", i + 1)); 00252 DOCHECK1(SectHasBusyWeap(mech,i),"You have weapons recycling!"); 00253 } 00254 00255 return 0; 00256 }
int doJettisonChecks | ( | MECH * | mech | ) |
Definition at line 314 of file bsuit.c.
References GetPartFireMode, IS_JETTISONED_MODE, mech_printf(), MECHALL, MechInfantrySpecials, MUST_JETTISON_TECH, NUM_BSUIT_MEMBERS, NUM_CRITICALS, and WILL_JETTISON_MODE.
Referenced by bsuit_attackleg(), bsuit_swarm(), and mech_jump().
00315 { 00316 int i, j; 00317 00318 if(!(MechInfantrySpecials(mech) & MUST_JETTISON_TECH)) 00319 return 0; 00320 00321 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) { 00322 for(j = 0; j < NUM_CRITICALS; j++) { 00323 if((GetPartFireMode(mech, i, j) & WILL_JETTISON_MODE) && 00324 (!(GetPartFireMode(mech, i, j) & IS_JETTISONED_MODE))) { 00325 mech_printf(mech, MECHALL, 00326 "Suit %d can not perform this feat before it jettisons its backpack!", 00327 i + 1); 00328 00329 return 1; 00330 } 00331 } 00332 } 00333 00334 return 0; 00335 }
Definition at line 268 of file bsuit.c.
References args, CLASS_MECH, Destroyed, DOCHECK1, FaMechRange, FindTargetDBREFFromMapNumber(), getMech(), InLineOfSight_NB(), Jumping, mech_notify(), mech_parseattributes(), MECHALL, MechTarget, MechType, MechX, MechY, and notify.
Referenced by bsuit_attackleg(), and bsuit_swarm().
00269 { 00270 int argc; 00271 char *args[3]; 00272 float range; 00273 char targetID[2]; 00274 int targetnum; 00275 MECH *t = NULL; 00276 00277 DOCHECK1((argc = 00278 mech_parseattributes(buffer, args, 3)) > 1, 00279 "Invalid arguments!"); 00280 switch (argc) { 00281 case 0: 00282 DOCHECK1(MechTarget(mech) <= 0, 00283 "You do not have a default target set!"); 00284 t = getMech(MechTarget(mech)); 00285 if(!(t)) { 00286 mech_notify(mech, MECHALL, "Invalid default target!"); 00287 MechTarget(mech) = -1; 00288 return 1; 00289 } 00290 break; 00291 case 1: 00292 targetID[0] = args[0][0]; 00293 targetID[1] = args[0][1]; 00294 targetnum = FindTargetDBREFFromMapNumber(mech, targetID); 00295 DOCHECK1(targetnum <= 0, "Target is not in line of sight!"); 00296 t = getMech(targetnum); 00297 DOCHECK1(!(t), "Invalid default target!"); 00298 break; 00299 default: 00300 notify(player, "Invalid target!"); 00301 return 1; 00302 } 00303 range = FaMechRange(mech, t); 00304 DOCHECK1(!InLineOfSight_NB(mech, t, MechX(t), MechY(t), range), 00305 "Target is not in line of sight!"); 00306 DOCHECK1(range >= 1.0, "Target out of range!"); 00307 DOCHECK1(Jumping(t), "That target's unreachable right now!"); 00308 DOCHECK1(MechType(t) != CLASS_MECH, "That target is of invalid type."); 00309 DOCHECK1(Destroyed(t), "A dead 'mech? C'mon :P"); 00310 *target = t; 00311 return 0; 00312 }
Definition at line 183 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapindex, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, and MECH::mynum.
Referenced by DamageMech().
00184 { 00185 MAP *map = FindObjectsData(mech->mapindex); 00186 int i, j; 00187 MECH *t; 00188 00189 if(!map) 00190 return 0; 00191 00192 for(i = 0; i < map->first_free; i++) 00193 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00194 if(!(t = FindObjectsData(j))) 00195 continue; 00196 00197 if(MechSwarmTarget(t) == mech->mynum) { 00198 return t; 00199 } 00200 } 00201 00202 return NULL; 00203 }
char* GetBSuitName | ( | MECH * | mech | ) |
Definition at line 43 of file bsuit.c.
References CLAN_TECH, and MechSpecials.
Referenced by PrintGenericStatus().
00044 { 00045 return (MechSpecials(mech) & CLAN_TECH) ? "Point" : "Squad"; 00046 }
char* GetLCaseBSuitName | ( | MECH * | mech | ) |
Definition at line 48 of file bsuit.c.
References CLAN_TECH, and MechSpecials.
Referenced by TECHCOMMANDH().
00049 { 00050 return (MechSpecials(mech) & CLAN_TECH) ? "point" : "squad"; 00051 }
int IsMechMounted | ( | MECH * | mech | ) |
Definition at line 138 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapindex, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, MechTeam, and MECH::mynum.
Referenced by FireWeaponNumber(), and Mech_ShowFlags().
00139 { 00140 MAP *map = FindObjectsData(mech->mapindex); 00141 int count = 0, i, j; 00142 MECH *t; 00143 00144 if(!map) 00145 return 0; 00146 00147 for(i = 0; i < map->first_free; i++) 00148 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00149 if(!(t = FindObjectsData(j))) 00150 continue; 00151 00152 if(MechSwarmTarget(t) != mech->mynum) 00153 continue; 00154 00155 if(MechTeam(mech) != MechTeam(t)) 00156 continue; 00157 00158 count++; 00159 break; 00160 } 00161 return count > 0; 00162 }
int IsMechSwarmed | ( | MECH * | mech | ) |
Definition at line 112 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapindex, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, MechTeam, and MECH::mynum.
Referenced by Mech_ShowFlags().
00113 { 00114 MAP *map = FindObjectsData(mech->mapindex); 00115 int count = 0, i, j; 00116 MECH *t; 00117 00118 if(!map) 00119 return 0; 00120 00121 for(i = 0; i < map->first_free; i++) 00122 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00123 if(!(t = FindObjectsData(j))) 00124 continue; 00125 00126 if(MechSwarmTarget(t) != mech->mynum) 00127 continue; 00128 00129 if(MechTeam(mech) == MechTeam(t)) 00130 continue; 00131 00132 count++; 00133 break; 00134 } 00135 return count > 0; 00136 }
void JettisonPacks | ( | dbref | player, | |
void * | data, | |||
char * | buffer | |||
) |
Definition at line 721 of file bsuit.c.
References BROKEN_MODE, CAN_JETTISON_TECH, cch, CountBSuitMembers(), DESTROYED_MODE, DISABLED_MODE, DOCHECK, GetPartFireMode, IS_JETTISONED_MODE, mech_notify(), MECH_USUALO, MECHALL, MechInfantrySpecials, MechLOSBroadcast(), NUM_BSUIT_MEMBERS, NUM_CRITICALS, and WILL_JETTISON_MODE.
00722 { 00723 MECH *mech = data; 00724 int wcJettisoned = 0; 00725 int wcSuits = 0; 00726 int i, j; 00727 00728 cch(MECH_USUALO); 00729 DOCHECK((!(MechInfantrySpecials(mech) & CAN_JETTISON_TECH)), 00730 "You have no backpack that is capable of being jettisoned!"); 00731 00732 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) { 00733 for(j = 0; j < NUM_CRITICALS; j++) { 00734 if((GetPartFireMode(mech, i, j) & WILL_JETTISON_MODE) && 00735 (!(GetPartFireMode(mech, i, j) & IS_JETTISONED_MODE))) { 00736 00737 GetPartFireMode(mech, i, j) |= DESTROYED_MODE; 00738 GetPartFireMode(mech, i, j) |= IS_JETTISONED_MODE; 00739 GetPartFireMode(mech, i, j) &= ~(BROKEN_MODE | DISABLED_MODE); 00740 00741 wcJettisoned++; 00742 } 00743 } 00744 } 00745 00746 if(wcJettisoned > 0) { 00747 wcSuits = CountBSuitMembers(mech); 00748 00749 if(wcSuits > 1) { 00750 mech_notify(mech, MECHALL, 00751 "The explosive bolts that hold the backpacks on blow, allowing them to drop to the ground."); 00752 MechLOSBroadcast(mech, 00753 "'s backpacks blow off in a shower of small explosions!"); 00754 } else { 00755 mech_notify(mech, MECHALL, 00756 "The explosive bolts that hold your backpack on blows, allowing it to drop to the ground."); 00757 MechLOSBroadcast(mech, 00758 "'s backpack blows off in a puff of grey smoke!"); 00759 } 00760 } else { 00761 mech_notify(mech, MECHALL, 00762 "You realize you have nothing to jettison. Maybe you already did it?"); 00763 } 00764 }
static void mech_hide_event | ( | MUXEVENT * | e | ) | [static] |
Definition at line 627 of file bsuit.c.
References CLAIRVOYANT, my_event_type::data, my_event_type::data2, Destroyed, EVENT_HIDE, FaMechRange, getMap(), getMech(), HIDDEN, HIDE_TICK, InLineOfSight(), INVISIBLE, MECH::mapindex, mech_notify(), MECHALL, MechCritStatus, MECHEVENT, MechsElevation, MechTeam, MechX, MechY, MyHiddenTurns, OBSERVATORIC, and Started.
Referenced by bsuit_hide().
00628 { 00629 MECH *mech = (MECH *) e->data; 00630 MECH *t; 00631 MAP *map = getMap(mech->mapindex); 00632 int fail = 0, i; 00633 int tic = (int) e->data2; 00634 00635 if(!map) 00636 return; 00637 00638 for(i = 0; i < map->first_free; i++) { 00639 if(map->mechsOnMap[i] <= 0) 00640 continue; 00641 if(!(t = getMech(map->mechsOnMap[i]))) 00642 continue; 00643 if(MechCritStatus(t) & (CLAIRVOYANT | OBSERVATORIC | INVISIBLE)) 00644 continue; 00645 if(MechTeam(t) == MechTeam(mech)) 00646 continue; 00647 if(!Started(t)) 00648 continue; 00649 if(Destroyed(t)) 00650 continue; 00651 if(InLineOfSight(t, mech, MechX(mech), MechY(mech), 00652 FaMechRange(t, mech))) 00653 fail = 1; 00654 } 00655 00656 if(MechsElevation(mech)) 00657 fail = 1; 00658 00659 if(fail) { 00660 mech_notify(mech, MECHALL, 00661 "Your spidey sense tingles, telling you this isn't going to work......"); 00662 return; 00663 } else if(tic < (MyHiddenTurns(mech) * HIDE_TICK)) { 00664 tic++; 00665 MECHEVENT(mech, EVENT_HIDE, mech_hide_event, 1, tic); 00666 } else if(!fail) { 00667 mech_notify(mech, MECHALL, "You are now hidden!"); 00668 MechCritStatus(mech) |= HIDDEN; 00669 } 00670 return; 00671 }
void StartBSuitRecycle | ( | MECH * | mech, | |
int | time | |||
) |
Definition at line 53 of file bsuit.c.
References GetSectInt, NUM_BSUIT_MEMBERS, and SetRecycleLimb.
Referenced by bsuit_attackleg(), bsuit_swarm(), mech_udisembark(), and StopSwarming().
00054 { 00055 int i; 00056 00057 for(i = 0; i < NUM_BSUIT_MEMBERS; i++) 00058 if(GetSectInt(mech, i)) 00059 SetRecycleLimb(mech, i, time); 00060 }
Definition at line 205 of file bsuit.c.
References FindObjectsData(), MAP::first_free, MECH::mapnumber, MAP::mechsOnMap, MechSwarmTarget, MECH::mynum, and StopSwarming().
Referenced by LandMech(), Leave_DS_Bay(), Leave_Hangar(), mech_drop(), mech_enter_event(), mech_enterbay_event(), and MechFalls().
00206 { 00207 int i, j; 00208 MECH *t; 00209 00210 if(!map || !mech) 00211 return; 00212 for(i = 0; i < map->first_free; i++) 00213 if((j = map->mechsOnMap[i]) > 0 && i != mech->mapnumber) { 00214 if(!(t = FindObjectsData(j))) 00215 continue; 00216 if(MechSwarmTarget(t) != mech->mynum) 00217 continue; 00218 StopSwarming(t, intentional); 00219 } 00220 }
void StopSwarming | ( | MECH * | mech, | |
int | intentional | |||
) |
Definition at line 62 of file bsuit.c.
References DamageMech(), DropSetElevation(), getMech(), GetMechToMechID(), MadePilotSkillRoll(), MaybeMove, mech_notify(), mech_printf(), MECHALL, MechFloods(), MechLOSBroadcasti(), MechSpeed, MechStatus2, MechSwarmer, MechSwarmTarget, NUM_BSUIT_MEMBERS, Number, RECYCLE_FALL_STOPSWARM, RECYCLE_INT_STOPSWARM, RECYCLE_UNINT_STOPSWARM, StartBSuitRecycle(), UNIT_MOUNTED, and UNIT_MOUNTING.
Referenced by bsuit_swarm(), mech_speed(), PhysicalDamage(), and StopBSuitSwarmers().
00063 { 00064 MECH *target = getMech(MechSwarmTarget(mech)); 00065 00066 if(!target || MechSwarmTarget(mech) <= 0) 00067 return; 00068 00069 MechSwarmTarget(mech) = -1; 00070 MechSwarmer(target) = -1; 00071 00072 MechStatus2(mech) &= ~UNIT_MOUNTING; 00073 MechStatus2(target) &= ~UNIT_MOUNTED; 00074 00075 if(intentional > 0) { 00076 mech_notify(mech, MECHALL, 00077 "You let your hold loosen and you drop from the 'mech!"); 00078 mech_printf(target, MECHALL, "%s lets go of you!", 00079 GetMechToMechID(target, mech)); 00080 MechLOSBroadcasti(mech, target, "lets go of %s!"); 00081 00082 StartBSuitRecycle(mech, RECYCLE_INT_STOPSWARM); 00083 } else { 00084 if(MadePilotSkillRoll(mech, 4)) { 00085 mech_notify(mech, MECHALL, 00086 "The hold loosens and you drop from the 'mech!"); 00087 MechLOSBroadcasti(mech, target, "jumps off of %s!"); 00088 mech_printf(target, MECHALL, "%s jumps off!", 00089 GetMechToMechID(target, mech)); 00090 00091 StartBSuitRecycle(mech, RECYCLE_UNINT_STOPSWARM); 00092 } else { 00093 mech_notify(mech, MECHALL, 00094 "You're suprised by the sudden action and find yourself rapidly approaching the ground!"); 00095 MechLOSBroadcasti(mech, target, "falls off %s!"); 00096 mech_printf(target, MECHALL, "%s falls off!", 00097 GetMechToMechID(target, mech)); 00098 00099 DamageMech(mech, mech, 1, -1, Number(0, NUM_BSUIT_MEMBERS - 1), 00100 0, 0, 11, 0, -1, 0, -1, 0, 1); 00101 00102 StartBSuitRecycle(mech, RECYCLE_FALL_STOPSWARM); 00103 } 00104 } 00105 00106 MechSpeed(mech) = 0; 00107 MaybeMove(mech); 00108 DropSetElevation(mech, 0); 00109 MechFloods(mech); 00110 }