Skip to content

Commit

Permalink
Added swamp monsters and stabbing weapons; also the weapon_flag enum …
Browse files Browse the repository at this point in the history
…to give weapons special effects.
  • Loading branch information
Whales committed May 4, 2011
1 parent 325947d commit 09e0b74
Show file tree
Hide file tree
Showing 29 changed files with 546 additions and 246 deletions.
6 changes: 3 additions & 3 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ GENERAL:
>Two levels; "Full" and "Overfull"; Only when Overfull is puking a risk
>Three levels, hunger, thirst, and stomach fullness

Include "(rotten)" in the tname() for food. Guessing whether a piece of
**Include "(rotten)" in the tname() for food. Guessing whether a piece of
food is rotten is not a fun game.
Add some use for rotten food? Maybe cooking salvages some of it?
Or level 1 cooking craft, 5 rotten tomatoes->1 fresh
Expand All @@ -178,7 +178,7 @@ GENERAL:
Highlight or color-invert monsters that're fleeing; also make indifference
visually obvious in some way (change glyph foreground color?)

Audit how we're using space in the data section
Audit how we're using screen space in the data window
Are pain AND painkiller level needed?
Definitely add player speed to the display
Maybe make a special data structure for how the data section is used and
Expand Down Expand Up @@ -303,7 +303,7 @@ CHARACTER CREATION:

TRAITS:

Auto-use inhaler if Asthmatic; right now the trait is just so annoying
**Auto-use inhaler if Asthmatic; right now the trait is just so annoying

More Schizophrenic effects
Make auditory hallucinations more realistic/varied
Expand Down
2 changes: 2 additions & 0 deletions game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4260,8 +4260,10 @@ void game::plmove(int x, int y)
int udam = u.hit_mon(this, &z[mondex]);
if (z[mondex].hurt(udam))
kill_mon(mondex);
/*
else if (udam > 0) // Stun them
z[mondex].moves -= udam + int((udam / z[mondex].hp) * z[mondex].speed);
*/
return;
} else
displace = true;
Expand Down
7 changes: 4 additions & 3 deletions help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,10 @@ positions relative to you, is displayed on the right side of the screen.\n\
To attack a monster with a melee weapon, simply move into them. The time it\n\
takes to attack depends on the size and weight of your weapon. Small, light\n\
weapons are the fastest; unarmed attacks increase in speed with your Unarmed\n\
Combat skill, and will eventually be VERY fast. A successful hit will stun\n\
the monster temporarily, and most one-on-one fights will be easily won by the\n\
player. On the other hand, a miss will make you stumble and cost YOU\n\
Combat skill, and will eventually be VERY fast. A successful hit with a\n\
bashing weapon may stun the monster temporarily, while cutting weapons may get\n\
stuck, possibly pulling the weapon from your hands--but a monster with a weapon\n\
stuck in it will move much more slowly. A miss may make you stumble and lose\n\
movement points. If a monster hits you, your clothing may absorb some damage,\n\
but you will absorb the excess.\n\
\n\
Expand Down
6 changes: 6 additions & 0 deletions item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ item::item()
bday = 0;
invlet = 0;
damage = 0;
type = NULL;
curammo = NULL;
corpse = NULL;
active = false;
Expand Down Expand Up @@ -557,6 +558,11 @@ int item::attack_time()
return 80 + 4 * volume() + 2 * weight();
}

bool item::has_weapon_flag(weapon_flag f)
{
return (type->weapon_flags & mfb(f));
}

int item::weapon_value(int skills[num_skill_types])
{
int my_value = 0;
Expand Down
10 changes: 6 additions & 4 deletions item.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,16 @@ class item
int volume();
int volume_contained();
int attack_time();
bool has_weapon_flag(weapon_flag f);

// Our value as a weapon, giving particular skills
// Our value as a weapon, given particular skills
int weapon_value(int skills[num_skill_types]);
// As above, but discounts its use as a ranged weapon
int melee_value(int skills[num_skill_types]);
bool is_two_handed(player *u);
bool made_of(material mat);
bool conductive();
bool conductive(); // Electricity
// Most of the is_whatever() functions call the same function in our itype
bool is_food(player *u);// Some non-food items are food to certain players
bool is_food_container(player *u); // Ditto
bool is_food(); // Ignoring the ability to eat batteries, etc.
Expand All @@ -80,8 +82,8 @@ class item

//bool stack_with(item &it); // Attempts to stack; returns true on success

itype* type;
mtype* corpse;
itype* type;
mtype* corpse;
it_ammo* curammo;

std::vector<item> contents;
Expand Down
55 changes: 38 additions & 17 deletions itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ itm_wrapper, itm_syringe, itm_rag, itm_fur, itm_leather, itm_superglue,
itm_hammer_sledge, itm_hatchet, itm_ax, itm_nailboard, itm_xacto, itm_pot,
itm_pan, itm_knife_butter, itm_knife_steak, itm_knife_butcher,
itm_knife_combat, itm_2x4, itm_muffler, itm_pipe, itm_bat, itm_machete,
itm_katana, itm_spear_wood, itm_baton, itm_bee_sting, itm_chitin_piece,
itm_canister_empty,
itm_katana, itm_spear_wood, itm_baton, itm_bee_sting, itm_wasp_sting,
itm_chitin_piece, itm_canister_empty,
// Footwear
itm_sneakers, itm_boots, itm_boots_steel, itm_boots_winter, itm_mocassins,
itm_flip_flops, itm_dress_shoes, itm_heels,
Expand Down Expand Up @@ -164,6 +164,15 @@ AT_FUSION,
NUM_AMMO_TYPES
};

