#include "mech.h"
#include "mech.events.h"
#include "p.mech.utils.h"
#include "p.mech.update.h"
#include "p.mech.restrict.h"
#include "p.mech.combat.h"
#include "p.mech.damage.h"
#include "p.template.h"
#include "p.btechstats.h"
#include "p.mech.combat.misc.h"
Include dependency graph for mech.ood.c:
Go to the source code of this file.
Functions | |
void | mech_ood_damage (MECH *wounded, MECH *attacker, int damage) |
void | mech_ood_event (MUXEVENT *e) |
void | initiate_ood (dbref player, MECH *mech, char *buffer) |
Definition at line 230 of file mech.ood.c.
References args, Digging, DOCHECK, Evading, EVADING, EVENT_OOD, Fallen, FlyingT, GOD, is_aero, LANDED, MarkForLOSUpdate(), MaybeMove, mech_ood_event(), mech_parseattributes(), mech_Rsetxy(), MechCocoon, MechDesiredAngle, MechDesiredSpeed, MECHEVENT, MechFZ, MechMaxSpeed, MechRTons, MechStatus, MechStatus2, MechX, MechY, MechZ, notify, OOD_TICK, OODing, ORBIT_Z, Readnum, Sprinting, SPRINTING, StopMoving, tprintf(), x, y, and ZSCALE.
Referenced by autoeject(), load_update1(), and mech_udisembark().
Definition at line 21 of file mech.ood.c.
References EVENT_FALL, FALL_TICK, MAX, mech_fall_event(), mech_notify(), mech_printf(), MECHALL, MechCocoon, MechElevation, MECHEVENT, MechJumpSpeed, MechLOSBroadcast(), MechZ, MP1, and StopOOD.
Referenced by DamageMech().
00022 { 00023 mech_printf(attacker, MECHALL, 00024 "%%cgYou hit the cocoon for %d points of damage!%%cn", 00025 damage); 00026 mech_printf(wounded, MECHALL, 00027 "%%ch%%cyYour cocoon has been hit for %d points of damage!%%cn", 00028 damage); 00029 MechCocoon(wounded) = MAX(0, MechCocoon(wounded) - damage); 00030 if(MechCocoon(wounded)) 00031 return; 00032 /* Abort the OOD and initiate falling */ 00033 if(MechZ(wounded) > MechElevation(wounded)) { 00034 if(MechJumpSpeed(wounded) >= MP1) { 00035 mech_notify(wounded, MECHALL, 00036 "You initiate your jumpjets to compensate for the breached cocoon!"); 00037 MechCocoon(wounded) = -1; 00038 return; 00039 } 00040 mech_notify(wounded, MECHALL, 00041 "Your cocoon has been destroyed - have a nice fall!"); 00042 MechLOSBroadcast(wounded, 00043 "starts plummeting down, as the final blast blows the cocoon apart!"); 00044 StopOOD(wounded); 00045 MECHEVENT(wounded, EVENT_FALL, mech_fall_event, FALL_TICK, -1); 00046 } 00047 }
void mech_ood_event | ( | MUXEVENT * | e | ) |
Definition at line 49 of file mech.ood.c.
References AccumulatePilXP(), Blinded, BOUNDED(), CLASS_AERO, CLASS_BSUIT, CLASS_DS, CLASS_MECH, CLASS_MW, CLASS_VEH_GROUND, CLASS_VTOL, COMBAT_SAFE, DamageMech(), my_event_type::data, DestroyMech(), domino_space(), DropGetElevation(), DropSetElevation(), EVENT_OOD, Fallen, FindPilotPiloting(), FindSPilotPiloting(), GetSectOInt, GRASSLAND, HIGHWATER, In_Character, InWater, Location, MarkForLOSUpdate(), MaybeMove, mech_notify(), mech_ood_event(), MECHALL, MechCocoon, MechDesiredSpeed, MECHEVENT, MechFalls(), MechFloods(), MechFZ, MechLOSBroadcast(), MechPilot, MECHPILOT, MechPilotSkillBase, MechRTerrain, MechsElevation, MechSpecials2, MechStatus, MechType, MechZ, MECH::mynum, NotInWater, NUM_SECTIONS, Number, OOD_SPEED, OOD_TICK, OODing, ROAD, Roll(), Started, tprintf(), Uncon, WATER, WaterBeast, WATERPROOF_TECH, and ZSCALE.
Referenced by initiate_ood(), and mech_ood_event().
00050 { 00051 MECH *mech = (MECH *) e->data; 00052 int mof = 0, roll, roll_needed, para = 0; 00053 00054 if(!OODing(mech)) 00055 return; 00056 MarkForLOSUpdate(mech); 00057 if((MechsElevation(mech) - DropGetElevation(mech)) > OOD_SPEED) { 00058 MechZ(mech) -= OOD_SPEED; 00059 MechFZ(mech) = MechZ(mech) * ZSCALE; 00060 MECHEVENT(mech, EVENT_OOD, mech_ood_event, OOD_TICK, 0); 00061 return; 00062 } 00063 /* Time to hit da ground */ 00064 mech_notify(mech, MECHALL, "Your unit touches down!"); 00065 00066 if(MechStatus(mech) & COMBAT_SAFE) { 00067 /* If we're combat safe, we land regardless, since we're not gonna take any damage */ 00068 MechCocoon(mech) = 0; 00069 MechLOSBroadcast(mech, "touches down safely!"); 00070 DropSetElevation(mech, 1); 00071 MaybeMove(mech); 00072 return; 00073 } 00074 00075 if(Fallen(mech)) 00076 mof = -10; 00077 if(Uncon(mech) || !Started(mech) || Blinded(mech)) 00078 mof = -20; 00079 roll = Roll(); 00080 roll_needed = MechType(mech) == CLASS_BSUIT 00081 || MechType(mech) == 00082 CLASS_MW ? FindPilotPiloting(mech) - 1 : FindSPilotPiloting(mech) + 00083 MechPilotSkillBase(mech); 00084 00085 if(!Started(mech)) 00086 roll_needed += 10; 00087 if(MechCocoon(mech) == 1) { 00088 para = 1; 00089 } else if(MechCocoon(mech) < 0) { 00090 roll_needed += 4; 00091 } else if(MechCocoon(mech) == 0) { 00092 roll_needed += 10; 00093 } 00094 00095 if(MechRTerrain(mech) != GRASSLAND && MechRTerrain(mech) != ROAD) { 00096 if(MechRTerrain(mech) == WATER || MechRTerrain(mech) == HIGHWATER) 00097 roll_needed += 2; 00098 else 00099 roll_needed += 3; 00100 } 00101 00102 MechCocoon(mech) = 0; 00103 00104 if(In_Character(mech->mynum) && Location(MechPilot(mech)) != mech->mynum) 00105 roll_needed += 99; 00106 00107 mech_notify(mech, MECHPILOT, "You make a piloting skill roll!"); 00108 mech_notify(mech, MECHPILOT, 00109 tprintf("Modified Pilot Skill: BTH %d\tRoll: %d", 00110 roll_needed, roll)); 00111 mof += (roll - roll_needed); 00112 if(roll >= roll_needed) { 00113 if(roll_needed > 2) 00114 AccumulatePilXP(MechPilot(mech), mech, 00115 BOUNDED(1, (abs(mof) + 1) * 2, 20), 1); 00116 } 00117 mof += (roll - roll_needed); 00118 if(mof < 0) { 00119 if(MechType(mech) == CLASS_MECH) { 00120 mech_notify(mech, MECHALL, 00121 "You are unable to control your momentum and fall on your face!"); 00122 MechLOSBroadcast(mech, 00123 "touches down on the ground, twists, and falls down!"); 00124 MechFalls(mech, (abs(mof) * (para ? 1 : 2)), 1); 00125 } else if(MechType(mech) == CLASS_BSUIT) { 00126 int i, ii, dam; 00127 mech_notify(mech, MECHALL, 00128 "You are unable to control your momentum and crash!"); 00129 MechLOSBroadcast(mech, "crashes to the ground!"); 00130 for(i = 0; i < NUM_SECTIONS; i++) { 00131 dam = 0; 00132 if(GetSectOInt(mech, i) > 0) { 00133 for(ii = mof; ii < 0; ii++) 00134 dam += Number(1, 4); 00135 DamageMech(mech, mech, 0, -1, i, 0, 0, dam, -1, -1, 0, 0, 00136 0, 0); 00137 MechFloods(mech); 00138 } 00139 } 00140 MechFalls(mech, 0, 1); 00141 } else { 00142 mech_notify(mech, MECHALL, 00143 "You are unable to control your momentum and crash!"); 00144 MechLOSBroadcast(mech, "crashes at the ground!"); 00145 MechFalls(mech, (abs(mof) * (para ? 1 : 3)), 1); 00146 } 00147 } else if(!para) { 00148 MechLOSBroadcast(mech, "touches down!"); 00149 } else if(para) { 00150 MechLOSBroadcast(mech, "touches down and rolls on the ground!"); 00151 00152 /* mech_notify(mech, MECHALL, 00153 "As you hit the ground you roll and sponge some damage!"); 00154 MechFalls(mech, (MechTons(mech) / 25), 0); */ 00155 } 00156 DropSetElevation(mech, 1); 00157 if(!Fallen(mech)) 00158 domino_space(mech, 2); 00159 if(WaterBeast(mech) && NotInWater(mech)) 00160 MechDesiredSpeed(mech) = 0.0; 00161 00162 MaybeMove(mech); 00163 00164 /* Lets handle dropping right into the water. Anything but a mech/hover goes glub */ 00165 if(InWater(mech) && (MechType(mech) == CLASS_VEH_GROUND || 00166 MechType(mech) == CLASS_VTOL || 00167 MechType(mech) == CLASS_BSUIT || 00168 MechType(mech) == CLASS_AERO || 00169 MechType(mech) == CLASS_DS) && 00170 !(MechSpecials2(mech) & WATERPROOF_TECH)) { 00171 00172 mech_notify(mech, MECHALL, 00173 "Water floods your engine and your unit " 00174 "becomes unoperable."); 00175 if(MechType(mech) == CLASS_BSUIT) 00176 MechLOSBroadcast(mech,"emits some bubbles and flails their arms around as they sink to the bottom!"); 00177 else 00178 MechLOSBroadcast(mech,"emits some bubbles as its engines are flooded."); 00179 DestroyMech(mech, mech, 0); 00180 } 00181 00182 } 00183 00184 void initiate_ood(dbref player, MECH * mech, char *buffer) 00185 { 00186 char *args[4]; 00187 int x, y, z = ORBIT_Z, argc; 00188 00189 DOCHECK((argc = 00190 mech_parseattributes(buffer, args, 3)) < 2, 00191 "Invalid attributes!"); 00192 DOCHECK(Readnum(x, args[0]), "Invalid number! (x)"); 00193 DOCHECK(Readnum(y, args[1]), "Invalid number! (y)"); 00194 if(argc == 3) 00195 DOCHECK(Readnum(z, args[2]), "Invalid number! (z)"); 00196 DOCHECK(OODing(mech), "OOD already in progress!"); 00197 mech_Rsetxy(GOD, (void *) mech, tprintf("%d %d", x, y)); 00198 DOCHECK(MechX(mech) != x || MechY(mech) != y, "Invalid co-ordinates!"); 00199 DOCHECK(Fallen(mech), "You'll have to get up first."); 00200 DOCHECK(Digging(mech), "You're too busy digging in."); 00201 MechZ(mech) = z; 00202 MechFZ(mech) = ZSCALE * MechZ(mech); 00203 MarkForLOSUpdate(mech); 00204 notify(player, "OOD initiated."); 00205 if(Evading(mech)) { 00206 MechStatus2(mech) &= ~EVADING; 00207 } 00208 00209 if(Sprinting(mech)) { 00210 MechStatus2(mech) &= ~SPRINTING; 00211 } 00212 00213 if(FlyingT(mech)) { 00214 MechStatus(mech) &= ~LANDED; 00215 MechDesiredSpeed(mech) = MechMaxSpeed(mech) / 2; 00216 if(is_aero(mech)) 00217 MechDesiredAngle(mech) = 0; 00218 MaybeMove(mech); 00219 } else { 00220 MechCocoon(mech) = MechRTons(mech) / 5 / 1024 + 1; 00221 StopMoving(mech); 00222 MECHEVENT(mech, EVENT_OOD, mech_ood_event, OOD_TICK, 0); 00223 } 00224 } 00225 }