Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for energy weapon bionics #2812

Merged
merged 1 commit into from Sep 3, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -377,14 +377,14 @@ void player::activate_bionic(int b, game *g)
} else if(bio.id == "bio_blaster"){
tmp_item = weapon;
weapon = item(g->itypes["bio_blaster_gun"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["bio_fusion_ammo"]);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
weapon.charges = 1;
g->refresh_all();
g->plfire(false);
weapon = tmp_item;
} else if (bio.id == "bio_laser"){
tmp_item = weapon;
weapon = item(g->itypes["v29"], 0);
weapon = item(g->itypes["bio_laser_gun"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
weapon.charges = 1;
g->refresh_all();
@@ -479,8 +479,8 @@ void player::activate_bionic(int b, game *g)
} else if(bio.id == "bio_chain_lightning"){
tmp_item = weapon;
weapon = item(g->itypes["bio_lightning"], 0);
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["bio_lightning_ammo"]);
weapon.charges = 10;
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes["generic_no_ammo"]);
weapon.charges = 1;
g->refresh_all();
g->plfire(false);
weapon = tmp_item;
@@ -387,6 +387,7 @@ struct it_gun : public itype
unsigned short pvolume, unsigned int pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
signed char pierce,
std::set<std::string> flags,
std::set<std::string> effects,

const char *pskill_used, ammotype pammo, signed char pdmg_bonus, signed char prange,
@@ -405,6 +406,7 @@ struct it_gun : public itype
clip = pclip;
reload_time = preload_time;
ammo_effects = effects;
item_tags = flags;
}

it_gun() :itype() { };
@@ -134,9 +134,9 @@ A large and very powerful 8-cylinder combustion engine."));
// clip is how many shots we get before reloading.

#define GUN(id,name,price,color,mat1,mat2,skill,ammo,volume,wgt,melee_dam,\
to_hit,dmg,range,dispersion,recoil,durability,burst,clip,reload_time,des,pierce,effects) \
to_hit,dmg,range,dispersion,recoil,durability,burst,clip,reload_time,des,pierce,flags,effects) \
itypes[id]=new it_gun(id,price,name,des,'(',\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,pierce,effects,\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,pierce,flags,effects,\
skill,ammo,dmg,range,dispersion,\
recoil,durability,burst,clip,reload_time)

@@ -320,18 +320,37 @@ for(std::map<std::string,itype*>::iterator iter = itypes.begin(); iter != itypes
}
}

std::set<std::string> empty_effects;
std::set<std::string> noammo_flags;
noammo_flags.insert("NO_AMMO");

std::set<std::string> laser_effects;
laser_effects.insert("LASER");
laser_effects.insert("INCENDIARY");
GUN("bio_laser_gun", _("laser finger"), 0,c_magenta, "steel", "plastic",
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"pistol", "generic_no_ammo", 12, 0, 0, 0, 10, 30, 4, 0, 10, 0, 1, 500,
// AP
"", 15, noammo_flags, laser_effects);

std::set<std::string> fusion_effects;
fusion_effects.insert("PLASMA");
fusion_effects.insert("INCENDIARY");
// NAME RARE COLOR MAT1 MAT2
GUN("bio_blaster_gun", _("fusion blaster"), 0,c_magenta, "steel", "plastic",
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", "fusion", 12, 0, 0, 0, 0, 0, 4, 0, 10, 0, 1, 500,
"", 15, empty_effects);

// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", "generic_no_ammo", 12, 0, 0, 0, 22, 30, 4, 0, 10, 0, 1, 500,
// AP
"", 15, noammo_flags, fusion_effects);

std::set<std::string> lightning_effects;
lightning_effects.insert("LIGHTNING");
lightning_effects.insert("BOUNCE");
// NAME RARE COLOR MAT1 MAT2
GUN("bio_lightning", _("Chain Lightning"), 0,c_magenta, "steel", "plastic",
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", "fusion", 12, 0, 0, 0, 0, 0, 4, 0, 10, 1, 10, 500,
"", 0, empty_effects);
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", "generic_no_ammo", 12, 0, 0, 0, 6, 10, 0, 0, 10, 1, 10, 500,
"", 0, noammo_flags, lightning_effects);



// Unarmed Styles
@@ -76,9 +76,11 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
}

bool is_bolt = false;
std::set<std::string> *effects = &curammo->ammo_effects;
std::set<std::string> effects;
std::set<std::string> *curammo_effects = &curammo->ammo_effects;
std::set<std::string> *gun_effects = &dynamic_cast<it_gun*>(weapon->type)->ammo_effects;
effects->insert(gun_effects->begin(),gun_effects->end());
effects.insert(curammo_effects->begin(),curammo_effects->end());
effects.insert(gun_effects->begin(),gun_effects->end());