enum weapon_flag {
WF_NULL,
WF_SPEAR, // Cutting damage is actually a piercing attack
WF_STAB, // This weapon *can* pierce, but also has normal cutting
WF_WRAP, // Can wrap around your target, costing you and them movement
WF_MESSY, // Splatters blood, etc.
NUM_WEAPON_FLAGS
};

// Returns the name of a category of ammo (e.g. "shot")
std::string ammo_name(ammotype t);
// Returns the default ammo for a category of ammo (e.g. "itm_00_shot")
Expand All @@ -174,7 +183,7 @@ struct itype
unsigned int id; // ID # that matches its place in master itype list
// Used for save files; aligns to itype_id above.
unsigned char rarity; // How often it's found
unsigned int price; // Its value
unsigned int price; // Its value

std::string name; // Proper name
std::string description;// Flavor text
Expand All @@ -192,6 +201,8 @@ struct itype
signed char melee_dam; // Bonus for melee damage; may be a penalty
signed char melee_cut; // Cutting damage in melee
signed char m_to_hit; // To-hit bonus for melee combat; -5 to 5 is reasonable

unsigned weapon_flags : NUM_WEAPON_FLAGS;

virtual bool is_food() { return false; }
virtual bool is_ammo() { return false; }
Expand All @@ -215,13 +226,15 @@ struct itype
weight = 0;
melee_dam = 0;
m_to_hit = 0;
weapon_flags = 0;
}

itype(unsigned short pid, unsigned char prarity, unsigned int pprice,
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit) {
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags) {
id = pid;
rarity = prarity;
price = pprice;
Expand All @@ -236,6 +249,7 @@ struct itype
melee_dam = pmelee_dam;
melee_cut = pmelee_cut;
m_to_hit = pm_to_hit;
weapon_flags = pweapon_flags;
}
};

Expand Down Expand Up @@ -265,15 +279,15 @@ struct it_comest : public itype
char psym, nc_color pcolor, material pm1,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit,
signed char pm_to_hit, unsigned pweapon_flags,

signed char pquench, unsigned char pnutr, signed char pspoils,
signed char pstim, signed char phealthy, unsigned char paddict,
unsigned char pcharges, signed char pfun, itype_id pcontainer,
itype_id ptool, void (iuse::*puse)(game *, player *, item *, bool),
add_type padd)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, MNULL,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
quench = pquench;
nutr = pnutr;
spoils = pspoils;
Expand Down Expand Up @@ -305,12 +319,13 @@ struct it_ammo : public itype
char psym, nc_color pcolor, material pm1,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags,

ammotype ptype, unsigned char pdamage, unsigned char ppierce,
signed char paccuracy, unsigned char precoil, unsigned char prange,
unsigned char pcount)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, MNULL,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
type = ptype;
damage = pdamage;
pierce = ppierce;
Expand Down Expand Up @@ -339,12 +354,13 @@ struct it_gun : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags,

skill pskill_used, ammotype pammo, signed char pdmg_bonus,
signed char paccuracy, signed char precoil, unsigned char pdurability,
unsigned char pburst, unsigned char pclip)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
skill_used = pskill_used;
ammo = pammo;
dmg_bonus = pdmg_bonus;
Expand Down Expand Up @@ -373,15 +389,15 @@ struct it_gunmod : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit,
signed char pm_to_hit, unsigned pweapon_flags,

signed char paccuracy, signed char pdamage, signed char ploudness,
signed char pclip, signed char precoil, signed char pburst,
ammotype pnewtype, long a_a_t, bool pistol,
bool shotgun, bool smg, bool rifle)

:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
accuracy = paccuracy;
damage = pdamage;
loudness = ploudness;
Expand Down Expand Up @@ -413,13 +429,14 @@ struct it_armor : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags,

unsigned char pcovers, signed char pencumber,
unsigned char pdmg_resist, unsigned char pcut_resist,
unsigned char penv_resist, signed char pwarmth,
unsigned char pstorage)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
covers = pcovers;
encumber = pencumber;
dmg_resist = pdmg_resist;
Expand All @@ -445,11 +462,12 @@ struct it_book : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags,

skill ptype, unsigned char plevel, unsigned char preq,
signed char pfun, unsigned char pintel, unsigned char ptime)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
type = ptype;
level = plevel;
req = preq;
Expand All @@ -476,11 +494,11 @@ struct it_container : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit,
signed char pm_to_hit, unsigned pweapon_flags,

unsigned char pcontains, unsigned pflags)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
contains = pcontains;
flags = pflags;
}
Expand All @@ -501,13 +519,14 @@ struct it_tool : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pweapon_flags,

unsigned int pmax_charges, unsigned int pdef_charges,
unsigned char pcharges_per_use, unsigned char pturns_per_charge,
ammotype pammo, itype_id prevert_to,
void (iuse::*puse)(game *, player *, item *, bool))
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
max_charges = pmax_charges;
def_charges = pdef_charges;
ammo = pammo;
Expand All @@ -529,10 +548,12 @@ struct it_bionic : public itype
std::string pname, std::string pdes,
char psym, nc_color pcolor, material pm1, material pm2,
unsigned char pvolume, unsigned char pweight,
signed char pmelee_dam, signed char pmelee_cut,signed char pm_to_hit,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pweapon_flags,

int pdifficulty, ...)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pweapon_flags) {
difficulty = pdifficulty;
va_list ap;
va_start(ap, pdifficulty);
Expand Down
Loading

0 comments on commit 09e0b74

Please sign in to comment.