src/hcode/btech/p.pcombat.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int pc_to_dam_conversion (MECH *target, int weapindx, int dam)
int dam_to_pc_conversion (MECH *target, int weapindx, int dam)
int armor_effect (MECH *wounded, int cause, int hitloc, int intDamage, int id)


Function Documentation

int armor_effect ( MECH wounded,
int  cause,
int  hitloc,
int  intDamage,
int  id 
)

Definition at line 83 of file pcombat.c.

Referenced by DamageMech().

00084 {
00085         int i;
00086         int block;
00087         int noblock = 0;
00088 
00089         if(id != -2)
00090                 intDamage = (intDamage * Number(75, 125)) / 100;
00091         if(MechType(wounded) != CLASS_MW)
00092                 return intDamage;
00093         hitloc = pcombat_hitloc(hitloc);
00094         if(!GetSectArmor(wounded, hitloc))
00095                 return intDamage;
00096         for(i = 0; Armors[i].name; i++)
00097                 if(Armors[i].loc == hitloc &&
00098                    Armors[i].loci == GetSectArmor(wounded, hitloc))
00099                         break;
00100         if(Number(1, 5) == 1) {
00101                 if(Number(1, 2) == 1)
00102                         intDamage = intDamage * 2;
00103                 else
00104                         noblock = 1;
00105         } else if(Number(1, 10) == 2)
00106                 intDamage = intDamage / 2;
00107         if(!Armors[i].name)
00108                 return intDamage;
00109         if(cause >= 0 &&
00110            !((Armors[i].deft) & (MechWeapons[cause].special & PCOMBAT)) &&
00111            (MechWeapons[cause].special & PCOMBAT))
00112                 return intDamage;
00113         block =
00114                 BOUNDED(Number(1, (Armors[i].defmin / 2)),
00115                                 abs(intDamage * Armors[i].defpros / 100),
00116                                 Armors[i].defmax / 2);
00117         if(noblock)
00118                 block = 0;
00119         if(abs(intDamage) < block) {
00120                 mech_printf(wounded, MECHALL, "Your armor blocks all of the damage!");
00121                 return 0;
00122         }
00123         if(block) {
00124                 mech_printf(wounded, MECHALL,
00125                                         "Armor blocks %d points of the damage!", block);
00126         }
00127         return (abs(intDamage) - block) * intDamage / abs(intDamage);
00128 }

int dam_to_pc_conversion ( MECH target,
int  weapindx,
int  dam 
)

Definition at line 55 of file pcombat.c.

Referenced by DamageMech().

00056 {
00057         int i = 0, j;
00058 
00059         if(weapindx >= 0 && MechWeapons[weapindx].special & PCOMBAT)
00060                 return dam;
00061         if(MechType(target) != CLASS_MW)
00062                 return dam;
00063         /* Target is MW _and_ we have yet to convert damage */
00064         for(j = 0; j < dam; j++)
00065                 i += Number(80, 130);
00066         return i;
00067 }

int pc_to_dam_conversion ( MECH target,
int  weapindx,
int  dam 
)

Definition at line 40 of file pcombat.c.

Referenced by HitTarget(), and Missile_Hit().

00041 {
00042         int i = 0;
00043 
00044         if(MechType(target) == CLASS_MW)
00045                 return dam;
00046         if(weapindx < 0 || !(MechWeapons[weapindx].special & PCOMBAT))
00047                 return dam;
00048         i = dam / 100;
00049         dam = dam % 100;
00050         if(Number(1, 100) <= dam)
00051                 i++;
00052         return i;
00053 }


Generated on Mon May 28 04:25:43 2007 for BattletechMUX by  doxygen 1.4.7