// Add weapon ammo_effect flags

@@ -95,7 +97,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
burst = false; // Can't burst fire a semi-auto

// Use different amounts of time depending on the type of gun and our skill
if (!effects->count("BOUNCE")) {
if (!effects.count("BOUNCE")) {
p.moves -= time_to_fire(p, firing);
}
// Decide how many shots to fire
@@ -332,14 +334,14 @@ int trange = rl_dist(p.posx, p.posy, tarx, tary);
int px = trajectory[0].x;
int py = trajectory[0].y;
for (int i = 0; i < trajectory.size() &&
(dam > 0 || (effects->count("FLAME"))); i++) {
(dam > 0 || (effects.count("FLAME"))); i++) {
px = tx;
py = ty;
tx = trajectory[i].x;
ty = trajectory[i].y;
// Drawing the bullet uses player u, and not player p, because it's drawn
// relative to YOUR position, which may not be the gunman's position.
draw_bullet(p, tx, ty, i, trajectory, effects->count("FLAME")? '#':'*', ts);
draw_bullet(p, tx, ty, i, trajectory, effects.count("FLAME")? '#':'*', ts);
/*
if (u_see(tx, ty)) {
if (i > 0)
@@ -348,7 +350,7 @@ int trange = rl_dist(p.posx, p.posy, tarx, tary);
true, u.posx + u.view_offset_x, u.posy + u.view_offset_y);
}
char bullet = '*';
if (effects->count("FLAME"))
if (effects.count("FLAME"))
bullet = '#';
mvwputch(w_terrain, ty + VIEWY - u.posy - u.view_offset_y,
tx + VIEWX - u.posx - u.view_offset_x, c_red, bullet);
@@ -357,10 +359,10 @@ int trange = rl_dist(p.posx, p.posy, tarx, tary);
nanosleep(&ts, NULL);
}
*/
if (dam <= 0 && !(effects->count("FLAME"))) { // Ran out of momentum.
ammo_effects(this, tx, ty, *effects);
if (is_bolt && !(effects->count("IGNITE")) &&
!(effects->count("EXPLOSIVE")) &&
if (dam <= 0 && !(effects.count("FLAME"))) { // Ran out of momentum.
ammo_effects(this, tx, ty, effects);
if (is_bolt && !(effects.count("IGNITE")) &&
!(effects.count("EXPLOSIVE")) &&
((curammo->m1 == "wood" && !one_in(4)) ||
(curammo->m1 != "wood" && !one_in(15))))
m.add_item_or_charges(tx, ty, ammotmp);
@@ -412,11 +414,11 @@ int trange = rl_dist(p.posx, p.posy, tarx, tary);
shoot_player(this, p, h, dam, goodhit);
}
} else
m.shoot(this, tx, ty, dam, i == trajectory.size() - 1, *effects);
m.shoot(this, tx, ty, dam, i == trajectory.size() - 1, effects);
} // Done with the trajectory!

ammo_effects(this, tx, ty, *effects);
if (effects->count("BOUNCE"))
ammo_effects(this, tx, ty, effects);
if (effects.count("BOUNCE"))
{
for (int i = 0; i < num_zombies(); i++)
{
@@ -441,8 +443,8 @@ int trange = rl_dist(p.posx, p.posy, tarx, tary);
tx = px;
ty = py;
}
if (is_bolt && !(effects->count("IGNITE")) &&
!(effects->count("EXPLOSIVE")) &&
if (is_bolt && !(effects.count("IGNITE")) &&
!(effects.count("EXPLOSIVE")) &&
((curammo->m1 == "wood" && !one_in(5)) ||
(curammo->m1 != "wood" && !one_in(15)) ))
m.add_item_or_charges(tx, ty, ammotmp);
@@ -977,10 +979,20 @@ void make_gun_sound_effect(game *g, player &p, bool burst, item* weapon)
} else if (noise < 40) {
gunsound = _("Pew!");
} else if (noise < 60) {
gunsound = _("Bzap!");
gunsound = _("Tsewww!");
} else {
gunsound = _("Kra-kow!!");
}
} else if (weapontype->ammo_effects.count("LIGHTNING")) {
if (noise < 20) {
gunsound = _("Bzzt!");
} else if (noise < 40) {
gunsound = _("Bzap!");
} else if (noise < 60) {
gunsound = _("Bzaapp!");
} else {
gunsound = _("Kra-koom!!");
}
} else {
if (noise < 5) {
if (burst)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.