[Add] Missiles can resist jamming.
This commit is contained in:
parent
21ca77d439
commit
115fa94cb8
@ -211,6 +211,7 @@
|
|||||||
<spfx>ExpM</spfx>
|
<spfx>ExpM</spfx>
|
||||||
<duration>7</duration>
|
<duration>7</duration>
|
||||||
<lockon>0.5</lockon>
|
<lockon>0.5</lockon>
|
||||||
|
<resist>5</resist>
|
||||||
<thrust>1300</thrust>
|
<thrust>1300</thrust>
|
||||||
<turn>90</turn>
|
<turn>90</turn>
|
||||||
<speed>550</speed>
|
<speed>550</speed>
|
||||||
|
12
src/outfit.c
12
src/outfit.c
@ -429,18 +429,20 @@ static void outfit_parseSAmmo(Outfit* tmp, const xmlNodePtr parent) {
|
|||||||
char str[PATH_MAX] = "\0";
|
char str[PATH_MAX] = "\0";
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
/* Basic. */
|
||||||
|
xmlr_float(node, "duration", tmp->u.amm.duration);
|
||||||
|
xmlr_float(node, "lockon", tmp->u.amm.lockon);
|
||||||
|
xmlr_float(node, "resist", tmp->u.amm.resist);
|
||||||
|
/* Movement. */
|
||||||
xmlr_float(node, "thrust", tmp->u.amm.thrust);
|
xmlr_float(node, "thrust", tmp->u.amm.thrust);
|
||||||
xmlr_float(node, "turn", tmp->u.amm.turn);
|
xmlr_float(node, "turn", tmp->u.amm.turn);
|
||||||
xmlr_float(node, "speed", tmp->u.amm.speed);
|
xmlr_float(node, "speed", tmp->u.amm.speed);
|
||||||
xmlr_float(node, "energy", tmp->u.amm.energy);
|
xmlr_float(node, "energy", tmp->u.amm.energy);
|
||||||
if(xml_isNode(node, "duration"))
|
if(xml_isNode(node, "gfx")) {
|
||||||
tmp->u.amm.duration = xml_getFloat(node);
|
|
||||||
else if(xml_isNode(node, "lockon"))
|
|
||||||
tmp->u.amm.lockon = xml_getFloat(node);
|
|
||||||
else if(xml_isNode(node, "gfx")) {
|
|
||||||
snprintf(str, strlen(xml_get(node))+sizeof(OUTFIT_GFX)+10,
|
snprintf(str, strlen(xml_get(node))+sizeof(OUTFIT_GFX)+10,
|
||||||
OUTFIT_GFX"space/%s.png", xml_get(node));
|
OUTFIT_GFX"space/%s.png", xml_get(node));
|
||||||
tmp->u.amm.gfx_space = gl_newSprite(str, 6, 6);
|
tmp->u.amm.gfx_space = gl_newSprite(str, 6, 6);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else if(xml_isNode(node, "spfx"))
|
else if(xml_isNode(node, "spfx"))
|
||||||
tmp->u.amm.spfx = spfx_get(xml_get(node));
|
tmp->u.amm.spfx = spfx_get(xml_get(node));
|
||||||
|
@ -84,6 +84,8 @@ typedef struct Outfit_ {
|
|||||||
struct { /* Ammo. */
|
struct { /* Ammo. */
|
||||||
double duration; /* Duration. */
|
double duration; /* Duration. */
|
||||||
double lockon; /* Time it takes to lock on the target. */
|
double lockon; /* Time it takes to lock on the target. */
|
||||||
|
double resist; /* Lowers chance of jamming by this ammount. */
|
||||||
|
|
||||||
double speed; /* Max speed. */
|
double speed; /* Max speed. */
|
||||||
double turn; /* Turn vel. */
|
double turn; /* Turn vel. */
|
||||||
double thrust; /* Acceleration. */
|
double thrust; /* Acceleration. */
|
||||||
|
@ -131,7 +131,8 @@ static void think_seeker(Weapon* w, const double dt) {
|
|||||||
if((p->jam_range != 0.) && /* Target has jammer and weapon is in range. */
|
if((p->jam_range != 0.) && /* Target has jammer and weapon is in range. */
|
||||||
(vect_dist(&w->solid->pos, &p->solid->pos) < p->jam_range)) {
|
(vect_dist(&w->solid->pos, &p->solid->pos) < p->jam_range)) {
|
||||||
|
|
||||||
if(RNGF() < p->jam_chance) { /* Is jammed? */
|
/* Check to see if the weapon is gets jammed. */
|
||||||
|
if(RNGF() < p->jam_chance - w->outfit->u.amm.resist) {
|
||||||
w->status = WEAPON_STATUS_JAMMED;
|
w->status = WEAPON_STATUS_JAMMED;
|
||||||
/* Give it a nice random effect. */
|
/* Give it a nice random effect. */
|
||||||
effect = RNG(0, 4);
|
effect = RNG(0, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user