Compare commits

...

448 Commits

Author SHA1 Message Date
Ethan "Soron" Kaminski 1cd0f1f61d Update changelog with everything since 602e64dafe 2013-05-30 19:01:23 +12:00
Ethan "Soron" Kaminski 783f0ef4a2 Merge PR #1216 - fix body temp equalization 2013-05-30 17:43:14 +12:00
Kevin Granade a98b011ed6 Merge pull request #1278 from dluechoy/keep_light_on
Vehicle head lights stay on after save and exit.
2013-05-29 21:28:31 -07:00
Kevin Granade c8b7515f38 Merge listing of all nearby items in advanced inventory. 2013-05-29 21:59:32 -05:00
Kevin Granade 78df118350 Merge pull request #1273 from i2amroy/Read-Time-INT-Effect
Read time INT penalty fix
2013-05-29 19:23:52 -07:00
D Lue Choy 0b035b344c Vehicle head lights stay on after save and exit.
They will also stay off.
This adds one integer to the "V ..."  entries of maps.txt

Signed-off-by: D Lue Choy <dluechoy@>
2013-05-29 22:15:05 -04:00
Kevin Granade afcec85b1c Mapgen enhancements and bugfixes. 2013-05-29 20:58:27 -05:00
Kevin Granade 29dcc1960c Merge fix to player exploration carrying over to later characters. 2013-05-29 19:58:43 -05:00
origamiwolf 45498558f9 Add zombie spawns to mansions 2013-05-30 07:47:29 +08:00
fnord d7b08463ea fix build breaking typo 2013-05-29 18:43:56 -05:00
fnord 2eb0ad444e advanced inventory: 'a' will now list everything in the surrounding
3x3 squares. defaults have changed from inventory, down, to down,
inventory (this fits my usage patterns better at least, can revert
if they're atypical). Color changes: The colors are subjectively
better.
2013-05-29 18:22:00 -05:00
origamiwolf 7b7b50dad7 Added more furnishings and items to mansion rooms 2013-05-30 00:34:06 +08:00
Fergus Dall a5620124d6 Stop generating extra lab levels after the finale 2013-05-29 20:58:48 +09:30
Fergus Dall 7642811bbf Generate extra downstairs in labs as needed to ensure connectivity 2013-05-29 20:58:09 +09:30
Christian Buskirk 9457aacdf0 Buffed INT penalty 2013-05-29 00:22:19 -07:00
Ilya Grigorev 9b15e7fcf8 fix crash 2013-05-28 17:49:04 +04:00
alex-gh 1f4459aafd Badly damaged clothing yields less raw materials when cut. Reinforced clothing yields more. 2013-05-28 09:57:44 +02:00
Ethan "Soron" Kaminski 8ab3b1a1cf Merge PR #1264 - show stat effects in @ screen 2013-05-28 18:47:39 +12:00
Ethan "Soron" Kaminski 085dcfd617 Merge PR #1263 - further refine rag requirements for sewing 2013-05-28 18:46:55 +12:00
Ethan "Soron" Kaminski 8e722ea716 Merge PR #1247 - spiral rooms now coded sanely 2013-05-28 18:46:36 +12:00
Ethan "Soron" Kaminski f15a4de104 Merge PR #1209 - avoid leaking seen overmap info 2013-05-28 18:46:16 +12:00
Fergus Dall 10e3ae9f33 Delete map exploration data on player death 2013-05-28 16:13:09 +09:30
veryinky 331bc16d61 Retry of player stat info on character screen 2013-05-27 23:25:11 -04:00
Reaper42 77c87667db Quickfix:sewing not require materials,if they are not nedded 2013-05-28 10:11:45 +07:00
Kevin Granade c8ce78afd0 Merge pull request #1258 from quietust/msvcfix
Fix MSVC compile
2013-05-27 15:49:06 -07:00
Kevin Granade ef83b84f8b A plethora of small bugfixes. 2013-05-27 17:17:17 -05:00
Kevin Granade a395843c68 Merge pickup menu enhancements. 2013-05-27 17:07:41 -05:00
Quietust 7615f98ff7 Fix MSVC compile, and re-enable optimization on itypedef.cpp 2013-05-27 16:50:14 -05:00
Kevin Granade a6494f5ad5 Merge cleanup of unload code. 2013-05-27 16:44:06 -05:00
Kevin Granade 379c161446 Store the current terrain and trap value in a local for temperature and fatigue calculations. 2013-05-27 16:39:57 -05:00
Kevin Granade 0c734d6832 Fix ter_at/ter mixup. 2013-05-27 15:54:01 -05:00
Kevin Granade 06e7288463 Merge more temperature system adjustments.
Conflicts:
	player.cpp
2013-05-27 15:53:18 -05:00
Kevin Granade a1833b71bb Remove an unused variable. 2013-05-27 15:20:31 -05:00
Kevin Granade 47fb78f48f Allow reading books with no associated skill as a noop. 2013-05-27 15:20:09 -05:00
Kevin Granade 3062f7b1c5 Merge mission enhancements and new lab locations. 2013-05-27 13:29:56 -05:00
Kevin Granade 685d36e801 Merge remote-tracking branch 'dda/master' into clear-overmap-buffer 2013-05-27 11:08:45 -05:00
Reaper42 928fc755cc Rags are not used as thread 2013-05-27 21:50:37 +07:00
veryinky 3942bb6bde Added electric cars to town spawns 2013-05-27 06:50:15 -04:00
veryinky 740ccdeae5 Flatbed trucks now have rear windows 2013-05-27 06:27:00 -04:00
fnord 43ab59355c pickup: make use of top border of item info window, to display item name 2013-05-27 04:15:12 -05:00
fnord 01975326ff inventory item submenu: can scroll to "=", selection highliter visible by default 2013-05-27 04:00:14 -05:00
fnord d19eb1b420 pickup: corrected mistaken removal of weight/volume subtraction on deselect 2013-05-27 03:49:05 -05:00
veryinky 6d6df3b0e0 Update catacurse so title bar displays .6git instead of .5 2013-05-27 04:33:37 -03:00
veryinky 5ed3f2cdc3 fix for int display in chargen 2013-05-27 03:20:43 -04:00
veryinky fd856d47cd thingy 2013-05-27 02:33:01 -04:00
veryinky 432aa7a7f9 .6 now 2013-05-27 03:15:21 -03:00
fnord 60d84eb9c7 pickup: item info automatically displays highlighted item 2013-05-27 01:06:25 -05:00
fnord 22a998a486 pickup: pagination corrections 2013-05-27 01:06:25 -05:00
fnord 8d25113870 pickup: selection highlights first item by default, follows letter input 2013-05-27 01:06:25 -05:00
veryinky 8eed366797 The 0.4-Git was annoying me 2013-05-27 01:47:45 -04:00
acidia 829b4c4755 Cleaning //tribute 2013-05-26 23:07:05 -05:00
acidia 52db89f7c8 Deleted some code artifacts in //tribute 2013-05-26 23:04:22 -05:00
Kevin Granade 49e7c28584 Merge a batch of simple bugfixes and refactors.
Conflicts:
	item.h
	player.cpp
	player.h
2013-05-26 22:50:13 -05:00
Kevin Granade 6377d81abc Really fix spiral room generation. 2013-05-26 20:14:45 -05:00
Kevin Granade 3c1b528685 Indention fix in spiral room generation. 2013-05-26 20:14:14 -05:00
Ethan "Soron" Kaminski 8f290fcc86 Unify and make sane the gun/tool unloading code
Closes #1242. Also makes it so that liquids don't get dumped on the ground if you're over-volume (since they can just go in another container).
2013-05-27 12:12:03 +12:00
Shoes01 e0e1f3e654 Removed some VARSIZE tags that weren't supposed to be 2013-05-26 21:05:42 -03:00
Shoes01 b663eef6f0 Update changelog 2013-05-26 21:02:59 -03:00
Shoes01 0ff829de6a Merge branch 'warmth' into features-and-tweaks 2013-05-26 20:59:22 -03:00
Shoes01 c7e5684425 Merge branch 'sleep-fixes' into features-and-tweaks 2013-05-26 20:59:17 -03:00
Shoes01 3df4b1af97 Tweaked warmth values of footwear 2013-05-26 20:55:31 -03:00
Shoes01 35ae82ec91 player::warmth now handles warmth reduction due to rain; wool is not affected 2013-05-26 20:47:45 -03:00
Ethan "Soron" Kaminski 34f6fb4e8d Set curammo properly in item constructor
Closes #1228. ACTUALLY closes #1142.
2013-05-27 11:18:44 +12:00
Ethan "Soron" Kaminski 7e53e362b3 Use standard item spawning method in game::wish
Closes #1142. Also makes it so that jacqueshammer spawns with no gasoline, but that's due to the item definition file.
2013-05-27 11:08:30 +12:00
Ethan "Soron" Kaminski 6319f032ec Monster-triggered crossbow traps only drop 1 bolt
Closes #1241.
2013-05-27 10:25:55 +12:00
Ethan "Soron" Kaminski 26c3919ded Recipe name collision message gives better info 2013-05-27 10:11:43 +12:00
Ethan "Soron" Kaminski e9fe6943b3 Made a couple crafting-related methods take player*, for NPC future-proofing 2013-05-27 10:10:57 +12:00
Octav Sandulescu b5c37c493e Add acid-from-batteries recipe. 2013-05-26 23:08:13 +01:00
Kevin Granade 9a83ba77d2 Today's batch of bugfixes. 2013-05-26 16:58:12 -05:00
Ethan "Soron" Kaminski e397c29983 Merge PRs #1239 and #1230 - trivial fixes 2013-05-27 09:35:08 +12:00
Ethan "Soron" Kaminski a49daf240c Rename mapgen_helper to building_generation 2013-05-27 09:31:39 +12:00
acidia e0ee49cfef Added FOLLOWUP for stringing mission together and strung 'patriot' together 2013-05-26 14:51:58 -05:00
Shoes01 0ead765da9 While sleeping, the player is informed if he is too cold or warm 2013-05-26 14:46:34 -03:00
Shoes01 0ec54e1dcf Sleeping is only interrupted by very hot or cold temperatures 2013-05-26 14:23:10 -03:00
Shoes01 efe30fdc31 Sofa and armchair get comfort messages too 2013-05-26 14:19:58 -03:00
Shoes01 faf89f3c8e Sleeping on an armchair or sofa is now benificial 2013-05-26 14:18:38 -03:00
jason.gilbert@nbed.nb.ca 195a68e9e1 Cold and heat are now less likely to interrupt sleeping 2013-05-26 14:12:39 -03:00
acidia b804dde202 Left a Testing Value in mattack::parrot 2013-05-26 12:07:46 -05:00
acidia d95c55f8c4 Added 'parrot' attack that will allow Mi Go to 'call out' 2013-05-26 11:57:30 -05:00
acidia 195446684f Added 'parrot' attack that will allow Mi Go to 'call out' 2013-05-26 11:56:53 -05:00
acidia 447fa2e768 Added 'parrot' attack that will allow Mi Go to 'call out' 2013-05-26 11:55:42 -05:00
Jan Christian Kaessens 1035cc8ba6 Fix for #1237, uninitialized moveCount 2013-05-26 18:54:02 +02:00
acidia 7929120aa8 Swap Broken Gas Pump for Broken Generator in Lab Utility 2013-05-26 11:49:03 -04:00
acidia 0696961ea7 Added Broken Generator 2013-05-26 11:46:22 -04:00
acidia e558e38487 Adding the Two Black Box Missions 2013-05-26 10:11:10 -05:00
acidia df013ad57b Adding the Two Black Box Missions 2013-05-26 11:09:26 -04:00
acidia 06f5c8ddd7 Added Starting Script for Black Box Transcript Mission 2013-05-26 11:07:03 -04:00
acidia c5e5541282 Added the Two Black Box Missions 2013-05-26 10:04:56 -05:00
jason.gilbert@nbed.nb.ca ab984471bd Oversized clothing can be worn regardless of encumberance or anything 2013-05-26 11:37:44 -03:00
jason.gilbert@nbed.nb.ca ca48e195b2 Added comment to list item flags (current and future planned ones) 2013-05-26 11:25:23 -03:00
jason.gilbert@nbed.nb.ca 2ee0736a5a Added OVERSIZE flags to items 2013-05-26 11:24:49 -03:00
jason.gilbert@nbed.nb.ca 9d766a375f Merge branches 'fixes' and 'new' into fixes 2013-05-26 10:59:22 -03:00
Octav Sandulescu 89e2fabaf4 Remove batteries from acid bomb recipe. 2013-05-26 14:32:39 +01:00
jason.gilbert@nbed.nb.ca c91b3ebaa2 Being hot now makes your MORE thirsty, not less 2013-05-26 09:33:01 -03:00
Octav Sandulescu 77bb0fe85f Typo fix 2013-05-26 13:02:44 +01:00
Octav Sandulescu 678b3f5f5c Get acid water from funnels during acid rain. 2013-05-26 13:00:38 +01:00
Fergus Dall 17a6d312a7 Fixed defective spiral cavern spirals 2013-05-26 17:58:08 +09:30
acidia cc5bccdf33 Add Black Box Spawn for Helicopter Crashes 2013-05-26 02:01:09 -05:00
Ethan "Soron" Kaminski a62858a5a5 Merge PR #1214 - 'V' looks in nearby containers, lab coats fittable 2013-05-26 18:34:09 +12:00
Ethan "Soron" Kaminski ab6425d526 Remove a couple dangling braces. 2013-05-26 18:08:10 +12:00
Ethan "Soron" Kaminski 7bad2dfd0a Fix another case of rng() in for loop conditionals 2013-05-26 17:57:49 +12:00
Ethan "Soron" Kaminski ac4c9c60d3 Remove some needless iteration in mapgen item spawning 2013-05-26 17:55:28 +12:00
Ethan "Soron" Kaminski bc07a5179f Fix a bug in mapgen spawn with rng() used in for loop conditional 2013-05-26 17:51:17 +12:00
Ethan "Soron" Kaminski 61e4d140e3 Merge PR #1212 - armor display bug 2013-05-26 17:45:42 +12:00
Fergus Dall 07317608bc Stop clearing artifact_itype_ids after save
Fixes #1213
2013-05-26 14:57:57 +09:30
Ethan "Soron" Kaminski b32ff5badc Make sewing pluralization saner 2013-05-26 17:09:27 +12:00
Ethan "Soron" Kaminski 4653350687 Sewing uses rags/leather from far away 2013-05-26 17:06:59 +12:00
acidia 8a2cc5493c Added Computer Commands for New Lab Rooms 2013-05-25 23:54:40 -05:00
acidia a97b899e74 6 New Lab Rooms and Added Concrete Walls to Rotate 2013-05-26 00:51:14 -04:00
Kevin Granade fb3ba56953 Base body temperature equalization on body temperature instead of convergant temperature. 2013-05-25 23:42:38 -05:00
acidia 0ee8e83212 Added Computer Functions for Data Lab 2013-05-26 00:39:43 -04:00
origamiwolf 16ab75d7fa Condensed protection values into one line 2013-05-26 12:37:50 +08:00
acidia 3a4c5e8047 Added Black Box 2013-05-25 23:35:06 -05:00
acidia 26611e970f Added Black Box Transcript 2013-05-25 23:33:24 -05:00
origamiwolf 9d984bbd5f Revert window size expansion 2013-05-26 12:30:20 +08:00
Ethan "Soron" Kaminski 141d788990 Factor out a bit of common logic in iuse::sew 2013-05-26 16:06:05 +12:00
Ethan "Soron" Kaminski ef00549452 Save-breaking typo fix: "stablizer" -> "stabilizer" 2013-05-26 15:47:13 +12:00
Christian Buskirk 5f3ccbcf1c Stopped players from being able to (e)xamine sealed crates to see their contents 2013-05-25 20:42:22 -07:00
Christian Buskirk 552a6d3cd4 Removed extraneous spaces 2013-05-25 20:04:34 -07:00
Christian Buskirk efa46c5d62 Allows the V menu to see items in adjacent containers unless container is sealed
Addresses issue #272
2013-05-25 19:45:09 -07:00
origamiwolf 92739fdbeb Expand item examine window 2013-05-26 10:42:05 +08:00
Ethan "Soron" Kaminski 84a0becfe4 Add corpse revivification to active item handling in inventory 2013-05-26 13:59:10 +12:00
Christian Buskirk 31c5694c10 Allow lab coats to be fitted
Fixes problem #1160
2013-05-25 18:43:32 -07:00
Ethan "Soron" Kaminski 1c0e09c334 Extract common weapon/inventory active item code from player 2013-05-26 13:30:14 +12:00
Kevin Granade 5aa4104683 Clear overmap_buffer when exiting a game session to avoid leaking seen state to another character. 2013-05-25 19:59:07 -05:00
origamiwolf d626730dd2 Fixed incorrect armour documentation 2013-05-26 08:48:44 +08:00
Ethan "Soron" Kaminski f3b0bcb7c9 Merge PR #1204 - fix NPC segfault (in choose_escape_item()) 2013-05-26 12:46:01 +12:00
Kevin Granade 6db72c165c Also check for no item found in use_escape_item(). 2013-05-25 19:40:53 -05:00
Kevin Granade d67fc55322 Merge headlights for default vehicles.
Conflicts:
	veh_typedef.cpp
2013-05-25 19:05:20 -05:00
Kevin Granade 78942cc30f Merge a batch of minor fixes. 2013-05-25 19:04:01 -05:00
Kevin Granade 0f682ec45e Merge improved vehicle collision code. 2013-05-25 18:55:18 -05:00
D Lue Choy d4f500787b Road vehicles now have a non-zero number of headlights.
Scooter, Military Truck and Semi Truck templates now have a similar number of head lights as the vehicles they are inspired by.
The lights have not been repositioned optimally for the game.

Signed-off-by: D Lue Choy <dluechoy@>
2013-05-25 19:54:01 -04:00
Ethan "Soron" Kaminski 986b7a07f0 Merge PR #1147 - bicycle seats 2013-05-26 11:25:13 +12:00
Ethan "Soron" Kaminski 835652c5d2 Merge PR #1206 - percent signs in gunmod descriptions 2013-05-26 11:24:04 +12:00
Ethan "Soron" Kaminski 6f63dd7522 Merge PR #1163 - improved armor damage descriptions 2013-05-26 11:16:36 +12:00
Fergus Dall ab15f1a879 Make % sign appear properly for the magazine line in gunmod descriptions
Fixed #1179
2013-05-26 08:42:09 +09:30
Ethan "Soron" Kaminski 4f8010d0a0 Merge PR #1202 - fix firing into smoke 2013-05-26 11:01:22 +12:00
Ethan "Soron" Kaminski 0988944949 Merge PR #1165 - moving furniture causes noise 2013-05-26 10:56:36 +12:00
Ethan "Soron" Kaminski c52f6b9048 Merge PR #1164 - fix teleporting arrows, etc.
Conflicts:
	ranged.cpp
2013-05-26 10:56:11 +12:00
Williham Totland 1e07470c98 Resolves an issue where bearings would not spawn. 2013-05-26 00:53:36 +02:00
Williham Totland 61113a8dd9 Resolves an issue where saving would oblitterate skill practice 2013-05-26 00:46:41 +02:00
Williham Totland 5acbb5b3db Disassembling ammo gives firearms training. 2013-05-26 00:44:20 +02:00
Kevin Granade ebecd3b40e Prevent use of an invalid index in NPC AI code.
Thanks jkaessens for providing the backtrace that enabled solving it.
2013-05-25 17:42:27 -05:00
Williham Totland 01cc3f6bf7 Foraging gives survival exprience 2013-05-26 00:40:21 +02:00
Williham Totland fcee31c237 Imroves birthday math 2013-05-26 00:39:17 +02:00
Kevin Granade 21855e2176 Remove redundant check of map::sees() that was confusing us when targeting monsters standing in smoke. 2013-05-25 16:12:16 -05:00
Kevin Granade 68cadcb52c Clean up some comments in game::target(). 2013-05-25 16:11:25 -05:00
Kevin Granade a28693139d More small fixes. 2013-05-25 15:01:31 -05:00
fnord 2e3af258b4 switched back to debugmsg (disabled) 2013-05-25 14:13:41 -05:00
fnord 528edd10b2 Revert "Enabling collision logging": silly assumption about dbg()
This reverts commit 01bfde4bc7.
2013-05-25 14:09:59 -05:00
Kevin Granade 8bf2035d3c Merge remote-tracking branch 'dda/pr/1167' into dda-master 2013-05-25 14:09:26 -05:00
fnord 25c9986d4d Moving items to the ground via advanced inventory and drop will add charges if applicable (ammo etc) 2013-05-25 13:57:03 -05:00
fnord 0c759878bd fixed left/right miscounting in pickup 2013-05-25 13:08:07 -05:00
origamiwolf 903feb9bc1 Added notes on how armour protection works 2013-05-25 23:12:59 +08:00
jason.gilbert@nbed.nb.ca 23f088e938 Merge branch 'fire-head-fix' of github.com:Shoes01/Cataclysm-DDA into test
Conflicts:
	disease.cpp
2013-05-25 11:58:23 -03:00
Kevin Granade c9ef1d465b Simple bugfix megamerge. 2013-05-25 09:55:14 -05:00
origamiwolf 9d61f574e8 Fix segfault when trying to read a wielded book 2013-05-25 22:48:41 +08:00
fnord 01bfde4bc7 Enabling collision logging 2013-05-25 09:21:26 -05:00
Octav Sandulescu f673fe21d2 Fix the Code::Blocks project by including material.{h,cpp}. 2013-05-25 14:58:16 +01:00
Ethan "Soron" Kaminski 7f5d6f8383 Fix an occasional segfault due to improper vector bounds in rng()
Thanks to forum user utunnels for spotting this (see http://www.cataclysmdda.com/smf/index.php?topic=1478).
2013-05-26 00:16:36 +12:00
fnord a9606106cd Vehicle collisions no longer become insane ping-pong fests that generate
velocity out of nowhere: vector changes now derived from equations at
http://en.wikipedia.org/wiki/Elastic_collision
2013-05-25 04:15:35 -05:00
fnord 029ce0d948 Added missing break; that caused disassemble to prompt for reassign 2013-05-25 03:24:14 -05:00
Kevin Granade 97e822da48 Merge Cathedral and a batch of new missions. 2013-05-24 22:20:49 -05:00
Fergus Dall 25b58a0873 Make autosave save mapdata and artifacts properly
Fixes #1175
2013-05-25 12:42:50 +09:30
Fergus Dall d9dcdb8915 Make artifact loading work for artifacts on the ground 2013-05-25 12:27:36 +09:30
Williham Totland c02fd28af1 40mm acid bomb crafting 2013-05-25 02:56:53 +02:00
Williham Totland a22522a725 Adds acid bomb 40mm shells 2013-05-25 02:47:13 +02:00
Fergus Dall 8dc7cd36fe Separated t_locker and t_rack from t_fridge and t_glass_fridge in map::bash 2013-05-25 09:35:04 +09:30
Kevin Granade 49b3b63d72 Merge skill gain/morale refactor. 2013-05-24 18:51:21 -05:00
fnord d2501bc030 Advanced inventory takes equipped items plus weapon into account and limits pickups accordingly. (Until invlet indexing is eliminated) 2013-05-24 14:06:19 -05:00
D Lue Choy 97b9331afb 96% fix for issue #808
Unfortunately worn items with charges (not implemented) are not ejected
from inventory. And item letter collisions are not corrected.
2013-05-24 14:15:20 -04:00
Fergus Dall 6451098bd8 Make lockers and racks spawn pipe instead of hose
Fixes #1172
2013-05-24 22:37:59 +09:30
Steven Wu 510c759f64 Fixes #960 by removing (dam != 0) check 2013-05-24 00:04:04 -07:00
Fergus Dall 6363ad61f7 Prevent non-version tags from being used for version info.
Fixes #1141
2013-05-24 15:58:58 +09:30
origamiwolf 551fc095ac Armour layering UI now shows fitted encumbrance values and coverage 2013-05-24 13:10:26 +08:00
Kevin Granade 7cfb3e9369 Merge pull request #1162 from ethankaminski/fridge-hoses
Make fridges drop a hose when deconstructed/smashed
2013-05-23 21:26:14 -07:00
Kevin Granade 222ce076f5 Add noise when moving furniture. 2013-05-23 23:06:57 -05:00
Kevin Granade d7d7b8bf49 Refactor game::fire() to behave sensibly about trajectories. 2013-05-23 22:50:15 -05:00
Ethan "Soron" Kaminski b5ace4ad2a Extract mapgen to helper methods, up to ot_forest_water 2013-05-24 15:20:36 +12:00
Kevin Granade 35eea03570 Remove HP reference from bite attack. 2013-05-23 21:37:26 -05:00
Kevin Granade 91449a4fc0 Apply new damage verbs to feedback when armor is damaged. 2013-05-23 21:36:26 -05:00
Kevin Granade 3e835b85a0 Add strings describing how different matrials take damage to material_type. 2013-05-23 21:35:47 -05:00
Ethan "Soron" Kaminski 0816af5cb8 Use the helper files for helper functions 2013-05-24 14:34:45 +12:00
Ethan "Soron" Kaminski a783ea88d3 Add a proper struct for passing around neighbor data 2013-05-24 14:30:43 +12:00
Ethan "Soron" Kaminski 8e4024afb0 Extract ot_null generation to a helper method 2013-05-24 14:15:01 +12:00
Ethan "Soron" Kaminski d29b244ff3 Add a debugmsg call when generating ot_null terrain 2013-05-24 14:04:27 +12:00
Ethan "Soron" Kaminski 092793805b Make fridges drop a hose when deconstructed/smashed 2013-05-24 13:48:23 +12:00
acidia 3d5ba4eae8 Fixed Jabberwock Name Typo 2013-05-23 20:34:09 -05:00
acidia 4350320437 Moved Jabberwock entry 2013-05-23 20:24:10 -05:00
acidia 3153790ac8 Moved Jabberwock entry 2013-05-23 20:17:35 -05:00
acidia 2316fd5911 Moved Jabberwock entry 2013-05-23 20:15:52 -05:00
acidia b8519ed9c7 Added flesh golem attack, chance of roar and a swipe attack that can knock you down. 2013-05-23 19:54:54 -05:00
Ethan "Soron" Kaminski 4183d70999 Update the help text about XP and learning 2013-05-24 12:53:29 +12:00
acidia 9a8283e121 Added flesh_golem attack 2013-05-23 19:48:09 -05:00
acidia 6f96ab0173 Added flesh golem attack, chance of roar and a swipe attack that can knock you down. 2013-05-23 19:47:27 -05:00
acidia 9f48d73510 Made flag mission text a bit clearer 2013-05-23 19:41:24 -05:00
acidia 305d1f5cdd Fixed warning statments caused by stained glass windows code... 2013-05-23 19:37:35 -05:00
Ethan "Soron" Kaminski b1a8c6d395 Remove references to skill comprehension 2013-05-24 12:22:57 +12:00
Ethan "Soron" Kaminski bd364111dc Replace references to "XP" with "Focus" 2013-05-24 12:12:21 +12:00
Kevin Granade e9745bba42 Merge armor handling refactor. 2013-05-23 18:51:17 -05:00
Ethan "Soron" Kaminski 3882cb5cc2 Add missing break statements to item examination logic 2013-05-24 10:08:52 +12:00
Ethan "Soron" Kaminski 7920ca2d48 Merge PR #1126 - armor UI tweaks
Conflicts:
	data/changelog.txt
2013-05-24 09:39:04 +12:00
Ethan "Soron" Kaminski 8673eea0a1 Merge PR #1151 - switching levels during map view 2013-05-24 09:25:58 +12:00
Ethan "Soron" Kaminski dc2d6a7244 Merge PR #1158 - fix backspacing in empty text fields 2013-05-24 09:13:11 +12:00
fnord 34d4b97189 string input popup: Prevent junk (^, etc) from being added if backspace is hit
while line is blank.
2013-05-23 10:44:04 -05:00
origamiwolf eb0f327c49 Added disassembly recipe for vacuum sealer 2013-05-23 22:01:00 +08:00
origamiwolf 877b136f02 remove storage check to show all allowable clothing on specific body part 2013-05-23 21:20:56 +08:00
Fergus Dall 705a2f25d6 Add level indicator to overmap screen 2013-05-23 20:30:28 +09:30
TheDarklingWolf 10ce9024f4 Merge branch 'pr/1148' 2013-05-23 09:47:08 +01:00
Kyratzes Talvadore 40350df34f Merge pull request #1146 from ethankaminski/vehicle-animation
Remove the vehicle animation delay
2013-05-23 01:38:14 -07:00
Fergus Dall ad3c7828d4 Make debug menu "Reveal map" reveal different z-levels as well 2013-05-23 16:47:39 +09:30
Fergus Dall 25dd4be923 Make '<' and '>' show different z-levels on the overmap screen 2013-05-23 16:47:29 +09:30
Kevin Granade 9474e84e35 Another day, another bugfix merge.
Conflicts:
	game.cpp
2013-05-22 19:42:07 -05:00
Kevin Granade ede15e1a8f Don't limit trajectory drawing to erroneous sight range. 2013-05-22 18:53:12 -05:00
Kevin Granade b51549e20a Use game::u_see() to check visibility and map::sees() to draw line in targeting screen. 2013-05-22 18:53:12 -05:00
Kevin Granade b9f6c70b95 Use map::draw() in game::plthrow() and game::plshoot() instead of drawing manually. 2013-05-22 18:53:12 -05:00
Kevin Granade 6359d73864 Drow enemes even when they're out of range. 2013-05-22 18:53:12 -05:00
Kevin Granade f8a43b5053 Add a saddle item and vehicle part for bicycles and motorcycles.
It is smaller and lighter than a car seat, but cannot have a seatbelt attached.
Incidentally it also can't hold tems dropped on it.
2013-05-22 18:52:39 -05:00
Kevin Granade f7b4bb5635 Require an anchor point to be present to install a seatbelt. 2013-05-22 18:52:39 -05:00
Kevin Granade 27f6f4064a Add new anchor point flag and apply it to car seats. 2013-05-22 18:52:39 -05:00
Kevin Granade 783bc2cc18 Nuke some commented out debug code. 2013-05-22 18:52:39 -05:00
Ethan "Soron" Kaminski 524ad4a5e1 Remove the vehicle animation delay
Nobody seems to like the vehicle animation delay, and I'm not aware of any reason why it's in the code, other than slowing down the animation. Excising the code.
2013-05-23 11:25:50 +12:00
Ethan "Soron" Kaminski 3ed605f45f Typo fix ("ressign" -> "reassign") 2013-05-23 11:22:57 +12:00
Ethan "Soron" Kaminski dcca01a26d Merge PR #1134 - in-inventory invlet reassignment 2013-05-23 11:06:07 +12:00
Charlie Nolan (FunnyMan3595) deedf81e90 Fixed a bug that prevented books from giving experience at 0 skill. 2013-05-22 15:04:19 -05:00
Charlie Nolan (FunnyMan3595) bd387006f4 SkillLevel::train and _exercise have increased granularity. 2013-05-22 11:00:39 -05:00
Charlie Nolan (FunnyMan3595) ed149d8ef3 max_ex < min_ex produces strange results in rng() 2013-05-22 10:13:59 -05:00
Charlie Nolan (FunnyMan3595) 086e56c81d Styling fix. 2013-05-22 10:12:27 -05:00
Charlie Nolan (FunnyMan3595) 3b561a037e No need to check for XP in the pool anymore. 2013-05-22 10:00:42 -05:00
Charlie Nolan (FunnyMan3595) e97fd63d8b Minor fixes to learning's rng() calls. 2013-05-22 09:59:51 -05:00
Charlie Nolan (FunnyMan3595) 9475956cdc Bugfix and minor cleanup to player::calc_focus_equilibrium 2013-05-22 09:55:54 -05:00
origamiwolf f74a85320e sauces now spawn in glass jars 2013-05-22 22:38:25 +08:00
origamiwolf d314685789 Added detailed armor info 2013-05-22 21:01:06 +08:00
origamiwolf 42d5e77536 Ensure distinct colours for armour damage, and added color key 2013-05-22 19:22:53 +08:00
Ethan "Soron" Kaminski 6d35478837 Remove obsolete sklevel member from player class 2013-05-22 20:43:30 +12:00
fnord be01f5fcab reassign invlet inside inventory with "=" item menu option 2013-05-22 03:07:25 -05:00
Ethan "Soron" Kaminski ad9f771c02 Remove obsolete, unused skill-related members of player class 2013-05-22 18:38:07 +12:00
Ethan "Soron" Kaminski 268819aa44 Merge PR #1101 - correct behavior of wborder in catacurse 2013-05-22 17:51:59 +12:00
Ethan "Soron" Kaminski 865b5ec6ba Merge PR #1125 - arrow keys work in multidrop/pickup windows 2013-05-22 17:48:13 +12:00
Ethan "Soron" Kaminski d2d7cc175e Merge PR #1114 - catacurse color tweaks 2013-05-22 17:47:04 +12:00
Ethan "Soron" Kaminski a195837be5 Erase the item info window when closing the pickup UI 2013-05-22 17:41:19 +12:00
Ethan "Soron" Kaminski 3ee1b69be4 Fix pickup window flickering in slow contexts 2013-05-22 17:39:55 +12:00
Ethan "Soron" Kaminski cec14342fa Merge PR #1118 - bifocals 2013-05-22 16:49:22 +12:00
Ethan "Soron" Kaminski e6b8b4b858 Merge PR #1117 - gasoline lanterns 2013-05-22 16:25:32 +12:00
fnord 9d7ed3b561 Added declaration that got lost in manual patch 2013-05-21 22:34:05 -05:00
alex-gh 723002d92b Gasoline lantern no longer disappears when it runs out. 2013-05-22 02:38:17 +02:00
alex-gh 05037ceed2 Gasoline lantern actually produces light now. Updated indentation of player::active_light to indentation required by CODE_STYLE 2013-05-22 01:56:50 +02:00
Fergus Dall f4795426be Make bifocal glasses spawn in bedrooms, offices and churchs 2013-05-22 08:21:37 +09:30
alex-gh acdf2094d0 Gasoline lanterns can actually spawn now. 2013-05-22 00:25:44 +02:00
Ethan "Soron" Kaminski bbd5143dc3 Merge PR #1110 - sewing crash fix 2013-05-22 10:20:21 +12:00
Ethan "Soron" Kaminski 9e23cf1a92 Merge PR #1115 - excise silly rounding logic 2013-05-22 10:13:40 +12:00
Ethan "Soron" Kaminski edafe2e453 Only warn about exiting a moving vehicle if >= 1 mph 2013-05-22 09:56:03 +12:00
Ethan "Soron" Kaminski e11b84b982 Merge PR #1127 - vehicle flinging fix
Conflicts:
	game.cpp
2013-05-22 09:27:00 +12:00
Ethan "Soron" Kaminski 8c1751c0b5 Merge PR #1124 - healing fixes, toolset normalization, soldering iron decomp 2013-05-22 09:08:02 +12:00
Skyrunner eafd32048b Fixed issue # 1037. fling_player_or_monster now considers vehicle speed when flinging. 2013-05-21 23:56:31 +09:00
origamiwolf 8712b85bea Updated changelog 2013-05-21 22:18:20 +08:00
origamiwolf b9b08294c9 Fixed bug in armour sort reassignment 2013-05-21 22:16:19 +08:00
origamiwolf f162d0f195 Use itype names instead and colour to indicate damage status 2013-05-21 21:58:21 +08:00
fnord ff98c8c4db Corrected typo: '\n' exits, '\t' selects 2013-05-21 08:09:41 -05:00
fnord 3f13bb9f25 multidrop allows scrolling with up/down, and selection with left/right 2013-05-21 07:53:26 -05:00
fnord ce19e1bf8d Arrow selection in 'g'et command 2013-05-21 07:52:44 -05:00
Williham Totland f64cb83838 Resolves an issue where rags and patches would not be consumed. 2013-05-21 14:00:29 +02:00
Williham Totland d790f8f9ba Normalizes toolset usage, makes soldering iron learnable from decomp 2013-05-21 13:56:39 +02:00
Williham Totland f42e20b48d Made V. Fast Healer/Regeneration be more effective while sleeping also. 2013-05-21 13:52:24 +02:00
Ethan "Soron" Kaminski 5f6441214b Learning from skill books reduces mental focus equilibrium point 2013-05-21 21:09:54 +12:00
Fergus Dall ded915d780 Fixed compiler error 2013-05-21 17:46:45 +09:30
Fergus Dall a711120781 Add bifocal glasses
Closes #845
2013-05-21 16:24:16 +09:30
Joshua Hunter ec1e7b63e1 fixed comment above to show new values for rng 2013-05-20 23:47:50 -07:00
alex-gh 6479dfcbe2 Lowered the efficiency a bit. The lanterns were too efficient. 2013-05-21 06:29:37 +02:00
alex-gh d3462eca05 Added gasoline lanterns. 2013-05-21 06:11:43 +02:00
Joshua Hunter 479f6feb6c fixes rng rounding error on initial fuel state 2013-05-20 18:39:54 -07:00
Dirkkun d897f1b9cb Catacurses color tweaks
Brightens the darker colors to remove ninja bears and stealthy zombie
hulks. Also makes light gray a bit darker because it currently looks
white.
2013-05-20 20:56:03 -04:00
Ethan "Soron" Kaminski c37e641e6b Merge PR #1085 - shrub smashing tweak 2013-05-21 11:19:39 +12:00
Ethan "Soron" Kaminski e098d1d39b Add feedback about focus gain to the morale screen 2013-05-21 11:16:52 +12:00
Ethan "Soron" Kaminski a2727180df Fix an NPC initialization bug
Nasty little thing that could cause a crash at game start, due to an index being out-of-bounds.
2013-05-21 10:51:27 +12:00
Ethan "Soron" Kaminski 79fc31c74f Merge UI enhancements (PRs #1095, #1093, #1081) 2013-05-21 10:32:11 +12:00
fnord cda170ff64 Add missing check for empty list 2013-05-20 16:30:36 -05:00
Williham Totland 7fceef44f2 Resolves an issue where destroying an item while tailoring would crash the game. 2013-05-20 18:32:09 +02:00
origamiwolf d1e11bf78a Display coverage in item stats, and fixed parenthesis warning 2013-05-20 22:48:46 +08:00
origamiwolf 3957eb2bf6 Add a small luck factor for armour damage to prevent complete invulnerabilities 2013-05-20 22:33:30 +08:00
origamiwolf bb56645fb0 Indentation cleanup 2013-05-20 22:28:48 +08:00
origamiwolf 04bd38a2ab Use coverage to determine if armour is hit, and thickness to determine damage absorption and armour damage 2013-05-20 22:23:13 +08:00
fnord 78591cd9ca Changing square resets page and position in list. Active border color yellow. 2013-05-20 02:11:26 -05:00
fnord fe2b68697b item colors for active window (green for usable ammo, blue for useful books etc) 2013-05-20 01:57:36 -05:00
fnord 4d27d8a250 Currently active window border is green. For windows, this requires
dab2041d158d804ae1fec8af937af3f145ab1c44 ( catacurse_wborder_fix )
2013-05-20 01:51:41 -05:00
fnord c474d10f77 Restructuring sorting to add less clutter. 2013-05-20 01:50:11 -05:00
fnord 600130b1a1 wborder() should not wattron(win, c_white): ncurses does not, and it prevents custom border colors
via 'wattron(win, c_green);  wborder(win, ...);  wattroff(win, c_green);'
2013-05-20 01:34:46 -05:00
Ethan "Soron" Kaminski 602e64dafe Update changelog for everything since 0.5 2013-05-20 17:42:27 +12:00
acidia 22f93982df small mission dialogue edits 2013-05-19 20:39:05 -05:00
acidia 6bb10531bc Added Jabberwock monster 2013-05-19 19:43:39 -05:00
acidia eb345f04c2 Added Jabberwock monster 2013-05-19 19:42:36 -05:00
acidia 96a4d54295 Added Jabberwock monster 2013-05-19 19:41:23 -05:00
acidia ca9a57c684 Added Kill Jabberwock mission 2013-05-19 19:39:49 -05:00
acidia 9074961c55 Added Kill Jabberwock 2013-05-19 19:38:03 -05:00
acidia 909ca50c49 Adding place_jabberwock 2013-05-19 19:33:10 -05:00
acidia c0f8cea2cf Added Kill Jabberwock 2013-05-19 19:30:14 -05:00
origamiwolf c4318c4e3d Made bash_resist and cut_resist accessors const 2013-05-20 07:51:57 +08:00
acidia 14eb3ddd4f Added Corporate Accounting Ledger, Patient Records, and National Weather Transcripts 2013-05-19 17:49:23 -04:00
acidia 8a3bec3f62 Added spawning of unique items for quests 2013-05-19 16:43:08 -05:00
acidia 697cba3bb5 Added new missions to mission_id 2013-05-19 16:28:37 -05:00
acidia b5087e1ed4 Added new missions... 2013-05-19 16:27:27 -05:00
acidia fd689a4a3b Added dialogue for 4 of the new missions 2013-05-19 16:26:00 -05:00
acidia e38776ab89 Added Corporate Accounting Ledger, Patient Records, and National Weather Transcripts 2013-05-19 16:17:59 -05:00
acidia 06696b6002 Added the small relic for the cathedral fetch quest 2013-05-19 16:11:58 -04:00
acidia 491273bd35 Added Cathedral
The towers will get filled in with the addition of z-levels...
2013-05-19 16:08:24 -04:00
acidia 4182ff8bf5 Added Cathedral 2013-05-19 15:05:51 -05:00
acidia 49589a2406 Added Cathedral 2013-05-19 16:03:19 -04:00
fnord 65e992f0c2 Advanced inventory now remembers the last sorting method of each
pane. This is only per game session, pending a method to add trivial
variables without breaking savegames.
2013-05-19 14:04:29 -05:00
fnord 15df8f7f37 Typo correction(s) and sanity check 2013-05-19 12:11:43 -05:00
fnord 73378e1456 Documented sort key and current sorting method 2013-05-19 12:04:07 -05:00
fnord 6bf376f3cf Advanced inventory will now sort via the 's' key: unsorted (order that
items were added), by name, weight, volume, and charges. (pending more).
Also:
* up/down in the 'e'xamine window will move to the next / previous
item in the list.
* weight and volume are displayed for ground / car squares
2013-05-19 11:48:55 -05:00
acidia 1708fc2b3b Added find flag dialogue 2013-05-19 12:22:57 -04:00
acidia 91f2a5a00a Added Find Flag 2013-05-19 11:19:04 -05:00
acidia 748d7561d8 Added GET_FLAG 2013-05-19 11:18:14 -05:00
acidia 1faf1e61c0 Added American Flag 2013-05-19 11:14:54 -05:00
acidia 2dbd68c703 Added American Flag Spawn for School 2013-05-19 11:13:11 -05:00
origamiwolf 08e8426cbd Added a new function and UI to re-layer clothing 2013-05-20 00:00:57 +08:00
origamiwolf c68bb0f295 Fully separate armour geometry from materials 2013-05-19 14:47:20 +08:00
Ethan "Soron" Kaminski ef62aeaa65 Rework learning mechanics, following issue #613
Implements items 1 through 5, from issue #613.
2013-05-19 16:50:20 +12:00
origamiwolf c288630d74 outer layers of armour protect inner layers 2013-05-19 12:30:42 +08:00
Kevin Granade d9de70eb3f Merge remote-tracking branches 'dda/pr/1082' and 'dda/pr/1083' into dda-master
Conflicts:
	game.h
2013-05-18 21:57:57 -05:00
Kevin Granade 9e3482b8ef Reduce difficulty to smash a shrub into underbrush. 2013-05-18 20:48:29 -05:00
Ethan "Soron" Kaminski d578c09c85 Account for ingredient age during cooking 2013-05-19 11:50:14 +12:00
Ethan "Soron" Kaminski 3d03d8c2a7 Stop item tags from spreading during map load 2013-05-19 11:22:14 +12:00
Ethan "Soron" Kaminski 3c70c9475c Fix iuse::sew indentation 2013-05-19 11:02:22 +12:00
Ethan "Soron" Kaminski 68551c1145 Merge PR #1069 - rags and leather for sewing repairs 2013-05-19 10:59:11 +12:00
Ethan "Soron" Kaminski 348e83c86a Merge PR #1076 - scrolling in menus, inventory 2013-05-19 10:37:22 +12:00
Ethan "Soron" Kaminski 3983e49459 Merge PR #1080 - pit constructions 2013-05-19 10:32:09 +12:00
Ethan "Soron" Kaminski a09087b3f2 Merge PR #1038 - scentmap optimization 2013-05-19 10:25:42 +12:00
fnord 4e66ed5cb3 One can now choose to ignore further sound interruptions and complete current task. Example: reloading while dozens of zeds are beating down walls. 2013-05-18 14:16:57 -05:00
origamiwolf ff458e43ea separate out materials contributions to armour protection values 2013-05-19 01:42:44 +08:00
fnord 4466f7e315 Actually remembers selection now. Oops 2013-05-18 12:36:59 -05:00
origamiwolf 1140e5a28a Fixed material not being passed correctly, and added chitin to item factory 2013-05-19 01:06:42 +08:00
Kevin Granade 9bef3b10ef Merge remote-tracking branches 'dda/pr/1077' and 'dda/pr/1078' into dda-master 2013-05-18 10:06:20 -05:00
Kevin Granade eb27dae044 Add pit construction recipe to the start of constructions requiring a pit.
This is to avoid confusion about their apparent unbuildability.
Thanks vache for pointing out this solution.
2013-05-18 10:02:56 -05:00
origamiwolf 0a2bfc91f4 use materials functions in armour absorption code 2013-05-18 22:46:25 +08:00
Kevin Granade d0e47205ea Prevent navagable terrain from receiving the scent-blocking trait. 2013-05-18 09:38:09 -05:00
Kevin Granade 431c9cdb1f Merge remote-tracking branch 'dda/master' into scent-performance 2013-05-18 09:22:06 -05:00
Kevin Granade 2a77a1307e Merge pull request #1052 from ethankaminski/windows-fixes
Catacurse fixes (closes #1045)
2013-05-18 07:20:45 -07:00
fnord 4e964a58f9 inventory will remember last selection position when backing out of per item menu 2013-05-18 08:28:43 -05:00
fnord 37d1a0b365 The inventory now allows selection via up / down / enter keys. 2013-05-18 08:14:49 -05:00
origamiwolf aeee7fa419 Added more materials calls, moved material resistance matrix to json 2013-05-18 19:51:44 +08:00
Ethan "Soron" Kaminski af799bc6c4 Track used items in game::consume_items 2013-05-18 22:59:40 +12:00
fnord efd23ef434 Item menu in inventory allows up/down/enter selection as well. compare_split_screen_popup has been abused further, taking an additional optional argument and returning int instead of char. 2013-05-18 05:55:42 -05:00
Ethan "Soron" Kaminski 0cb717e342 Use a std::list for used item tracking (easier to combine) 2013-05-18 22:46:45 +12:00
Ethan "Soron" Kaminski d13ca72b67 Make containers unloadable again 2013-05-18 22:16:37 +12:00
Ethan "Soron" Kaminski d85b39e41f Use boolean rather than bitwise logic in a conditional 2013-05-18 21:57:47 +12:00
Ethan "Soron" Kaminski 6a570f0c53 Merge PR #1019 - weather handles non-default starting time 2013-05-18 21:42:13 +12:00
fnord 1ec122d162 Background for selected entry extends the entire line. 2013-05-18 04:30:55 -05:00
Ethan "Soron" Kaminski cf1fcdde28 Merge PR #1073 - spontaneous fitting fix 2013-05-18 21:30:35 +12:00
fnord 2dd42317ef menu function allows selection via up/down + enter in addition to
single character.
2013-05-18 03:50:44 -05:00
origamiwolf 7da807e1be set up JSON for materials 2013-05-18 16:38:49 +08:00
Kevin Granade 989be8275d Merge welder fix. 2013-05-17 23:56:16 -05:00
KA101 5485b75e2f Move the "good" appearance mutations to the "good" column 2013-05-17 23:54:25 -05:00
Kevin Granade 55e1197800 Move fitted clothing generation to item spawn method so dropped items don't become fitted. 2013-05-17 23:37:19 -05:00
Kevin Granade 3cb3dce7f2 Extract common code from the two spawn item methods. 2013-05-17 23:36:20 -05:00
Ethan "Soron" Kaminski 294c04cc1e Actually use the iterator variable in a for loop 2013-05-18 13:40:42 +12:00
Ethan "Soron" Kaminski 9bbefa16e8 Allow tracking of consumed items 2013-05-18 13:39:41 +12:00
Ethan "Soron" Kaminski b66fd49c8e Add a debug message if no components are available 2013-05-18 13:05:48 +12:00
Ethan "Soron" Kaminski 424bcf0b5d Re-indent game::consume_items 2013-05-18 13:04:16 +12:00
alex-gh 78d87c8e4c Make sewing use rags/leather. 2013-05-18 02:00:11 +02:00
alex-gh 11f18517f4 Check if we have enough rags/leather before sewing. 2013-05-18 01:44:39 +02:00
Kevin Granade 7eff9b9fe1 Merge remote-tracking branch 'dda/pr/1051' into dda-master 2013-05-17 18:16:59 -05:00
Kevin Granade fec629aa4f Merge remote-tracking branch 'dda/pr/1021' into dda-master 2013-05-17 18:15:17 -05:00
Ethan "Soron" Kaminski 66e8cdf26b Merge PR #929 - air conditioning 2013-05-18 10:58:49 +12:00
fnord 015a8b5284 initilization fix, redux 2013-05-17 17:27:14 -05:00
fnord 6ad3169434 Merge remote branch 'origin/master' into air_conditioning 2013-05-17 11:33:35 -05:00
maseck 0379189c17 Fixed errors in original commit 2013-05-17 11:06:56 -04:00
origamiwolf ac4c785fb8 Added chitin as a material 2013-05-17 21:26:39 +08:00
origamiwolf e08ceb81db Rewrite armour damage code 2013-05-17 21:13:23 +08:00
origamiwolf 4495a9369f Rewrite armor damage absorption code 2013-05-17 20:38:43 +08:00
Ethan "Soron" Kaminski 11fac6058d Fix welder charges, allow code to force-mark tools as available 2013-05-17 23:16:22 +12:00
alex-gh 098887a329 Moved bone broth to the food crafting category. 2013-05-17 13:13:15 +02:00
Ethan "Soron" Kaminski f394fa7b92 Make bone broth made of flesh, normalize toolset charges 2013-05-17 22:28:08 +12:00
Ethan "Soron" Kaminski 0da409648c Merge PR #1049 - add bone broth 2013-05-17 18:41:07 +12:00
Ethan "Soron" Kaminski 9108c53e5d Merge PR #1044 - advanced inventory changes 2013-05-17 18:23:55 +12:00
Ethan "Soron" Kaminski 22c3301c5b Make hoses usable (as a tool) to siphon gas 2013-05-17 16:06:25 +12:00
Ethan "Soron" Kaminski e22b6f6e81 Make siphoning take the same time as refueling 2013-05-17 15:29:39 +12:00
Ethan "Soron" Kaminski 2ab5e43c29 Siphoning is possible on any tile of the vehicle now 2013-05-17 15:26:58 +12:00
Ethan "Soron" Kaminski 40318b986d Add missing return statement to catacurse's getch() 2013-05-17 14:43:01 +12:00
maseck a8051ba330 Create arrays for n/e/s/w_fac and t_north/east/south/west 2013-05-16 22:26:13 -04:00
alex-gh d4bbbf352b Buffed bone broth to make up for a long cooking time 2013-05-17 03:06:35 +02:00
alex-gh 95b0f791c2 Added bone broth. 2013-05-17 03:05:12 +02:00
Ethan "Soron" Kaminski 6f1ddd2126 Make newwin in catacurse correctly handle 0 for ncols/nlines 2013-05-17 13:04:41 +12:00
Kevin Granade 03153ebfc5 Merge pull request #1046 from ethankaminski/bolt-category
Moved bolts to ammo category, like arrows
2013-05-16 17:36:58 -07:00
Kevin Granade 2e475fa83d Merge bugfixes du jour. 2013-05-16 19:19:25 -05:00
Kevin Granade b0345c2f7b Update unit test to use overmapbuffer. 2013-05-16 19:13:43 -05:00
Kevin Granade 9f94ff602b Exit early from map::field_at() if trhere are no fields in the current submap. 2013-05-16 19:13:09 -05:00
Kevin Granade ec1f8c0656 Further cleanup of update_scent, and handle barrier scent attenuation properly. 2013-05-16 19:12:31 -05:00
alex-gh 8f9f2b81fa random_good_bionic() should no longer return faulty bionics. 2013-05-17 01:28:41 +02:00
Kevin Granade 2e40eeaf57 Move STARTING_MINUTES to mongroupdef.cpp since it's the only place it's used now. 2013-05-16 17:52:11 -05:00
Kevin Granade 195d8caba5 Don't add in the starting time offset to the initial weather change calculation, it's alreadt in OPT_INITIAL_TIME. 2013-05-16 17:51:36 -05:00
Ethan "Soron" Kaminski f0eb67f2df Moved bolts to ammo category, like arrows 2013-05-17 10:41:22 +12:00
fnord aec010d4aa Unclobber cleanup 2013-05-16 10:35:30 -05:00
fnord 61d7722d58 advanced_inv: refactor. Struct contains all window pane specific variables,
eliminating code duplication in anticipation of further functionality.
Space now exits. 'i' selects inventory. Scrolling past end of page
advances to next page.
2013-05-16 10:26:44 -05:00
origamiwolf 5510fdda83 Alter glowstick behaviour to match reality 2013-05-16 21:30:32 +08:00
Ethan "Soron" Kaminski c2d5d6b845 Prevent unloading of M72 LAW and NX-17 Charge Rifle 2013-05-16 20:57:43 +12:00
Ethan "Soron" Kaminski 688263a4b2 Merge PR #1033 - item tags as sets 2013-05-16 18:20:56 +12:00
Ethan "Soron" Kaminski b505b82a6c Merge pull request #1035 from kevingranade/pad-oper
Add padding argument to coding style specification.
2013-05-15 22:58:48 -07:00
Kevin Granade ed4ca9497d Unrolled and refactored update_scent() to accelerate waiting, reading, etc. 2013-05-16 00:44:28 -05:00
Kevin Granade b04f51abe3 Merge todays bugfixes. 2013-05-15 21:09:59 -05:00
Kevin Granade 41950db139 Merge remote-tracking branch 'dda/pr/1023' into dda-master 2013-05-15 21:06:08 -05:00
Kevin Granade ac3bebf8bc Add padding argument to coding style specification. 2013-05-15 21:04:45 -05:00
Kevin Granade a9e0ee9515 Style cleanup. 2013-05-15 20:58:17 -05:00
Kevin Granade 1bfb4bec63 Merge remote-tracking branch 'dda/pr/986' into dda-master 2013-05-15 20:44:17 -05:00
Kevin Granade d62c714434 Merge remote-tracking branch 'dda/pr/1020' into dda-master 2013-05-15 20:17:49 -05:00
Kevin Granade 1d84ccf2b5 Clean up obsolete item flag enum and tag->enum mapping. 2013-05-15 20:08:04 -05:00
Kevin Granade 9a79713510 Convert item::item_flags to item::item_tags.
Also changing from a bit array to a set of strings.
Applying the same change to item::mode.
2013-05-15 20:08:03 -05:00
Kevin Granade 5f87fcd549 Move some library includes to the end of the list where they belong. 2013-05-15 20:08:03 -05:00
Kevin Granade 98779857d6 Remove obsolete item construction macros. 2013-05-15 20:08:03 -05:00
Kevin Granade e7fb33496e Remove unused flag parameter from item template constructors. 2013-05-15 20:08:03 -05:00
Kevin Granade 1bc4f249de Remove overloaded use of item::mode in preperation for turning it into a string field. 2013-05-15 20:08:03 -05:00
Kevin Granade d6b05e978e Add a catajson method to extract a list of strings as a set for use as tags. 2013-05-15 20:08:03 -05:00
Ethan "Soron" Kaminski 76bbf9779d Merge pull request #1026 from Voker57/fixes
Added missing break to season length option
2013-05-15 16:25:22 -07:00
Fergus Dall aaff40057e Make android give a power source even for passive bionics
Fixes #1027
2013-05-16 08:51:48 +09:30
Ethan "Soron" Kaminski 6dae388bcf Make signs in negative torso smart, like the rest 2013-05-16 11:21:07 +12:00
Voker57 32e2942650 Added missing break to season length option 2013-05-15 18:12:22 +04:00
fnord fd9975c5ff Debug spew removed. Oops 2013-05-15 06:34:50 -05:00
fnord db5c679e8d Dropping stuff into a vehicle container will add charges instead of adding
a new item, if applicable.
2013-05-15 04:24:17 -05:00
Ethan "Soron" Kaminski a6d32cde1a Add fuel siphoning to the game.
You can now siphon fuel from the vehicle examination screen. Requires a hose.

Eventually I'd like to add a Mechanics recipe to make an alternate siphon item out of pipe or something, because hoses are really too rare to be the sole item for something as important as fuel siphoning.
2013-05-15 19:23:20 +12:00
Ethan "Soron" Kaminski f34568ee60 Add a message when nearby corpses rez 2013-05-15 17:52:29 +12:00
Ethan "Soron" Kaminski bbbe83ffdc Fix zombie revival timing - no longer tuned for testing
Whoops, left the code in a testing state when I committed at some point.
2013-05-15 15:36:21 +12:00
Ethan "Soron" Kaminski 01f5296a1d Save state of zombie death drops 2013-05-15 15:30:52 +12:00
Ethan "Soron" Kaminski 3fbca61610 Fix some revification bugs 2013-05-15 15:28:35 +12:00
Ethan "Soron" Kaminski 3367e0cf13 Zombies rise from the dead after a certain amount of time 2013-05-15 14:06:24 +12:00
Ethan "Soron" Kaminski 98220d9e36 Extract corpse-revival code to a method of game 2013-05-15 13:02:59 +12:00
Kevin Granade 2d8967f603 Take starting time option into account when setting initial weather timeout. 2013-05-14 19:42:42 -05:00
Ethan "Soron" Kaminski cbfe708f36 Merge PR #1018 - vehicle collisions less crazy 2013-05-15 12:18:36 +12:00
Kevin Granade 2be2924e05 Merge remote-tracking branch 'dda/pr/1015' into dda-master 2013-05-14 19:10:19 -05:00
Kevin Granade ea7211ab97 Don't allow driverless vehicles to recover from skids. 2013-05-14 18:55:24 -05:00
Kevin Granade 8047cbf4ff Make skidding cause uncontrollable turning rather than uncontrollable impossible vector changes. 2013-05-14 18:55:23 -05:00
Ethan "Soron" Kaminski b7d0bae27e Use correct spelling of "acceptable" in JSON 2013-05-15 11:12:50 +12:00
Ethan "Soron" Kaminski ad1920876c Merge PR #1009 - ammo to JSON 2013-05-15 11:10:13 +12:00
Ethan "Soron" Kaminski 46bcc0845a Merge PR #1011 - purifier fix 2013-05-15 10:42:46 +12:00
Ethan "Soron" Kaminski 95f3b83ff3 Add missing semicolon after catacurse.h function declaration 2013-05-15 10:41:13 +12:00
Ethan "Soron" Kaminski 4ca94f6bb1 Merge PR #985 - more curses functions in catacurse 2013-05-15 10:34:39 +12:00
Ethan "Soron" Kaminski 5edcfdcd26 Change some more odd double vs. int stuff 2013-05-15 10:22:58 +12:00
Ethan "Soron" Kaminski 397b231583 Fix floating-point math to actually use floating point numbers 2013-05-15 10:13:54 +12:00
fnord 6402bcf27b Purifiers will no longer remove starting traits such as 'android',
'skilled liar' or 'nearsighted'
2013-05-14 09:09:44 -05:00
Fergus Dall a720914bb5 Move all gun mods into json raws 2013-05-14 17:41:32 +09:30
fnord e36d22b247 Advanced inventory's weight and volume columns will now display full
stack values. Oops. Small UI comprovements in addition to this:
* The 'same square!' popup can be ignored as it will pass the next
 keypress (except q and esc) and disappear.
* '0' for weight or volume will appear dimmed.
* current/max number of items displayed at top right
* current inventory total displayed above 'weight vol' header.
* [stack amount] moved to it's own column as it's easier to read.
2013-05-13 03:54:49 -05:00
Ben Fox-Moore 70ef2c462d Fix incorrect mvwgetch prototype 2013-05-13 00:12:30 +01:00
Ben Fox-Moore 68952a196e Add wgetch and mvwgetch functions 2013-05-12 23:48:20 +01:00
jason.gilbert@nbed.nb.ca 2054755efa Lowered homeostasis adjustement while hot 2013-05-11 18:24:36 -03:00
jason.gilbert@nbed.nb.ca 44d3adbc92 Tweaked pain due to heat 2013-05-11 18:23:21 -03:00
fnord 7b3f6542e7 Initialize cache vars in class 2013-05-10 21:04:56 -05:00
fnord ec96820550 Temperature: Bio climate mod will only modify comfort levels if active.
Traditional air conditioning will modify comfort levels in addition
to bio climate mod. This wraps the has_bionic("bio_climate") check in
a new player::in_climate_control(game g*) function, which will return
positive on has_active_bionic("bio_climate"). If not, it will perform
additional checks that are cached every 20-60 turns to save cpu and
simulate temperature acclimation.
Currently, it will check to see if the player is inside a vehicle
with no open doors, and a working engine with fuel (total_power(true)).
Later a requirement for an Air Conditioning vehicle item can be added,
as well as building checks if / when building power is added.
2013-05-10 07:44:00 -05:00
Shoes01 bb1872ac1a Disease.cpp fixes 2013-05-09 18:51:42 -07:00
102 changed files with 8534 additions and 3440 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ Current policy is to update code to the standard style when changing a
substantial portion of it. Blocks of code can be passed through astyle
to ensure that their formatting is correct:
astyle --style=allman --indent=spaces=4 --add-brackets --align-pointer=name
astyle --style=allman --indent=spaces=4 --add-brackets --align-pointer=name -p
For example, from vi, set marks a and b around the block, then:
:'a,'b ! astyle --style=allman --indent=spaces=4 --add-brackets --align-pointer=name
+4
View File
@@ -33,6 +33,8 @@
<Unit filename="bionics.h" />
<Unit filename="bodypart.cpp" />
<Unit filename="bodypart.h" />
<Unit filename="building_generation.cpp" />
<Unit filename="building_generation.h" />
<Unit filename="calendar.cpp" />
<Unit filename="calendar.h" />
<Unit filename="catacurse.cpp" />
@@ -106,6 +108,8 @@
<Unit filename="mapgenformat.h" />
<Unit filename="mapitems.h" />
<Unit filename="mapitemsdef.cpp" />
<Unit filename="material.h" />
<Unit filename="material.cpp" />
<Unit filename="melee.cpp" />
<Unit filename="mission.cpp" />
<Unit filename="mission.h" />
+34 -1
View File
@@ -61,6 +61,39 @@
{ot_toxic_dump, 0, 5, 15, -1, mcat_null, 0, 0, 0, 0, &omspec_place::wilderness,0}
The comments given in source code to structure struct overmap_special explains the meaning of these constants in the example above.
1.4 Adding/editing armour and how armour protection is calculated
1) Edit armor.json and add your armor item near similar types.
2) The fields are:
"type" : "ARMOR", // this must be ARMOR
"id" : "socks", // the identifier used by the game. Must be one continuous word, use underscores if necessary
"name" : "socks", // the name appearing in the examine box. Can be more than one word separated by spaces
"weight" : 1, // weight of armour
"color" : "blue", // ascii character colour
"covers" : ["FEET"], // where it covers. Possible options are TORSO, HEAD, EYES, MOUTH, ARMS, HANDS, LEGS, FEET
"to_hit" : 0, // bonus if using it as a melee weapon (whatever for?)
"storage" : 0, // how many volume storage slots it adds
"symbol" : "[", // ascii character
"description" : "Socks. Put 'em on your feet.", // description of armour
"price" : 100, // price of armour, used when bartering with NPCs
"material" : ["COTTON", "NULL"], // material types. See materials.json for possible options
"volume" : 1, // volume occupied
"cutting" : 0, // cutting damage caused by using it as a melee weapon
"warmth" : 10, // how much warmth clothing provides
"phase" : "solid", // what phase it is
"enviromental_protection" : 0, // how much environmental protection it affords
"rarity" : 70, // determines how often it spawns
"encumberance" : 0, // base encumbrance (unfitted value)
"bashing" : -5, // bashing damage caused by using it as a melee weapon
"flags" : ["VARSIZE"] // used to indicate clothing type which can be fitted. Leave out the flags field entirely if clothing cannot be fitted
"coverage" : 80, // what percentage of body part
"material_thickness" : 1 // thickness of material, in millimetre units (approximately). Generally ranges between 1 - 5, more unusual armour types go up to 10 or more
3) When the player is hit at a specific body part, armour coverage determines whether the armour is hit, or an uncovered part of the player is hit (roll 1d100 against coverage)
4) If the above roll fails (ie roll value is above coverage), then the armour does not absorb any damage from the blow, neither does it become damaged
5) If the above roll succeeds, the armour is hit, possibly absorbing some damage and possibly getting damaged in the process
6) The above steps are repeated for each layer of armour on the body part
7) Armour protects against bash and cut damage. These are determined by multiplying the armour thickness by the material bash/cut resistance factor respectively, given in materials.json
8) If the armour is made from 2 materials types, then it takes a weighted average of the primary material (66%) and secondary material (33%).
9) Materials resistance factors are given relative to PAPER as a material (this probably needs some fine-tuning for balance).
FAQ
Q: What the heck is up with the map objects?
@@ -84,4 +117,4 @@ An overmap encapsulates the large-scale structure of a map
FAQ
Q: what is the relation of NPCS/Monsters vs maps. How are they stored, where are they stored? Are they stored?
A: All npcs are now stored in the overmap. Active npcs only contain the currently active npcs. There is a difference between npc active npc coordinates, and overmap coordinates. So these will need to be changed when saving the npcs. Or else the npcs will be saved at the wrong location. And yes they are stored.
A: All npcs are now stored in the overmap. Active npcs only contain the currently active npcs. There is a difference between npc active npc coordinates, and overmap coordinates. So these will need to be changed when saving the npcs. Or else the npcs will be saved at the wrong location. And yes they are stored.
+1 -1
View File
@@ -152,7 +152,7 @@ $(TARGET): $(ODIR) $(DDIR) $(OBJS)
.PHONY: version
version:
@( VERSION_STRING=$(VERSION) ; \
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --dirty ) && VERSION_STRING=$$GITVERSION ; \
[ -e ".git" ] && GITVERSION=$$( git describe --tags --always --dirty --match "[0-9]*.[0-9]*" ) && VERSION_STRING=$$GITVERSION ; \
[ -e "version.h" ] && OLDVERSION=$$(grep VERSION version.h|cut -d '"' -f2) ; \
if [ "x$$VERSION_STRING" != "x$$OLDVERSION" ]; then echo "#define VERSION \"$$VERSION_STRING\"" | tee version.h ; fi \
)
+4
View File
@@ -196,6 +196,8 @@ std::string action_ident(action_id act)
return "drop_adj";
case ACTION_BIONICS:
return "bionics";
case ACTION_SORT_ARMOR:
return "sort_armor";
case ACTION_WAIT:
return "wait";
case ACTION_CRAFT:
@@ -366,6 +368,8 @@ std::string action_name(action_id act)
return "Drop Item to Adjacent Tile";
case ACTION_BIONICS:
return "View/Activate Bionics";
case ACTION_SORT_ARMOR:
return "Re-layer armour/clothing";
case ACTION_WAIT:
return "Wait for Several Minutes";
case ACTION_CRAFT:
+1
View File
@@ -58,6 +58,7 @@ ACTION_SELECT_FIRE_MODE,
ACTION_DROP,
ACTION_DIR_DROP,
ACTION_BIONICS,
ACTION_SORT_ARMOR,
// Long-term / special actions
ACTION_WAIT,
ACTION_CRAFT,
+33 -31
View File
@@ -245,53 +245,53 @@ artifact_tool_form_datum artifact_tool_form_data[NUM_ARTTOOLFORMS] = {
};
artifact_weapon_datum artifact_weapon_data[NUM_ARTWEAPS] = {
{"", 0, 0, 0, 0, 0, 0, 0, 0, 0},
{"", 0, 0, 0, 0, 0, 0, 0, 0, ""},
// Adjective Vol,wgt Bash Cut To-Hit
{"Heavy", 0, 12, 10, 20, 0, 0, -2, 0,
0},
""},
{"Knobbed", 1, 2, 14, 30, 0, 0, -1, 1,
0},
""},
{"Spiked", 1, 1, 0, 0, 20, 40, -1, 1,
mfb(IF_SPEAR)},
"SPEAR"},
{"Edged", 2, 4, 0, 0, 20, 50, -1, 2,
0},
""},
{"Bladed", 1, 2, 0, 0, 12, 30, -1, 1,
mfb(IF_STAB)}
"STAB"}
};
artifact_armor_form_datum artifact_armor_form_data[NUM_ARTARMFORMS] = {
{"", c_white, MNULL, MNULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Robe", c_red, WOOL, MNULL, 6, 6, 1, 3, 1, 0, 2, 0, -8, 0, -3,
// Name color Materials Vol Wgt Enc Cov Thk Env Wrm Sto Bsh Cut Hit
{"Robe", c_red, WOOL, MNULL, 6, 6, 1, 3, 3, 0, 2, 0, -8, 0, -3,
mfb(bp_torso)|mfb(bp_legs), false,
{ARMORMOD_LIGHT, ARMORMOD_BULKY, ARMORMOD_POCKETED, ARMORMOD_FURRED,
ARMORMOD_PADDED}},
{"Coat", c_brown,LEATHER,MNULL, 14, 14, 2, 4, 12, 1, 4, 4, -6, 0, -3,
{"Coat", c_brown,LEATHER,MNULL, 14, 14, 2, 3, 2, 1, 4, 4, -6, 0, -3,
mfb(bp_torso), false,
{ARMORMOD_LIGHT, ARMORMOD_POCKETED, ARMORMOD_FURRED, ARMORMOD_PADDED,
ARMORMOD_PLATED}},
{"Mask", c_white, WOOD, MNULL, 4, 1, 2, 2, 16, 1, 2, 0, 2, 0, -2,
{"Mask", c_white, WOOD, MNULL, 4, 1, 2, 2, 2, 1, 2, 0, 2, 0, -2,
mfb(bp_eyes)|mfb(bp_mouth), false,
{ARMORMOD_FURRED, ARMORMOD_FURRED, ARMORMOD_NULL, ARMORMOD_NULL,
ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Helm", c_dkgray,SILVER, MNULL, 6, 6, 2, 4, 18, 0, 1, 0, 8, 0, -2,
// Name color Materials Vol Wgt Enc Cov Thk Env Wrm Sto Bsh Cut Hit
{"Helm", c_dkgray,SILVER, MNULL, 6, 6, 2, 3, 3, 0, 1, 0, 8, 0, -2,
mfb(bp_head), false,
{ARMORMOD_BULKY, ARMORMOD_FURRED, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
{"Gloves", c_ltblue,LEATHER,MNULL, 2, 1, 1, 6, 6, 1, 2, 0, -4, 0, -2,
{"Gloves", c_ltblue,LEATHER,MNULL, 2, 1, 1, 3, 3, 1, 2, 0, -4, 0, -2,
mfb(bp_hands), true,
{ARMORMOD_BULKY, ARMORMOD_FURRED, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
// Name color Materials Vol Wgt Enc Dmg Cut Env Wrm Sto Bsh Cut Hit
{"Boots", c_blue, LEATHER, MNULL, 6, 2, 1, 6, 6, 1, 3, 0, 4, 0, -1,
// Name color Materials Vol Wgt Enc Cov Thk Env Wrm Sto Bsh Cut Hit
{"Boots", c_blue, LEATHER, MNULL, 6, 2, 1, 3, 3, 1, 3, 0, 4, 0, -1,
mfb(bp_feet), true,
{ARMORMOD_LIGHT, ARMORMOD_BULKY, ARMORMOD_PADDED, ARMORMOD_PLATED,
ARMORMOD_NULL}},
@@ -308,7 +308,7 @@ artifact_armor_form_datum artifact_armor_mod_data[NUM_ARMORMODS] = {
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
// Description; "It is ..." or "They are ..."
{"very thin and light.", c_white, MNULL, MNULL,
// Vol Wgt Enc Dmg Cut Env Wrm Sto
// Vol Wgt Enc Cov Thk Env Wrm Sto
-4, -8, -2, -1, -1, -1, -1, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
@@ -322,15 +322,15 @@ artifact_armor_form_datum artifact_armor_mod_data[NUM_ARMORMODS] = {
{"disgustingly furry.", c_white, WOOL, MNULL,
// Vol Wgt Enc Dmg Cut Env Wrm Sto
4, 2, 1, 4, 0, 1, 3, 0, 0, 0, 0, 0, false,
4, 2, 1, 1, 1, 1, 3, 0, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"leather-padded.", c_white, LEATHER, MNULL,
4, 4, 1, 10, 4, 0, 1, -3, 0, 0, 0, 0, false,
4, 4, 1, 1, 1, 0, 1, -3, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
{"plated in iron.", c_white, IRON, MNULL,
4, 12, 3, 8, 14, 0, 1, -4, 0, 0, 0, 0, false,
4, 12, 3, 2, 2, 0, 1, -4, 0, 0, 0, 0, false,
{ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL, ARMORMOD_NULL}},
};
@@ -372,7 +372,9 @@ itype* game::new_artifact()
art->melee_dam = rng(weapon->bash_min, weapon->bash_max);
art->melee_cut = rng(weapon->cut_min, weapon->cut_max);
art->m_to_hit = rng(weapon->to_hit_min, weapon->to_hit_max);
art->item_flags = weapon->flags;
if( weapon->tag != "" ) {
art->item_tags.insert(weapon->tag);
}
// Add an extra weapon perhaps?
if (one_in(2)) {
int select = rng(0, 2);
@@ -383,7 +385,9 @@ itype* game::new_artifact()
art->melee_dam += rng(weapon->bash_min, weapon->bash_max);
art->melee_cut += rng(weapon->bash_min, weapon->bash_max);
art->m_to_hit += rng(weapon->to_hit_min, weapon->to_hit_max);
art->item_flags |= weapon->flags;
if( weapon->tag != "" ) {
art->item_tags.insert(weapon->tag);
}
std::stringstream newname;
newname << weapon->adjective << " " << info->name;
art->name = artifact_name(newname.str());
@@ -503,11 +507,10 @@ It may have unknown powers; use 'a' to activate them.";
art->melee_dam = info->melee_bash;
art->melee_cut = info->melee_cut;
art->m_to_hit = info->melee_hit;
art->item_flags = 0;
art->covers = info->covers;
art->encumber = info->encumb;
art->dmg_resist = info->dmg_resist;
art->cut_resist = info->cut_resist;
art->coverage = info->coverage;
art->thickness = info->thickness;
art->env_resist = info->env_resist;
art->warmth = info->warmth;
art->storage = info->storage;
@@ -534,15 +537,15 @@ It may have unknown powers; use 'a' to activate them.";
art->encumber += modinfo->encumb;
if (modinfo->dmg_resist > 0 || art->dmg_resist > abs(modinfo->dmg_resist))
art->dmg_resist += modinfo->dmg_resist;
if (modinfo->coverage > 0 || art->coverage > abs(modinfo->coverage))
art->coverage += modinfo->coverage;
else
art->dmg_resist = 0;
art->coverage = 0;
if (modinfo->cut_resist > 0 || art->cut_resist > abs(modinfo->cut_resist))
art->cut_resist += modinfo->cut_resist;
if (modinfo->thickness > 0 || art->thickness > abs(modinfo->thickness))
art->thickness += modinfo->thickness;
else
art->cut_resist = 0;
art->thickness = 0;
if (modinfo->env_resist > 0 || art->env_resist > abs(modinfo->env_resist))
art->env_resist += modinfo->env_resist;
@@ -616,7 +619,6 @@ itype* game::new_natural_artifact(artifact_natural_property prop)
art->melee_dam = 0;
art->melee_cut = 0;
art->m_to_hit = 0;
art->item_flags = 0;
art->name = property_data->name + " " + shape_data->name;
std::stringstream desc;
+5 -5
View File
@@ -87,7 +87,7 @@ struct artifact_weapon_datum
int bash_min, bash_max;
int cut_min, cut_max;
int to_hit_min, to_hit_max;
unsigned flags : NUM_ITEM_FLAGS;
std::string tag;
};
extern artifact_weapon_datum artifact_weapon_data[NUM_ARTWEAPS];
@@ -112,8 +112,8 @@ struct artifact_armor_form_datum
material m2;
int volume, weight;
int encumb;
int dmg_resist;
int cut_resist;
int coverage;
int thickness;
int env_resist;
int warmth;
int storage;
@@ -130,8 +130,8 @@ struct artifact_armor_form_datum
int Warmth, int Storage, int Bash, int Cut, int Hit, unsigned char Covers,
bool Plural, artifact_armor_mod Mods[5])
: name (Name), color (Color), m1 (M1), m2 (M2), volume (Volume),
weight (Weight), encumb (Encumb), dmg_resist (Dmg_res),
cut_resist (Cut_res), env_resist (Env_res), warmth (Warmth),
weight (Weight), encumb (Encumb), coverage (Coverage),
thickness (thickness), env_resist (Env_res), warmth (Warmth),
storage (Storage), melee_bash (Bash), melee_cut (Cut), melee_hit (Hit),
covers (Covers), plural (Plural), available_mods (Mods) { };
+7 -7
View File
@@ -910,7 +910,7 @@ may cause delayed reaction time and drowsiness.");
bionics["bio_nanobots"] = new bionic_data("Repair Nanobots", false, true, 5, 0, "\
Inside your body is a fleet of tiny dormant robots. Once charged from your\n\
energy banks, they will flit about your body, repairing any damage.");
bionics["bio_heatsink"] = new bionic_data("Thermal Dissapation", false, true, 1, 6, "\
bionics["bio_heatsink"] = new bionic_data("Thermal Dissipation", false, true, 1, 6, "\
Powerful heatsinks supermaterials are woven into your flesh. While powered,\n\
this system will prevent heat damage up to 2000 degrees fahrenheit. Note\n\
that this does not affect your internal temperature.");
@@ -990,31 +990,31 @@ Interfaces your power system with the internal charging port on suits of power a
//Fault Bionics from here on out.
bionics["bio_dis_shock"] = new bionic_data("Electrical Discharge", false, false, 0, 0, "\
A malfunctioning bionic which occasionally discharges electricity through\n\
your body, causing pain and brief paralysis but no damage.");
your body, causing pain and brief paralysis but no damage.",true);
faulty_bionics.push_back("bio_dis_shock");
bionics["bio_dis_acid"] = new bionic_data("Acidic Discharge", false, false, 0, 0, "\
A malfunctioning bionic which occasionally discharges acid into your muscles,\n\
causing sharp pain and minor damage.");
causing sharp pain and minor damage.",true);
faulty_bionics.push_back("bio_dis_shock");
bionics["bio_drain"] = new bionic_data("Electrical Drain", false, false, 0, 0, "\
A malfunctioning bionic. It doesn't perform any useful function, but will\n\
occasionally draw power from your batteries.");
occasionally draw power from your batteries.",true);
faulty_bionics.push_back("bio_drain");
bionics["bio_noise"] = new bionic_data("Noisemaker", false, false, 0, 0, "\
A malfunctioning bionic. It will occasionally emit a loud burst of noise.");
A malfunctioning bionic. It will occasionally emit a loud burst of noise.",true);
faulty_bionics.push_back("bio_noise");
bionics["bio_power_weakness"] = new bionic_data("Power Overload", false, false, 0, 0, "\
Damaged power circuits cause short-circuiting inside your muscles when your\n\
batteries are above 75%%%% capacity, causing greatly reduced strength. This\n\
has no effect if you have no internal batteries.");
has no effect if you have no internal batteries.",true);
faulty_bionics.push_back("bio_power_weakness");
bionics["bio_stiff"] = new bionic_data("Wire-induced Stiffness", false, false, 0, 0, "\
Improperly installed wires cause a physical stiffness in most of your body,\n\
causing increased encumberance.");
causing increased encumberance.",true);
faulty_bionics.push_back("bio_stiff");
}
+380
View File
@@ -0,0 +1,380 @@
#include "building_generation.h"
#include "output.h"
#include "item_factory.h"
mapgendata::mapgendata(oter_id north, oter_id east, oter_id south, oter_id west)
{
t_nesw[0] = north;
t_nesw[1] = east;
t_nesw[2] = south;
t_nesw[3] = west;
n_fac = 0;
e_fac = 0;
s_fac = 0;
w_fac = 0;
}
void mapgendata::set_dir(int dir_in, int val)
{
switch (dir_in)
{
case 0:
n_fac = val;
break;
case 1:
e_fac = val;
break;
case 2:
s_fac = val;
break;
case 3:
w_fac = val;
break;
default:
debugmsg("Invalid direction for mapgendata::set_dir. dir_in = %d", dir_in);
break;
}
}
void mapgendata::fill(int val)
{
n_fac = val;
e_fac = val;
s_fac = val;
w_fac = val;
}
int& mapgendata::dir(int dir_in)
{
switch (dir_in)
{
case 0:
return n_fac;
break;
case 1:
return e_fac;
break;
case 2:
return s_fac;
break;
case 3:
return w_fac;
break;
default:
debugmsg("Invalid direction for mapgendata::set_dir. dir_in = %d", dir_in);
//return something just so the compiler doesn't freak out. Not really correct, though.
return n_fac;
break;
}
}
ter_id grass_or_dirt()
{
if (one_in(4))
return t_grass;
return t_dirt;
}
ter_id dirt_or_pile()
{
if (one_in(4))
return t_dirtmound;
return t_dirt;
}
// helper functions below
void mapgen_null(map *m)
{
debugmsg("Generating terrain for ot_null, please report this as a bug");
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
m->ter_set(i, j, t_null);
m->radiation(i, j) = 0;
}
}
}
void mapgen_crater(map *m, mapgendata dat)
{
for(int i = 0; i < 4; i++)
{
if(dat.t_nesw[i] != ot_crater)
{
dat.set_dir(i, 6);
}
}
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
if (rng(0, dat.w_fac) <= i && rng(0, dat.e_fac) <= SEEX * 2 - 1 - i &&
rng(0, dat.n_fac) <= j && rng(0, dat.s_fac) <= SEEX * 2 - 1 - j )
{
m->ter_set(i, j, t_rubble);
m->radiation(i, j) = rng(0, 4) * rng(0, 2);
}
else
{
m->ter_set(i, j, t_dirt);
m->radiation(i, j) = rng(0, 2) * rng(0, 2) * rng(0, 2);
}
}
}
m->place_items(mi_wreckage, 83, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, 0);
}
void mapgen_field(map *m, int turn)
{
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
m->ter_set(i, j, grass_or_dirt());
//------Jovan's-----
if (one_in(120))
{
if (one_in(30))
{
m->ter_set(i, j, t_shrub_blueberry);
}
else
{
m->ter_set(i, j, t_shrub);
}
}
else
if (one_in(1000)) { m->ter_set(i,j, t_mutpoppy); }
//------------------
}
}
m->place_items(mi_field, 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
}
void mapgen_dirtlot(map *m, game *g)
{
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
m->ter_set(i, j, t_dirt);
if (one_in(120))
{
m->ter_set(i, j, t_pit_shallow);
}
else if (one_in(50))
{
m->ter_set(i,j, t_grass);
}
}
}
if (one_in(4))
{
m->add_vehicle (g, veh_truck, 12, 12, 90, -1, -1);
}
}
void mapgen_forest_general(map *m, oter_id terrain_type, mapgendata dat, int turn)
{
switch (terrain_type)
{
case ot_forest_thick:
dat.fill(8);
break;
case ot_forest_water:
dat.fill(4);
break;
case ot_forest:
dat.fill(0);
break;
}
for (int i = 0; i < 4; i++)
{
if (dat.t_nesw[i] == ot_forest || dat.t_nesw[i] == ot_forest_water)
{
dat.dir(i) += 14;
}
else if (dat.t_nesw[i] == ot_forest_thick)
{
dat.dir(i) += 18;
}
}
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEY * 2; j++)
{
int forest_chance = 0, num = 0;
if (j < dat.n_fac)
{
forest_chance += dat.n_fac - j;
num++;
}
if (SEEX * 2 - 1 - i < dat.e_fac)
{
forest_chance += dat.e_fac - (SEEX * 2 - 1 - i);
num++;
}
if (SEEY * 2 - 1 - j < dat.s_fac)
{
forest_chance += dat.s_fac - (SEEY * 2 - 1 - j);
num++;
}
if (i < dat.w_fac)
{
forest_chance += dat.w_fac - i;
num++;
}
if (num > 0)
{
forest_chance /= num;
}
int rn = rng(0, forest_chance);
if ((forest_chance > 0 && rn > 13) || one_in(100 - forest_chance))
{
if (one_in(250))
{
m->ter_set(i, j, t_tree_apple);
m->spawn_item(i, j, item_controller->find_template("apple"), turn);
}
else
{
m->ter_set(i, j, t_tree);
}
}
else if ((forest_chance > 0 && rn > 10) || one_in(100 - forest_chance))
{
m->ter_set(i, j, t_tree_young);
}
else if ((forest_chance > 0 && rn > 9) || one_in(100 - forest_chance))
{
if (one_in(250))
{
m->ter_set(i, j, t_shrub_blueberry);
}
else
{
m->ter_set(i, j, t_underbrush);
}
}
else
{
m->ter_set(i, j, t_dirt);
}
}
}
m->place_items(mi_forest, 60, 0, 0, SEEX * 2 - 1, SEEY * 2 - 1, true, turn);
if (terrain_type == ot_forest_water)
{
// Reset *_fac to handle where to place water
for (int i = 0; i < 4; i++)
{
if (dat.t_nesw[i] == ot_forest_water)
{
dat.set_dir(i, 2);
}
else if (dat.t_nesw[i] >= ot_river_center && dat.t_nesw[i] <= ot_river_nw)
{
dat.set_dir(i, 3);
}
else if (dat.t_nesw[i] == ot_forest || dat.t_nesw[i] == ot_forest_thick)
{
dat.set_dir(i, 1);
}
else
{
dat.set_dir(i, 0);
}
}
int x = SEEX / 2 + rng(0, SEEX), y = SEEY / 2 + rng(0, SEEY);
for (int i = 0; i < 20; i++)
{
if (x >= 0 && x < SEEX * 2 && y >= 0 && y < SEEY * 2)
{
if (m->ter(x, y) == t_water_sh)
{
m->ter_set(x, y, t_water_dp);
}
else if (m->ter(x, y) == t_dirt || m->ter(x, y) == t_underbrush)
{
m->ter_set(x, y, t_water_sh);
}
}
else
{
i = 20;
}
x += rng(-2, 2);
y += rng(-2, 2);
if (x < 0 || x >= SEEX * 2)
{
x = SEEX / 2 + rng(0, SEEX);
}
if (y < 0 || y >= SEEY * 2)
{
y = SEEY / 2 + rng(0, SEEY);
}
for (int j = 0; j < dat.n_fac; j++)
{
int wx = rng(0, SEEX * 2 -1), wy = rng(0, SEEY - 1);
if (m->ter(wx, wy) == t_dirt || m->ter(wx, wy) == t_underbrush)
{
m->ter_set(wx, wy, t_water_sh);
}
}
for (int j = 0; j < dat.e_fac; j++)
{
int wx = rng(SEEX, SEEX * 2 - 1), wy = rng(0, SEEY * 2 - 1);
if (m->ter(wx, wy) == t_dirt || m->ter(wx, wy) == t_underbrush)
{
m->ter_set(wx, wy, t_water_sh);
}
}
for (int j = 0; j < dat.s_fac; j++)
{
int wx = rng(0, SEEX * 2 - 1), wy = rng(SEEY, SEEY * 2 - 1);
if (m->ter(wx, wy) == t_dirt || m->ter(wx, wy) == t_underbrush)
{
m->ter_set(wx, wy, t_water_sh);
}
}
for (int j = 0; j < dat.w_fac; j++)
{
int wx = rng(0, SEEX - 1), wy = rng(0, SEEY * 2 - 1);
if (m->ter(wx, wy) == t_dirt || m->ter(wx, wy) == t_underbrush)
{
m->ter_set(wx, wy, t_water_sh);
}
}
}
int rn = rng(0, 2) * rng(0, 1) * (rng(0, 1) + rng(0, 1));// Good chance of 0
for (int i = 0; i < rn; i++)
{
x = rng(0, SEEX * 2 - 1);
y = rng(0, SEEY * 2 - 1);
m->add_trap(x, y, tr_sinkhole);
if (m->ter(x, y) != t_water_sh)
{
m->ter_set(x, y, t_dirt);
}
}
}
if (one_in(100)) // One in 100 forests has a spider living in it :o
{
for (int i = 0; i < SEEX * 2; i++)
{
for (int j = 0; j < SEEX * 2; j++)
{
if ((m->ter(i, j) == t_dirt || m->ter(i, j) == t_underbrush) && !one_in(3))
{
m->add_field(NULL, i, j, fd_web, rng(1, 3));
}
}
}
m->add_spawn(mon_spider_web, rng(1, 2), SEEX, SEEY);
}
}
+32
View File
@@ -0,0 +1,32 @@
#ifndef _BUILDING_GENERATION_H_
#define _BUILDING_GENERATION_H_
#include "omdata.h"
#include "map.h"
struct mapgendata
{
public:
oter_id t_nesw[4];
int n_fac; // dir == 0
int e_fac; // dir == 1
int s_fac; // dir == 2
int w_fac; // dir == 3
mapgendata(oter_id north, oter_id east, oter_id south, oter_id west);
void set_dir(int dir_in, int val);
void fill(int val);
int& dir(int dir_in);
};
ter_id grass_or_dirt();
ter_id dirt_or_pile();
// helper functions for mapgen.cpp, so that we can avoid having a massive switch statement (sorta)
void mapgen_null(map *m);
void mapgen_crater(map *m, mapgendata dat);
void mapgen_field(map *m, int turn);
void mapgen_dirtlot(map *m, game *g);
void mapgen_forest_general(map *m, oter_id terrain_type, mapgendata dat, int turn);
#endif
-3
View File
@@ -3,9 +3,6 @@
#include <string>
// How many minutes exist when the game starts - 8:00 AM
#define STARTING_MINUTES 480
// Convert minutes, hours, days to turns
#define MINUTES(x) ((x) * 10)
#define HOURS(x) ((x) * 600)
+33 -8
View File
@@ -1,6 +1,7 @@
#if (defined _WIN32 || defined WINDOWS)
#include "catacurse.h"
#include "options.h"
#include "output.h"
#include "color.h"
#include <cstdlib>
#include <fstream>
@@ -48,7 +49,7 @@ bool WinCreate()
int WinBorderWidth;
int WinTitleSize;
unsigned int WindowStyle;
const WCHAR *szTitle= (L"Cataclysm: Dark Days Ahead - 0.5");
const WCHAR *szTitle= (L"Cataclysm: Dark Days Ahead - 0.6git");
WinTitleSize = GetSystemMetrics(SM_CYCAPTION); //These lines ensure
WinBorderWidth = GetSystemMetrics(SM_CXDLGFRAME) * 2; //that our window will
WinBorderHeight = GetSystemMetrics(SM_CYDLGFRAME) * 2; // be a perfect size
@@ -359,6 +360,16 @@ WINDOW *newwin(int nlines, int ncols, int begin_y, int begin_x)
return NULL; //it's the caller's problem now (since they have logging functions declared)
}
// default values
if (ncols == 0)
{
ncols = TERMX - begin_x;
}
if (nlines == 0)
{
nlines = TERMY - begin_y;
}
int i,j;
WINDOW *newwindow = new WINDOW;
//newwindow=&_windows[WindowCount];
@@ -428,7 +439,10 @@ inline void addedchar(WINDOW *win){
//Borders the window with fancy lines!
int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl, chtype tr, chtype bl, chtype br)
{
/*
ncurses does not do this, and this prevents: wattron(win, c_customBordercolor); wborder(win, ...); wattroff(win, c_customBorderColor);
wattron(win, c_white);
*/
int i, j;
int oldx=win->cursorx;//methods below move the cursor, save the value!
int oldy=win->cursory;//methods below move the cursor, save the value!
@@ -474,14 +488,19 @@ int refresh(void)
return wrefresh(mainwin);
};
int getch(void)
{
return wgetch(mainwin);
}
//Not terribly sure how this function is suppose to work,
//but jday helped to figure most of it out
int getch(void)
int wgetch(WINDOW* win)
{
// standards note: getch is sometimes required to call refresh
// see, e.g., http://linux.die.net/man/3/getch
// so although it's non-obvious, that refresh() call (and maybe InvalidateRect?) IS supposed to be there
refresh();
wrefresh(win);
InvalidateRect(WindowHandle,NULL,true);
lastchar=ERR;//ERR=-1
if (inputdelay < 0)
@@ -521,6 +540,12 @@ int mvgetch(int y, int x)
return getch();
}
int mvwgetch(WINDOW* win, int y, int x)
{
move(y, x);
return wgetch(win);
}
int getnstr(char *str, int size)
{
int startX = mainwin->cursorx;
@@ -754,20 +779,20 @@ int start_color(void)
windowsPalette=new RGBQUAD[16]; //Colors in the struct are BGR!! not RGB!!
windowsPalette[0]= BGR(0,0,0); // Black
windowsPalette[1]= BGR(0, 0, 255); // Red
windowsPalette[2]= BGR(0,100,0); // Green
windowsPalette[2]= BGR(0,110,0); // Green
windowsPalette[3]= BGR(23,51,92); // Brown???
windowsPalette[4]= BGR(150, 0, 0); // Blue
windowsPalette[4]= BGR(200, 0, 0); // Blue
windowsPalette[5]= BGR(98, 58, 139); // Purple
windowsPalette[6]= BGR(180, 150, 0); // Cyan
windowsPalette[7]= BGR(196, 196, 196);// Gray
windowsPalette[8]= BGR(77, 77, 77);// Dark Gray
windowsPalette[7]= BGR(150, 150, 150);// Gray
windowsPalette[8]= BGR(99, 99, 99);// Dark Gray
windowsPalette[9]= BGR(150, 150, 255); // Light Red/Salmon?
windowsPalette[10]= BGR(0, 255, 0); // Bright Green
windowsPalette[11]= BGR(0, 255, 255); // Yellow
windowsPalette[12]= BGR(255, 100, 100); // Light Blue
windowsPalette[13]= BGR(240, 0, 255); // Pink
windowsPalette[14]= BGR(255, 240, 0); // Light Cyan?
windowsPalette[15]= BGR(255, 255, 255);
windowsPalette[15]= BGR(255, 255, 255); //White
return SetDIBColorTable(backbuffer, 0, 16, windowsPalette);
};
+2
View File
@@ -116,7 +116,9 @@ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs, chtype tl,
int wrefresh(WINDOW *win);
int refresh(void);
int getch(void);
int wgetch(WINDOW* win);
int mvgetch(int y, int x);
int mvwgetch(WINDOW* win, int y, int x);
int mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...);
int mvprintw(int y, int x, const char *fmt, ...);
int werase(WINDOW *win);
+18
View File
@@ -91,6 +91,24 @@ double catajson::as_double() const
return 0;
}
std::set<std::string> catajson::as_tags()
{
std::set<std::string> tags;
if (is_array())
{
for (set_begin(); has_curr(); next())
{
tags.insert( curr().as_string() );
}
}
else
{
// We should have gotten a string, if not an array.
tags.insert( as_string() );
}
return tags;
}
catajson catajson::get(std::string key) const
{
if (val.is<picojson::object>())
+3
View File
@@ -2,6 +2,7 @@
#define _CATAJSON_H_
#include "picojson.h"
#include <set>
class catajson
{
@@ -16,6 +17,8 @@ public:
int as_int() const;
bool as_bool() const;
double as_double() const;
// accessor for not-so-simple type
std::set<std::string> as_tags();
// accessors in the case of array or object values
catajson get(std::string key) const;
catajson get(int index) const;
+35
View File
@@ -48,3 +48,38 @@ ADDITIONS
unique among the set of such recipes), "decomp_learn" (the level (if any)
when you can learn it from disassembly), "book_learn" (a list of books that
teach the recipe, and the level they teach it at).
1.4 Adding/editing armour and how armour protection is calculated
1) Edit armor.json and add your armor item near similar types.
2) The fields are:
"type" : "ARMOR", // this must be ARMOR
"id" : "socks", // the identifier used by the game. Must be one continuous word, use underscores if necessary
"name" : "socks", // the name appearing in the examine box. Can be more than one word separated by spaces
"weight" : 1, // weight of armour
"color" : "blue", // ascii character colour
"covers" : ["FEET"], // where it covers. Possible options are TORSO, HEAD, EYES, MOUTH, ARMS, HANDS, LEGS, FEET
"to_hit" : 0, // to-hit bonus if using it as a melee weapon (whatever for?)
"storage" : 0, // how many volume storage slots it adds
"symbol" : "[", // ascii character
"description" : "Socks. Put 'em on your feet.", // description of armour
"price" : 100, // price of armour, used when bartering with NPCs
"material" : ["COTTON", "NULL"], // material types. See materials.json for possible options
"volume" : 1, // volume occupied
"cutting" : 0, // cutting damage caused by using it as a melee weapon
"warmth" : 10, // how much warmth clothing provides
"phase" : "solid", // what phase it is
"enviromental_protection" : 0, // how much environmental protection it affords
"rarity" : 70, // determines how often it spawns
"encumberance" : 0, // base encumbrance (unfitted value)
"bashing" : -5, // bashing damage caused by using it as a melee weapon
"flags" : ["VARSIZE"] // used to indicate clothing type which can be fitted. Leave out the flags field entirely if clothing cannot be fitted
"coverage" : 80, // what percentage of body part
"material_thickness" : 1 // thickness of material, in millimetre units (approximately). Generally ranges between 1 - 5, more unusual armour types go up to 10 or more
3) When the player is hit at a specific body part, armour coverage determines whether the armour is hit, or an uncovered part of the player is hit (roll 1d100 against coverage)
4) If the above roll fails (ie roll value is above coverage), then the armour does not absorb any damage from the blow, neither does it become damaged
5) If the above roll succeeds, the armour is hit, possibly absorbing some damage and possibly getting damaged in the process
6) The above steps are repeated for each layer of armour on the body part
7) Armour protects against bash and cut damage. These are determined by multiplying the armour thickness by the material bash/cut resistance factor respectively, given in materials.json
8) If the armour is made from 2 materials types, then it takes a weighted average of the primary material (66%) and secondary material (33%).
9) Materials resistance factors are given relative to PAPER as a material (this probably needs some fine-tuning for balance).
+72
View File
@@ -693,6 +693,53 @@ of pureed bone & LSD.");
}
}
break;
case COMPACT_DATA_ANAL:
for (int x = g->u.posx - 2; x <= g->u.posx + 2; x++) {
for (int y = g->u.posy - 2; y <= g->u.posy + 2; y++) {
if (g->m.ter(x, y) == t_floor_blue) {
print_error("PROCESSING DATA");
if (g->m.i_at(x, y).empty()){
print_error("ERROR: Please place memory bank in scan area.");
query_any("Press any key to continue...");}
else if (g->m.i_at(x, y).size() > 1){
print_error("ERROR: Please only scan one item at a time.");
query_any("Press any key to continue...");}
else if (g->m.i_at(x, y)[0].type->id != "usb_drive" && g->m.i_at(x, y)[0].type->id != "black_box"){
print_error("ERROR: Memory bank destroyed or not present.");
query_any("Press any key to continue...");}
else if (g->m.i_at(x, y)[0].type->id == "usb_drive" && g->m.i_at(x, y)[0].contents.empty()){
print_error("ERROR: Memory bank is empty.");
query_any("Press any key to continue...");}
else { // Success!
if (g->m.i_at(x, y)[0].type->id == "usb_drive"){
print_line("Memory Bank: Unencrypted\nNothing of interest.");
query_any("Press any key to continue...");}
if (g->m.i_at(x, y)[0].type->id == "black_box"){
print_line("Memory Bank: Military Hexron Encryption\nPrinting Transcript\n");
query_any("Press any key to continue...");
item transcript(g->itypes["black_box_transcript"], g->turn);
g->m.add_item(g->u.posx, g->u.posy, transcript);
} else
print_line("Memory Bank: Unencrypted\nNothing of interest.\n");
query_any("Press any key to continue...");
reset_terminal();
}
}
}
}
break;
case COMPACT_DISCONNECT:
reset_terminal();
print_line("\n\
ERROR: NETWORK DISCONNECT \n\
UNABLE TO REACH NETWORK ROUTER OR PROXY. PLEASE CONTACT YOUR\n\
SYSTEM ADMINISTRATOR TO RESOLVE THIS ISSUE.\n\
\n");
query_any("Press any key to continue...");
reset_terminal();
break;
case COMPACT_EMERG_MESS:
print_line("\
@@ -1089,6 +1136,31 @@ void computer::activate_failure(game *g, computer_failure fail)
}
getch();
break;
case COMPFAIL_DESTROY_DATA:
print_error("ERROR: ACCESSING DATA MALFUNCTION");
for (int x = 0; x <= 23; x++) {
for (int y = 0; y <= 23; y++) {
if (g->m.ter(x, y) == t_floor_blue) {
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
if (g->m.i_at(x, y).empty())
print_error("ERROR: Please place memory bank in scan area.");
else if (g->m.i_at(x, y).size() > 1)
print_error("ERROR: Please only scan one item at a time.");
else if (g->m.i_at(x, y)[0].type->id != "usb_drive")
print_error("ERROR: Memory bank destroyed or not present.");
else if (g->m.i_at(x, y)[0].contents.empty())
print_error("ERROR: Memory bank is empty.");
else {
print_error("ERROR: Data bank destroyed.");
g->m.i_at(x, y)[i].contents.clear();
}
}
}
}
}
getch();
break;
}// switch (fail)
}
+3
View File
@@ -33,6 +33,8 @@ enum computer_action
COMPACT_AMIGARA_START,
COMPACT_DOWNLOAD_SOFTWARE,
COMPACT_BLOOD_ANAL,
COMPACT_DATA_ANAL,
COMPACT_DISCONNECT,
COMPACT_STEMCELL_TREATMENT,
COMPACT_EMERG_MESS,
COMPACT_TOWER_UNRESPONSIVE,
@@ -60,6 +62,7 @@ enum computer_failure
COMPFAIL_PUMP_LEAK,
COMPFAIL_AMIGARA,
COMPFAIL_DESTROY_BLOOD,
COMPFAIL_DESTROY_DATA,
NUM_COMPUTER_FAILURES
};
+29 -8
View File
@@ -141,7 +141,14 @@ void game::init_construction()
COMP("2x4", 10);
COMP("nail", 20);
CONSTRUCT("Build Log Wall", 2, &construct::able_pit, &construct::done_nothing);
CONSTRUCT("Build Log Wall", 2, &construct::able_dig, &construct::done_nothing);
STAGE(t_pit_shallow, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
TOOLCONT("digging_stick");
STAGE(t_pit, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
STAGE(t_wall_log_half, 20);
TOOL("shovel");
TOOLCONT("primitive_shovel");
@@ -155,7 +162,14 @@ void game::init_construction()
COMP("stick", 3);
COMPCONT("2x4", 6);
CONSTRUCT("Build Palisade Wall", 2, &construct::able_pit, &construct::done_nothing);
CONSTRUCT("Build Palisade Wall", 2, &construct::able_dig, &construct::done_nothing);
STAGE(t_pit_shallow, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
TOOLCONT("digging_stick");
STAGE(t_pit, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
STAGE(t_palisade, 20);
TOOL("shovel");
TOOLCONT("primitive_shovel");
@@ -168,7 +182,14 @@ void game::init_construction()
COMP("stick", 8);
COMPCONT("2x4", 8);
CONSTRUCT("Build Palisade Gate", 2, &construct::able_pit, &construct::done_nothing);
CONSTRUCT("Build Palisade Gate", 2, &construct::able_dig, &construct::done_nothing);
STAGE(t_pit_shallow, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
TOOLCONT("digging_stick");
STAGE(t_pit, 10);
TOOL("shovel");
TOOLCONT("primitive_shovel");
STAGE(t_palisade_gate, 20);
TOOL("shovel");
TOOLCONT("primitive_shovel");
@@ -422,7 +443,7 @@ void game::construction_menu()
long ch;
bool exit = false;
inventory total_inv = crafting_inventory();
inventory total_inv = crafting_inventory(&u);
do {
// Erase existing list of constructions
@@ -711,7 +732,7 @@ bool game::player_can_build(player &p, inventory pinv, constructable* con,
void game::place_construction(constructable *con)
{
refresh_all();
inventory total_inv = crafting_inventory();
inventory total_inv = crafting_inventory(&u);
std::vector<point> valid;
for (int x = u.posx - 1; x <= u.posx + 1; x++) {
@@ -794,8 +815,6 @@ void game::place_construction(constructable *con)
void game::complete_construction()
{
inventory map_inv;
map_inv.form_from_map(this, point(u.posx, u.posy), PICKUP_RANGE);
int stage_num = u.activity.values[0];
constructable *built = constructions[u.activity.index];
construction_stage stage = built->stages[stage_num];
@@ -807,7 +826,7 @@ void game::complete_construction()
u.practice(turn, "carpentry", 10);
for (int i = 0; i < 10; i++) {
if (!stage.components[i].empty())
consume_items(stage.components[i]);
consume_items(&u, stage.components[i]);
}
// Make the terrain change
@@ -977,6 +996,7 @@ void construct::done_furniture(game *g, point p)
break;
}
g->sound(x, y, terlist[g->m.ter(p.x, p.y)].move_str_req * 2, "a scraping noise");
g->m.ter_set(x, y, g->m.ter(p.x, p.y));
g->m.ter_set(p.x, p.y, t_floor);
@@ -1123,6 +1143,7 @@ void construct::done_deconstruct(game *g, point p)
case t_fridge:
g->m.spawn_item(p.x, p.y, item_controller->find_template("scrap"), 0, rng(2,6));
g->m.spawn_item(p.x, p.y, item_controller->find_template("steel_chunk"), 0, rng(2,3));
g->m.spawn_item(p.x, p.y, item_controller->find_template("hose"), 0, 1);
g->m.ter_set(p.x, p.y, t_floor);
break;
+222 -147
View File
@@ -65,7 +65,7 @@ void game::init_recipes()
{
if ((*name_iter) == rec_name)
{
debugmsg("Recipe name collision: %s", rec_name.c_str());
debugmsg("Recipe name collision (set a unique value for the id_suffix field to fix): %s", rec_name.c_str());
}
}
@@ -186,7 +186,7 @@ bool game::making_would_work(recipe *making)
bool game::can_make(recipe *r)
{
bool RET_VAL = true;
inventory crafting_inv = crafting_inventory();
inventory crafting_inv = crafting_inventory(&u);
if(!u.knows_recipe(r))
{
return false;
@@ -522,7 +522,7 @@ recipe* game::select_crafting_recipe()
recipe *chosen = NULL;
InputEvent input;
inventory crafting_inv = crafting_inventory();
inventory crafting_inv = crafting_inventory(&u);
std::string filterstring = "";
do {
if (redraw)
@@ -905,14 +905,14 @@ void draw_recipe_tabs(WINDOW *w, craft_cat tab,bool filtered)
wrefresh(w);
}
inventory game::crafting_inventory(){
inventory game::crafting_inventory(player *p){
inventory crafting_inv;
crafting_inv.form_from_map(this, point(u.posx, u.posy), PICKUP_RANGE);
crafting_inv += u.inv;
crafting_inv += u.weapon;
if (u.has_bionic("bio_tools")) {
crafting_inv.form_from_map(this, point(p->posx, p->posy), PICKUP_RANGE);
crafting_inv += p->inv;
crafting_inv += p->weapon;
if (p->has_bionic("bio_tools")) {
item tools(item_controller->find_template("toolset"), turn);
tools.charges = u.power_level;
tools.charges = p->power_level;
crafting_inv += tools;
}
return crafting_inv;
@@ -995,7 +995,8 @@ void game::complete_craft()
// farsightedness can impose a penalty on electronics and tailoring success
// it's equivalent to a 2-rank electronics penalty, 1-rank tailoring
if (u.has_trait(PF_HYPEROPIC) && !u.is_wearing("glasses_reading")) {
if (u.has_trait(PF_HYPEROPIC) && !u.is_wearing("glasses_reading")
&& !u.is_wearing("glasses_bifocal")) {
int main_rank_penalty = 0;
if (making->sk_primary == Skill::skill("electronics")) {
main_rank_penalty = 2;
@@ -1038,12 +1039,12 @@ void game::complete_craft()
for (int i = 0; i < making->components.size(); i++)
{
if (making->components[i].size() > 0)
consume_items(making->components[i]);
consume_items(&u, making->components[i]);
}
for (int i = 0; i < making->tools.size(); i++) {
if (making->tools[i].size() > 0)
consume_tools(making->tools[i]);
consume_tools(&u, making->tools[i], false);
}
u.activity.type = ACT_NULL;
return;
@@ -1058,31 +1059,49 @@ void game::complete_craft()
}
// If we're here, the craft was a success!
// Use up the components and tools
std::list<item> used;
for (int i = 0; i < making->components.size(); i++) {
if (making->components[i].size() > 0)
consume_items(making->components[i]);
if (making->components[i].size() > 0) {
std::list<item> tmp = consume_items(&u, making->components[i]);
used.splice(used.end(), tmp);
}
}
for (int i = 0; i < making->tools.size(); i++) {
if (making->tools[i].size() > 0)
consume_tools(making->tools[i]);
consume_tools(&u, making->tools[i], false);
}
// Set up the new item, and pick an inventory letter
int iter = 0;
item newit(item_controller->find_template(making->result), turn, nextinv);
if (newit.is_armor() && newit.has_flag(IF_VARSIZE))
if (newit.is_armor() && newit.has_flag("VARSIZE"))
{
newit.item_flags |= mfb(IF_FIT);
newit.item_tags.insert("FIT");
}
int used_bday_tally = 0;
int used_bday_count = 0;
for (std::list<item>::iterator iter = used.begin(); iter != used.end(); ++iter)
{
if (iter->goes_bad())
{
used_bday_tally += iter->bday;
++used_bday_count;
}
}
if (used_bday_count > 0)
{
const int average_used_bday = used_bday_tally / used_bday_count;
newit.bday = (average_used_bday + newit.bday) / 2;
}
// for food items
if (newit.is_food())
{
int bday_tmp = turn % 3600; // fuzzy birthday for stacking reasons
newit.bday = int(turn) + 3600 - bday_tmp;
int bday_tmp = newit.bday % 3600; // fuzzy birthday for stacking reasons
newit.bday = int(newit.bday) + 3600 - bday_tmp;
if (newit.has_flag(IF_EATEN_HOT)) { // hot foods generated
newit.item_flags |= mfb(IF_HOT);
if (newit.has_flag("EATEN_HOT")) { // hot foods generated
newit.item_tags.insert("HOT");
newit.active = true;
newit.item_counter = 600;
}
@@ -1114,163 +1133,219 @@ void game::complete_craft()
}
}
void game::consume_items(std::vector<component> components)
std::list<item> game::consume_items(player *p, std::vector<component> components)
{
// For each set of components in the recipe, fill you_have with the list of all
// matching ingredients the player has.
std::vector<component> player_has;
std::vector<component> map_has;
std::vector<component> mixed;
std::vector<component> player_use;
std::vector<component> map_use;
std::vector<component> mixed_use;
inventory map_inv;
map_inv.form_from_map(this, point(u.posx, u.posy), PICKUP_RANGE);
std::list<item> ret;
// For each set of components in the recipe, fill you_have with the list of all
// matching ingredients the player has.
std::vector<component> player_has;
std::vector<component> map_has;
std::vector<component> mixed;
std::vector<component> player_use;
std::vector<component> map_use;
std::vector<component> mixed_use;
inventory map_inv;
map_inv.form_from_map(this, point(p->posx, p->posy), PICKUP_RANGE);
for (int i = 0; i < components.size(); i++) {
itype_id type = components[i].type;
int count = abs(components[i].count);
bool pl = false, mp = false;
if (components[i].available != 1)
{
continue;
}
for (int i = 0; i < components.size(); i++)
{
itype_id type = components[i].type;
int count = abs(components[i].count);
bool pl = false, mp = false;
if (item_controller->find_template(type)->count_by_charges() && count > 0)
{
if (u.has_charges(type, count)) {
player_has.push_back(components[i]);
pl = true;
}
if (map_inv.has_charges(type, count)) {
map_has.push_back(components[i]);
mp = true;
}
if (!pl && !mp && u.charges_of(type) + map_inv.charges_of(type) >= count)
mixed.push_back(components[i]);
}
if (components[i].available != 1)
{
continue;
}
else { // Counting by units, not charges
if (item_controller->find_template(type)->count_by_charges() && count > 0)
{
if (p->has_charges(type, count))
{
player_has.push_back(components[i]);
pl = true;
}
if (map_inv.has_charges(type, count))
{
map_has.push_back(components[i]);
mp = true;
}
if (!pl && !mp && p->charges_of(type) + map_inv.charges_of(type) >= count)
{
mixed.push_back(components[i]);
}
}
else // Counting by units, not charges
{
if (u.has_amount(type, count)) {
player_has.push_back(components[i]);
pl = true;
}
if (map_inv.has_amount(type, count)) {
map_has.push_back(components[i]);
mp = true;
}
if (!pl && !mp && u.amount_of(type) + map_inv.amount_of(type) >= count)
mixed.push_back(components[i]);
if (p->has_amount(type, count))
{
player_has.push_back(components[i]);
pl = true;
}
if (map_inv.has_amount(type, count))
{
map_has.push_back(components[i]);
mp = true;
}
if (!pl && !mp && p->amount_of(type) + map_inv.amount_of(type) >= count)
{
mixed.push_back(components[i]);
}
}
}
}
}
if (player_has.size() + map_has.size() + mixed.size() == 1) { // Only 1 choice
if (player_has.size() == 1)
player_use.push_back(player_has[0]);
else if (map_has.size() == 1)
map_use.push_back(map_has[0]);
else
mixed_use.push_back(mixed[0]);
if (player_has.size() + map_has.size() + mixed.size() == 1) // Only 1 choice
{
if (player_has.size() == 1)
{
player_use.push_back(player_has[0]);
}
else if (map_has.size() == 1)
{
map_use.push_back(map_has[0]);
}
else
{
mixed_use.push_back(mixed[0]);
}
}
else // Let the player pick which component they want to use
{
std::vector<std::string> options; // List for the menu_vec below
// Populate options with the names of the items
for (int i = 0; i < map_has.size(); i++)
{
std::string tmpStr = item_controller->find_template(map_has[i].type)->name + " (nearby)";
options.push_back(tmpStr);
}
for (int i = 0; i < player_has.size(); i++)
{
options.push_back(item_controller->find_template(player_has[i].type)->name);
}
for (int i = 0; i < mixed.size(); i++)
{
std::string tmpStr = item_controller->find_template(mixed[i].type)->name +" (on person & nearby)";
options.push_back(tmpStr);
}
} else { // Let the player pick which component they want to use
std::vector<std::string> options; // List for the menu_vec below
// Populate options with the names of the items
for (int i = 0; i < map_has.size(); i++) {
std::string tmpStr = item_controller->find_template(map_has[i].type)->name + " (nearby)";
options.push_back(tmpStr);
}
for (int i = 0; i < player_has.size(); i++)
options.push_back(item_controller->find_template(player_has[i].type)->name);
for (int i = 0; i < mixed.size(); i++) {
std::string tmpStr = item_controller->find_template(mixed[i].type)->name +" (on person & nearby)";
options.push_back(tmpStr);
}
// unlike with tools, it's a bad thing if there aren't any components available
if (options.size() == 0)
{
debugmsg("Attempted a recipe with no available components!");
return ret;
}
if (options.size() == 0) // This SHOULD only happen if cooking with a fire,
return; // and the fire goes out.
// Get the selection via a menu popup
int selection = menu_vec(false, "Use which component?", options) - 1;
if (selection < map_has.size())
{
map_use.push_back(map_has[selection]);
}
else if (selection < map_has.size() + player_has.size())
{
selection -= map_has.size();
player_use.push_back(player_has[selection]);
}
else
{
selection -= map_has.size() + player_has.size();
mixed_use.push_back(mixed[selection]);
}
}
// Get the selection via a menu popup
int selection = menu_vec(false, "Use which component?", options) - 1;
if (selection < map_has.size())
map_use.push_back(map_has[selection]);
else if (selection < map_has.size() + player_has.size()) {
selection -= map_has.size();
player_use.push_back(player_has[selection]);
} else {
selection -= map_has.size() + player_has.size();
mixed_use.push_back(mixed[selection]);
}
}
for (int i = 0; i < player_use.size(); i++) {
if (item_controller->find_template(player_use[i].type)->count_by_charges() &&
player_use[i].count > 0)
u.use_charges(player_use[i].type, player_use[i].count);
else
u.use_amount(player_use[i].type, abs(player_use[i].count),
(player_use[i].count < 0));
}
for (int i = 0; i < map_use.size(); i++) {
if (item_controller->find_template(map_use[i].type)->count_by_charges() &&
map_use[i].count > 0)
m.use_charges(point(u.posx, u.posy), PICKUP_RANGE,
map_use[i].type, map_use[i].count);
else
m.use_amount(point(u.posx, u.posy), PICKUP_RANGE,
map_use[i].type, abs(map_use[i].count),
(map_use[i].count < 0));
}
for (int i = 0; i < mixed_use.size(); i++) {
if (item_controller->find_template(mixed_use[i].type)->count_by_charges() &&
mixed_use[i].count > 0) {
int from_map = mixed_use[i].count - u.charges_of(mixed_use[i].type);
u.use_charges(mixed_use[i].type, u.charges_of(mixed_use[i].type));
m.use_charges(point(u.posx, u.posy), PICKUP_RANGE,
mixed_use[i].type, from_map);
} else {
bool in_container = (mixed_use[i].count < 0);
int from_map = abs(mixed_use[i].count) - u.amount_of(mixed_use[i].type);
u.use_amount(mixed_use[i].type, u.amount_of(mixed_use[i].type),
in_container);
m.use_amount(point(u.posx, u.posy), PICKUP_RANGE,
mixed_use[i].type, from_map, in_container);
}
}
for (int i = 0; i < player_use.size(); i++)
{
if (item_controller->find_template(player_use[i].type)->count_by_charges() &&
player_use[i].count > 0)
{
std::list<item> tmp = p->use_charges(player_use[i].type, player_use[i].count);
ret.splice(ret.end(), tmp);
}
else
{
std::list<item> tmp = p->use_amount(player_use[i].type, abs(player_use[i].count),
(player_use[i].count < 0));
ret.splice(ret.end(), tmp);
}
}
for (int i = 0; i < map_use.size(); i++)
{
if (item_controller->find_template(map_use[i].type)->count_by_charges() &&
map_use[i].count > 0)
{
std::list<item> tmp = m.use_charges(point(p->posx, p->posy), PICKUP_RANGE,
map_use[i].type, map_use[i].count);
ret.splice(ret.end(), tmp);
}
else
{
std::list<item> tmp = m.use_amount(point(p->posx, p->posy), PICKUP_RANGE,
map_use[i].type, abs(map_use[i].count),
(map_use[i].count < 0));
ret.splice(ret.end(), tmp);
}
}
for (int i = 0; i < mixed_use.size(); i++)
{
if (item_controller->find_template(mixed_use[i].type)->count_by_charges() &&
mixed_use[i].count > 0)
{
int from_map = mixed_use[i].count - p->charges_of(mixed_use[i].type);
std::list<item> tmp;
tmp = p->use_charges(mixed_use[i].type, p->charges_of(mixed_use[i].type));
ret.splice(ret.end(), tmp);
tmp = m.use_charges(point(p->posx, p->posy), PICKUP_RANGE,
mixed_use[i].type, from_map);
ret.splice(ret.end(), tmp);
}
else
{
bool in_container = (mixed_use[i].count < 0);
int from_map = abs(mixed_use[i].count) - p->amount_of(mixed_use[i].type);
std::list<item> tmp;
tmp = p->use_amount(mixed_use[i].type, p->amount_of(mixed_use[i].type),
in_container);
ret.splice(ret.end(), tmp);
tmp = m.use_amount(point(p->posx, p->posy), PICKUP_RANGE,
mixed_use[i].type, from_map, in_container);
ret.splice(ret.end(), tmp);
}
}
return ret;
}
void game::consume_tools(std::vector<component> tools)
void game::consume_tools(player *p, std::vector<component> tools, bool force_available)
{
bool found_nocharge = false;
inventory map_inv;
map_inv.form_from_map(this, point(u.posx, u.posy), PICKUP_RANGE);
map_inv.form_from_map(this, point(p->posx, p->posy), PICKUP_RANGE);
std::vector<component> player_has;
std::vector<component> map_has;
// Use charges of any tools that require charges used
for (int i = 0; i < tools.size() && !found_nocharge; i++) {
if (tools[i].available != 1)
if (!force_available && tools[i].available != 1)
{
continue;
}
itype_id type = tools[i].type;
if (tools[i].count > 0) {
int count = tools[i].count;
if (u.has_charges(type, count))
if (p->has_charges(type, count))
player_has.push_back(tools[i]);
if (map_inv.has_charges(type, count))
map_has.push_back(tools[i]);
} else if (u.has_amount(type, 1) || map_inv.has_amount(type, 1))
} else if (p->has_amount(type, 1) || map_inv.has_amount(type, 1))
found_nocharge = true;
}
if (found_nocharge)
return; // Default to using a tool that doesn't require charges
if (player_has.size() == 1 && map_has.size() == 0)
u.use_charges(player_has[0].type, player_has[0].count);
p->use_charges(player_has[0].type, player_has[0].count);
else if (map_has.size() == 1 && player_has.size() == 0)
m.use_charges(point(u.posx, u.posy), PICKUP_RANGE,
m.use_charges(point(p->posx, p->posy), PICKUP_RANGE,
map_has[0].type, map_has[0].count);
else { // Variety of options, list them and pick one
// Populate the list
@@ -1288,11 +1363,11 @@ void game::consume_tools(std::vector<component> tools)
// Get selection via a popup menu
int selection = menu_vec(false, "Use which tool?", options) - 1;
if (selection < map_has.size())
m.use_charges(point(u.posx, u.posy), PICKUP_RANGE,
m.use_charges(point(p->posx, p->posy), PICKUP_RANGE,
map_has[selection].type, map_has[selection].count);
else {
selection -= map_has.size();
u.use_charges(player_has[selection].type, player_has[selection].count);
p->use_charges(player_has[selection].type, player_has[selection].count);
}
}
}
@@ -1330,7 +1405,7 @@ void game::disassemble(char ch)
{
// check tools are available
// loop over the tools and see what's required...again
inventory crafting_inv = crafting_inventory();
inventory crafting_inv = crafting_inventory(&u);
bool have_all_tools = true;
for (int j = 0; j < cur_recipe->tools.size(); j++)
{
@@ -1447,7 +1522,7 @@ void game::complete_disassemble()
for (int j = 0; j < dis->tools.size(); j++)
{
if (dis->tools[j].size() > 0)
consume_tools(dis->tools[j]);
consume_tools(&u, dis->tools[j], false);
}
// add the components to the map
+116
View File
@@ -1,5 +1,121 @@
Changelog will be a little light for the early entries due to me being really bad at documenting things.
0.6
Highlights:
---
* Some work to make vehicle collisions sane.
* Zombies will revive after a time, if not butchered (or otherwise dealt with).
* The Android trait now behaves the way that the description indicates.
* Gasoline can be siphoned from vehicles. Requires a rubber hose for now - these are easier to acquire.
* Sewing requires materials other than thread - rags for cloth, leather patches for leather.
* Leather repair/reinforcement actually possible!
* Inventory management UI improvements, and a new screen to organize worn items.
* NPCs continue to be less buggy, but are still prone to crashes.
* Weapon firing code reworked a bit. UI improvements, and you should now be able to fire at anything within range.
* Reworked the armor/protection code.
* Reworked the learning system: replaced XP with Focus. See the relevant help text.
* Added a bunch of new missions, for those who play with the shelter NPC turned on.
* Vehicle collision physics are now based on *actual* physics! Reduces collision insanity.
* As usual, many bugfixes.
Full list:
---
Purifier no longer removes traits available at chargen.
Fix some calculations that wanted floating-point math, and were using integer math.
Fix some vehicle collision craziness related to skids.
Added zombie revival. Chance of unbutchered zombie corpses rezzing, once 6 hours have passed.
Advanced inventory UI improvements/fixes.
Dropping count-by-charge items (batteries, meds, etc.) into vehicles will cause restacking.
Android trait always gives a power system bionic.
Fix torso encumbrance display (it's smart about sign use now).
Bitmask-based item flags no longer exist! Instead, we have string-based tags, that have no upper limit.
Tweaked glowstick behavior - can no longer deactivate, and they have a dead state.
Android trait should no longer give the player faulty bionics.
Bolts moved to ammo category, like arrows.
Added bone broth, and recipe.
Adjust how Climate Control bionic works, make vehicles have functioning (magic!) AC.
Added fuel siphoning using rubber hose.
Appearance-improving mutations are now flagged as being good mutations.
Welder charges are actually used during vehicle construction.
Items will no longer become erroneously fitted, and item tags should not spread during map loading.
Weather accounts for starting time properly.
Containers can be unloaded again (they were bugged).
Optimized scentmap updates, hopefully this speeds up certain activities.
Pit-requiring constructions have pit digging as their first two stages, to make it more obvious what the prereqs are.
Some menus (notably, inventory) can be navigated with arrow keys and enter.
Allowing sewing of leather items, make sewing require rags/patches.
Cooking rotten food does not make it magically fresh any more (but it does make it slightly less rotten).
Resolves an issue where destroying an item while tailoring would crash the game.
New UI to sort clothing and automatically assign special characters to clothing (accessed via +)
Footwear warmth values tweaked to be more flexible.
Wool warmth is not reduced by rain.
Sofas and armchairs help with sleeping.
Temperature is less of an issue while sleeping.
Warning messages for when the player is cold/hot while sleeping.
Oversized clothing can be worn over anything (blankets, cloaks, etc).
Sound interruptions can be categorically ignored while crafting, reading, etc.
More improvements to the advanced inventory UI.
Shrubs less difficult to smash.
Upgraded versions of Fast Healer still give you bonuses while sleeping.
Soldering iron recipe learnable via disassembly.
Integrated toolset power usage normalized on a few recipes.
Vehicle speed is now taken into account when throwing a character that exits a moving vehicle.
Gasoline lanterns added to the game.
Bifocal glasses added to the game.
Tweak Windows (catacurse) colors.
Correct window border color behavior under Windows.
Add glass jars, make sauces spawn in them instead of in tin cans.
Removed a couple NPC crash bugs.
You can safely exit a vehicle moving less than 1 MPH.
Fix a pair of drawing glitches related to the item pickup window.
Remove the artificial delay when animating vehicle movement.
Out-of-range enemies are still drawn when firing a weapon.
Make it so that anything within range can be targeted with a ranged weapon.
Disassembly recipe for vacuum sealer.
Backspace no longer causes junk to be input during string entry.
The overmap screen now lets you use "<" and ">" to view different z-levels.
Reworked the armor/protection code.
Fridges drop rubber hose instead of pipe when destroyed.
Reworked the learning system: replaced XP with Focus. See the relevant help text.
Autosave should save everything now, rather than a subset.
Fix artifact saving/loading... again.
Added new missions.
Added cathedral to mapgen.
Fixed flamethrowers.
Add 40mm acid bomb shells.
Moving furniture causes noise.
Clothing damage descriptions now depend on the item's material.
Gunmods now show "%" properly in the magazine size line.
Add bicycle seats: low-mass seats that can't take a seatbelt.
Vehicle collision physics are now based on *actual* physics! Reduces collision insanity.
Foraging gives survival experience, even on failure.
Disassembling ammo gives firearms experience.
Ball bearings should hopefully drop now.
Added headlights to a few more default vehicles.
Lab coats can be fitted.
Items in adjacent containers (fridges, lockers, etc.) visible with 'V' screen.
Players can no longer examine sealed crates to see their contents.
Funnels give acid water during acid rain :).
Acid water (after refinement) now an alternate ingredient for acid bombs.
Corrected a few item name typos.
Cleaned up generation of a particular (spiral-y) underground room.
More temperature tweaks.
Being hot makes you MORE thirsty, not less.
Reworked item unloading and reloading a bit to remove bugs.
Flatbed trucks now have rear windows.
Electric cars added as potential vehicle spawns.
Fix some bugs related to known overmap data and leaking the state to other characters.
Effects of current stats are shown on the '@' screen.
Materials obtained from clothing depend on the clothing's damage level.
Fixed some lab mapgen bugs.
Mansions got a little love.
Having too little intelligence for a book is more of a penalty.
Vehicle headlight state is persistent after save-load.
======
0.5
Highlights:
+23
View File
@@ -1226,6 +1226,29 @@
"count" : 6,
"effects" : ["FLASHBANG"]
},
{ "type" : "AMMO",
"id" : "40mm_acidbomb",
"rarity" : 6,
"price" : 500,
"name" : "40mm acid bomb",
"symbol" : "=",
"color" : "light_red",
"description" : "A 40mm grenade with an acid bomb load.",
"material" : "STEEL",
"volume" : 1,
"weight" : 200,
"bashing" : 1,
"cutting" : 0,
"to_hit" : 0,
"ammo_type" : "40mm",
"damage" : 5,
"pierce" : 0,
"range" : 40,
"accuracy" : 8,
"recoil" : 15,
"count" : 1,
"effects" : ["ACIDBOMB"]
},
{ "type" : "AMMO",
"id" : "66mm_HEAT",
"rarity" : 0,
+365 -286
View File
File diff suppressed because it is too large Load Diff
+88
View File
@@ -966,5 +966,93 @@
"rarity" : 1,
"price" : 920,
"required_level" : 5
},
{
"type" : "BOOK",
"id" : "record_weather",
"name" : "National Weather Transcripts",
"max_level" : 0,
"description" : "Old weather records are about as interesting as a rock.",
"weight" : 7,
"to_hit" : 1,
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"volume" : 7,
"bashing" : 7,
"cutting" : 0,
"time" : 30,
"fun" : -1,
"skill" : "none",
"rarity" : 20,
"price" : 5,
"required_level" : 0
},
{
"type" : "BOOK",
"id" : "record_patient",
"name" : "Patient Treatment Records",
"max_level" : 0,
"description" : "A massive stack of medical records that contain every gory detail.",
"weight" : 6,
"to_hit" : 1,
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"volume" : 6,
"bashing" : 6,
"cutting" : 0,
"time" : 30,
"fun" : -1,
"skill" : "none",
"rarity" : 20,
"price" : 5,
"required_level" : 0
},
{
"type" : "BOOK",
"id" : "record_accounting",
"name" : "Corporate Accounting Ledger",
"max_level" : 0,
"description" : "If you knew what to look for something might stand out...",
"weight" : 5,
"to_hit" : 1,
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"volume" : 5,
"bashing" : 5,
"cutting" : 0,
"time" : 30,
"fun" : -1,
"skill" : "none",
"rarity" : 20,
"price" : 100,
"required_level" : 0
},
{
"type" : "BOOK",
"id" : "black_box_transcript",
"name" : "black box transcript",
"max_level" : 0,
"description" : "A full flight log for a military aircraft. Nothing of interest stands out.",
"weight" : 5,
"to_hit" : 1,
"color" : "blue",
"intelligence" : 0,
"symbol" : "?",
"material" : ["PAPER", "NULL"],
"volume" : 5,
"bashing" : 5,
"cutting" : 0,
"time" : 30,
"fun" : -1,
"skill" : "none",
"rarity" : 0,
"price" : 500,
"required_level" : 0
}
]
+94 -2
View File
@@ -358,6 +358,38 @@
"flags" : ["EATEN_HOT"],
"fun" : 1
},
{
"type" : "COMESTIBLE",
"id" : "broth_bone",
"name" : "bone broth",
"weight" : 1,
"color" : "yellow",
"addiction_type" : "none",
"spoils_in" : 160,
"use_action" : "NONE",
"stim" : 0,
"container" : "can_food",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : 10,
"heal" : 0,
"addiction_potential" : 0,
"nutrition" : 20,
"description" : "A tasty and nutritious broth made from bones.",
"price" : 35,
"material" : "FLESH",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 1,
"rarity" : 0,
"bashing" : 0,
"flags" : ["EATEN_HOT"],
"fun" : 10
},
{
"type" : "COMESTIBLE",
"id" : "soup_veggy",
@@ -811,6 +843,66 @@
"bashing" : 0,
"fun" : -30
},
{
"type" : "COMESTIBLE",
"id" : "water_acid",
"name" : "acid water",
"weight" : 1,
"color" : "yellow",
"addiction_type" : "none",
"spoils_in" : 0,
"use_action" : "BLECH",
"stim" : 0,
"container" : "jug_plastic",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -96,
"heal" : -2,
"addiction_potential" : 0,
"nutrition" : 0,
"description" : "Water collected during an acid rainstorm. Don't drink it. Boiling it concentrates the acid.",
"price" : 30,
"material" : "NULL",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 1,
"rarity" : 24,
"bashing" : 0,
"fun" : -30
},
{
"type" : "COMESTIBLE",
"id" : "acid",
"name" : "concentrated acid",
"weight" : 1,
"color" : "yellow",
"addiction_type" : "none",
"spoils_in" : 0,
"use_action" : "BLECH",
"stim" : 0,
"container" : "jug_plastic",
"to_hit" : 0,
"comestible_type" : "DRINK",
"symbol" : "~",
"quench" : -96,
"heal" : -2,
"addiction_potential" : 0,
"nutrition" : 0,
"description" : "Concentrated acid from an acid rainstorm. Don't drink it.",
"price" : 30,
"material" : "NULL",
"tool" : "null",
"volume" : 2,
"cutting" : 0,
"phase" : "liquid",
"charges" : 1,
"rarity" : 24,
"bashing" : 0,
"fun" : -30
},
{
"type" : "COMESTIBLE",
"id" : "mutagen",
@@ -2188,7 +2280,7 @@
"spoils_in" : 0,
"use_action" : "NONE",
"stim" : 0,
"container" : "can_food",
"container" : "jar_glass",
"to_hit" : 0,
"comestible_type" : "FOOD",
"symbol" : "%",
@@ -2219,7 +2311,7 @@
"spoils_in" : 0,
"use_action" : "NONE",
"stim" : 0,
"container" : "can_food",
"container" : "jar_glass",
"to_hit" : 0,
"comestible_type" : "FOOD",
"symbol" : "%",
+15 -16
View File
@@ -1264,22 +1264,6 @@
"rarity" : 20,
"price" : 80
},
{
"id" : "hose",
"name" : "rubber hose",
"description" : "A flexible rubber hose. Useful for crafting.",
"weight" : 2,
"to_hit" : 3,
"color" : "green",
"symbol" : ",",
"material" : ["PLASTIC", "NULL"],
"volume" : 3,
"bashing" : 4,
"cutting" : 0,
"flags" : ["WRAP"],
"rarity" : 15,
"price" : 80
},
{
"id" : "broom",
"name" : "broom",
@@ -1622,6 +1606,21 @@
"rarity" : 8,
"price" : 250
},
{
"id" : "saddle",
"name" : "saddle",
"description" : "A leather-covered seat designed to be straddled.",
"weight" : 10,
"to_hit" : -4,
"color" : "red",
"symbol" : "0",
"material" : ["PLASTIC", "NULL"],
"volume" : 5,
"bashing" : 2,
"cutting" : 0,
"rarity" : 8,
"price" : 25
},
{
"id" : "vehicle_controls",
"name" : "vehicle controls",
+565 -2
View File
@@ -21,6 +21,569 @@
"burst_modifier": 0,
"clip_size_modifier": 0,
"mod_targets": ["pistol", "smg"],
"ammo_types": ["9MM", "38", "40", "44"]
}
"acceptable_ammo": ["9MM", "38", "40", "44"]
},
{
"type" : "GUNMOD",
"id" : "suppressor",
"name" : "suppressor",
"clip_size_modifier" : 0,
"accuracy_modifier" : -1,
"damage_modifier" : -4,
"ammo_modifier" : "none",
"description" : "Using a suppressor is almost an imperative in zombie-infested regions. Gunfire is very noisy, and will attract predators. Its only drawback is a reduced muzzle velocity, resulting in less accuracy and damage.",
"weight" : 1,
"to_hit" : 2,
"color" : "dark_gray",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["pistol", "smg", "rifle"],
"volume" : 2,
"bashing" : 3,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : 0,
"rarity" : 15,
"price" : 480,
"loudness_modifier" : -25
},
{
"type" : "GUNMOD",
"id" : "grip",
"name" : "enhanced grip",
"clip_size_modifier" : 0,
"accuracy_modifier" : 2,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "A grip placed forward on the barrel allows for greater control and accuracy. Aside from increased weight, there are no drawbacks.",
"weight" : 1,
"to_hit" : -1,
"color" : "brown",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["shotgun", "smg", "rifle"],
"volume" : 1,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : -2,
"rarity" : 12,
"price" : 280,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "barrel_big",
"name" : "barrel extension",
"clip_size_modifier" : 0,
"accuracy_modifier" : 6,
"damage_modifier" : 1,
"ammo_modifier" : "none",
"description" : "A longer barrel increases the muzzle velocity of a firearm, contributing to both accuracy and damage. However, the longer barrel tends to vibrate after firing, greatly increasing recoil.",
"weight" : 1,
"to_hit" : 2,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"mod_targets" : ["smg", "rifle"],
"volume" : 4,
"bashing" : 5,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : 5,
"rarity" : 10,
"price" : 400,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "barrel_small",
"name" : "shortened barrel",
"clip_size_modifier" : 0,
"accuracy_modifier" : -5,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "A shortened barrel results in markedly reduced accuracy, and a minor increase in noise, but also reduces recoil greatly as a result of the improved managability of the firearm.",
"weight" : 1,
"to_hit" : -1,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"mod_targets" : ["smg", "rifle"],
"volume" : 1,
"bashing" : -2,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : -6,
"rarity" : 6,
"price" : 320,
"loudness_modifier" : 2
},
{
"type" : "GUNMOD",
"id" : "barrel_rifled",
"name" : "rifled barrel",
"clip_size_modifier" : 0,
"accuracy_modifier" : 10,
"damage_modifier" : -20,
"ammo_modifier" : "none",
"description" : "Rifling a shotgun barrel is mainly done in order to improve its accuracy when firing slugs. The rifling makes the gun less suitable for shot, however.",
"weight" : 1,
"to_hit" : 1,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"mod_targets" : ["shotgun"],
"volume" : 2,
"bashing" : 3,
"cutting" : 0,
"burst_modifier" : -1,
"recoil_modifier" : 0,
"rarity" : 5,
"price" : 220,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "clip",
"name" : "extended magazine",
"clip_size_modifier" : 50,
"accuracy_modifier" : -1,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "Increases the ammunition capacity of your firearm by 50%, but the added bulk reduces accuracy slightly.",
"weight" : 1,
"to_hit" : -1,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["pistol", "shotgun", "smg", "rifle"],
"volume" : 1,
"bashing" : -2,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : 0,
"rarity" : 8,
"price" : 560,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "clip2",
"name" : "double magazine",
"clip_size_modifier" : 100,
"accuracy_modifier" : -2,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "Completely doubles the ammunition capacity of your firearm, but the added bulk reduces accuracy and increases recoil.",
"weight" : 2,
"to_hit" : 0,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["shotgun", "smg", "rifle"],
"volume" : 2,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : 2,
"rarity" : 4,
"price" : 720,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "spare_mag",
"name" : "spare magazine",
"clip_size_modifier" : 0,
"accuracy_modifier" : 0,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "A spare magazine you can keep on hand to make reloads faster, but must itself be reloaded before it can be used again.",
"weight" : 1,
"to_hit" : 0,
"color" : "light_gray",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["pistol", "shotgun", "smg", "rifle"],
"volume" : 1,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : 0,
"rarity" : 15,
"price" : 200,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "stabilizer",
"name" : "gyroscopic stabilizer",
"clip_size_modifier" : -10,
"accuracy_modifier" : 2,
"damage_modifier" : -2,
"ammo_modifier" : "none",
"description" : "An advanced unit that straps onto the side of your firearm and reduces vibration, greatly reducing recoil and increasing accuracy. However, it also takes up space in the magazine slot, reducing ammo capacity.",
"weight" : 2,
"to_hit" : -3,
"color" : "blue",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["smg", "rifle"],
"volume" : 3,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : 0,
"recoil_modifier" : -8,
"rarity" : 4,
"price" : 680,
"loudness_modifier" : 0
},
{
"type" : "GUNMOD",
"id" : "blowback",
"name" : "rapid blowback",
"clip_size_modifier" : 0,
"accuracy_modifier" : -3,
"damage_modifier" : 0,
"ammo_modifier" : "none",
"description" : "An improved blowback mechanism makes your firearm's automatic fire faster, at the cost of reduced accuracy and increased noise.",
"weight" : 1,
"to_hit" : 0,
"color" : "red",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"mod_targets" : ["smg", "rifle"],
"volume" : 0,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : 6,
"recoil_modifier" : 0,
"rarity" : 3,
"price" : 700,
"loudness_modifier" : 4
},
{
"type" : "GUNMOD",
"id" : "autofire",
"name" : "auto-fire mechanism",
"weight" : 2,
"color" : "red",
"burst_modifier" : 3,
"loudness_modifier" : 2,
"to_hit" : -1,
"accuracy_modifier" : -2,
"price" : 650,
"clip_size_modifier" : 0,
"description" : "A simple mechanism that converts a pistol to a fully-automatic weapon, with a burst size of three rounds. However, it reduces accuracy, and increases noise and recoil.",
"symbol" : ":",
"material" : ["STEEL", "PLASTIC"],
"volume" : 1,
"cutting" : 0,
"recoil_modifier" : 2,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38", "40", "57", "46"],
"mod_targets" : ["pistol"],
"rarity" : 2,
"bashing" : 2,
"ammo_modifier" : "none"
},
{
"type" : "GUNMOD",
"id" : "retool_9mm",
"name" : "9mm caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"price" : 420,
"clip_size_modifier" : 0,
"description" : "Replacing several key parts of a .38, .40, .44 or .45 firearm converts it to a 9mm firearm. The conversion results in a slight reduction in accuracy.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 1,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["38", "40", "44", "45"],
"mod_targets" : ["pistol", "smg"],
"rarity" : 3,
"bashing" : 0,
"ammo_modifier" : "9mm"
},
{
"type" : "GUNMOD",
"id" : "retool_22",
"name" : ".22 caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"price" : 320,
"clip_size_modifier" : 0,
"description" : "Replacing several key parts of a 9mm, .38, .40, 5.7mm, 4.6mm, 7.62mm or .223 firearm converts it to a .22 firearm. The conversion results in a slight reduction in accuracy.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 1,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["9MM", "38", "40", "57", "46", "762", "223"],
"mod_targets" : ["pistol", "smg", "rifle"],
"rarity" : 2,
"bashing" : -2,
"ammo_modifier" : ".22"
},
{
"type" : "GUNMOD",
"id" : "retool_57",
"name" : "5.7mm caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"price" : 460,
"clip_size_modifier" : 0,
"description" : "FN Hestal sells a conversion kit, used to convert .22, 9mm, or .38 firearms to their proprietary 5.7x28mm, a round designed for accuracy and armor penetration.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 1,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38"],
"mod_targets" : ["pistol", "smg"],
"rarity" : 1,
"bashing" : -3,
"ammo_modifier" : "5.7mm"
},
{
"type" : "GUNMOD",
"id" : "retool_46",
"name" : "4.6mm caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -1,
"price" : 460,
"clip_size_modifier" : 0,
"description" : "Heckler and Koch sells a conversion kit, used to convert .22, 9mm, or .38 firearms to their proprietary 4.6x30mm, a round designed for accuracy and armor penetration.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 1,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["22", "9MM", "38"],
"mod_targets" : ["pistol", "smg"],
"rarity" : 1,
"bashing" : -3,
"ammo_modifier" : "4.6mm"
},
{
"type" : "GUNMOD",
"id" : "retool_308",
"name" : ".308 caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : 1,
"accuracy_modifier" : -2,
"price" : 520,
"clip_size_modifier" : -20,
"description" : "This kit is used to convert a shotgun or 7.62mm, .223 or .30-06 rifle to the popular and powerful .308 caliber. The conversion results in reduced ammo capacity and a slight reduction in accuracy.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 2,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["SHOT", "762", "223", "3006"],
"mod_targets" : ["shotgun", "rifle"],
"rarity" : 2,
"bashing" : 4,
"ammo_modifier" : ".308"
},
{
"type" : "GUNMOD",
"id" : "retool_223",
"name" : ".223 caliber retool",
"weight" : 1,
"color" : "green",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : 1,
"accuracy_modifier" : -2,
"price" : 500,
"clip_size_modifier" : -10,
"description" : "This kit is used to convert a shotgun or 7.62mm, .30-06, or .308 rifle to the popular, accurate, and damaging .223 caliber. The conversion results in slight reductions in both accuracy and ammo capacity.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 2,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"acceptable_ammo" : ["SHOT", "762", "3006", "308"],
"mod_targets" : ["shotgun", "rifle"],
"rarity" : 2,
"bashing" : 4,
"ammo_modifier" : ".223"
},
{
"type" : "GUNMOD",
"id" : "conversion_battle",
"name" : "battle rifle conversion",
"clip_size_modifier" : 20,
"accuracy_modifier" : -6,
"damage_modifier" : 6,
"ammo_modifier" : "none",
"description" : "This is a complete conversion kit, designed to turn a rifle into a powerful battle rifle. It reduces accuracy, and increases noise and recoil, but also increases damage, ammo capacity, and fire rate.",
"weight" : 3,
"to_hit" : -1,
"color" : "magenta",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"mod_targets" : ["rifle"],
"volume" : 4,
"bashing" : 6,
"cutting" : 0,
"burst_modifier" : 4,
"recoil_modifier" : 4,
"rarity" : 1,
"price" : 680,
"loudness_modifier" : 4
},
{
"type" : "GUNMOD",
"id" : "conversion_sniper",
"name" : "sniper conversion",
"clip_size_modifier" : -15,
"accuracy_modifier" : 10,
"damage_modifier" : 8,
"ammo_modifier" : "none",
"description" : "This is a complete conversion kit, designed to turn a rifle into a deadly sniper rifle. It decreases ammo capacity, and removes any automatic fire capabilities, but also increases accuracy and damage.",
"weight" : 2,
"to_hit" : -1,
"color" : "green",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"mod_targets" : ["rifle"],
"volume" : 1,
"bashing" : 0,
"cutting" : 0,
"burst_modifier" : -99,
"recoil_modifier" : 0,
"rarity" : 1,
"price" : 660,
"loudness_modifier" : 3
},
{
"type" : "GUNMOD",
"id" : "m203",
"name" : "M203",
"weight" : 1,
"color" : "light_red",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -2,
"price" : 650,
"clip_size_modifier" : 1,
"description" : "The M203 was originally designed for use with M16 variants but today can be attached to almost any rifle. It allows a single 40mm grenade to be loaded and fired.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 2,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"mod_targets" : ["rifle"],
"rarity" : 2,
"bashing" : 2,
"flags" : ["MODE_AUX"],
"ammo_modifier" : "40mm"
},
{
"type" : "GUNMOD",
"id" : "bayonet",
"name" : "bayonet",
"weight" : 2,
"color" : "light_cyan",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -3,
"accuracy_modifier" : 0,
"price" : 400,
"clip_size_modifier" : 0,
"description" : "A bayonet is a stabbing weapon that can be attached to the front of a shotgun, sub-machinegun or rifle, allowing a melee attack to deal piercing damage. The added length increases recoil slightly.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 2,
"cutting" : 16,
"recoil_modifier" : 3,
"damage_modifier" : 0,
"mod_targets" : ["shotgun", "smg", "rifle"],
"rarity" : 6,
"bashing" : 0,
"flags" : ["STAB"],
"ammo_modifier" : "none"
},
{
"type" : "GUNMOD",
"id" : "u_shotgun",
"name" : "underslung shotgun",
"weight" : 1,
"color" : "light_red",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : -2,
"price" : 650,
"clip_size_modifier" : 2,
"description" : "A miniaturized shotgun with 2 barrels, which can be mounted under the barrel of many rifles. It allows two shotgun shells to be loaded and fired.",
"symbol" : ":",
"material" : ["STEEL", "NULL"],
"volume" : 2,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"mod_targets" : ["rifle"],
"rarity" : 2,
"bashing" : 2,
"flags" : ["MODE_AUX"],
"ammo_modifier" : "shot"
},
{
"type" : "GUNMOD",
"id" : "gun_crossbow",
"name" : "rail-mounted crossbow",
"weight" : 1,
"color" : "light_red",
"burst_modifier" : 0,
"loudness_modifier" : 0,
"to_hit" : -1,
"accuracy_modifier" : 0,
"price" : 500,
"clip_size_modifier" : 1,
"description" : "A kit to attach a pair of crossbow arms and a firing rail to the barrel of a long firearm. It allows crossbow bolts to be fired.",
"symbol" : ":",
"material" : ["STEEL", "WOOD"],
"volume" : 2,
"cutting" : 0,
"recoil_modifier" : 0,
"damage_modifier" : 0,
"mod_targets" : ["shotgun", "rifle"],
"rarity" : 2,
"bashing" : 2,
"flags" : ["MODE_AUX", "STR_RELOAD"],
"ammo_modifier" : "bolt"
}
]
+125 -2
View File
@@ -191,6 +191,55 @@
"use_action": "EXTRA_BATTERY"
},
{
"id": "gasoline_lantern",
"type": "TOOL",
"symbol": ";",
"color": "yellow",
"name": "gasoline lantern (off)",
"description": "A small gasoline powered lantern. It does not provide much light, but it lasts a long time. Use it to turn it on.",
"rarity": 5,
"price": 600,
"material": ["GLASS", "IRON"],
"weight": 2,
"volume": 3,
"bashing": 1,
"cutting": 0,
"to_hit": 2,
"max_charges": 500,
"initial_charges": 500,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "gasoline",
"revert_to": "null",
"use_action": "GASOLINE_LANTERN_OFF"
},
{
"id": "gasoline_lantern_on",
"type": "TOOL",
"symbol": ";",
"color": "yellow",
"name": "gasoline lantern (on)",
"description": "A small gasoline powered lantern. It does not provide much light, but it lasts a long time. It is turned on. Use it to turn it off.",
"rarity": 0,
"price": 600,
"material": ["GLASS", "IRON"],
"flags": "LIGHT_4",
"weight": 2,
"volume": 3,
"bashing": 1,
"cutting": 0,
"to_hit": 2,
"max_charges": 500,
"initial_charges": 500,
"charges_per_use": 0,
"turns_per_charge": 20,
"ammo": "gasoline",
"revert_to": "gasoline_lantern",
"use_action": "GASOLINE_LANTERN_ON"
},
{
"id": "flashlight",
"type": "TOOL",
@@ -358,9 +407,33 @@
"charges_per_use": 0,
"turns_per_charge": 2,
"ammo": "none",
"revert_to": "null",
"revert_to": "glowstick_dead",
"use_action": "GLOWSTICK_ACTIVE"
},
{
"id": "glowstick_dead",
"type": "TOOL",
"symbol": ";",
"color": "light_gray",
"name": "dead glowstick",
"description": "A spent glowstick, essentially trash.",
"rarity": 0,
"price": 300,
"material": "PLASTIC",
"weight": 0,
"volume": 1,
"bashing": 0,
"cutting": 0,
"to_hit": -1,
"max_charges": 0,
"initial_charges": 0,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "none",
"revert_to": "null",
"use_action": "NONE"
},
{
"id": "hotplate",
@@ -530,7 +603,31 @@
"revert_to": "null",
"use_action": "DIRECTIONAL_ANTENNA"
},
{
"id": "black_box",
"type": "TOOL",
"symbol": ";",
"color": "yellow",
"name": "military black box",
"description": "If you can find a system to analyze this you may find something of interest.",
"rarity": 0,
"price": 800,
"material": "STEEL",
"weight": 8,
"volume": 4,
"bashing": 4,
"cutting": 0,
"to_hit": -1,
"max_charges": 0,
"initial_charges": 0,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "none",
"revert_to": "null",
"use_action": "NONE"
},
{
"id": "noise_emitter",
"type": "TOOL",
@@ -676,6 +773,32 @@
"use_action": "DIG"
},
{
"id" : "hose",
"type": "TOOL",
"name" : "rubber hose",
"description" : "A flexible rubber hose. Can be used for crafting, or siphoning fuel from a vehicle.",
"weight" : 2,
"to_hit" : 3,
"color" : "green",
"symbol" : ",",
"material" : ["PLASTIC", "NULL"],
"volume" : 3,
"bashing" : 4,
"cutting" : 0,
"flags" : ["WRAP"],
"rarity" : 15,
"price" : 80,
"max_charges": 0,
"initial_charges": 0,
"charges_per_use": 0,
"turns_per_charge": 0,
"ammo": "none",
"revert_to": "null",
"use_action": "SIPHON"
},
{
"id": "chainsaw_off",
"type": "TOOL",
+211
View File
@@ -0,0 +1,211 @@
[
{
"ident" : "null",
"name" : "Null",
"bash_resist" : 0,
"cut_resist" : 0,
"bash_dmg_verb" : "damaged",
"cut_dmg_verb" : "damaged",
"acid_resist" : 0,
"elec_resist" : 0,
"fire_resist" : 0
},
{
"ident" : "veggy",
"name" : "Plant Matter",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "cut",
"acid_resist" : 0,
"elec_resist" : 1,
"fire_resist" : 0
},
{
"ident" : "flesh",
"name" : "Flesh",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "bruised",
"cut_dmg_verb" : "sliced",
"acid_resist" : 0,
"elec_resist" : 1,
"fire_resist" : 0
},
{
"ident" : "powder",
"name" : "Powder",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "damaged",
"cut_dmg_verb" : "damaged",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "hflesh",
"name" : "Human Flesh",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "bruised",
"cut_dmg_verb" : "sliced",
"acid_resist" : 0,
"elec_resist" : 1,
"fire_resist" : 0
},
{
"ident" : "cotton",
"name" : "Cotton",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "cut",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "wool",
"name" : "Wool",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "torn",
"cut_dmg_verb" : "cut",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "leather",
"name" : "Leather",
"bash_resist" : 2,
"cut_resist" : 2,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "sliced",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 1
},
{
"ident" : "kevlar",
"name" : "Kevlar",
"bash_resist" : 2,
"cut_resist" : 4,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "cut",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 1
},
{
"ident" : "fur",
"name" : "Fur",
"bash_resist" : 2,
"cut_resist" : 2,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "sliced",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "chitin",
"name" : "Chitin",
"bash_resist" : 3,
"cut_resist" : 4,
"bash_dmg_verb" : "cracked",
"cut_dmg_verb" : "chipped",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 2
},
{
"ident" : "stone",
"name" : "Stone",
"bash_resist" : 6,
"cut_resist" : 6,
"bash_dmg_verb" : "cracked",
"cut_dmg_verb" : "chipped",
"acid_resist" : 2,
"elec_resist" : 2,
"fire_resist" : 2
},
{
"ident" : "paper",
"name" : "Paper",
"bash_resist" : 1,
"cut_resist" : 1,
"bash_dmg_verb" : "ripped",
"cut_dmg_verb" : "cut",
"acid_resist" : 0,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "wood",
"name" : "Wood",
"bash_resist" : 3,
"cut_resist" : 2,
"bash_dmg_verb" : "splintered",
"cut_dmg_verb" : "gouged",
"acid_resist" : 1,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "plastic",
"name" : "Plastic",
"bash_resist" : 2,
"cut_resist" : 2,
"bash_dmg_verb" : "dented",
"cut_dmg_verb" : "gouged",
"acid_resist" : 1,
"elec_resist" : 2,
"fire_resist" : 0
},
{
"ident" : "glass",
"name" : "Glass",
"bash_resist" : 1,
"cut_resist" : 4,
"bash_dmg_verb" : "cracked",
"cut_dmg_verb" : "scratched",
"acid_resist" : 2,
"elec_resist" : 2,
"fire_resist" : 2
},
{
"ident" : "iron",
"name" : "Iron",
"bash_resist" : 4,
"cut_resist" : 4,
"bash_dmg_verb" : "dented",
"cut_dmg_verb" : "scratched",
"acid_resist" : 0,
"elec_resist" : 0,
"fire_resist" : 2
},
{
"ident" : "steel",
"name" : "Steel",
"bash_resist" : 6,
"cut_resist" : 6,
"bash_dmg_verb" : "dented",
"cut_dmg_verb" : "scratched",
"acid_resist" : 0,
"elec_resist" : 0,
"fire_resist" : 2
},
{
"ident" : "silver",
"name" : "Silver",
"bash_resist" : 2,
"cut_resist" : 3,
"bash_dmg_verb" : "dented",
"cut_dmg_verb" : "scratched",
"acid_resist" : 0,
"elec_resist" : 0,
"fire_resist" : 2
}
]
+177 -38
View File
@@ -65,6 +65,37 @@
},
{
"result": "vac_sealer",
"id_suffix": "uncraft",
"category": "CC_NONCRAFT",
"difficulty": 0,
"time": 500,
"reversible": true,
"autolearn": false,
"tools": [
[
["screwdriver", -1],
["toolset", -1]
]
],
"components": [
[
["scrap", 4]
],
[
["element", 2]
],
[
["hose", 1]
],
[
["power_supply", 1]
]
]
},
{
"result": "lighter",
"id_suffix": "uncraft",
@@ -627,40 +658,6 @@
},
{
"result": "bolt_wood",
"category": "CC_WEAPON",
"skill_pri": "mechanics",
"skill_sec": "archery",
"difficulty": 1,
"time": 5000,
"reversible": false,
"autolearn": true,
"tools": [
[
["hatchet", -1],
["knife_steak", -1],
["knife_combat", -1],
["knife_butcher", -1],
["pockknife", -1],
["scalpel", -1],
["machete", -1],
["broadsword", -1],
["toolset", -1]
]
],
"components": [
[
["stick", 1],
["broom", 1],
["mop", 1],
["2x4", 1],
["bee_sting", 1]
]
]
},
{
"result": "crossbow",
"category": "CC_WEAPON",
@@ -944,7 +941,31 @@
["flask_glass", 1]
],
[
["battery", 500]
["acid", 4]
]
]
},
{
"result": "40mm_acidbomb",
"category": "CC_WEAPON",
"skill_pri": "mechanics",
"difficulty": 3,
"time": 100,
"reversible": false,
"autolearn": true,
"tools": [
[
["screwdriver",-1],
["toolset", -1]
]
],
"components": [
[
["acidbomb", 1]
],
[
["40mm_casing", 1]
]
]
},
@@ -1235,6 +1256,40 @@
]
},
{
"result": "bolt_wood",
"category": "CC_AMMO",
"skill_pri": "mechanics",
"skill_sec": "archery",
"difficulty": 1,
"time": 5000,
"reversible": false,
"autolearn": true,
"tools": [
[
["hatchet", -1],
["knife_steak", -1],
["knife_combat", -1],
["knife_butcher", -1],
["pockknife", -1],
["scalpel", -1],
["machete", -1],
["broadsword", -1],
["toolset", -1]
]
],
"components": [
[
["stick", 1],
["broom", 1],
["mop", 1],
["2x4", 1],
["bee_sting", 1]
]
]
},
{
"result": "9mm",
@@ -2199,6 +2254,57 @@
]
},
{
"result": "acid",
"category": "CC_DRINK",
"skill_pri": "cooking",
"difficulty": 4,
"time": 10000,
"reversible": false,
"autolearn": true,
"tools": [
[
["hotplate", 3],
["toolset", 1],
["fire", -1]
],
[
["pan", -1],
["pot", -1],
["rock_pot", -1]
]
],
"components": [
[
["water_acid", 1]
]
]
},
{
"result": "acid",
"id_suffix": "from batteries",
"category": "CC_DRINK",
"skill_pri": "electronics",
"skill_sec": "mechanics",
"difficulty": 2,
"time": 5000,
"reversible": false,
"autolearn": true,
"tools": [
[
["screwdriver", -1],
["toolset", -1]
]
],
"components": [
[
["battery", 125]
]
]
},
{
"result": "meat_cooked",
@@ -2755,6 +2861,37 @@
},
{
"result": "broth_bone",
"category": "CC_FOOD",
"skill_pri": "cooking",
"difficulty": 1,
"time": 60000,
"reversible": false,
"autolearn": true,
"tools": [
[
["hotplate", 6],
["toolset", 1],
["fire", -1]
],
[
["pot", -1],
["rock_pot", -1]
]
],
"components": [
[
["bone", 10]
],
[
["water", 1],
["water_clean", 1]
]
]
},
{
"result": "soup_veggy",
"category": "CC_FOOD",
@@ -3568,6 +3705,7 @@
"difficulty": 1,
"time": 20000,
"reversible": true,
"decomp_learn": 0,
"autolearn": true,
"components": [
[
@@ -3607,7 +3745,8 @@
"components": [
[
["ammonia", 1],
["lemon", 1]
["lemon", 1],
["acid", 1]
],
[
["steel_chunk", 1],
@@ -4216,7 +4355,7 @@
],
[
["soldering_iron", 20],
["toolset", 1]
["toolset", 2]
]
],
"components": [
@@ -4252,7 +4391,7 @@
],
[
["soldering_iron", 20],
["toolset", 20]
["toolset", 2]
]
],
"components": [
+79 -59
View File
@@ -3,6 +3,7 @@
#include "bodypart.h"
#include "disease.h"
#include "weather.h"
#include <stdlib.h>
#include <sstream>
void dis_msg(game *g, dis_type type)
@@ -219,13 +220,14 @@ void dis_effect(game *g, player &p, disease &dis)
case DI_HOT_HEAD:
switch (dis.intensity) {
case 3 :
p.thirst--;
if (p.pain < 50) p.pain++;
p.thirst++;
if (p.pain < 40) p.pain++;
if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("Your head is pounding from the heat.");
// Speed -20
case 2 :
p.thirst--;
if (one_in(15000 - p.temp_cur[bp_head])) p.vomit(g); // Hallucinations handled in game.cpp
p.thirst++;
// Hallucinations handled in game.cpp
if (one_in(std::min(14500,15000-p.temp_cur[bp_head]))) p.vomit(g);
if (p.pain < 20) p.pain++;
if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("The heat is making you see things.");
// Speed -5
@@ -235,21 +237,21 @@ void dis_effect(game *g, player &p, disease &dis)
case DI_HOT_MOUTH:
switch (dis.intensity) {
case 3 : p.thirst--;
if (p.pain < 50) p.pain++;
case 2 : p.thirst--;
case 3 : p.thirst++;
if (p.pain < 30) p.pain++;
case 2 : p.thirst++;
}
break;
case DI_HOT_TORSO:
switch (dis.intensity) {
case 3 :
p.thirst--;
p.thirst++;
p.str_cur--;
if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("You are sweating profusely.");
// Speed -20
case 2 :
p.thirst--;
p.thirst++;
p.str_cur--;
// Speed -5
// case 1 : Speed -2
@@ -258,9 +260,9 @@ void dis_effect(game *g, player &p, disease &dis)
case DI_HOT_ARMS:
switch (dis.intensity) {
case 3 : p.thirst--;
if (p.pain < 50) p.pain++;
case 2 : p.thirst--;
case 3 : p.thirst++;
if (p.pain < 30) p.pain++;
case 2 : p.thirst++;
}
break;
@@ -273,17 +275,16 @@ void dis_effect(game *g, player &p, disease &dis)
case DI_HOT_LEGS:
switch (dis.intensity) {
case 3 : p.thirst--;
if (p.pain < 50) p.pain++;
case 3 : p.thirst++;
if (p.pain < 30) p.pain++;
if (one_in(400)) g->add_msg("Your legs are cramping up.");
case 2 : p.thirst--;
case 2 : p.thirst++;
}
break;
case DI_HOT_FEET:
switch (dis.intensity) {
case 3 : if (p.pain < 50) p.pain++;
case 2 :
case 3 :
if (p.pain < 30) p.pain++;
if (!p.has_disease(DI_SLEEP) && one_in(400)) g->add_msg("Your feet are swelling in the heat.");
}
@@ -523,48 +524,67 @@ void dis_effect(game *g, player &p, disease &dis)
g->add_msg("You try to sleep, but can't...");
break;
case DI_SLEEP:
p.moves = 0;
if (int(g->turn) % 25 == 0) {
if (p.fatigue > 0)
p.fatigue -= 1 + rng(0, 1) * rng(0, 1);
if (p.has_trait(PF_FASTHEALER))
p.healall(rng(0, 1));
else
p.healall(rng(0, 1) * rng(0, 1) * rng(0, 1));
if (p.fatigue <= 0 && p.fatigue > -20) {
p.fatigue = -25;
g->add_msg("Fully rested.");
dis.duration = dice(3, 100);
}
}
if (int(g->turn) % 100 == 0 && !p.has_bionic("bio_recycler")) {
// Hunger and thirst advance more slowly while we sleep.
p.hunger--;
p.thirst--;
}
if (rng(5, 80) + rng(0, 120) + rng(0, abs(p.fatigue)) +
rng(0, abs(p.fatigue * 5)) < g->light_level() &&
(p.fatigue < 10 || one_in(p.fatigue / 2))) {
g->add_msg("The light wakes you up.");
dis.duration = 1;
}
// Cold or heat may wake you up.
// Player will sleep through cold or heat if fatigued enough
for (int i = 0 ; i < num_bp ; i++){
if (p.temp_cur[i] < BODYTEMP_VERY_COLD - p.fatigue/2 ||
(one_in(p.temp_cur[i] + 1000) && p.temp_cur[i] < BODYTEMP_COLD - p.fatigue/2)){
g->add_msg("The cold wakes you up.");
dis.duration = 1;
}
if (p.temp_cur[i] > BODYTEMP_VERY_HOT + p.fatigue/2 ||
(one_in(11000 - p.temp_cur[i]) && p.temp_cur[i] > BODYTEMP_HOT + p.fatigue/2)){
g->add_msg("The heat wakes you up.");
dis.duration = 1;
}
}
case DI_SLEEP:
p.moves = 0;
break;
if (int(g->turn) % 25 == 0) {
if (p.fatigue > 0)
p.fatigue -= 1 + rng(0, 1) * rng(0, 1);
if (p.has_trait(PF_FASTHEALER)) {
p.healall(rng(0, 1));
} else if (p.has_trait(PF_FASTHEALER2)) {
p.healall(rng(0, 2));
} else if (p.has_trait(PF_REGEN)) {
p.healall(rng(1, 2));
} else {
p.healall(rng(0, 1) * rng(0, 1) * rng(0, 1));
}
if (p.fatigue <= 0 && p.fatigue > -20) {
p.fatigue = -25;
g->add_msg("Fully rested.");
dis.duration = dice(3, 100);
}
}
if (int(g->turn) % 100 == 0 && !p.has_bionic("bio_recycler")) {
// Hunger and thirst advance more slowly while we sleep.
p.hunger--;
p.thirst--;
}
if (rng(5, 80) + rng(0, 120) + rng(0, abs(p.fatigue)) +
rng(0, abs(p.fatigue * 5)) < g->light_level() &&
(p.fatigue < 10 || one_in(p.fatigue / 2))) {
g->add_msg("The light wakes you up.");
dis.duration = 1;
}
// Cold or heat may wake you up.
// Player will sleep through cold or heat if fatigued enough
for (int i = 0 ; i < num_bp ; i++)
{
if (p.temp_cur[i] < BODYTEMP_VERY_COLD - p.fatigue/2)
{
if (one_in(5000)) { g->add_msg("You toss and turn trying to keep warm."); }
if (p.temp_cur[i] < BODYTEMP_FREEZING - p.fatigue/2 || (one_in(p.temp_cur[i] + 5000)))
{
g->add_msg("The cold wakes you up.");
dis.duration = 1;
}
}
else if (p.temp_cur[i] > BODYTEMP_VERY_HOT + p.fatigue/2)
{
if (one_in(5000)) { g->add_msg("You toss and turn in the heat."); }
if (p.temp_cur[i] > BODYTEMP_SCORCHING + p.fatigue/2 || (one_in(15000 - p.temp_cur[i])))
{
g->add_msg("The heat wakes you up.");
dis.duration = 1;
}
}
}
break;
case DI_STEMCELL_TREATMENT:
//slightly repair broken limbs. (also nonbroken limbs (unless they're too healthy))
@@ -1494,7 +1514,7 @@ std::string dis_description(disease dis)
case DI_HOT_FEET:
switch (dis.intensity) {
case 1: return "Your feet feel hot.";
case 1: return "Your feet feel warm.";
case 2: return "Your feet are painfully swollen due to the heat.";
case 3: return "Your feet are painfully swollen due to the heat.";}
+14 -2
View File
@@ -10,15 +10,27 @@ MNULL = 0,
//Food Materials
VEGGY, FLESH, POWDER, HFLESH, //Human Flesh.
//Clothing
COTTON, WOOL, LEATHER, KEVLAR, FUR,
COTTON, WOOL, LEATHER, KEVLAR, FUR, CHITIN,
//Other
STONE, PAPER, WOOD, PLASTIC, GLASS, IRON, STEEL, SILVER
STONE, PAPER, WOOD, PLASTIC, GLASS, IRON, STEEL, SILVER,
NUM_MAT_TYPES
};
enum phase_id {
PNULL, SOLID, LIQUID, GAS, PLASMA
};
enum damage_type
{
DNULL = 0,
BASH,
CUT,
ACID,
ELECTRICITY,
FIRE,
NUM_DAM_TYPES
};
struct point {
int x;
int y;
+2 -2
View File
@@ -316,7 +316,7 @@ bool map::process_fields_in_submap(game *g, int gridn)
for (int a = -1; a <= 1; a++) {
for (int b = -1; b <= 1; b++) {
if ((field_at(x+a, y+b).type == fd_smoke &&
field_at(x+a, y+b).density < 3 ) ||
field_at(x+a, y+b).density < 3) ||
(field_at(x+a, y+b).is_null() && move_cost(x+a, y+b) > 0))
spread.push_back(point(x+a, y+b));
}
@@ -1114,7 +1114,7 @@ void map::field_effect(int x, int y, game *g) //Applies effect of field immediat
}
vehicle *veh = veh_at(x, y, veh_part);
if (veh) {
veh->damage(veh_part, ceil(veh->parts[veh_part].hp/3 * cur->density), 1, false);
veh->damage(veh_part, ceil(veh->parts[veh_part].hp/3.0 * cur->density), 1, false);
}
}
}
+1106 -688
View File
File diff suppressed because it is too large Load Diff
+15 -6
View File
@@ -145,6 +145,8 @@ class game
// Kill that monster; fixes any pointers etc
void kill_mon(int index, bool player_did_it = false);
void explode_mon(int index); // Explode a monster; like kill_mon but messier
void revive_corpse(int x, int y, int n); // revives a corpse from an item pile
void revive_corpse(int x, int y, item *it); // revives a corpse by item pointer, caller handles item deletion
// hit_monster_with_flags processes ammo flags (e.g. incendiary, etc)
void hit_monster_with_flags(monster &z, unsigned int flags);
void plfire(bool burst); // Player fires a gun (target selection)...
@@ -155,6 +157,8 @@ class game
std::vector<point> &trajectory);
void cancel_activity();
void cancel_activity_query(const char* message, ...);
bool cancel_activity_or_ignore_query(const char* reason, ...);
int assign_mission_id(); // Just returns the next available one
void give_mission(mission_id type); // Create the mission and assign it
void assign_mission(int id); // Just assign an existing mission
@@ -177,7 +181,7 @@ class game
void teleport(player *p = NULL);
void plswim(int x, int y); // Called by plmove. Handles swimming
// when player is thrown (by impact or something)
void fling_player_or_monster(player *p, monster *zz, int dir, int flvel);
void fling_player_or_monster(player *p, monster *zz, const int& dir, float flvel);
void nuke(int x, int y);
std::vector<faction *> factions_at(int x, int y);
@@ -226,9 +230,9 @@ class game
point find_item(item *it);
void remove_item(item *it);
inventory crafting_inventory(); // inv_from_map, inv, & 'weapon'
void consume_items(std::vector<component> components);
void consume_tools(std::vector<component> tools);
inventory crafting_inventory(player *p); // inv_from_map, inv, & 'weapon'
std::list<item> consume_items(player *p, std::vector<component> components);
void consume_tools(player *p, std::vector<component> tools, bool force_available);
bool has_gametype() const { return gamemode && gamemode->id() != SGAME_NULL; }
special_game_id gametype() const { return (gamemode) ? gamemode->id() : SGAME_NULL; }
@@ -289,13 +293,15 @@ class game
bionic_id random_good_bionic() const; // returns a non-faulty, valid bionic
void load_artifacts(); // Load artifact data
// Needs to be called by main() before MAPBUFFER.load
private:
// Game-start procedures
bool opening_screen();// Warn about screen size, then present the main menu
void print_menu(WINDOW* w_open, int iSel, const int iMenuOffsetX, int iMenuOffsetY, bool bShowDDA = true);
void print_menu_items(WINDOW* w_in, std::vector<std::string> vItems, int iSel, int iOffsetY, int iOffsetX);
bool load_master(); // Load the master data file, with factions &c
void load_artifacts(); // Load artifact data
void load_weather(std::ifstream &fin);
void load(std::string name); // Load a player-specific save file
void start_game(); // Starts a new game
@@ -383,7 +389,7 @@ class game
void compare(int iCompareX = -999, int iCompareY = -999); // Compare two Items 'I'
void drop(char chInput = '.'); // Drop an item 'd'
void drop_in_direction(); // Drop w/ direction 'D'
void reassign_item(); // Reassign the letter of an item '='
void reassign_item(char ch = '.'); // Reassign the letter of an item '='
void butcher(); // Butcher a corpse 'B'
void complete_butcher(int index); // Finish the butchering process
void forage(); // Foraging ('a' on underbrush)
@@ -477,6 +483,9 @@ class game
int kills[num_monsters]; // Player's kill count
std::string last_action; // The keypresses of last turn
int last_inv_start, last_inv_sel; // workaround until inventory_ui.cpp is rewritten
int advanced_inv_leftsort, advanced_inv_rightsort;
int moves_since_last_save;
int item_exchanges_since_save;
time_t last_save_timestamp;
+18 -8
View File
@@ -39,7 +39,7 @@ c: Viewing k: Traps\n\
d: Hunger, Thirst, and Sleep l: Items overview\n\
e: Pain and Stimulants m: Combat\n\
f: Addiction n: Unarmed Styles\n\
g: Morale and XP o: Survival tips\n\
g: Morale and Learning o: Survival tips\n\
h: Radioactivity and Mutation\n\
\n\
1: List of all commands (you can change key commands here)\n\
@@ -221,14 +221,24 @@ Press any key for more...");
getch();
werase(w_help);
mvwprintz(w_help, 0, 0, c_white, "\
Morale is also responsible for filling your XP pool. This XP pool is used\n\
for improving your skills; as you use your skills, points are taken from the\n\
XP pool and placed into the skill used. If your XP pool is empty, your\n\
skills cannot be improved except through the use of books.\n\
Morale is also responsible for ensuring you can learn effectively, via a\n\
mechanic referred to as 'focus'. Your focus level is a measure of how\n\
effectively you can learn. The natural level is 100, which indicates normal\n\
learning potential. Higher or lower focus levels make it easier or harder to\n\
learn from practical experience.\n\
\n\
Your XP pool will not fill unless your morale is at least 0. A morale level\n\
between 0 and 100 gives the percentage chance for your XP to increase by 1\n\
each turn. Above 100, you get 1 XP point each turn for every 100 morale.");
Your focus level has a natural set point that it converges towards. When your\n\
focus is much lower - or higher - than this set point, it will change faster\n\
than when it is near the set point. Having high morale will raise the set\n\
point, and having low morale will lower the set point. Pain is also factored\n\
into the set point calculation - it's harder to learn when you're in pain.\n\
\n\
Your focus is also lowered by certain activities. Training your skills\n\
through real-world practice lowers your focus gradually, by an amount that\n\
depends on your current level of focus (higher focus means larger decreases,\n\
as well as improved learning). Training your skills by reading books\n\
decreases your focus rapidly, by giving a significant penalty to the set\n\
point of your focus.");
wrefresh(w_help);
refresh();
getch();
+14
View File
@@ -713,6 +713,11 @@ void iexamine::trap(game *g, player *p, map *m, int examx, int examy) {
{
water_source(g, p, m, examx, examy);
}
else if (m->tr_at(examx, examy) == tr_funnel && m->is_outside(examx, examy) &&
(g->weather == WEATHER_ACID_DRIZZLE || g->weather == WEATHER_ACID_RAIN))
{
acid_source(g, p, m, examx, examy);
}
}
void iexamine::water_source(game *g, player *p, map *m, const int examx, const int examy)
@@ -732,3 +737,12 @@ void iexamine::water_source(game *g, player *p, map *m, const int examx, const i
p->moves -= 350;
}
}
void iexamine::acid_source(game *g, player *p, map *m, const int examx, const int examy)
{
item acid = m->acid_from(examx, examy);
if (g->handle_liquid(acid, true, true))
{
p->moves -= 100;
}
}
+1
View File
@@ -48,6 +48,7 @@ public:
void recycler (game *g, player *p, map *m, int examx, int examy);
void trap(game *g, player *p, map *m, int examx, int examy);
void water_source (game *g, player *p, map *m, const int examx, const int examy);
void acid_source (game *g, player *p, map *m, const int examx, const int examy);
};
#endif /* defined(__Cataclysmic__iexamine__) */
+23 -8
View File
@@ -318,7 +318,7 @@ item& inventory::add_item(item newit, bool keep_invlet)
}
else if (it_ref->stacks_with(newit))
{
if (it_ref->is_food() && it_ref->has_flag(IF_HOT))
if (it_ref->is_food() && it_ref->has_flag("HOT"))
{
int tmpcounter = (it_ref->item_counter + newit.item_counter) / 2;
it_ref->item_counter = tmpcounter;
@@ -830,8 +830,9 @@ int inventory::charges_of(itype_id it) const
return count;
}
void inventory::use_amount(itype_id it, int quantity, bool use_container)
std::list<item> inventory::use_amount(itype_id it, int quantity, bool use_container)
{
std::list<item> ret;
for (invstack::iterator iter = items.begin(); iter != items.end() && quantity > 0; ++iter)
{
for (std::list<item>::iterator stack_iter = iter->begin();
@@ -844,6 +845,7 @@ void inventory::use_amount(itype_id it, int quantity, bool use_container)
{
if (stack_iter->contents[k].type->id == it)
{
ret.push_back(stack_iter->contents[k]);
quantity--;
stack_iter->contents.erase(stack_iter->contents.begin() + k);
k--;
@@ -864,6 +866,7 @@ void inventory::use_amount(itype_id it, int quantity, bool use_container)
}
else if (stack_iter->type->id == it && quantity > 0)
{
ret.push_back(*stack_iter);
quantity--;
stack_iter = iter->erase(stack_iter);
--stack_iter;
@@ -871,14 +874,17 @@ void inventory::use_amount(itype_id it, int quantity, bool use_container)
{
iter = items.erase(iter);
--iter;
stack_iter = iter->begin();
}
}
}
}
return ret;
}
void inventory::use_charges(itype_id it, int quantity)
std::list<item> inventory::use_charges(itype_id it, int quantity)
{
std::list<item> ret;
for (invstack::iterator iter = items.begin(); iter != items.end() && quantity > 0; ++iter)
{
for (std::list<item>::iterator stack_iter = iter->begin();
@@ -892,6 +898,7 @@ void inventory::use_charges(itype_id it, int quantity)
{
if (stack_iter->contents[k].charges <= quantity)
{
ret.push_back(stack_iter->contents[k]);
quantity -= stack_iter->contents[k].charges;
if (stack_iter->contents[k].destroyed_at_zero_charges())
{
@@ -905,8 +912,11 @@ void inventory::use_charges(itype_id it, int quantity)
}
else
{
item tmp = stack_iter->contents[k];
tmp.charges = quantity;
ret.push_back(tmp);
stack_iter->contents[k].charges -= quantity;
return;
return ret;
}
}
}
@@ -916,6 +926,7 @@ void inventory::use_charges(itype_id it, int quantity)
{
if (stack_iter->charges <= quantity)
{
ret.push_back(*stack_iter);
quantity -= stack_iter->charges;
if (stack_iter->destroyed_at_zero_charges())
{
@@ -935,12 +946,16 @@ void inventory::use_charges(itype_id it, int quantity)
}
else
{
item tmp = *stack_iter;
tmp.charges = quantity;
ret.push_back(tmp);
stack_iter->charges -= quantity;
return;
return ret;
}
}
}
}
return ret;
}
bool inventory::has_amount(itype_id it, int quantity) const
@@ -1037,7 +1052,7 @@ int inventory::butcher_factor() const
++stack_iter)
{
const item& cur_item = *stack_iter;
if (cur_item.damage_cut() >= 10 && !cur_item.has_flag(IF_SPEAR))
if (cur_item.damage_cut() >= 10 && !cur_item.has_flag("SPEAR"))
{
int factor = cur_item.volume() * 5 - cur_item.weight() * 1.5 -
cur_item.damage_cut();
@@ -1206,13 +1221,13 @@ item& inventory::most_appropriate_painkiller(int pain)
return ret;
}
item& inventory::best_for_melee(int skills[num_skill_types])
item& inventory::best_for_melee(player *p)
{
item& ret = nullitem;
int best = 0;
for (invstack::iterator iter = items.begin(); iter != items.end(); ++iter)
{
int score = iter->front().melee_value(skills);
int score = iter->front().melee_value(p);
if (score > best)
{
best = score;
+3 -3
View File
@@ -76,8 +76,8 @@ class inventory
int amount_of (itype_id it) const;
int charges_of(itype_id it) const;
void use_amount (itype_id it, int quantity, bool use_container = false);
void use_charges(itype_id it, int quantity);
std::list<item> use_amount (itype_id it, int quantity, bool use_container = false);
std::list<item> use_charges(itype_id it, int quantity);
bool has_amount (itype_id it, int quantity) const;
bool has_charges(itype_id it, int quantity) const;
@@ -95,7 +95,7 @@ class inventory
int worst_item_value(npc* p) const;
bool has_enough_painkiller(int pain) const;
item& most_appropriate_painkiller(int pain);
item& best_for_melee(int skills[num_skill_types]);
item& best_for_melee(player *p);
item& most_loaded_gun();
void rust_iron_items();
+217 -81
View File
@@ -142,7 +142,7 @@ char game::inv(std::string title)
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int ch = (int)'.';
int start = 0, cur_it;
int start = 0, cur_it, max_it;
u.inv.sort();
u.inv.restack(&u);
invslice slice = u.inv.slice(0, u.inv.size());
@@ -150,8 +150,13 @@ char game::inv(std::string title)
print_inv_statics(this, w_inv, title, null_vector);
// Gun, ammo, weapon, armor, food, tool, book, other
std::vector<int> firsts = find_firsts(slice);
int selected=-1;
int selected_char=(int)' ';
if( last_inv_start >= 0 ) start = last_inv_start;
if( last_inv_sel >= 0 ) selected = last_inv_sel;
do {
selected_char=(int)' ';
if (( ch == '<' || ch == KEY_PPAGE ) && start > 0) { // Clear lines and shift
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
@@ -159,14 +164,17 @@ char game::inv(std::string title)
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
if ( selected > -1 ) selected = start; // oy, the cheese
}
if ((ch == '>' || ch == KEY_NPAGE ) && cur_it < u.inv.size()) { // Clear lines and shift
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
if ( selected < start && selected > -1 ) selected = start;
}
int cur_line = 2;
max_it = 0;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
@@ -179,8 +187,9 @@ char game::inv(std::string title)
}
if (cur_it < slice.size()) {
item& it = slice[cur_it]->front();
mvwputch (w_inv, cur_line, 0, c_white, it.invlet);
mvwprintz(w_inv, cur_line, 1, it.color_in_inventory(&u), " %s",
if(cur_it==selected) selected_char=(int)it.invlet;
mvwputch (w_inv, cur_line, 0, (cur_it == selected ? h_white : c_white), it.invlet);
mvwprintz(w_inv, cur_line, 1, (cur_it == selected ? h_white : it.color_in_inventory(&u) ), " %s",
it.tname(this).c_str());
if (slice[cur_it]->size() > 1)
wprintw(w_inv, " [%d]", slice[cur_it]->size());
@@ -189,6 +198,7 @@ char game::inv(std::string title)
else if (it.contents.size() == 1 &&
it.contents[0].charges > 0)
wprintw(w_inv, " (%d)", it.contents[0].charges);
max_it=cur_it;
}
cur_line++;
}
@@ -197,8 +207,44 @@ char game::inv(std::string title)
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
} while (ch == '<' || ch == '>' || ch == KEY_NPAGE || ch == KEY_PPAGE );
if ( ch == KEY_DOWN ) {
if ( selected < 0 ) {
selected = start;
} else {
selected++;
}
if ( selected > max_it ) {
if( cur_it < u.inv.size() ) {
ch='>';
} else {
selected = u.inv.size() - 1; // wraparound?
}
}
} else if ( ch == KEY_UP ) {
selected--;
if ( selected < -1 ) {
selected = -1; // wraparound?
} else if ( selected < start ) {
if ( start > 0 ) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
}
} else if ( ch == '\n' || ch == KEY_RIGHT ) {
if ( last_inv_start > -2 && last_inv_sel > -2 ) {
last_inv_start=start;
last_inv_sel=selected;
}
ch = selected_char;
}
} while (ch == '<' || ch == '>' || ch == KEY_NPAGE || ch == KEY_PPAGE || ch == KEY_UP || ch == KEY_DOWN );
werase(w_inv);
delwin(w_inv);
erase();
@@ -214,7 +260,7 @@ char game::inv_type(std::string title, item_cat inv_item_type)
WINDOW* w_inv = newwin(((VIEWY < 12) ? 25 : VIEWY*2+1), ((VIEWX < 12) ? 80 : VIEWX*2+56), VIEW_OFFSET_Y, VIEW_OFFSET_X);
const int maxitems = (VIEWY < 12) ? 20 : VIEWY*2-4; // Number of items to show at one time.
int ch = (int)'.';
int start = 0, cur_it;
int start = 0, cur_it, max_it;
u.inv.sort();
u.inv.restack(&u);
std::vector<char> null_vector;
@@ -227,6 +273,8 @@ char game::inv_type(std::string title, item_cat inv_item_type)
invslice slice = reduced_inv.slice(0, reduced_inv.size());
std::vector<int> firsts = find_firsts(slice);
int selected=-1;
int selected_char=(int)' ';
do {
if (( ch == '<' || ch == KEY_PPAGE ) && start > 0) { // Clear lines and shift
for (int i = 1; i < maxitems+4; i++)
@@ -235,14 +283,17 @@ char game::inv_type(std::string title, item_cat inv_item_type)
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
if ( selected > -1 ) selected = start; // oy, the cheese
}
if (( ch == '>' || ch == KEY_NPAGE ) && cur_it < reduced_inv.size()) { // Clear lines and shift
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
if ( selected < start && selected > -1 ) selected = start;
}
int cur_line = 2;
max_it = 0;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
@@ -257,8 +308,9 @@ char game::inv_type(std::string title, item_cat inv_item_type)
if (cur_it < slice.size())
{
item& it = slice[cur_it]->front();
mvwputch (w_inv, cur_line, 0, c_white, it.invlet);
mvwprintz(w_inv, cur_line, 1, it.color_in_inventory(&u), " %s",
if(cur_it==selected) selected_char=(int)it.invlet;
mvwputch (w_inv, cur_line, 0, (cur_it == selected ? h_white : c_white), it.invlet);
mvwprintz(w_inv, cur_line, 1, (cur_it == selected ? h_white : it.color_in_inventory(&u) ), " %s",
it.tname(this).c_str());
if (slice[cur_it]->size() > 1)
wprintw(w_inv, " [%d]", slice[cur_it]->size());
@@ -267,7 +319,8 @@ char game::inv_type(std::string title, item_cat inv_item_type)
else if (it.contents.size() == 1 &&
it.contents[0].charges > 0)
wprintw(w_inv, " (%d)", it.contents[0].charges);
cur_line++;
cur_line++;
max_it=cur_it;
}
// cur_line++;
}
@@ -276,8 +329,41 @@ char game::inv_type(std::string title, item_cat inv_item_type)
if (cur_it < reduced_inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
ch = getch();
} while (ch == '<' || ch == '>' || ch == KEY_NPAGE || ch == KEY_PPAGE );
if ( ch == KEY_DOWN ) {
if ( selected < 0 ) {
selected = start;
} else {
selected++;
}
if ( selected > max_it ) {
if( cur_it < u.inv.size() ) {
ch='>';
} else {
selected = u.inv.size() - 1; // wraparound?
}
}
} else if ( ch == KEY_UP ) {
selected--;
if ( selected < -1 ) {
selected = -1; // wraparound?
} else if ( selected < start ) {
if ( start > 0 ) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
}
} else if ( ch == '\n' || ch == KEY_RIGHT ) {
ch = selected_char;
}
} while (ch == '<' || ch == '>' || ch == KEY_NPAGE || ch == KEY_PPAGE || ch == KEY_UP || ch == KEY_DOWN );
werase(w_inv);
delwin(w_inv);
erase();
@@ -300,9 +386,11 @@ std::vector<item> game::multidrop()
int base_volume = u.volume_carried();
int ch = (int)'.';
int start = 0, cur_it;
int start = 0, cur_it, max_it;
invslice stacks = u.inv.slice(0, u.inv.size());
std::vector<int> firsts = find_firsts(stacks);
int selected=-1;
int selected_char=(int)' ';
do {
inventory drop_subset = u.inv.subset(dropping);
int new_weight = base_weight - drop_subset.weight();
@@ -311,21 +399,8 @@ std::vector<item> game::multidrop()
new_weight -= u.i_at(weapon_and_armor[i]).weight();
}
print_inv_weight_vol(this, w_inv, new_weight, new_volume);
if (( ch == '<' || ch == KEY_PPAGE ) && start > 0) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
if (( ch == '>' || ch == KEY_NPAGE ) && cur_it < u.inv.size()) {
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
}
int cur_line = 2;
max_it = 0;
for (cur_it = start; cur_it < start + maxitems && cur_line < maxitems+3; cur_it++) {
// Clear the current line;
mvwprintw(w_inv, cur_line, 0, " ");
@@ -336,15 +411,19 @@ std::vector<item> game::multidrop()
cur_line++;
}
}
if ( selected < start && selected > -1 ) selected = start;
if (cur_it < stacks.size()) {
item& it = stacks[cur_it]->front();
mvwputch (w_inv, cur_line, 0, c_white, it.invlet);
if(cur_it==selected) selected_char=(int)it.invlet;
mvwputch (w_inv, cur_line, 0, (cur_it == selected ? h_white : c_white), it.invlet);
char icon = '-';
if (dropping[it.invlet] >= (it.count_by_charges() ? it.charges : stacks[cur_it]->size()))
icon = '+';
else if (dropping[it.invlet] > 0)
icon = '#';
nc_color col = (dropping[it.invlet] == 0 ? c_ltgray : c_white);
nc_color col = ( cur_it == selected ? h_white : (dropping[it.invlet] == 0 ? c_ltgray : c_white ) );
mvwprintz(w_inv, cur_line, 1, col, " %c %s", icon,
it.tname(this).c_str());
if (stacks[cur_it]->size() > 1)
@@ -356,74 +435,131 @@ std::vector<item> game::multidrop()
wprintw(w_inv, " (%d)", it.contents[0].charges);
}
cur_line++;
max_it=cur_it;
}
if (start > 0)
mvwprintw(w_inv, maxitems + 4, 0, "< Go Back");
if (cur_it < u.inv.size())
mvwprintw(w_inv, maxitems + 4, 12, "> More items");
wrefresh(w_inv);
/* back to (int)getch() as input() mangles arrow keys
ch = input();
if (ch >= '0'&& ch <= '9') {
*/
ch = getch();
if ( ch == '<' || ch == KEY_PPAGE ) {
if( start > 0) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
if ( selected > -1 ) selected = start; // oy, the cheese
}
} else if ( ch == '>' || ch == KEY_NPAGE ) {
if ( cur_it < u.inv.size()) {
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
if ( selected < start && selected > -1 ) selected = start;
}
} else if ( ch == KEY_DOWN ) {
if ( selected < 0 ) {
selected = start;
} else {
selected++;
}
if ( selected > max_it ) {
if( cur_it < u.inv.size() ) {
start = cur_it;
mvwprintw(w_inv, maxitems + 4, 12, " ");
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
} else {
selected = u.inv.size() - 1; // wraparound?
}
}
} else if ( ch == KEY_UP ) {
selected--;
if ( selected < -1 ) {
selected = -1; // wraparound?
} else if ( selected < start ) {
if ( start > 0 ) {
for (int i = 1; i < maxitems+4; i++)
mvwprintz(w_inv, i, 0, c_black, " ");
start -= maxitems;
if (start < 0)
start = 0;
mvwprintw(w_inv, maxitems + 4, 0, " ");
}
}
} else if (ch >= '0'&& ch <= '9') {
ch = (char)ch - '0';
count *= 10;
count += ch;
} else if (u.has_item(ch)) {
item& it = u.inv.item_by_letter(ch);
if (it.is_null()) { // Not from inventory
int found = false;
for (int i = 0; i < weapon_and_armor.size() && !found; i++) {
if (weapon_and_armor[i] == ch) {
weapon_and_armor.erase(weapon_and_armor.begin() + i);
found = true;
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
} else { // todo: reformat and maybe rewrite
if ( ch == '\t' || ch == KEY_RIGHT || ch == KEY_LEFT ) {
ch = selected_char;
}
}
if (!found) {
if ( ch == u.weapon.invlet &&
std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(), u.weapon.type->id) != unreal_itype_ids.end()){
if (!warned_about_bionic)
add_msg("You cannot drop your %s.", u.weapon.tname(this).c_str());
warned_about_bionic = true;
} else {
weapon_and_armor.push_back(ch);
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
}
}
} else {
int index = -1;
for (int i = 0; i < stacks.size(); ++i) {
if (stacks[i]->front().invlet == it.invlet) {
index = i;
break;
}
}
if (index == -1) {
debugmsg("Inventory got out of sync with inventory slice?");
}
if (count == 0) {
if (it.count_by_charges())
{
if (dropping[it.invlet] == 0)
dropping[it.invlet] = -1;
else
dropping[it.invlet] = 0;
}
else
{
if (dropping[it.invlet] == 0)
dropping[it.invlet] = stacks[index]->size();
else
dropping[it.invlet] = 0;
}
}
if (u.has_item(ch)) {
item& it = u.inv.item_by_letter(ch);
if (it.is_null()) { // Not from inventory
int found = false;
for (int i = 0; i < weapon_and_armor.size() && !found; i++) {
if (weapon_and_armor[i] == ch) {
weapon_and_armor.erase(weapon_and_armor.begin() + i);
found = true;
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
}
}
if (!found) {
if ( ch == u.weapon.invlet &&
std::find(unreal_itype_ids.begin(), unreal_itype_ids.end(), u.weapon.type->id) != unreal_itype_ids.end()){
if (!warned_about_bionic)
add_msg("You cannot drop your %s.", u.weapon.tname(this).c_str());
warned_about_bionic = true;
} else {
weapon_and_armor.push_back(ch);
print_inv_statics(this, w_inv, "Multidrop:", weapon_and_armor);
}
}
} else {
int index = -1;
for (int i = 0; i < stacks.size(); ++i) {
if (stacks[i]->front().invlet == it.invlet) {
index = i;
break;
}
}
if (index == -1) {
debugmsg("Inventory got out of sync with inventory slice?");
}
if (count == 0) {
if (it.count_by_charges())
{
if (dropping[it.invlet] == 0)
dropping[it.invlet] = -1;
else
dropping[it.invlet] = 0;
}
else
{
if (dropping[it.invlet] == 0)
dropping[it.invlet] = stacks[index]->size();
else
dropping[it.invlet] = 0;
}
}
else if (count >= stacks[index]->size() && !it.count_by_charges())
dropping[it.invlet] = stacks[index]->size();
else
dropping[it.invlet] = count;
else if (count >= stacks[index]->size() && !it.count_by_charges())
dropping[it.invlet] = stacks[index]->size();
else
dropping[it.invlet] = count;
count = 0;
}
count = 0;
}
}
}
} while (ch != '\n' && ch != KEY_ESCAPE && ch != ' ');
werase(w_inv);
+244 -135
View File
@@ -7,6 +7,8 @@
#include <algorithm>
#include "cursesdef.h"
#include "text_snippets.h"
#include "material.h"
#include "item_factory.h"
// mfb(n) converts a flag to its appropriate position in covers's bitfield
#ifndef mfb
@@ -26,8 +28,7 @@ item::item()
damage = 0;
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
mode = "NULL";
item_counter = 0;
type = nullitem();
curammo = NULL;
@@ -50,8 +51,7 @@ item::item(itype* it, unsigned int turn)
damage = 0;
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
mode = "NULL";
item_counter = 0;
active = false;
curammo = NULL;
@@ -74,11 +74,15 @@ item::item(itype* it, unsigned int turn)
charges = comest->charges;
} else if (it->is_tool()) {
it_tool* tool = dynamic_cast<it_tool*>(it);
if (tool->max_charges == 0)
if (tool->max_charges == 0) {
charges = -1;
else
} else {
charges = tool->def_charges;
} else if ((it->is_gunmod() && it->id == "spare_mag") || it->item_flags & mfb(IF_MODE_AUX)) {
if (tool->ammo != AT_NULL) {
curammo = dynamic_cast<it_ammo*>(item_controller->find_template(default_ammo(tool->ammo)));
}
}
} else if ((it->is_gunmod() && it->id == "spare_mag") || it->item_tags.count("MODE_AUX")) {
charges = 0;
} else
charges = -1;
@@ -89,7 +93,7 @@ item::item(itype* it, unsigned int turn)
// Should be a flag, but we're out at the moment
if( it->is_stationary() )
{
mode = SNIPPET.assign( (dynamic_cast<it_stationary*>(it))->category );
note = SNIPPET.assign( (dynamic_cast<it_stationary*>(it))->category );
}
}
@@ -104,8 +108,7 @@ item::item(itype *it, unsigned int turn, char let)
damage = 0;
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
mode = "NULL";
item_counter = 0;
active = false;
if (it->is_gun()) {
@@ -143,7 +146,7 @@ item::item(itype *it, unsigned int turn, char let)
// Should be a flag, but we're out at the moment
if( it->is_stationary() )
{
mode = SNIPPET.assign( (dynamic_cast<it_stationary*>(it))->category );
note = SNIPPET.assign( (dynamic_cast<it_stationary*>(it))->category );
}
}
@@ -155,11 +158,10 @@ void item::make_corpse(itype* it, mtype* mt, unsigned int turn)
damage = 0;
burnt = 0;
poison = 0;
mode = IF_NULL;
item_flags = 0;
mode = "NULL";
item_counter = 0;
curammo = NULL;
active = false;
active = mt->species == species_zombie ? true : false;
if(!it)
type = nullitem();
else
@@ -192,6 +194,13 @@ void item::make(itype* it)
contents.clear();
}
void item::clear()
{
// should we be clearing contents, as well?
// Seems risky to - there aren't any reported content-clearing bugs
item_tags.clear();
}
bool item::is_null() const
{
return (type == NULL || type->id == "null");
@@ -237,7 +246,7 @@ bool item::stacks_with(item rhs)
bool stacks = (type == rhs.type && damage == rhs.damage &&
active == rhs.active && charges == rhs.charges &&
item_flags == rhs.item_flags &&
item_tags == rhs.item_tags &&
contents.size() == rhs.contents.size() &&
(!goes_bad() || bday == rhs.bday));
@@ -289,8 +298,17 @@ std::string item::save_info() const
}
std::stringstream dump;
dump << " " << int(invlet) << " " << typeId() << " " << int(charges) <<
" " << int(damage) << " " << int(item_flags) << " " << int(burnt) <<
" " << poison << " " << ammotmp << " " << owned << " " << int(bday) << " " << mode;
" " << int(damage) << " ";
dump << item_tags.size() << " ";
for( std::set<std::string>::const_iterator it = item_tags.begin();
it != item_tags.end(); ++it )
{
dump << *it << " ";
}
dump << int(burnt) << " " << poison << " " << ammotmp <<
" " << owned << " " << int(bday) << " " << mode;
if (active)
dump << " 1";
else
@@ -312,13 +330,21 @@ std::string item::save_info() const
void item::load_info(std::string data, game *g)
{
clear();
std::stringstream dump;
dump << data;
std::string idtmp, ammotmp;
int lettmp, damtmp, burntmp, acttmp, corp, item_flagstmp;
dump >> lettmp >> idtmp >> charges >> damtmp >> item_flagstmp >>
burntmp >> poison >> ammotmp >> owned >> bday >> mode >> acttmp >>
corp >> mission_id >> player_id;
std::string idtmp, ammotmp, item_tag;
int lettmp, damtmp, burntmp, acttmp, corp, tag_count;
dump >> lettmp >> idtmp >> charges >> damtmp >> tag_count;
for( int i = 0; i < tag_count; ++i )
{
dump >> item_tag;
item_tags.insert( item_tag );
}
dump >> burntmp >> poison >> ammotmp >> owned >> bday >>
mode >> acttmp >> corp >> mission_id >> player_id;
if (corp != -1)
corpse = g->mtypes[corp];
else
@@ -338,7 +364,6 @@ void item::load_info(std::string data, game *g)
invlet = char(lettmp);
damage = damtmp;
burnt = burntmp;
item_flags = item_flagstmp;
active = false;
if (acttmp == 1)
active = true;
@@ -363,7 +388,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("BASE", " Volume: ", "", int(volume()), "", false, true));
dump->push_back(iteminfo("BASE", " Weight: ", "", int(weight()), "", true, true));
dump->push_back(iteminfo("BASE", " Bash: ", "", int(type->melee_dam), "", false));
dump->push_back(iteminfo("BASE", (has_flag(IF_SPEAR) ? " Pierce: " : " Cut: "), "", int(type->melee_cut), "", false));
dump->push_back(iteminfo("BASE", (has_flag("SPEAR") ? " Pierce: " : " Cut: "), "", int(type->melee_cut), "", false));
dump->push_back(iteminfo("BASE", " To-hit bonus: ", ((type->m_to_hit > 0) ? "+" : ""), int(type->m_to_hit), ""));
dump->push_back(iteminfo("BASE", " Moves per attack: ", "", int(attack_time()), "", true, true));
@@ -465,10 +490,10 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
dump->push_back(iteminfo("GUN"," Recoil: ", temp1.str(), int(recoil(false)), temp2.str(), true, true));
dump->push_back(iteminfo("GUN", " Reload time: ", "", int(gun->reload_time), ((has_flag(IF_RELOAD_ONE)) ? " per round" : ""), true, true));
dump->push_back(iteminfo("GUN", " Reload time: ", "", int(gun->reload_time), ((has_flag("RELOAD_ONE")) ? " per round" : ""), true, true));
if (burst_size() == 0) {
if (gun->skill_used == Skill::skill("pistol") && has_flag(IF_RELOAD_ONE))
if (gun->skill_used == Skill::skill("pistol") && has_flag("RELOAD_ONE"))
dump->push_back(iteminfo("GUN", " Revolver."));
else
dump->push_back(iteminfo("GUN", " Semi-automatic."));
@@ -492,7 +517,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
if (mod->damage != 0)
dump->push_back(iteminfo("GUNMOD", " Damage: ", ((mod->damage > 0) ? "+" : ""), int(mod->damage)));
if (mod->clip != 0)
dump->push_back(iteminfo("GUNMOD", " Magazine: ", ((mod->clip > 0) ? "+" : ""), int(mod->clip), "%"));
dump->push_back(iteminfo("GUNMOD", " Magazine: ", ((mod->clip > 0) ? "+" : ""), int(mod->clip), "%%"));
if (mod->recoil != 0)
dump->push_back(iteminfo("GUNMOD", " Recoil: ", ((mod->recoil > 0) ? "+" : ""), int(mod->recoil), "", true, true));
if (mod->burst != 0)
@@ -537,8 +562,8 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
temp1 << "The feet. ";
dump->push_back(iteminfo("ARMOR", temp1.str()));
if (has_flag(IF_FIT))
dump->push_back(iteminfo("ARMOR", " Coverage: ", "", int(armor->coverage), " percent"));
if (has_flag("FIT"))
{
dump->push_back(iteminfo("ARMOR", " Encumberment: ", "", int(armor->encumber) - 1, " (fits)", true, true));
}
@@ -546,9 +571,8 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
{
dump->push_back(iteminfo("ARMOR", " Encumberment: ", "", int(armor->encumber), "", true, true));
}
dump->push_back(iteminfo("ARMOR", " Bashing protection: ", "", int(armor->dmg_resist)));
dump->push_back(iteminfo("ARMOR", " Cut protection: ", "", int(armor->cut_resist)));
dump->push_back(iteminfo("ARMOR", " Protection: Bash: ", "", int(bash_resist()), "", false, true));
dump->push_back(iteminfo("ARMOR", " Cut: ", "", int(cut_resist()), "", true, true));
dump->push_back(iteminfo("ARMOR", " Environmental protection: ", "", int(armor->env_resist)));
dump->push_back(iteminfo("ARMOR", " Warmth: ", "", int(armor->warmth)));
dump->push_back(iteminfo("ARMOR", " Storage: ", "", int(armor->storage)));
@@ -581,7 +605,7 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
it_tool* tool = dynamic_cast<it_tool*>(type);
if ((tool->max_charges)!=0) {
if (has_flag(IF_DOUBLE_AMMO)) {
if (has_flag("DOUBLE_AMMO")) {
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges*2), " charges (doubled)" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
} else {
dump->push_back(iteminfo("TOOL", " Maximum ", "", int(tool->max_charges), " charges" + ((tool->ammo == AT_NULL) ? "" : (" of " + ammo_name(tool->ammo))) + "."));
@@ -600,17 +624,17 @@ std::string item::info(bool showtext, std::vector<iteminfo> *dump)
if ( showtext && !is_null() ) {
if (is_stationary()) {
// Just use the dynamic description
dump->push_back( iteminfo("DESCRIPTION", SNIPPET.get(mode)) );
dump->push_back( iteminfo("DESCRIPTION", SNIPPET.get(note)) );
} else {
dump->push_back(iteminfo("DESCRIPTION", type->description));
}
if (is_armor() && has_flag(IF_FIT))
if (is_armor() && has_flag("FIT"))
{
dump->push_back(iteminfo("DESCRIPTION", "\n\n"));
dump->push_back(iteminfo("DESCRIPTION", "This piece of clothing fits you perfectly."));
}
if (is_tool() && has_flag(IF_DOUBLE_AMMO))
if (is_tool() && has_flag("DOUBLE_AMMO"))
{
dump->push_back(iteminfo("DESCRIPTION", "\n\n"));
dump->push_back(iteminfo("DESCRIPTION", "This tool has double the normal maximum charges."));
@@ -810,7 +834,7 @@ std::string item::tname(game *g)
if (food != NULL && g != NULL && food_type->spoils != 0 &&
int(g->turn) < (int)(food->bday + 100))
ret << " (fresh)";
if (food != NULL && g != NULL && food->has_flag(IF_HOT))
if (food != NULL && g != NULL && food->has_flag("HOT"))
ret << " (hot)";
if (food != NULL && g != NULL && food_type->spoils != 0 &&
int(g->turn) - (int)(food->bday) > food_type->spoils * 600)
@@ -954,34 +978,34 @@ int item::damage_cut() const
return type->melee_cut;
}
bool item::has_flag(item_flag f) const
bool item::has_flag(std::string f) const
{
bool ret = false;
// first check for flags specific to item type
// gun flags
if (is_gun()) {
if (mode == IF_MODE_AUX) {
item const* gunmod = inspect_active_gunmod();
if( gunmod != NULL )
ret = gunmod->has_flag(f);
if (ret) return ret;
} else {
for (int i = 0; i < contents.size(); i++) {
// Don't report flags from active gunmods for the gun.
if (contents[i].has_flag(f) && contents[i].has_flag(IF_MODE_AUX)) {
ret = true;
return ret;
}
}
}
if (mode == "MODE_AUX") {
item const* gunmod = inspect_active_gunmod();
if( gunmod != NULL )
ret = gunmod->has_flag(f);
if (ret) return ret;
} else {
for (int i = 0; i < contents.size(); i++) {
// Don't report flags from active gunmods for the gun.
if (contents[i].has_flag(f) && contents[i].has_flag("MODE_AUX")) {
ret = true;
return ret;
}
}
}
}
// other item type flags
ret = type->item_flags & mfb(f);
ret = type->item_tags.count(f);
if (ret) return ret;
// now check for item specific flags
ret = item_flags & mfb(f);
ret = item_tags.count(f);
return ret;
}
@@ -1028,6 +1052,21 @@ bool item::rotten(game *g)
return (food->spoils != 0 && int(g->turn) - (int)bday > food->spoils * 600);
}
bool item::ready_to_revive(game *g)
{
if (type->id != "corpse" || corpse->species != species_zombie)
{
return false;
}
int age_in_hours = (int(g->turn) - bday) / (10 * 60);
int rez_factor = 48 - age_in_hours;
if (age_in_hours > 6 && (rez_factor <= 0 || one_in(rez_factor)))
{
return true;
}
return false;
}
bool item::goes_bad()
{
if (!is_food())
@@ -1060,7 +1099,7 @@ bool item::craft_has_charges()
int item::num_charges()
{
if (is_gun()) {
if (mode == IF_MODE_AUX) {
if (mode == "MODE_AUX") {
item* gunmod = active_gunmod();
if (gunmod != NULL)
return gunmod->charges;
@@ -1068,12 +1107,12 @@ int item::num_charges()
return charges;
}
}
if (is_gunmod() && mode == IF_MODE_AUX)
if (is_gunmod() && mode == "MODE_AUX")
return charges;
return 0;
}
int item::weapon_value(int skills[num_skill_types]) const
int item::weapon_value(player *p) const
{
if( is_null() )
return 0;
@@ -1086,42 +1125,95 @@ int item::weapon_value(int skills[num_skill_types]) const
gun_value += int(gun->burst / 2);
gun_value += int(gun->clip / 3);
gun_value -= int(gun->accuracy / 5);
gun_value *= (.5 + (.3 * skills[sk_gun]));
gun_value *= (.3 + (.7 * skills[gun->skill_used->id()])); /// TODO: FIXME
gun_value *= (.5 + (.3 * p->skillLevel(sk_gun)));
gun_value *= (.3 + (.7 * p->skillLevel(gun->skill_used->id()))); /// TODO: FIXME
my_value += gun_value;
}
my_value += int(type->melee_dam * (1 + .3 * skills[sk_bashing] +
.1 * skills[sk_melee] ));
my_value += int(type->melee_dam * (1 + .3 * p->skillLevel(sk_bashing) +
.1 * p->skillLevel(sk_melee) ));
my_value += int(type->melee_cut * (1 + .4 * skills[sk_cutting] +
.1 * skills[sk_melee] ));
my_value += int(type->melee_cut * (1 + .4 * p->skillLevel(sk_cutting) +
.1 * p->skillLevel(sk_melee) ));
my_value += int(type->m_to_hit * (1.2 + .3 * skills[sk_melee]));
my_value += int(type->m_to_hit * (1.2 + .3 * p->skillLevel(sk_melee)));
return my_value;
}
int item::melee_value(int skills[num_skill_types])
int item::melee_value(player *p)
{
if( is_null() )
return 0;
int my_value = 0;
my_value += int(type->melee_dam * (1 + .3 * skills[sk_bashing] +
.1 * skills[sk_melee] ));
my_value += int(type->melee_dam * (1 + .3 * p->skillLevel(sk_bashing) +
.1 * p->skillLevel(sk_melee) ));
my_value += int(type->melee_cut * (1 + .4 * skills[sk_cutting] +
.1 * skills[sk_melee] ));
my_value += int(type->melee_cut * (1 + .4 * p->skillLevel(sk_cutting) +
.1 * p->skillLevel(sk_melee) ));
my_value += int(type->m_to_hit * (1.2 + .3 * skills[sk_melee]));
my_value += int(type->m_to_hit * (1.2 + .3 * p->skillLevel(sk_melee)));
if (is_style())
my_value += 15 * skills[sk_unarmed] + 8 * skills[sk_melee];
my_value += 15 * p->skillLevel(sk_unarmed) + 8 * p->skillLevel(sk_melee);
return my_value;
}
int item::bash_resist() const
{
int ret = 0;
if (is_null())
return 0;
// base resistance
it_armor* tmp = dynamic_cast<it_armor*>(type);
material_type* cur_mat1 = material_type::find_material_from_tag(tmp->m1);
material_type* cur_mat2 = material_type::find_material_from_tag(tmp->m2);
int eff_thickness = ((tmp->thickness - damage <= 0) ? 1 : (tmp->thickness - damage));
// assumes weighted sum of materials for items with 2 materials, 66% material 1 and 33% material 2
if (cur_mat2->is_null())
{
ret = eff_thickness * (3 * cur_mat1->bash_resist());
}
else
{
ret = eff_thickness * (cur_mat1->bash_resist() + cur_mat1->bash_resist() + cur_mat2->bash_resist());
}
return ret;
}
int item::cut_resist() const
{
int ret = 0;
if (is_null())
return 0;
it_armor* tmp = dynamic_cast<it_armor*>(type);
material_type* cur_mat1 = material_type::find_material_from_tag(tmp->m1);
material_type* cur_mat2 = material_type::find_material_from_tag(tmp->m2);
int eff_thickness = ((tmp->thickness - damage <= 0) ? 1 : (tmp->thickness - damage));
// assumes weighted sum of materials for items with 2 materials, 66% material 1 and 33% material 2
if (cur_mat2->is_null())
{
ret = eff_thickness * (3 * cur_mat1->cut_resist());
}
else
{
ret = eff_thickness * (cur_mat1->cut_resist() + cur_mat1->cut_resist() + cur_mat2->cut_resist());
}
return ret;
}
style_move item::style_data(technique_id tech)
{
style_move ret;
@@ -1314,7 +1406,7 @@ bool item::is_cutting_weapon() const
if( is_null() )
return false;
return (type->melee_cut >= 8 && !has_flag(IF_SPEAR));
return (type->melee_cut >= 8 && !has_flag("SPEAR"));
}
bool item::is_armor() const
@@ -1475,7 +1567,7 @@ int item::reload_time(player &u)
} else if (is_tool())
ret = 100 + volume() + weight();
if (has_flag(IF_STR_RELOAD))
if (has_flag("STR_RELOAD"))
ret -= u.str_cur * 20;
if (ret < 25)
ret = 25;
@@ -1485,20 +1577,20 @@ int item::reload_time(player &u)
item* item::active_gunmod()
{
if( mode == IF_MODE_AUX )
if( mode == "MODE_AUX" )
for (int i = 0; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].mode == IF_MODE_AUX)
if (contents[i].is_gunmod() && contents[i].mode == "MODE_AUX")
return &contents[i];
return NULL;
}
item const* item::inspect_active_gunmod() const
{
if (mode == IF_MODE_AUX)
if (mode == "MODE_AUX")
{
for (int i = 0; i < contents.size(); ++i)
{
if (contents[i].is_gunmod() && contents[i].mode == IF_MODE_AUX)
if (contents[i].is_gunmod() && contents[i].mode == "MODE_AUX")
{
return &contents[i];
}
@@ -1509,55 +1601,72 @@ item const* item::inspect_active_gunmod() const
void item::next_mode()
{
switch(mode) {
case IF_NULL:
if( has_flag(IF_MODE_BURST) )
mode = IF_MODE_BURST;
else
// Enable the first mod with an AUX firing mode.
for (int i = 0; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].has_flag(IF_MODE_AUX)) {
mode = IF_MODE_AUX;
contents[i].mode = IF_MODE_AUX;
break;
if( mode == "NULL" )
{
if( has_flag("MODE_BURST") )
{
mode = "MODE_BURST";
}
else
{
// Enable the first mod with an AUX firing mode.
for (int i = 0; i < contents.size(); i++)
{
if (contents[i].is_gunmod() && contents[i].has_flag("MODE_AUX"))
{
mode = "MODE_AUX";
contents[i].mode = "MODE_AUX";
break;
}
}
}
// Doesn't have another mode.
}
// Doesn't have another mode, just return.
break;
case IF_MODE_BURST:
// Enable the first mod with an AUX firing mode.
for (int i = 0; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].has_flag(IF_MODE_AUX)) {
mode = IF_MODE_AUX;
contents[i].mode = IF_MODE_AUX;
break;
}
if (mode == IF_MODE_BURST)
mode = IF_NULL;
break;
case IF_MODE_AUX:
{
int i = 0;
// Advance to next aux mode, or if there isn't one, normal mode
for (; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].mode == IF_MODE_AUX) {
contents[i].mode = IF_NULL;
break;
else if( mode == "MODE_BURST" )
{
// Enable the first mod with an AUX firing mode.
for (int i = 0; i < contents.size(); i++)
{
if (contents[i].is_gunmod() && contents[i].has_flag("MODE_AUX"))
{
mode = "MODE_AUX";
contents[i].mode = "MODE_AUX";
break;
}
}
if (mode == "MODE_BURST")
mode = "NULL";
}
for (i++; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].has_flag(IF_MODE_AUX)) {
contents[i].mode = IF_MODE_AUX;
break;
else if( mode == "MODE_AUX")
{
int i = 0;
// Advance to next aux mode, or if there isn't one, normal mode
for (; i < contents.size(); i++)
{
if (contents[i].is_gunmod() && contents[i].mode == "MODE_AUX")
{
contents[i].mode = "NULL";
break;
}
}
for (i++; i < contents.size(); i++)
{
if (contents[i].is_gunmod() && contents[i].has_flag("MODE_AUX"))
{
contents[i].mode = "MODE_AUX";
break;
}
}
if (i == contents.size())
{
mode = "NULL";
}
}
if (i == contents.size())
mode = IF_NULL;
break;
}
}
}
int item::clip_size()
{
if(is_gunmod() && has_flag(IF_MODE_AUX))
if(is_gunmod() && has_flag("MODE_AUX"))
return (dynamic_cast<it_gunmod*>(type))->clip;
if (!is_gun())
return 0;
@@ -1565,7 +1674,7 @@ int item::clip_size()
it_gun* gun = dynamic_cast<it_gun*>(type);
int ret = gun->clip;
for (int i = 0; i < contents.size(); i++) {
if (contents[i].is_gunmod() && !contents[i].has_flag(IF_MODE_AUX)) {
if (contents[i].is_gunmod() && !contents[i].has_flag("MODE_AUX")) {
int bonus = (ret * (dynamic_cast<it_gunmod*>(contents[i].type))->clip) / 100;
ret = int(ret + bonus);
}
@@ -1589,11 +1698,11 @@ int item::accuracy()
int item::gun_damage(bool with_ammo)
{
if (is_gunmod() && mode == IF_MODE_AUX)
if (is_gunmod() && mode == "MODE_AUX")
return curammo->damage;
if (!is_gun())
return 0;
if(mode == IF_MODE_AUX) {
if(mode == "MODE_AUX") {
item* gunmod = active_gunmod();
if(gunmod != NULL && gunmod->curammo != NULL)
return gunmod->curammo->damage;
@@ -1617,7 +1726,7 @@ int item::noise() const
if (!is_gun())
return 0;
int ret = 0;
if(mode == IF_MODE_AUX) {
if(mode == "MODE_AUX") {
item const* gunmod = inspect_active_gunmod();
if (gunmod && gunmod->curammo)
ret = gunmod->curammo->damage;
@@ -1626,7 +1735,7 @@ int item::noise() const
ret *= .8;
if (ret >= 5)
ret += 20;
if(mode == IF_MODE_AUX)
if(mode == "MODE_AUX")
return ret;
for (int i = 0; i < contents.size(); i++) {
if (contents[i].is_gunmod())
@@ -1640,7 +1749,7 @@ int item::burst_size()
if (!is_gun())
return 0;
// No burst fire for gunmods right now.
if(mode == IF_MODE_AUX)
if(mode == "MODE_AUX")
return 1;
it_gun* gun = dynamic_cast<it_gun*>(type);
int ret = gun->burst;
@@ -1658,7 +1767,7 @@ int item::recoil(bool with_ammo)
if (!is_gun())
return 0;
// Just use the raw ammo recoil for now.
if(mode == IF_MODE_AUX) {
if(mode == "MODE_AUX") {
item* gunmod = active_gunmod();
if (gunmod && gunmod->curammo)
return gunmod->curammo->recoil;
@@ -1682,7 +1791,7 @@ int item::range(player *p)
return 0;
// Just use the raw ammo range for now.
// we do NOT want to use the parent gun's range.
if(mode == IF_MODE_AUX) {
if(mode == "MODE_AUX") {
item* gunmod = active_gunmod();
if(gunmod && gunmod->curammo)
return gunmod->curammo->range;
@@ -1692,12 +1801,12 @@ int item::range(player *p)
int ret = (curammo ? dynamic_cast<it_gun*>(type)->range + curammo->range : 0);
if (has_flag(IF_STR8_DRAW) && p) {
if (has_flag("STR8_DRAW") && p) {
if (p->str_cur < 4)
return 0;
else if (p->str_cur < 8)
ret -= 2 * (8 - p->str_cur);
} else if (has_flag(IF_STR10_DRAW) && p) {
} else if (has_flag("STR10_DRAW") && p) {
if (p->str_cur < 5)
return 0;
else if (p->str_cur < 10)
@@ -1714,7 +1823,7 @@ ammotype item::ammo_type() const
it_gun* gun = dynamic_cast<it_gun*>(type);
ammotype ret = gun->ammo;
for (int i = 0; i < contents.size(); i++) {
if (contents[i].is_gunmod() && !contents[i].has_flag(IF_MODE_AUX)) {
if (contents[i].is_gunmod() && !contents[i].has_flag("MODE_AUX")) {
it_gunmod* mod = dynamic_cast<it_gunmod*>(contents[i].type);
if (mod->newtype != AT_NULL)
ret = mod->newtype;
@@ -1769,7 +1878,7 @@ char item::pick_reload_ammo(player &u, bool interactive)
// ammo for gun attachments (shotgun attachments, grenade attachments, etc.)
// for each attachment, find its associated ammo & append it to the ammo vector
for (int i = 0; i < contents.size(); i++)
if (contents[i].is_gunmod() && contents[i].has_flag(IF_MODE_AUX) &&
if (contents[i].is_gunmod() && contents[i].has_flag("MODE_AUX") &&
contents[i].charges < (dynamic_cast<it_gunmod*>(contents[i].type))->clip) {
std::vector<item*> tmpammo = u.has_ammo((dynamic_cast<it_gunmod*>(contents[i].type))->newtype);
for(int j = 0; j < tmpammo.size(); j++)
@@ -1864,7 +1973,7 @@ bool item::reload(player &u, char ammo_invlet)
} else {
for (int i = 0; i < contents.size(); i++) {
if (&contents[i] != gunmod && i != spare_mag && contents[i].is_gunmod() &&
contents[i].has_flag(IF_MODE_AUX) && contents[i].ammo_type() == ammo_to_use->ammo_type() &&
contents[i].has_flag("MODE_AUX") && contents[i].ammo_type() == ammo_to_use->ammo_type() &&
(contents[i].charges <= (dynamic_cast<it_gunmod*>(contents[i].type))->clip ||
(contents[i].charges <= 0 || contents[i].curammo->id == ammo_to_use->typeId()))) {
reload_target = &contents[i];
@@ -1880,9 +1989,9 @@ bool item::reload(player &u, char ammo_invlet)
if (reload_target->is_gunmod() && reload_target->typeId() == "spare_mag") {
// Use gun numbers instead of the mod if it's a spare magazine
max_load = (dynamic_cast<it_gun*>(type))->clip;
single_load = has_flag(IF_RELOAD_ONE);
single_load = has_flag("RELOAD_ONE");
} else {
single_load = reload_target->has_flag(IF_RELOAD_ONE);
single_load = reload_target->has_flag("RELOAD_ONE");
max_load = reload_target->clip_size();
}
}
@@ -1894,7 +2003,7 @@ bool item::reload(player &u, char ammo_invlet)
} else
return false;
if (has_flag(IF_DOUBLE_AMMO)) {
if (has_flag("DOUBLE_AMMO")) {
max_load *= 2;
}
+12 -5
View File
@@ -41,6 +41,7 @@ public:
item(std::string itemdata, game *g);
~item();
void make(itype* it);
void clear(); // cleanup that's required to re-use an item variable
// returns the default container of this item, with this item in it
item in_its_container(std::map<std::string, itype*> *itypes);
@@ -84,7 +85,7 @@ public:
int attack_time();
int damage_bash();
int damage_cut() const;
bool has_flag(item_flag f) const;
bool has_flag(std::string f) const;
bool has_technique(technique_id t, player *p = NULL);
int has_gunmod(itype_id type);
item* active_gunmod();
@@ -95,11 +96,15 @@ public:
bool craft_has_charges();
int num_charges();
bool rotten(game *g);
bool ready_to_revive(game *g); // used for corpses
// Our value as a weapon, given particular skills
int weapon_value(int skills[num_skill_types]) const;
int weapon_value(player *p) const;
// As above, but discounts its use as a ranged weapon
int melee_value (int skills[num_skill_types]);
int melee_value (player *p);
// how resistant armour is to bashing and cutting damage
int bash_resist() const;
int cut_resist() const;
// Returns the data associated with tech, if we are an it_style
style_move style_data(technique_id tech);
bool is_two_handed(player *u);
@@ -155,9 +160,11 @@ public:
union{
int poison; // How badly poisoned is it?
int bigness; // engine power, wheel size
int frequency; // Radio frequency
int note; // Associated dynamic text snippet.
};
int mode; // Mode of operation, can be changed by the player.
unsigned item_flags : NUM_ITEM_FLAGS; // generic item specific flags
std::string mode; // Mode of operation, can be changed by the player.
std::set<std::string> item_tags; // generic item specific flags
unsigned item_counter; // generic counter to be used with item flags
int mission_id;// Refers to a mission in game's master list
int player_id; // Only give a mission to the right player!
+25 -41
View File
@@ -76,6 +76,8 @@ void Item_factory::init(){
iuse_function_list["HAMMER"] = &iuse::hammer;
iuse_function_list["LIGHT_OFF"] = &iuse::light_off;
iuse_function_list["LIGHT_ON"] = &iuse::light_on;
iuse_function_list["GASOLINE_LANTERN_OFF"] = &iuse::gasoline_lantern_off;
iuse_function_list["GASOLINE_LANTERN_ON"] = &iuse::gasoline_lantern_on;
iuse_function_list["LIGHTSTRIP"] = &iuse::lightstrip;
iuse_function_list["LIGHTSTRIP_ACTIVE"] = &iuse::lightstrip_active;
iuse_function_list["GLOWSTICK"] = &iuse::glowstick;
@@ -97,6 +99,7 @@ void Item_factory::init(){
iuse_function_list["CROWBAR"] = &iuse::crowbar;
iuse_function_list["MAKEMOUND"] = &iuse::makemound;
iuse_function_list["DIG"] = &iuse::dig;
iuse_function_list["SIPHON"] = &iuse::siphon;
iuse_function_list["CHAINSAW_OFF"] = &iuse::chainsaw_off;
iuse_function_list["CHAINSAW_ON"] = &iuse::chainsaw_on;
iuse_function_list["JACKHAMMER"] = &iuse::jackhammer;
@@ -173,39 +176,6 @@ void Item_factory::init(){
// See artifact.h for a list
iuse_function_list["ARTIFACT"] = &iuse::artifact;
// ITEM FLAGS
item_flags_list["LIGHT_1"] = mfb(IF_LIGHT_1);
item_flags_list["LIGHT_4"] = mfb(IF_LIGHT_4);
item_flags_list["LIGHT_8"] = mfb(IF_LIGHT_8);
item_flags_list["LIGHT_20"] = mfb(IF_LIGHT_20);
item_flags_list["FIRE"] = mfb(IF_FIRE);
item_flags_list["SPEAR"] = mfb(IF_SPEAR);
item_flags_list["STAB"] = mfb(IF_STAB);
item_flags_list["WRAP"] = mfb(IF_WRAP);
item_flags_list["MESSY"] = mfb(IF_MESSY);
item_flags_list["RELOAD_ONE"] = mfb(IF_RELOAD_ONE);
item_flags_list["STR_RELOAD"] = mfb(IF_STR_RELOAD);
item_flags_list["STR8_DRAW"] = mfb(IF_STR8_DRAW);
item_flags_list["STR10_DRAW"] = mfb(IF_STR10_DRAW);
item_flags_list["USE_UPS"] = mfb(IF_USE_UPS);
item_flags_list["RELOAD_AND_SHOOT"] = mfb(IF_RELOAD_AND_SHOOT);
item_flags_list["FIRE_100"] = mfb(IF_FIRE_100);
item_flags_list["GRENADE"] = mfb(IF_GRENADE);
item_flags_list["CHARGE"] = mfb(IF_CHARGE);
item_flags_list["SHOCK"] = mfb(IF_SHOCK);
item_flags_list["UNARMED_WEAPON"] = mfb(IF_UNARMED_WEAPON);
item_flags_list["NO_UNWIELD"] = mfb(IF_NO_UNWIELD);
item_flags_list["NO_UNLOAD"] = mfb(IF_NO_UNLOAD);
item_flags_list["BACKBLAST"] = mfb(IF_BACKBLAST);
item_flags_list["MODE_AUX"] = mfb(IF_MODE_AUX);
item_flags_list["MODE_BURST"] = mfb(IF_MODE_BURST);
item_flags_list["HOT"] = mfb(IF_HOT);
item_flags_list["EATEN_HOT"] = mfb(IF_EATEN_HOT);
item_flags_list["ROTTEN"] = mfb(IF_ROTTEN);
item_flags_list["VARSIZE"] = mfb(IF_VARSIZE);
item_flags_list["FIT"] = mfb(IF_FIT);
item_flags_list["DOUBLE_AMMO"] = mfb(IF_DOUBLE_AMMO);
// Offensive Techniques
techniques_list["SWEEP"] = mfb(TEC_SWEEP);
techniques_list["PRECISE"] = mfb(TEC_PRECISE);
@@ -265,6 +235,7 @@ void Item_factory::init(){
ammo_effects_list["EXPLOSIVE"] = mfb(AMMO_EXPLOSIVE);
ammo_effects_list["FRAG"] = mfb(AMMO_FRAG);
ammo_effects_list["NAPALM"] = mfb(AMMO_NAPALM);
ammo_effects_list["ACIDBOMB"] = mfb(AMMO_ACIDBOMB);
ammo_effects_list["EXPLOSIVE_BIG"] = mfb(AMMO_EXPLOSIVE_BIG);
ammo_effects_list["TEARGAS"] = mfb(AMMO_TEARGAS);
ammo_effects_list["SMOKE"] = mfb(AMMO_SMOKE);
@@ -433,8 +404,7 @@ void Item_factory::load_item_templates_from(const std::string file_name){
gunmod_template->recoil = entry.get("recoil_modifier").as_int();
gunmod_template->burst = entry.get("burst_modifier").as_int();
gunmod_template->clip = entry.get("clip_size_modifier").as_int();
gunmod_template->techniques = (!entry.has("ammo") ? 0 :
flags_from_json(entry.get("techniques"), "ammo"));
gunmod_template->acceptible_ammo_types = (!entry.has("acceptable_ammo") ? 0 : flags_from_json(entry.get("acceptable_ammo"), "ammo"));
new_item_template = gunmod_template;
}
else if (type_label == "COMESTIBLE")
@@ -507,8 +477,8 @@ void Item_factory::load_item_templates_from(const std::string file_name){
it_armor* armor_template = new it_armor();
armor_template->encumber = entry.get("encumberance").as_int();
armor_template->dmg_resist = entry.get("bashing_protection").as_int();
armor_template->cut_resist = entry.get("cutting_protection").as_int();
armor_template->coverage = entry.get("coverage").as_int();
armor_template->thickness = entry.get("material_thickness").as_int();
armor_template->env_resist = entry.get("enviromental_protection").as_int();
armor_template->warmth = entry.get("warmth").as_int();
armor_template->storage = entry.get("storage").as_int();
@@ -565,8 +535,19 @@ void Item_factory::load_item_templates_from(const std::string file_name){
new_item_template->melee_cut = entry.get("cutting").as_int();
new_item_template->m_to_hit = entry.get("to_hit").as_int();
new_item_template->item_flags = (!entry.has("flags") ? 0 :
flags_from_json(entry.get("flags")));
if( entry.has("flags") )
{
new_item_template->item_tags = entry.get("flags").as_tags();
/*
List of current flags
FIT - Reduces encumberance by one
VARSIZE - Can be made to fit via tailoring
OVERSIZE - Can always be worn no matter encumberance/mutations/bionics/etc
HOOD - Will increase warmth for head if head is cold and player is not wearing a helmet (headwear of material that is not wool or cotton)
POCKETS - Will increase warmth for hands if hands are cold and the player is wielding nothing
*/
}
new_item_template->techniques = (!entry.has("techniques") ? 0 :
flags_from_json(entry.get("techniques"), "techniques"));
new_item_template->use = (!entry.has("use_action") ? &iuse::none :
@@ -801,8 +782,7 @@ Use_function Item_factory::use_from_string(std::string function_name){
void Item_factory::set_flag_by_string(unsigned& cur_flags, std::string new_flag, std::string flag_type)
{
//Use the standard item flag list unless a valid alternative is provided
std::map<Item_tag, unsigned> flag_map = item_flags_list;
std::map<Item_tag, unsigned> flag_map;
if(flag_type=="ammo"){
flag_map = ammo_flags_list;
} else if(flag_type=="techniques"){
@@ -908,6 +888,8 @@ phase_id Item_factory::phase_from_tag(Item_tag name){
}
};
// TODO: depreciate once materials rewrite is up and running
material Item_factory::material_from_tag(Item_tag new_id, Item_tag name){
// Map the valid input tags to a valid material
@@ -932,6 +914,8 @@ material Item_factory::material_from_tag(Item_tag new_id, Item_tag name){
return KEVLAR;
} else if(name == "FUR"){
return FUR;
} else if(name == "CHITIN"){
return CHITIN;
} else if(name == "STONE"){
return STONE;
} else if(name == "PAPER"){
+4 -6
View File
@@ -1,9 +1,6 @@
#ifndef _ITEM_FACTORY_H_
#define _ITEM_FACTORY_H_
#include <string>
#include <vector>
#include <map>
#include "game.h"
#include "itype.h"
#include "item.h"
@@ -11,7 +8,10 @@
#include "picojson.h"
#include "catajson.h"
#include "item_group.h"
#include "iuse.h"
#include "iuse.h"
#include <string>
#include <vector>
#include <map>
typedef std::string Item_tag;
typedef std::vector<item> Item_list;
@@ -71,8 +71,6 @@ private:
//iuse stuff
std::map<Item_tag, Use_function> iuse_function_list;
//flags stuff
std::map<Item_tag, unsigned> item_flags_list;
//techniques stuff
std::map<Item_tag, unsigned> techniques_list;
//ammo stuff
+73 -105
View File
@@ -1,9 +1,6 @@
#ifndef _ITYPE_H_
#define _ITYPE_H_
#include <string>
#include <vector>
#include <sstream>
#include "color.h"
#include "enums.h"
#include "iuse.h"
@@ -13,6 +10,12 @@
#include "bionics.h"
#include "artifact.h"
#include "picojson.h"
#include "rng.h"
#include "material.h"
#include <string>
#include <vector>
#include <sstream>
#include <set>
// mfb(n) converts a flag to its appropriate position in covers's bitfield
#ifndef mfb
@@ -71,67 +74,13 @@ SW_DATA,
NUM_SOFTWARE_TYPES
};
enum item_flag {
IF_NULL,
IF_LIGHT_1, // Provides 1 tile of light
IF_LIGHT_4, // Provides 4 tiles of light
IF_LIGHT_8, // Provides 8 tiles of light
IF_LIGHT_20, // Provides 20 tiles of light
IF_FIRE, // Chance to set fire to tiles/enemies
IF_SPEAR, // Cutting damage is actually a piercing attack
IF_STAB, // This weapon *can* pierce, but also has normal cutting
IF_WRAP, // Can wrap around your target, costing you and them movement
IF_MESSY, // Splatters blood, etc.
IF_RELOAD_ONE, // Reload cartridge by cartridge (e.g. most shotguns)
IF_STR_RELOAD, // Reloading time is reduced by Strength * 20
IF_STR8_DRAW, // Requires strength 8 to draw
IF_STR10_DRAW, // Requires strength 10 to draw
IF_USE_UPS, // Draws power from a UPS
IF_RELOAD_AND_SHOOT, // Reloading and shooting is one action
IF_FIRE_100, // Fires 100 rounds at once! (e.g. flamethrower)
IF_GRENADE, // NPCs treat this as a grenade
IF_CHARGE, // For guns; charges up slowly
IF_SHOCK, // Stuns and damages enemies, powers up shockers.
IF_UNARMED_WEAPON, // Counts as an unarmed weapon
IF_NO_UNWIELD, // Impossible to unwield, e.g. bionic claws
IF_NO_UNLOAD, // Cannot be unloaded. For Fusion rifles and other ammo generating weapons.
IF_BACKBLAST, // Creates a backblast of smoke.
// Weapon mode flags
IF_MODE_AUX, // A gunmod with a firing mode
IF_MODE_BURST, // A burst of attacks
// Food status flags
IF_HOT, // hot food
IF_EATEN_HOT, // food meant to be eaten hot
IF_ROTTEN, // rotten food
// Clothing flags
IF_VARSIZE, // comes in variable sizes (item type flag)
IF_FIT, // clothing fits player (item specific flag)
//Book Flags
/*IF_READ_SKILLBOOK,
IF_READ_FUNBOOK,
*/
// Item mod flags
// has double the normal ammo capacity (item specific flag), only works with tools at the moment
// need to tweak a few things to make it work with guns as well
IF_DOUBLE_AMMO,
NUM_ITEM_FLAGS
};
enum ammo_effect {
AMMO_FLAME, // Sets fire to terrain and monsters
AMMO_INCENDIARY, // Sparks explosive terrain
AMMO_EXPLOSIVE, // Small explosion
AMMO_FRAG, // Frag explosion
AMMO_NAPALM, // Firey explosion
AMMO_ACIDBOMB, // Acid bomb ammo
AMMO_EXPLOSIVE_BIG, // Big explosion!
AMMO_TEARGAS, // Teargas burst
AMMO_SMOKE, // Smoke burst
@@ -227,7 +176,7 @@ struct itype
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 item_flags : NUM_ITEM_FLAGS;
std::set<std::string> item_tags;
unsigned techniques : NUM_TECHNIQUES;
virtual bool is_food() { return false; }
@@ -266,7 +215,6 @@ struct itype
weight = 0;
melee_dam = 0;
m_to_hit = 0;
item_flags = 0;
techniques = 0;
use = &iuse::none;
}
@@ -276,7 +224,7 @@ struct itype
char psym, nc_color pcolor, material pm1, material pm2, phase_id pphase,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pitem_flags, unsigned ptechniques = 0) {
unsigned ptechniques = 0) {
id = pid;
rarity = prarity;
price = pprice;
@@ -292,7 +240,6 @@ struct itype
melee_dam = pmelee_dam;
melee_cut = pmelee_cut;
m_to_hit = pm_to_hit;
item_flags = pitem_flags;
techniques = ptechniques;
use = &iuse::none;
}
@@ -334,7 +281,7 @@ struct it_comest : public itype
char psym, nc_color pcolor, material pm1, phase_id pphase,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
signed char pquench, unsigned char pnutr, signed char pspoils,
signed char pstim, signed char phealthy, unsigned char paddict,
@@ -342,7 +289,7 @@ struct it_comest : public itype
itype_id ptool, void (iuse::*puse)(game *, player *, item *, bool),
add_type padd, std::string pcomesttype)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, MNULL, pphase,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags)
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit)
{
quench = pquench;
nutr = pnutr;
@@ -357,7 +304,6 @@ struct it_comest : public itype
use = puse;
add = padd;
comesttype = pcomesttype;
item_flags = pitem_flags;
}
it_comest() :itype() { };
@@ -381,7 +327,7 @@ struct it_var_veh_part: public itype
unsigned int big_max,
bigness_property_aspect big_aspect)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, 0) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
min_bigness = big_min;
max_bigness = big_max;
bigness_aspect = big_aspect;
@@ -467,13 +413,12 @@ struct it_gun : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pitem_flags,
const char *pskill_used, ammotype pammo, signed char pdmg_bonus, signed char prange,
signed char paccuracy, signed char precoil, unsigned char pdurability,
unsigned char pburst, int pclip, int preload_time)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
skill_used = pskill_used?Skill::skill(pskill_used):NULL;
ammo = pammo;
dmg_bonus = pdmg_bonus;
@@ -506,7 +451,7 @@ struct it_gunmod : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
signed char paccuracy, signed char pdamage, signed char ploudness,
signed char pclip, signed char precoil, signed char pburst,
@@ -514,7 +459,7 @@ struct it_gunmod : public itype
bool shotgun, bool smg, bool rifle)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
accuracy = paccuracy;
damage = pdamage;
loudness = ploudness;
@@ -536,8 +481,8 @@ struct it_armor : public itype
{
unsigned char covers; // Bitfield of enum body_part
signed char encumber;
unsigned char dmg_resist;
unsigned char cut_resist;
unsigned char coverage;
unsigned char thickness;
unsigned char env_resist; // Resistance to environmental effects
signed char warmth;
unsigned char storage;
@@ -548,13 +493,21 @@ struct it_armor : public itype
virtual bool is_power_armor() { return power_armor; }
virtual bool is_artifact() { return false; }
virtual picojson::value save_data() { return picojson::value(); }
std::string bash_dmg_verb() { return m2 == MNULL || !one_in(3) ?
material_type::find_material_from_tag(m1)->bash_dmg_verb() :
material_type::find_material_from_tag(m2)->bash_dmg_verb();
}
std::string cut_dmg_verb() { return m2 == MNULL || !one_in(3) ?
material_type::find_material_from_tag(m1)->cut_dmg_verb() :
material_type::find_material_from_tag(m2)->cut_dmg_verb();
}
it_armor() : itype()
{
covers = 0;
encumber = 0;
dmg_resist = 0;
cut_resist = 0;
coverage = 0;
thickness = 0;
env_resist = 0;
warmth = 0;
storage = 0;
@@ -566,18 +519,17 @@ struct it_armor : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pitem_flags,
unsigned char pcovers, signed char pencumber,
unsigned char pdmg_resist, unsigned char pcut_resist,
unsigned char pcoverage, unsigned char pthickness,
unsigned char penv_resist, signed char pwarmth,
unsigned char pstorage, bool ppower_armor = false)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
covers = pcovers;
encumber = pencumber;
dmg_resist = pdmg_resist;
cut_resist = pcut_resist;
coverage = pcoverage;
thickness = pthickness;
env_resist = penv_resist;
warmth = pwarmth;
storage = pstorage;
@@ -604,12 +556,11 @@ struct it_book : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pitem_flags,
const char *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, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
type = ptype?Skill::skill(ptype):NULL;
level = plevel;
req = preq;
@@ -636,11 +587,11 @@ struct it_container : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
unsigned char pcontains, unsigned pflags)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
contains = pcontains;
flags = pflags;
}
@@ -675,14 +626,13 @@ struct it_tool : public itype
char psym, nc_color pcolor, material pm1, material pm2, phase_id pphase,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
unsigned pitem_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, pphase,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
max_charges = pmax_charges;
def_charges = pdef_charges;
ammo = pammo;
@@ -705,11 +655,11 @@ struct it_bionic : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
int pdifficulty)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
difficulty = pdifficulty;
options.push_back(id);
}
@@ -726,12 +676,12 @@ struct it_macguffin : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
bool preadable,
void (iuse::*puse)(game *, player *, item *, bool))
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
readable = preadable;
use = puse;
}
@@ -749,11 +699,11 @@ struct it_software : public itype
char psym, nc_color pcolor, material pm1, material pm2,
unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit,
software_type pswtype, int ppower)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) {
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
swtype = pswtype;
power = ppower;
}
@@ -770,10 +720,10 @@ struct it_style : 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 pitem_flags)
signed char pm_to_hit)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags) { }
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) { }
};
struct it_stationary : public itype
@@ -787,11 +737,11 @@ struct it_stationary : 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 pitem_flags,
signed char pm_to_hit,
std::string pcategory)
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags)
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit)
{
category = pcategory;
}
@@ -826,7 +776,15 @@ struct it_artifact_tool : public it_tool
data[std::string("melee_dam")] = picojson::value(melee_dam);
data[std::string("melee_cut")] = picojson::value(melee_cut);
data[std::string("m_to_hit")] = picojson::value(m_to_hit);
data[std::string("item_flags")] = picojson::value(item_flags);
std::vector<picojson::value> tags_json;
for(std::set<std::string>::iterator it = item_tags.begin();
it != item_tags.end(); ++it)
{
tags_json.push_back(picojson::value(*it));
}
data[std::string("item_flags")] = picojson::value(tags_json);
data[std::string("techniques")] = picojson::value(techniques);
// tool data
@@ -885,7 +843,7 @@ struct it_artifact_tool : public it_tool
std::string pdes, char psym, nc_color pcolor, material pm1,
material pm2, unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit, std::set<std::string> pitem_tags,
unsigned int pmax_charges, unsigned int pdef_charges,
unsigned char pcharges_per_use,
@@ -893,10 +851,11 @@ struct it_artifact_tool : public it_tool
ammotype pammo, itype_id prevert_to)
:it_tool(pid, 0, pprice, pname, pdes, psym, pcolor, pm1, pm2, SOLID,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit,
pmax_charges, pdef_charges, pcharges_per_use, pturns_per_charge,
pammo, prevert_to, &iuse::artifact)
{
item_tags = pitem_tags;
artifact_itype_ids.push_back(pid);
};
};
@@ -928,14 +887,22 @@ struct it_artifact_armor : public it_armor
data[std::string("melee_dam")] = picojson::value(melee_dam);
data[std::string("melee_cut")] = picojson::value(melee_cut);
data[std::string("m_to_hit")] = picojson::value(m_to_hit);
data[std::string("item_flags")] = picojson::value(item_flags);
std::vector<picojson::value> tags_json;
for(std::set<std::string>::iterator it = item_tags.begin();
it != item_tags.end(); ++it)
{
tags_json.push_back(picojson::value(*it));
}
data[std::string("item_flags")] = picojson::value(tags_json);
data[std::string("techniques")] = picojson::value(techniques);
// armor data
data[std::string("covers")] = picojson::value(covers);
data[std::string("encumber")] = picojson::value(encumber);
data[std::string("dmg_resist")] = picojson::value(dmg_resist);
data[std::string("cut_resist")] = picojson::value(cut_resist);
data[std::string("coverage")] = picojson::value(coverage);
data[std::string("material_thickness")] = picojson::value(thickness);
data[std::string("env_resist")] = picojson::value(env_resist);
data[std::string("warmth")] = picojson::value(warmth);
data[std::string("storage")] = picojson::value(storage);
@@ -963,17 +930,18 @@ struct it_artifact_armor : public it_armor
std::string pdes, char psym, nc_color pcolor, material pm1,
material pm2, unsigned short pvolume, unsigned short pweight,
signed char pmelee_dam, signed char pmelee_cut,
signed char pm_to_hit, unsigned pitem_flags,
signed char pm_to_hit, std::set<std::string> pitem_tags,
unsigned char pcovers, signed char pencumber,
unsigned char pdmg_resist, unsigned char pcut_resist,
unsigned char pcoverage, unsigned char pthickness,
unsigned char penv_resist, signed char pwarmth,
unsigned char pstorage)
:it_armor(pid, 0, pprice, pname, pdes, psym, pcolor, pm1, pm2,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit, pitem_flags,
pcovers, pencumber, pdmg_resist, pcut_resist, penv_resist, pwarmth,
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit,
pcovers, pencumber, pcoverage, pthickness, penv_resist, pwarmth,
pstorage)
{
item_tags = pitem_tags;
artifact_itype_ids.push_back(pid);
};
};
+13 -303
View File
@@ -55,51 +55,6 @@ void game::init_itypes ()
"A fake item. If you are reading this it's a bug! (itypdef:apparatus)",
'$', c_red, MNULL, MNULL, PNULL, 0, 0, 0, 0, 0, 0);
// Drinks
// Stim should be -8 to 8.
// quench MAY be less than zero--salt water and liquor make you thirstier.
// Thirst goes up by 1 every 5 minutes; so a quench of 12 lasts for 1 hour
// Any foods with a nutrition of lower than 5 will never prompt a 'You are full, force yourself to eat that?' message
#define DRINK(id, name,rarity,price,color,container,quench,nutr,spoils,stim,\
healthy,addict,charges,fun,use_func,addict_func,des, item_flags) \
itypes[id] = new it_comest(id,rarity,price,name,des,'~',\
color,MNULL,LIQUID,2,1,0,0,0,item_flags,quench,nutr,spoils,stim,healthy,addict,charges,\
fun,container,"null",use_func,addict_func,"DRINK");
#define FOOD(id, name, rarity,price,color,mat1,container,volume,weight,quench,\
nutr,spoils,stim,healthy,addict,charges,fun,use_func,addict_func,des, item_flags) \
itypes[id]=new it_comest(id,rarity,price,name,des,'%',\
color,mat1,SOLID,volume,weight,0,0,0,item_flags, quench,nutr,spoils,stim,healthy,addict,charges,\
fun,container,"null",use_func,addict_func,"FOOD");
// FOOD
// MEDS
#define MED(id, name,rarity,price,color,tool,mat,stim,healthy,addict,\
charges,fun,use_func,addict_func,des) \
itypes[id]=new it_comest(id,rarity,price,name,des,'!',\
color,mat,SOLID,1,1,0,0,0,0,0,0,0,stim,healthy,addict,charges,\
fun,"null",tool,use_func,addict_func,"MED");
/*MED("grack", "Grack Cocaine", 8,420, c_white, "apparatus",
POWDER, 200, -2, 80, 4, 50,&iuse::grack, ADD_CRACK, "\
Grack Cocaine, the strongest substance known to the multiverse\n\
this potent substance is refined from the sweat of the legendary\n\
gracken");
*/
// MELEE WEAPONS
// Only use secondary material if it will have a major impact.
// dam is a somewhat rigid bonus--anything above 30, tops, is ridiculous
// cut is even MORE rigid, and should be kept lower still
// to_hit (affects chances of hitting) should be kept small, -5 to +5
// Note that do-nothing objects (e.g. superglue) belong here too!
#define MELEE(id, name,rarity,price,sym,color,mat1,mat2,volume,wgt,dam,cut,to_hit,\
flags, des)\
itypes[id]=new itype(id,rarity,price,name,des,sym,\
color,mat1,mat2,SOLID,volume,wgt,dam,cut,to_hit,flags);
#define VAR_VEH_PART(id, name,rarity,price,sym,color,mat1,mat2,volume,wgt,dam,cut,to_hit,\
flags, bigmin, bigmax, bigaspect, des)\
itypes[id]=new it_var_veh_part(id,rarity,price,name,des,sym,\
@@ -163,19 +118,6 @@ VAR_VEH_PART("v8_combustion", "V8 engine", 2, 250, ':', c_ltcyan, IRON, MNUL
25, 600, 15, 0, -5, 0, 380, 700, BIGNESS_ENGINE_DISPLACEMENT, "\
A large and very powerful 8-cylinder combustion engine.");
// ARMOR
#define ARMOR(id, name, rarity,price,color,mat1,mat2,volume,wgt,dam,to_hit,\
encumber,dmg_resist,cut_resist,env,warmth,storage,covers,des,item_flags)\
itypes[id]=new it_armor(id, rarity,price,name,des,'[',\
color,mat1,mat2,volume,wgt,dam,0,to_hit,item_flags,covers,encumber,dmg_resist,cut_resist,\
env,warmth,storage)
#define POWER_ARMOR(id, name,rarity,price,color,mat1,mat2,volume,wgt,dam,to_hit,\
encumber,dmg_resist,cut_resist,env,warmth,storage,covers,des)\
itypes[id] = new it_armor(id,rarity,price,name,des,'[',\
color,mat1,mat2,volume,wgt,dam,0,to_hit,0,covers,encumber,dmg_resist,cut_resist,\
env,warmth,storage,true)
// AMMUNITION
// Material should be the wrapper--even though shot is made of iron, because
// it can survive a dip in water and be okay, its material here is PLASTIC.
@@ -193,13 +135,6 @@ accuracy,recoil,count,des,effects) \
itypes[id]=new it_ammo(id,rarity,price,name,des,'=',\
color,mat,SOLID,volume,wgt,1,0,0,effects,ammo_type,dmg,AP,accuracy,recoil,range,count);
// FUEL
// Fuel is just a special type of ammo; liquid
#define FUEL(id, name,rarity,price,ammo_type,color,dmg,AP,range,accuracy,recoil,\
count,des,effects) \
itypes[id]=new it_ammo(id,rarity,price,name,des,'~',\
color,MNULL,LIQUID,1,1,0,0,0,effects,ammo_type,dmg,AP,accuracy,recoil,range,count)
// GUNS
// ammo_type matches one of the ammo_types above.
// dmg is ADDED to the damage of the corresponding ammo. +/-, should be small.
@@ -209,43 +144,11 @@ color,MNULL,LIQUID,1,1,0,0,0,effects,ammo_type,dmg,AP,accuracy,recoil,range,coun
// clip is how many shots we get before reloading.
#define GUN(id,name,rarity,price,color,mat1,mat2,skill,ammo,volume,wgt,melee_dam,\
to_hit,dmg,range,accuracy,recoil,durability,burst,clip,reload_time,des,flags) \
to_hit,dmg,range,accuracy,recoil,durability,burst,clip,reload_time,des) \
itypes[id]=new it_gun(id,rarity,price,name,des,'(',\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,flags,skill,ammo,dmg,range,accuracy,\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,skill,ammo,dmg,range,accuracy,\
recoil,durability,burst,clip,reload_time)
// GUN MODS
// Accuracy is inverted from guns; high values are a bonus, low values a penalty
// The clip modification is a percentage of the original clip size.
// The final variable is a bitfield of acceptable ammo types. Using 0 means
// that any ammo type is acceptable (so long as the mod works on the class of
// gun)
#define GUNMOD(id, name, rare, value, color, mat1, mat2, volume, weight, meleedam,\
meleecut, meleehit, acc, damage, loudness, clip, recoil, burst,\
newtype, pistol, shotgun, smg, rifle, a_a_t, des, flags)\
itypes[id]=new it_gunmod(id, rare, value, name, des, ':',\
color, mat1, mat2, volume, weight, meleedam,\
meleecut, meleehit, flags, acc, damage, loudness,\
clip, recoil, burst, newtype, a_a_t, pistol,\
shotgun, smg, rifle)
// BOOKS
// Try to keep colors consistant among types of books.
// TYPE is the skill type required to read, or trained via reading; see skill.h
// LEV is the skill level you can be brought to by this book; if your skill is
// already at LEV or higher, you may enjoy the book but won't learn anything.
// REQ is the skill level required to read this book, at all. If you lack the
// required skill level, you'll waste 10 (?) turns then quit.
// FUN is the fun had by reading;
// INT is an intelligence requirement.
// TIME is the time, in minutes (10 turns), taken to gain the fun/skill bonus.
#define BOOK(id, name,rarity,price,color,mat1,mat2,volume,wgt,melee_dam,to_hit,\
type,level,req,fun,intel,time,des) \
itypes[id]=new it_book(id,rarity,price,name,des,'?',\
color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,0,type,level,req,fun,intel,time)
// NAME RAR PRC COLOR MAT1 MAT2
// CONTAINERS
// These are containers you hold in your hand--ones you wear are _armor_!
// These only have two attributes; contains, which is the volume it holds, and
@@ -260,7 +163,7 @@ color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,0,type,level,req,fun,intel,time)
#define CONT(id, name,rarity,price,color,mat1,mat2,volume,wgt,melee_dam,to_hit,\
contains,flags,des) \
itypes[id]=new it_container(id,rarity,price,name,des,\
')',color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,0,contains,flags)
')',color,mat1,mat2,volume,wgt,melee_dam,0,to_hit,contains,flags)
// NAME RAR PRC COLOR MAT1 MAT2
/* TOOLS
@@ -280,204 +183,11 @@ itypes[id]=new it_container(id,rarity,price,name,des,\
*/
#define TOOL(id, name,rarity,price,sym,color,mat1,mat2,volume,wgt,melee_dam,\
melee_cut,to_hit,max_charge,def_charge,charge_per_use,charge_per_sec,fuel,\
revert,func,flags,des) \
revert,func,des) \
itypes[id]=new it_tool(id,rarity,price,name,des,sym,\
color,mat1,mat2,SOLID,volume,wgt,melee_dam,melee_cut,to_hit,flags,max_charge,\
color,mat1,mat2,SOLID,volume,wgt,melee_dam,melee_cut,to_hit,max_charge,\
def_charge,charge_per_use,charge_per_sec,fuel,revert,func)
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("suppressor", "suppressor", 15, 480, c_dkgray, STEEL, PLASTIC, 2, 1, 3, 0, 2,
// ACC DAM NOI CLP REC BST NEWTYPE, PISTOL SHOT SMG RIFLE
-1, -4,-25, 0, 0, 0, AT_NULL, true, false, true, true,
0, "\
Using a suppressor is almost an imperative in zombie-infested regions. Gunfire\n\
is very noisy, and will attract predators. Its only drawback is a reduced\n\
muzzle velocity, resulting in less accuracy and damage.",
0);
GUNMOD("grip", "enhanced grip", 12, 280, c_brown, STEEL, PLASTIC, 1, 1, 0, 0, -1,
2, 0, 0, 0, -2, 0, AT_NULL, false, true, true, true,
0, "\
A grip placed forward on the barrel allows for greater control and accuracy.\n\
Aside from increased weight, there are no drawbacks.",
0);
GUNMOD("barrel_big", "barrel extension",10,400, c_ltgray, STEEL, MNULL, 4, 1, 5, 0, 2,
6, 1, 0, 0, 5, 0, AT_NULL, false, false, true, true,
0, "\
A longer barrel increases the muzzle velocity of a firearm, contributing to\n\
both accuracy and damage. However, the longer barrel tends to vibrate after\n\
firing, greatly increasing recoil.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("barrel_small", "shortened barrel", 6, 320, c_ltgray, STEEL, MNULL, 1, 1, -2, 0, -1,
// ACC DAM NOI CLP REC BST NEWTYPE, PISTOL SHOT SMG RIFLE
-5, 0, 2, 0, -6, 0, AT_NULL, false, false, true, true,
0, "\
A shortened barrel results in markedly reduced accuracy, and a minor increase\n\
in noise, but also reduces recoil greatly as a result of the improved\n\
managability of the firearm.",
0);
GUNMOD("barrel_rifled", "rifled barrel", 5, 220, c_ltgray, STEEL, MNULL, 2, 1, 3, 0, 1,
10,-20, 0, 0, 0, -1, AT_NULL, false, true, false, false,
0, "\
Rifling a shotgun barrel is mainly done in order to improve its accuracy when\n\
firing slugs. The rifling makes the gun less suitable for shot, however.",
0);
GUNMOD("clip", "extended magazine", 8, 560, c_ltgray, STEEL, PLASTIC, 1, 1, -2, 0, -1,
-1, 0, 0, 50, 0, 0, AT_NULL, true, true, true, true,
0, "\
Increases the ammunition capacity of your firearm by 50%, but the added bulk\n\
reduces accuracy slightly.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("clip2", "double magazine", 4, 720, c_ltgray, STEEL, PLASTIC, 2, 2, 0, 0, 0,
// ACC DAM NOI CLP REC BST NEWTYPE, PISTOL SHOT SMG RIFLE
-2, 0, 0,100, 2, 0, AT_NULL, false, true, true, true,
0, "\
Completely doubles the ammunition capacity of your firearm, but the added\n\
bulk reduces accuracy and increases recoil.",
0);
GUNMOD("spare_mag", "spare magazine", 15, 200, c_ltgray, STEEL, PLASTIC, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, AT_NULL, true, true, true, true,
0, "\
A spare magazine you can keep on hand to make reloads faster, but must itself\n\
be reloaded before it can be used again.",
0);
GUNMOD("stablizer", "gyroscopic stablizer",4,680,c_blue, STEEL, PLASTIC, 3, 2, 0, 0, -3,
2, -2, 0,-10, -8, 0, AT_NULL, false, false, true, true,
0, "\
An advanced unit that straps onto the side of your firearm and reduces\n\
vibration, greatly reducing recoil and increasing accuracy. However, it also\n\
takes up space in the magazine slot, reducing ammo capacity.",
0);
GUNMOD("blowback", "rapid blowback", 3, 700, c_red, STEEL, PLASTIC, 0, 1, 0, 0, 0,
-3, 0, 4, 0, 0, 6, AT_NULL, false, false, true, true,
0, "\
An improved blowback mechanism makes your firearm's automatic fire faster, at\n\
the cost of reduced accuracy and increased noise.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("autofire", "auto-fire mechanism",2,650,c_red, STEEL, PLASTIC, 1, 2, 2, 0, -1,
// ACC DAM NOI CLP REC BST NEWTYPE, PISTOL SHOT SMG RIFLE
-2, 0, 2, 0, 2, 3, AT_NULL, true, false, false, false,
(mfb(AT_22)|mfb(AT_9MM)|mfb(AT_38)|mfb(AT_40)|mfb(AT_57)|mfb(AT_46)), "\
A simple mechanism that converts a pistol to a fully-automatic weapon, with\n\
a burst size of three rounds. However, it reduces accuracy, and increases\n\
noise and recoil.",
0);
GUNMOD("retool_9mm", "9mm caliber retool",3,420, c_green, STEEL, MNULL, 1, 1, 0, 0, -1,
-1, 0, 0, 0, 0, 0, AT_9MM, true, false, true, false,
(mfb(AT_38)|mfb(AT_40)|mfb(AT_44)|mfb(AT_45)), "\
Replacing several key parts of a .38, .40, .44 or .45 firearm converts it to\n\
a 9mm firearm. The conversion results in a slight reduction in accuracy.",
0);
GUNMOD("retool_22", ".22 caliber retool",2,320, c_green, STEEL, MNULL, 1, 1, -2, 0, -1,
-1, 0, 0, 0, 0, 0, AT_22, true, false, true, true,
(mfb(AT_9MM)|mfb(AT_38)|mfb(AT_40)|mfb(AT_57)|mfb(AT_46)|mfb(AT_762)|
mfb(AT_223)), "\
Replacing several key parts of a 9mm, .38, .40, 5.7mm, 4.6mm, 7.62mm or .223\n\
firearm converts it to a .22 firearm. The conversion results in a slight\n\
reduction in accuracy.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("retool_57", "5.7mm caliber retool",1,460,c_green, STEEL, MNULL, 1, 1, -3, 0, -1,
// ACC DAM NOI CLP REC BST NEWTYPE, PISTOL SHOT SMG RIFLE
-1, 0, 0, 0, 0, 0, AT_57, true, false, true, false,
(mfb(AT_22)|mfb(AT_9MM)|mfb(AT_38)), "\
FN Hestal sells a conversion kit, used to convert .22, 9mm, or .38 firearms\n\
to their proprietary 5.7x28mm, a round designed for accuracy and armor\n\
penetration.",
0);
GUNMOD("retool_46", "4.6mm caliber retool",1,460,c_green, STEEL, MNULL, 1, 1, -3, 0, -1,
-1, 0, 0, 0, 0, 0, AT_46, true, false, true, false,
(mfb(AT_22)|mfb(AT_9MM)|mfb(AT_38)), "\
Heckler and Koch sells a conversion kit, used to convert .22, 9mm, or .38\n\
firearms to their proprietary 4.6x30mm, a round designed for accuracy and\n\
armor penetration.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("retool_308", ".308 caliber retool",2,520,c_green, STEEL, MNULL, 2, 1, 4, 0, 1,
// ACC DAM NOI CLP REC BST NEWTYPE PISTOL SHOT SMG RIFLE
-2, 0, 0,-20, 0, 0, AT_308, false, true, false, true,
(mfb(AT_SHOT)|mfb(AT_762)|mfb(AT_223)|mfb(AT_3006)), "\
This kit is used to convert a shotgun or 7.62mm, .223 or .30-06 rifle to the\n\
popular and powerful .308 caliber. The conversion results in reduced ammo\n\
capacity and a slight reduction in accuracy.",
0);
GUNMOD("retool_223", ".223 caliber retool",2,500,c_green, STEEL, MNULL, 2, 1, 4, 0, 1,
-2, 0, 0,-10, 0, 0, AT_223, false, true, false, true,
(mfb(AT_SHOT)|mfb(AT_762)|mfb(AT_3006)|mfb(AT_308)), "\
This kit is used to convert a shotgun or 7.62mm, .30-06, or .308 rifle to the\n\
popular, accurate, and damaging .223 caliber. The conversion results in\n\
slight reductions in both accuracy and ammo capacity.",
0);
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("conversion_battle", "battle rifle conversion",1,680,c_magenta,STEEL,MNULL, 4, 3, 6, 0, -1,
// ACC DAM NOI CLP REC BST NEWTYPE PISTOL SHOT SMG RIFLE
-6, 6, 4, 20, 4, 4, AT_NULL, false, false, false, true,
0, "\
This is a complete conversion kit, designed to turn a rifle into a powerful\n\
battle rifle. It reduces accuracy, and increases noise and recoil, but also\n\
increases damage, ammo capacity, and fire rate.",
0);
GUNMOD("conversion_sniper", "sniper conversion",1,660, c_green, STEEL, MNULL, 1, 2, 0, 0, -1,
10, 8, 3,-15, 0,-99, AT_NULL, false, false, false, true,
0, "\
This is a complete conversion kit, designed to turn a rifle into a deadly\n\
sniper rifle. It decreases ammo capacity, and removes any automatic fire\n\
capabilities, but also increases accuracy and damage.",
0);
GUNMOD("m203", "M203", 2,650, c_ltred, STEEL, MNULL, 2, 1, 2, 0, -1,
-2, 0, 0, 1, 0, 0, AT_40MM, false, false, false, true,
0, "\
The M203 was originally designed for use with M16 variants but today can be\n\
attached to almost any rifle. It allows a single 40mm grenade to be loaded\n\
and fired.",
mfb(IF_MODE_AUX));
// NAME RAR PRC COLOR MAT1 MAT2 VOL WGT DAM CUT HIT
GUNMOD("bayonet", "bayonet", 6, 400, c_ltcyan, STEEL, MNULL, 2, 2, 0, 16, -3,
// ACC DAM NOI CLP REC BST NEWTYPE PISTOL SHOT SMG RIFLE
0, 0, 0, 0, 3, 0, AT_NULL, false, true, true, true,
0, "\
A bayonet is a stabbing weapon that can be attached to the front of a\n\
shotgun, sub-machinegun or rifle, allowing a melee attack to deal\n\
piercing damage. The added length increases recoil slightly.",
mfb(IF_STAB));
GUNMOD("u_shotgun", "underslung shotgun", 2,650, c_ltred, STEEL, MNULL, 2, 1, 2, 0, -1,
-2, 0, 0, 2, 0, 0, AT_SHOT, false, false, false, true,
0, "\
A miniaturized shotgun with 2 barrels, which can be mounted under the\n\
barrel of many rifles. It allows two shotgun shells to be loaded and fired.",
mfb(IF_MODE_AUX));
GUNMOD("gun_crossbow", "rail-mounted crossbow", 2, 500, c_ltred, STEEL, WOOD, 2, 1, 2, 0, -1,
0, 0, 0, 1, 0, 0, AT_BOLT, false, true, false, true,
0, "\
A kit to attach a pair of crossbow arms and a firing rail to\n\
the barrel of a long firearm. It allows crossbow bolts to be fired.",
mfb(IF_MODE_AUX)|mfb(IF_STR_RELOAD));
CONT("bag_plastic", "plastic bag", 50, 1, c_ltgray, PLASTIC,MNULL,
// VOL WGT DAM HIT VOL FLAGS
1, 0, -8, -4, 24, 0, "\
@@ -541,7 +251,7 @@ A half-litre glass jar with a metal screw top lid, used for canning.");
TOOL("jack", "jack", 30, 86, ';', c_ltgray, IRON, MNULL,
// VOL WGT DAM CUT HIT FLAGS
5, 10, 11, 0, 2, 0, 0, 0, 0, AT_NULL, "null", &iuse::none, 0, "\
5, 10, 11, 0, 2, 0, 0, 0, 0, AT_NULL, "null", &iuse::none, "\
A common hydraulic jack, used when changing tires.");
// BIONICS
@@ -550,7 +260,7 @@ A common hydraulic jack, used when changing tires.");
// list of options.
#define BIO(id, name, rarity, price, color, difficulty, des) \
itypes[id]=new it_bionic(id, rarity,price,name,des,':',\
color, STEEL, PLASTIC, 10, 18, 8, 0, 0, 0, difficulty)
color, STEEL, PLASTIC, 10, 18, 8, 0, 0, difficulty)
#define BIO_SINGLE(id,rarity,price,color,difficulty) \
BIO(id, std::string("CBM: ")+bionics[id]->name, rarity,price,color,difficulty, \
@@ -570,13 +280,13 @@ by 10 units."); // This is another special case, increases power capacity by 10
// SOFTWARE
#define SOFTWARE(id, name, price, swtype, power, description) \
itypes[id]=new it_software(id, 0, price, name, description,\
' ', c_white, MNULL, MNULL, 0, 0, 0, 0, 0, 0, swtype, power)
' ', c_white, MNULL, MNULL, 0, 0, 0, 0, 0, swtype, power)
//Macguffins
#define MACGUFFIN(id, name, price, sym, color, mat1, mat2, volume, wgt, dam, cut,\
to_hit, readable, function, description) \
itypes[id]=new it_macguffin(id, 0, price, name, description,\
sym, color, mat1, mat2, volume, wgt, dam, cut, to_hit, 0, readable,\
sym, color, mat1, mat2, volume, wgt, dam, cut, to_hit, readable,\
function)
// BIONIC IMPLANTS
@@ -679,7 +389,7 @@ A hand-written paper note.");
#define STATIONARY(id, name, rarity, price, category, description) \
itypes[id] = new it_stationary(id, rarity, price, name, description,\
',', c_white, PAPER, MNULL, 0, 0, 0, 0, 0, 0, category)
',', c_white, PAPER, MNULL, 0, 0, 0, 0, 0, category)
STATIONARY("flyer", "flyer", 5, 1, "flier", "A scrap of paper.");
@@ -701,7 +411,7 @@ AMMO("bio_fusion_ammo", "Fusion blast", 0,0, AT_FUSION,c_dkgray, MNULL,
GUN("bio_blaster_gun", "fusion blaster", 0,0,c_magenta, STEEL, PLASTIC,
// SKILL AMMO VOL WGT MDG HIT DMG RNG ACC REC DUR BST CLIP REL
"rifle", AT_FUSION, 12, 0, 0, 0, 0, 0, 4, 0, 10, 0, 1, 500,
"",0);
"");
@@ -711,9 +421,9 @@ GUN("bio_blaster_gun", "fusion blaster", 0,0,c_magenta, STEEL, PLASTIC,
// Unarmed Styles
#define STYLE(id, name, dam, description, ...) \
itypes[id]=new it_style(id, 0, 0, name, description, '$', \
c_white, MNULL, MNULL, 0, 0, dam, 0, 0, 0); \
c_white, MNULL, MNULL, 0, 0, dam, 0, 0); \
setvector(&((static_cast<it_style*>(itypes[id])))->moves, __VA_ARGS__, NULL); \
itypes[id]->item_flags |= mfb(IF_UNARMED_WEAPON); \
itypes[id]->item_tags.insert("UNARMED_WEAPON"); \
martial_arts_itype_ids.push_back(id)
STYLE("style_karate", "karate", 2, "\
+135 -21
View File
@@ -715,7 +715,7 @@ void iuse::mutagen_3(game *g, player *p, item *it, bool t)
void iuse::purifier(game *g, player *p, item *it, bool t)
{
std::vector<int> valid; // Which flags the player has
for (int i = 1; i < PF_MAX2; i++) {
for (int i = PF_MAX+1; i < PF_MAX2; i++) {
if (p->has_trait(pl_flag(i)) && p->has_mutation(pl_flag(i)))
valid.push_back(i);
}
@@ -924,9 +924,33 @@ void iuse::sew(game *g, player *p, item *it, bool t)
it->charges++;
return;
}
if (!fix->made_of(COTTON) && !fix->made_of(WOOL))
itype_id repair_item = "none";
std::string plural = "";
if (fix->made_of(COTTON) || fix->made_of(WOOL))
{
repair_item = "rag";
plural = "s";
}
else if (fix->made_of(LEATHER))
{
repair_item = "leather";
}
else
{
g->add_msg_if_player(p,"Your %s is not made of cotton or wool.", fix->tname().c_str());
g->add_msg_if_player(p,"Your %s is not made of cotton, wool or leather.", fix->tname().c_str());
it->charges++;
return;
}
int items_needed=(fix->damage>2||fix->damage==0)?1:0;
// this will cause issues if/when NPCs start being able to sew.
// but, then again, it'll cause issues when they start crafting, too.
inventory crafting_inv = g->crafting_inventory(p);
if (!crafting_inv.has_amount(repair_item, items_needed))
{
g->add_msg_if_player(p,"You don't have enough %s%s to do that.", repair_item.c_str(), plural.c_str());
it->charges++;
return;
}
@@ -936,8 +960,14 @@ void iuse::sew(game *g, player *p, item *it, bool t)
it->charges++;
return;
}
else if (fix->damage == 0)
{
std::vector<component> comps;
comps.push_back(component(repair_item, items_needed));
comps.back().available = true;
if (fix->damage == 0)
{
p->moves -= 500 * p->fine_detail_vision_mod(g);
p->practice(g->turn, "tailor", 10);
int rn = dice(4, 2 + p->skillLevel("tailor"));
@@ -952,15 +982,16 @@ void iuse::sew(game *g, player *p, item *it, bool t)
g->add_msg_if_player(p,"You damage your %s!", fix->tname().c_str());
fix->damage++;
}
else if (rn >= 12 && p->i_at(ch).has_flag(IF_VARSIZE) && !p->i_at(ch).has_flag(IF_FIT))
else if (rn >= 12 && p->i_at(ch).has_flag("VARSIZE") && !p->i_at(ch).has_flag("FIT"))
{
g->add_msg_if_player(p,"You take your %s in, improving the fit.", fix->tname().c_str());
(p->i_at(ch).item_flags |= mfb(IF_FIT));
(p->i_at(ch).item_tags.insert("FIT"));
}
else if (rn >= 12 && (p->i_at(ch).has_flag(IF_FIT) || !p->i_at(ch).has_flag(IF_VARSIZE)))
else if (rn >= 12 && (p->i_at(ch).has_flag("FIT") || !p->i_at(ch).has_flag("VARSIZE")))
{
g->add_msg_if_player(p, "You make your %s extra sturdy.", fix->tname().c_str());
fix->damage--;
g->consume_items(p, comps);
}
else
{
@@ -1001,6 +1032,7 @@ void iuse::sew(game *g, player *p, item *it, bool t)
else if (rn <= 8)
{
g->add_msg_if_player(p,"You repair your %s, but waste lots of thread.", fix->tname().c_str());
if (fix->damage>=3) {g->consume_items(p, comps);}
fix->damage--;
int waste = rng(1, 8);
if (waste > it->charges)
@@ -1011,14 +1043,17 @@ void iuse::sew(game *g, player *p, item *it, bool t)
else if (rn <= 16)
{
g->add_msg_if_player(p,"You repair your %s!", fix->tname().c_str());
if (fix->damage>=3) {g->consume_items(p, comps);}
fix->damage--;
}
else
{
g->add_msg_if_player(p,"You repair your %s completely!", fix->tname().c_str());
if (fix->damage>=3) {g->consume_items(p, comps);}
fix->damage = 0;
}
}
//iuse::sew uses up 1 charge when called, if less than 1, set to 1, and use that one up.
if (it->charges < 1)
{it->charges = 1;}
@@ -1047,13 +1082,13 @@ void iuse::extra_battery(game *g, player *p, item *it, bool t)
return;
}
if (modded->has_flag(IF_DOUBLE_AMMO))
if (modded->has_flag("DOUBLE_AMMO"))
{
g->add_msg_if_player(p,"That item has already had its battery capacity doubled.");
return;
}
modded->item_flags |= mfb(IF_DOUBLE_AMMO);
modded->item_tags.insert("DOUBLE_AMMO");
g->add_msg_if_player(p,"You double the battery capacity of your %s!", tool->name.c_str());
it->invlet = 0;
}
@@ -1115,6 +1150,11 @@ void iuse::scissors(game *g, player *p, item *it, bool t)
{
count -= rng(1, 3);
}
if (cut->damage>2 || cut->damage<0)
{
count-= cut->damage;
}
if (count <= 0)
{
@@ -1248,6 +1288,39 @@ void iuse::hammer(game *g, player *p, item *it, bool t)
g->m.ter_set(dirx, diry, newter);
}
void iuse::gasoline_lantern_off(game *g, player *p, item *it, bool t)
{
if (it->charges == 0)
{
g->add_msg_if_player(p,"The lantern is empty.");
}
else if(!p->use_charges_if_avail("fire", 1))
{
g->add_msg_if_player(p,"You need a lighter!");
}
else
{
g->add_msg_if_player(p,"You turn the lantern on.");
it->make(g->itypes["gasoline_lantern_on"]);
it->active = true;
it->charges --;
}
}
void iuse::gasoline_lantern_on(game *g, player *p, item *it, bool t)
{
if (t) // Normal use
{
// Do nothing... player::active_light and the lightmap::generate deal with this
}
else // Turning it off
{
g->add_msg_if_player(p,"The lantern is extinguished.");
it->make(g->itypes["gasoline_lantern"]);
it->active = false;
}
}
void iuse::light_off(game *g, player *p, item *it, bool t)
{
if (it->charges == 0)
@@ -1308,9 +1381,16 @@ void iuse::glowstick_active(game *g, player *p, item *it, bool t)
// Do nothing... player::active_light and the lightmap::generate deal with this
}
else
{ // Turning it off
g->add_msg_if_player(p,"The glowstick dies.");
it->active = false;
{
if (it->charges > 0)
{
g->add_msg_if_player(p,"You can't turn off a glowstick.");
}
else
{
g->add_msg_if_player(p,"The glowstick fades out.");
it->active = false;
}
}
}
void iuse::cauterize_elec(game *g, player *p, item *it, bool t)
@@ -1468,7 +1548,7 @@ void iuse::directional_antenna(game *g, player *p, item *it, bool t)
return;
}
// Find the radio station its tuned to (if any)
radio_tower *tower = find_radio_station( g, radio.mode );
radio_tower *tower = find_radio_station( g, radio.frequency );
if( tower == NULL )
{
g->add_msg( "You can't find the direction if your radio isn't tuned." );
@@ -1485,7 +1565,7 @@ void iuse::radio_on(game *g, player *p, item *it, bool t)
if (t)
{ // Normal use
std::string message = "Radio: Kssssssssssssh.";
radio_tower *selected_tower = find_radio_station( g, it->mode );
radio_tower *selected_tower = find_radio_station( g, it->frequency );
if( selected_tower != NULL )
{
if( selected_tower->type == MESSAGE_BROADCAST )
@@ -1540,7 +1620,7 @@ void iuse::radio_on(game *g, player *p, item *it, bool t)
{
case 1:
{
int old_frequency = it->mode;
int old_frequency = it->frequency;
radio_tower *tower = NULL;
radio_tower *lowest_tower = NULL;
radio_tower *lowest_larger_tower = NULL;
@@ -1567,11 +1647,11 @@ void iuse::radio_on(game *g, player *p, item *it, bool t)
}
if( lowest_larger_tower != NULL )
{
it->mode = lowest_larger_tower->frequency;
it->frequency = lowest_larger_tower->frequency;
}
else if( lowest_tower != NULL )
{
it->mode = lowest_tower->frequency;
it->frequency = lowest_tower->frequency;
}
}
break;
@@ -1906,6 +1986,38 @@ void iuse::dig(game *g, player *p, item *it, bool t)
*/
}
void iuse::siphon(game *g, player *p, item *it, bool t)
{
int posx = 0;
int posy = 0;
g->draw();
mvprintw(0, 0, "Siphon where?");
get_direction(g, posx, posy, input());
if (posx == -2)
{
g->add_msg_if_player(p,"Invalid direction.");
return;
}
// there's no self-tile check because the player could be in a vehicle
posx += p->posx;
posy += p->posy;
vehicle* veh = g->m.veh_at(posx, posy);
if (veh == NULL)
{
g->add_msg_if_player(p,"There's no vehicle there.");
return;
}
if (veh->fuel_left(AT_GAS) == 0)
{
g->add_msg_if_player(p, "That vehicle has no fuel to siphon.");
return;
}
p->siphon_gas(g, veh);
p->moves -= 200;
return;
}
void iuse::chainsaw_off(game *g, player *p, item *it, bool t)
{
p->moves -= 80;
@@ -3588,7 +3700,9 @@ void iuse::bullet_puller(game *g, player *p, item *it, bool t)
p->i_add(lead);}
else
g->m.add_item(p->posx, p->posy, lead);
}
p->practice(g->turn, "gun", rng(1, multiply / 5 + 1));
}
void iuse::boltcutters(game *g, player *p, item *it, bool t)
{
@@ -4088,7 +4202,7 @@ void iuse::heatpack(game *g, player *p, item *it, bool t)
if (heat->type->is_food()) {
p->moves -= 300;
g->add_msg("You heat up the food.");
heat->item_flags |= mfb(IF_HOT);
heat->item_tags.insert("HOT");
heat->active = true;
heat->item_counter = 600; // sets the hot food flag for 60 minutes
it->make(g->itypes["heatpack_used"]);
@@ -4096,7 +4210,7 @@ void iuse::heatpack(game *g, player *p, item *it, bool t)
} else if (heat->is_food_container()) {
p->moves -= 300;
g->add_msg("You heat up the food.");
heat->contents[0].item_flags |= mfb(IF_HOT);
heat->contents[0].item_tags.insert("HOT");
heat->contents[0].active = true;
heat->contents[0].item_counter = 600; // sets the hot food flag for 60 minutes
it->make(g->itypes["heatpack_used"]);
+3
View File
@@ -60,6 +60,8 @@ class iuse
void hammer (game *g, player *p, item *it, bool t);
void light_off (game *g, player *p, item *it, bool t);
void light_on (game *g, player *p, item *it, bool t);
void gasoline_lantern_off (game *g, player *p, item *it, bool t);
void gasoline_lantern_on (game *g, player *p, item *it, bool t);
void lightstrip (game *g, player *p, item *it, bool t);
void lightstrip_active(game *g, player *p, item *it, bool t);
void glowstick (game *g, player *p, item *it, bool t);
@@ -79,6 +81,7 @@ class iuse
void crowbar (game *g, player *p, item *it, bool t);
void makemound (game *g, player *p, item *it, bool t);
void dig (game *g, player *p, item *it, bool t);
void siphon (game *g, player *p, item *it, bool t);
void chainsaw_off (game *g, player *p, item *it, bool t);
void chainsaw_on (game *g, player *p, item *it, bool t);
void jackhammer (game *g, player *p, item *it, bool t);
+1
View File
@@ -219,6 +219,7 @@ select_fire_mode F\n\
drop d\n\
drop_adj D\n\
bionics p\n\
sort_armor +\n\
\n\
# LONG TERM & SPECIAL ACTIONS\n\
wait |\n\
+4 -4
View File
@@ -70,10 +70,10 @@ void map::generate_lightmap(game* g)
for( std::vector<item>::const_iterator itm = items.begin(); itm != items.end(); ++itm )
{
if ( itm->has_flag(IF_LIGHT_20)) { apply_light_source(sx, sy, 20); }
if ( itm->has_flag(IF_LIGHT_1)) { apply_light_source(sx, sy, 1); }
if ( itm->has_flag(IF_LIGHT_4)) { apply_light_source(sx, sy, 4); }
if ( itm->has_flag(IF_LIGHT_8)) { apply_light_source(sx, sy, 8); }
if ( itm->has_flag("LIGHT_20")) { apply_light_source(sx, sy, 20); }
if ( itm->has_flag("LIGHT_1")) { apply_light_source(sx, sy, 1); }
if ( itm->has_flag("LIGHT_4")) { apply_light_source(sx, sy, 4); }
if ( itm->has_flag("LIGHT_8")) { apply_light_source(sx, sy, 8); }
}
if(terrain == t_lava)
+1
View File
@@ -55,6 +55,7 @@ int main(int argc, char *argv[])
game *g = new game;
g->init_ui();
MAPBUFFER.set_game(g);
g->load_artifacts(); //artifacts have to be loaded before any items are created
MAPBUFFER.load();
curs_set(0); // Invisible cursor here, because MAPBUFFER.load() is crash-prone
+168 -75
View File
@@ -524,8 +524,7 @@ bool map::vehproceed(game* g){
if (veh->skidding){
if (one_in(4)){ // might turn uncontrollably while skidding
veh->move.init (veh->move.dir() +
(one_in(2) ? -15 * rng(1, 3) : 15 * rng(1, 3)));
veh->turn (one_in(2) ? -15 : 15);
}
}
else if (pl_ctrl && rng(0, 4) > g->u.skillLevel("driving") && one_in(20)) {
@@ -592,29 +591,47 @@ bool map::vehproceed(game* g){
float m2 = veh2->total_mass();
rl_vec2d collision_axis = (velo_veh1 - velo_veh2).normalized();
// imp? & delta? & final? reworked:
// newvel1 =( vel1 * ( mass1 - mass2 ) + ( 2 * mass2 * vel2 ) ) / ( mass1 + mass2 )
// as per http://en.wikipedia.org/wiki/Elastic_collision
// impulse vectors
rl_vec2d imp1 = collision_axis * collision_axis.dot_product (velo_veh1) * m1;
rl_vec2d imp2 = (collision_axis) * (-collision_axis).dot_product (velo_veh2) * m2;
rl_vec2d imp1 = collision_axis * collision_axis.dot_product (velo_veh1) * ( m1 ) * 2;
rl_vec2d imp2 = (collision_axis) * (-collision_axis).dot_product (velo_veh2) * ( m2 ) * 2;
// finally, changes in veh velocity
// 30% is absorbed as bashing damage??
rl_vec2d delta1 = imp2 * .7f / m1;
rl_vec2d delta2 = imp1 * .7f / m2;
rl_vec2d delta1 = (imp2 * .7f); // todo: get remaing kinetic energy, convert to damage
rl_vec2d delta2 = (imp1 * .7f); // by adding imp
rl_vec2d final1 = ( ( velo_veh1 * ( m1 - m2 ) ) + delta1 ) / ( m1 + m2 );
rl_vec2d final2 = ( ( velo_veh2 * ( m2 - m1 ) ) + delta2 ) / ( m1 + m2 );
/* old bouncing pingpong collisions that generate kinetic energy to reach mach 20+
rl_vec2d imp1 = collision_axis * collision_axis.dot_product (velo_veh1) * m1;
rl_vec2d imp2 = (collision_axis) * (-collision_axis).dot_product (velo_veh2) * m2;
rl_vec2d delta1 = (imp2 * .7f) / m1;
rl_vec2d delta2 = (imp1 * .7f) / m2;
rl_vec2d final1 = velo_veh1 + delta1;
rl_vec2d final2 = velo_veh2 + delta2;
*/
veh->move.init (final1.x, final1.y);
veh->velocity = final1.norm();
// shrug it off if the change is less than 8mph.
if(delta1.norm() > 800) {
veh->skidding = 1;
}
rl_vec2d final2 = velo_veh2 + delta2;
veh2->move.init(final2.x, final2.y);
veh2->velocity = final2.norm();
if(delta2.norm() > 800) {
veh2->skidding = 1;
}
#ifdef testng_vehicle_collisions
debugmsg("C(%d): %s (%.0f): %.0f => %.0f // %s (%.0f): %.0f => %.0f",
(int)g->turn,
veh->name.c_str(), m1, velo_veh1.norm(), final1.norm(),
veh2->name.c_str(), m2, velo_veh2.norm(), final2.norm()
);
#endif
//give veh2 the initiative to proceed next before veh1
float avg_of_turn = (veh2->of_turn + veh->of_turn) / 2;
if(avg_of_turn < .1f)
@@ -705,23 +722,14 @@ bool map::vehproceed(game* g){
veh->last_turn = 0;
}
if (pl_ctrl && veh->velocity) {
// a bit of delay for animation
// total delay is roughly one third of a second.
int ns_per_frame = abs ( (BILLION/3) / ( (float)veh->velocity / 1000) );
if (ns_per_frame > BILLION/15)
ns_per_frame = BILLION/15;
timespec ts; // Timespec for the animation
ts.tv_sec = 0;
ts.tv_nsec = ns_per_frame;
nanosleep (&ts, 0);
}
if (can_move) {
// accept new direction
if (veh->skidding){
veh->face.init (veh->turn_dir);
veh->possibly_recover_from_skid();
if(pl_ctrl)
{
veh->possibly_recover_from_skid();
}
}
else
veh->face = mdir;
@@ -1375,6 +1383,23 @@ case t_wall_log:
case t_locker:
case t_rack:
result = rng(0, 30);
if (res) *res = result;
if (str >= result) {
sound += "metal screeching!";
ter_set(x, y, t_metal);
spawn_item(x, y, (*itypes)["scrap"], 0, rng(2, 8));
const int num_boards = rng(0, 3);
for (int i = 0; i < num_boards; i++)
spawn_item(x, y, (*itypes)["steel_chunk"], 0);
spawn_item(x, y, (*itypes)["pipe"], 0);
return true;
} else {
sound += "clang!";
return true;
}
break;
case t_fridge:
case t_glass_fridge:
result = rng(0, 30);
@@ -1386,7 +1411,7 @@ case t_wall_log:
const int num_boards = rng(0, 3);
for (int i = 0; i < num_boards; i++)
spawn_item(x, y, (*itypes)["steel_chunk"], 0);
spawn_item(x, y, (*itypes)["pipe"], 0);
spawn_item(x, y, (*itypes)["hose"], 0);
return true;
} else {
sound += "clang!";
@@ -1541,7 +1566,9 @@ case t_wall_log:
break;
case t_shrub:
if (str >= rng(0, 30) && str >= rng(0, 30) && str >= rng(0, 30) && one_in(2)){
result = rng(0, 30);
if (res) *res = result;
if (str >= result && str >= rng(0, 30) && one_in(2)){
sound += "crunch.";
ter_set(x, y, t_underbrush);
return true;
@@ -2195,6 +2222,12 @@ item map::water_from(const int x, const int y)
return ret;
}
item map::acid_from(const int x, const int y)
{
item ret(item_controller->find_template("water_acid"), 0);
return ret;
}
void map::i_rem(const int x, const int y, const int index)
{
if (index > i_at(x, y).size() - 1)
@@ -2223,52 +2256,86 @@ point map::find_item(const item *it)
return ret;
}
void map::spawn_item(const int x, const int y, item new_item, const int birthday,
const int quantity, const int charges, const int damlevel)
{
if (charges && new_item.charges > 0)
{
//let's fail silently if we specify charges for an item that doesn't support it
new_item.charges = charges;
}
new_item = new_item.in_its_container(itypes);
if (new_item.made_of(LIQUID) && has_flag(swimmable, x, y))
{
return;
}
// bounds checking for damage level
if (damlevel < -1)
{
new_item.damage = -1;
}
if (damlevel > 4)
{
new_item.damage = 4;
}
new_item.damage = damlevel;
// clothing with variable size flag may sometimes be generated fitted
if (new_item.is_armor() && new_item.has_flag("VARSIZE") && one_in(3))
{
new_item.item_tags.insert("FIT");
}
add_item(x, y, new_item);
}
//Old spawn_item method
//TODO: Deprecate
// added argument to spawn at various damage levels
void map::spawn_item(const int x, const int y, itype* type, const int birthday, const int quantity, const int charges, const int damlevel)
void map::spawn_item(const int x, const int y, itype* type, const int birthday,
const int quantity, const int charges, const int damlevel)
{
if (type->is_style())
return;
item tmp(type, birthday);
for(int i = 0; i < quantity; i++)
spawn_item(x, y, type, birthday, 0, charges);
if (charges && tmp.charges > 0) //let's fail silently if we specify charges for an item that doesn't support it
tmp.charges = charges;
tmp = tmp.in_its_container(itypes);
if (tmp.made_of(LIQUID) && has_flag(swimmable, x, y))
return;
// bounds checking for damage level
if (damlevel < -1)
tmp.damage = -1;
if (damlevel > 4)
tmp.damage = 4;
tmp.damage = damlevel;
add_item(x, y, tmp);
if (type->is_style())
{
return;
}
item new_item(type, birthday);
for(int i = 0; i < quantity; i++)
{
spawn_item(x, y, type, birthday, 0, charges);
}
spawn_item( x, y, new_item, birthday, quantity, charges, damlevel );
}
//New spawn_item method, using item factory
// added argument to spawn at various damage levels
void map::spawn_item(const int x, const int y, std::string type_id, const int birthday, const int quantity, const int charges, const int damlevel)
void map::spawn_item(const int x, const int y, std::string type_id, const int birthday,
const int quantity, const int charges, const int damlevel)
{
item tmp = item_controller->create(type_id, birthday);
if (quantity)
for(int i = 0; i < quantity; i++)
spawn_item(x, y, type_id, birthday, 0, charges);
if (charges && tmp.charges > 0) //let's fail silently if we specify charges for an item that doesn't support it
tmp.charges = charges;
tmp = tmp.in_its_container(itypes);
if (tmp.made_of(LIQUID) && has_flag(swimmable, x, y))
return;
// bounds checking for damage level
if (damlevel < -1)
tmp.damage = -1;
if (damlevel > 4)
tmp.damage = 4;
tmp.damage = damlevel;
add_item(x, y, tmp);
item new_item = item_controller->create(type_id, birthday);
for(int i = 0; i < quantity; i++)
{
spawn_item(x, y, type_id, birthday, 0, charges);
}
spawn_item( x, y, new_item, birthday, quantity, charges, damlevel );
}
void map::add_item_or_charges(const int x, const int y, item new_item) {
if (new_item.is_style() || !INBOUNDS(x, y) || (new_item.made_of(LIQUID) && has_flag(swimmable, x, y)) ) {
return;
}
if(new_item.charges != -1 && (new_item.is_food() || new_item.is_ammo())) {
for (int n = 0; n < i_at(x, y).size(); n++) {
item* curit = &(i_at(x, y)[n]);
if(curit->type->id == new_item.type->id) {
curit->charges+= new_item.charges;
return;
}
}
}
add_item(x, y, new_item);
}
// Place an item on the map, despite the parameter name, this is not necessaraly a new item.
void map::add_item(const int x, const int y, item new_item)
{
if (new_item.is_style())
@@ -2278,12 +2345,6 @@ void map::add_item(const int x, const int y, item new_item)
if (new_item.made_of(LIQUID) && has_flag(swimmable, x, y))
return;
// clothing with variable size flag may sometimes be generated fitted
if (new_item.is_armor() && new_item.has_flag(IF_VARSIZE) & one_in(3))
{
new_item.item_flags |= mfb(IF_FIT);
}
if (has_flag(noitem, x, y) || i_at(x, y).size() >= 64) {// Too many items there
std::vector<point> okay;
for (int i = x - 1; i <= x + 1; i++) {
@@ -2343,23 +2404,34 @@ void map::process_active_items_in_submap(game *g, const int nonant)
((*items)[n].is_container() && (*items)[n].contents.size() > 0 && (*items)[n].contents[0].active))
{
if ((*items)[n].is_food()) { // food items
if ((*items)[n].has_flag(IF_HOT)) {
if ((*items)[n].has_flag("HOT")) {
(*items)[n].item_counter--;
if ((*items)[n].item_counter == 0) {
(*items)[n].item_flags ^= mfb(IF_HOT);
(*items)[n].item_tags.erase("HOT");
(*items)[n].active = false;
grid[nonant]->active_item_count--;
}
}
} else if ((*items)[n].is_food_container()) { // food in containers
if ((*items)[n].contents[0].has_flag(IF_HOT)) {
if ((*items)[n].contents[0].has_flag("HOT")) {
(*items)[n].contents[0].item_counter--;
if ((*items)[n].contents[0].item_counter == 0) {
(*items)[n].contents[0].item_flags ^= mfb(IF_HOT);
(*items)[n].contents[0].item_tags.erase("HOT");
(*items)[n].contents[0].active = false;
grid[nonant]->active_item_count--;
}
}
} else if ((*items)[n].type->id == "corpse") { // some corpses rez over time
if ((*items)[n].ready_to_revive(g))
{
int mapx = (nonant % my_MAPSIZE) * SEEX + i;
int mapy = (nonant / my_MAPSIZE) * SEEY + j;
if (g->u_see(mapx, mapy))
{
g->add_msg("A nearby corpse rises and moves towards you!");
}
g->revive_corpse(mapx, mapy, n);
}
} else if (!(*items)[n].is_tool()) { // It's probably a charger gun
(*items)[n].active = false;
(*items)[n].charges = 0;
@@ -2390,9 +2462,10 @@ void map::process_active_items_in_submap(game *g, const int nonant)
}
}
void map::use_amount(const point origin, const int range, const itype_id type, const int amount,
std::list<item> map::use_amount(const point origin, const int range, const itype_id type, const int amount,
const bool use_container)
{
std::list<item> ret;
int quantity = amount;
for (int radius = 0; radius <= range && quantity > 0; radius++) {
for (int x = origin.x - radius; x <= origin.x + radius; x++) {
@@ -2403,6 +2476,7 @@ void map::use_amount(const point origin, const int range, const itype_id type, c
bool used_contents = false;
for (int m = 0; m < curit->contents.size() && quantity > 0; m++) {
if (curit->contents[m].type->id == type) {
ret.push_back(curit->contents[m]);
quantity--;
curit->contents.erase(curit->contents.begin() + m);
m--;
@@ -2413,6 +2487,7 @@ void map::use_amount(const point origin, const int range, const itype_id type, c
i_rem(x, y, n);
n--;
} else if (curit->type->id == type && quantity > 0) {
ret.push_back(*curit);
quantity--;
i_rem(x, y, n);
n--;
@@ -2422,10 +2497,12 @@ void map::use_amount(const point origin, const int range, const itype_id type, c
}
}
}
return ret;
}
void map::use_charges(const point origin, const int range, const itype_id type, const int amount)
std::list<item> map::use_charges(const point origin, const int range, const itype_id type, const int amount)
{
std::list<item> ret;
int quantity = amount;
for (int radius = 0; radius <= range && quantity > 0; radius++) {
for (int x = origin.x - radius; x <= origin.x + radius; x++) {
@@ -2445,10 +2522,13 @@ void map::use_charges(const point origin, const int range, const itype_id type,
else if (type == "hotplate")
ftype = AT_BATT;
quantity -= veh->drain(ftype, quantity);
item tmp = item_controller->create(type, 0); //TODO add a sane birthday arg
tmp.charges = veh->drain(ftype, quantity);
quantity -= tmp.charges;
ret.push_back(tmp);
if (quantity == 0)
return;
return ret;
}
}
@@ -2458,6 +2538,7 @@ void map::use_charges(const point origin, const int range, const itype_id type,
for (int m = 0; m < curit->contents.size() && quantity > 0; m++) {
if (curit->contents[m].type->id == type) {
if (curit->contents[m].charges <= quantity) {
ret.push_back(curit->contents[m]);
quantity -= curit->contents[m].charges;
if (curit->contents[m].destroyed_at_zero_charges()) {
curit->contents.erase(curit->contents.begin() + m);
@@ -2465,14 +2546,18 @@ void map::use_charges(const point origin, const int range, const itype_id type,
} else
curit->contents[m].charges = 0;
} else {
item tmp = curit->contents[m];
tmp.charges = quantity;
ret.push_back(tmp);
curit->contents[m].charges -= quantity;
return;
return ret;
}
}
}
// Now check the actual item
if (curit->type->id == type) {
if (curit->charges <= quantity) {
ret.push_back(*curit);
quantity -= curit->charges;
if (curit->destroyed_at_zero_charges()) {
i_rem(x, y, n);
@@ -2480,8 +2565,11 @@ void map::use_charges(const point origin, const int range, const itype_id type,
} else
curit->charges = 0;
} else {
item tmp = *curit;
tmp.charges = quantity;
ret.push_back(tmp);
curit->charges -= quantity;
return;
return ret;
}
}
}
@@ -2489,6 +2577,7 @@ void map::use_charges(const point origin, const int range, const itype_id type,
}
}
}
return ret;
}
trap_id& map::tr_at(const int x, const int y)
@@ -2583,6 +2672,10 @@ field& map::field_at(const int x, const int y)
cast_to_nonant(x, y, nonant);
*/
const int nonant = int(x / SEEX) + int(y / SEEY) * my_MAPSIZE;
if( grid[nonant]->field_count <= 0) {
nulfield = field();
return nulfield;
}
const int lx = x % SEEX;
const int ly = y % SEEY;
+7 -3
View File
@@ -140,19 +140,21 @@ class map
// Items
std::vector<item>& i_at(int x, int y);
item water_from(const int x, const int y);
item acid_from(const int x, const int y);
void i_clear(const int x, const int y);
void i_rem(const int x, const int y, const int index);
point find_item(const item *it);
void spawn_item(const int x, const int y, itype* type, int birthday, int quantity = 0, int charges = 0, int damlevel = 0);
void spawn_item(const int x, const int y, std::string itype_id, int birthday, int quantity = 0, int charges = 0, int damlevel = 0);
void add_item_or_charges(const int x, const int y, item new_item);
void add_item(const int x, const int y, item new_item);
void process_active_items(game *g);
void process_active_items_in_submap(game *g, const int nonant);
void process_vehicles(game *g);
void use_amount(const point origin, const int range, const itype_id type, const int amount,
const bool use_container = false);
void use_charges(const point origin, const int range, const itype_id type, const int amount);
std::list<item> use_amount(const point origin, const int range, const itype_id type, const int amount,
const bool use_container = false);
std::list<item> use_charges(const point origin, const int range, const itype_id type, const int amount);
// Traps
trap_id& tr_at(const int x, const int y);
@@ -190,6 +192,8 @@ class map
const int x2, const int y2, bool ongrass, const int turn);
// put_items_from puts exactly num items, based on chances
void put_items_from(items_location loc, const int num, const int x, const int y, const int turn = 0, const int quantity = 0, const int charges = 0, const int damlevel = 0);
void spawn_item(const int x, const int y, item new_item, const int birthday,
const int quantity, const int charges, const int damlevel);
void add_spawn(mon_id type, const int count, const int x, const int y, bool friendly = false,
const int faction_id = -1, const int mission_id = -1,
std::string name = "NONE");
+3
View File
@@ -138,6 +138,7 @@ t_sink, t_oven, t_woodstove, t_fireplace, t_bathtub, t_chair, t_armchair, t_sofa
t_sandbox, t_slide, t_monkey_bars, t_backboard,
t_bench, t_table, t_pool_table,
t_gas_pump, t_gas_pump_smashed, t_gas_pump_empty,
t_generator_broken,
t_missile, t_missile_exploded,
t_counter,
t_radio_tower, t_radio_controls,
@@ -514,6 +515,8 @@ const ter_t terlist[num_terrain_types] = { // MUST match enum ter_id above!
mfb(transparent)|mfb(noitem), &iexamine::none},
{"out-of-order gasoline pump", '&', c_red, 0, -1, tr_null,
mfb(transparent)|mfb(noitem), &iexamine::none},
{"broken generator", '&', c_ltgray, 0, -1, tr_null,
mfb(transparent)|mfb(noitem), &iexamine::none},
{"missile", '#', c_ltblue, 0, -1, tr_null,
mfb(explodes)|mfb(noitem), &iexamine::none},
{"blown-out missile",'#', c_ltgray, 0, -1, tr_null,
+1139 -419
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -25,7 +25,7 @@ enum items_location {
mi_lab_shoes, mi_lab_torso, mi_lab_pants,
mi_hospital_lab, mi_hospital_samples, mi_surgery,
mi_office, mi_cubical_office, mi_school, mi_church, mi_vault,
mi_art, mi_pawn, mi_mil_surplus,
mi_medieval, mi_art, mi_pawn, mi_mil_surplus,
mi_shelter, mi_mechanics,
mi_chemistry, mi_teleport, mi_goo, mi_cloning_vat, mi_dissection,
mi_hydro, mi_electronics, mi_monparts, mi_bionics, mi_bionics_common,
+19 -14
View File
@@ -28,7 +28,7 @@ void game::init_mapitems()
setvector(
&mapitems[mi_road],
"muffler", "pipe", "motor", "seat",
"muffler", "pipe", "motor", "seat", "saddle",
"wheel", "wheel_wide", "wheel_bicycle", "wheel_motorbike", "wheel_small",
"1cyl_combustion", "v2_combustion", "i4_combustion", "v6_combustion",
"v8_combustion", "foot_crank", "flyer", NULL);
@@ -80,13 +80,13 @@ void game::init_mapitems()
"solar_cell",
"manual_mechanics", "hammer", "flashlight", "soldering_iron",
"bubblewrap", "binoculars", "duct_tape", "lawnmower", "foot_crank",
"boltcutters", "spray_can", "jar_glass", "bearings", NULL);
"boltcutters", "spray_can", "jar_glass", "bearing", NULL);
setvector(
&mapitems[mi_bedroom],
"inhaler", "cig", "cigar", "weed", "coke", "meth",
"heroin", "sneakers", "socks", "mocassins", "bandana", "glasses_eye", "sunglasses",
"glasses_reading", "hat_ball", "backpack", "purse", "mbag",
"glasses_reading", "glasses_bifocal", "hat_ball", "backpack", "purse", "mbag",
"fanny", "battery", "bb", "bbgun", "mag_porn", "mag_tv", "mag_gaming",
"mag_news", "novel_romance", "novel_drama", "novel_mystery", "manual_mechanics",
"manual_speech", "manual_business", "manual_computers",
@@ -199,7 +199,7 @@ void game::init_mapitems()
"superglue", "chain", "rope_6", "rope_30", "glass_sheet",
"pipe", "nail", "hose", "string_36", "frame", "metal_tank",
"wire", "wire_barbed", "duct_tape", "jerrycan", "lawnmower",
"foot_crank", "spray_can", "ax", "jerrycan_big", "funnel", "bearings", "jack",
"foot_crank", "spray_can", "ax", "jerrycan_big", "funnel", "bearing", "jack",
NULL);
setvector(
@@ -246,7 +246,7 @@ void game::init_mapitems()
"hammer", "flashlight", "water_purifier", "radio", "beartrap",
"UPS_off", "string_36", "longbow", "compbow", "arrow_wood",
"arrow_cf", "wire", "rollmat", "tent_kit", "canteen", "ax",
"heatpack", "glowstick", "emer_blanket", "cloak", "sleeping_bag", NULL);
"heatpack", "glowstick", "emer_blanket", "cloak", "sleeping_bag", "gasoline_lantern", NULL);
setvector(
@@ -333,7 +333,7 @@ void game::init_mapitems()
"glasses_safety", "goggles_nv", "holster", "bootstrap",
"mag_guns", "mag_archery", "flashlight", "UPS_off", "suppressor", "grip",
"barrel_big", "barrel_small", "barrel_rifled", "clip", "spare_mag",
"clip2", "stablizer", "blowback", "autofire", "retool_45",
"clip2", "stabilizer", "blowback", "autofire", "retool_45",
"retool_9mm", "retool_22", "retool_57", "retool_46",
"retool_308", "retool_223", "tazer","shot_hull",
"9mm_casing", "38_casing", "40_casing", "44_casing", "45_casing",
@@ -465,7 +465,7 @@ void game::init_mapitems()
setvector(
&mapitems[mi_office],
"cola", "aspirin", "cigar", "glasses_eye", "sunglasses", "glasses_reading",
"cola", "aspirin", "cigar", "glasses_eye", "sunglasses", "glasses_reading", "glasses_bifocal",
"purse", "mbag", "battery", "mag_news", "manual_business",
"textbook_business", "lighter", "matches", "extinguisher", "flashlight",
"radio", "bubblewrap", "coffee_raw", "usb_drive",
@@ -473,7 +473,7 @@ void game::init_mapitems()
setvector(
&mapitems[mi_cubical_office],
"cola", "aspirin", "cigar", "glasses_eye", "sunglasses", "glasses_reading",
"cola", "aspirin", "cigar", "glasses_eye", "sunglasses", "glasses_reading", "glasses_bifocal",
"purse", "mbag", "battery", "mag_news", "manual_business",
"textbook_business", "manual_computers", "textbook_computers", "lighter", "matches", "extinguisher", "flashlight",
"radio", "bubblewrap", "coffee_raw", "usb_drive","rootbeer", "cig", "coat_rain", "poncho",
@@ -490,7 +490,7 @@ void game::init_mapitems()
setvector(
&mapitems[mi_church],
"glasses_eye", "sunglasses", "glasses_reading", "lighter", "matches", "coat_rain", "cane", "candlestick",
"glasses_eye", "sunglasses", "glasses_reading", "glasses_bifocal", "lighter", "matches", "coat_rain", "cane", "candlestick",
"candlestick", "candlestick", "candlestick", NULL);
setvector(
@@ -501,6 +501,11 @@ void game::init_mapitems()
"power_armor_basic",
"minireactor", "alloy_plate", NULL);
setvector(
&mapitems[mi_medieval],
"katana", "mace", "morningstar", "rapier", "broadsword",
"pike", "helmet_plate", "armor_plate", NULL);
setvector(
&mapitems[mi_art],
"fur", "katana", "petrified_eye", "spiral_stone", "rapier",
@@ -526,7 +531,7 @@ void game::init_mapitems()
"broadsword", "morningstar", "helmet_plate", "cot", "rollmat", "tent_kit",
"bat_metal", "lawnmower", "pickelhaube",
"makeshift_machete", "picklocks", "rucksack", "puller", "press",
"vac_sealer", NULL);
"vac_sealer", "gasoline_lantern", NULL);
setvector(
&mapitems[mi_mil_surplus], // NOT food or armor!
@@ -548,7 +553,7 @@ void game::init_mapitems()
"manual_first_aid", "manual_tailor", "manual_carpentry",
"lighter", "matches", "sewing_kit", "thread", "hammer", "extinguisher",
"flashlight", "hotplate", "water_purifier", "radio", "rollmat",
"tent_kit", "canteen", "spray_can", "ax", "heatpack", "blanket", "emer_blanket", "flyer", NULL);
"tent_kit", "canteen", "spray_can", "ax", "heatpack", "blanket", "emer_blanket", "flyer", "gasoline_lantern", NULL);
setvector(
&mapitems[mi_mechanics],
@@ -556,7 +561,7 @@ void game::init_mapitems()
"wheel", "wheel_wide", "wheel_bicycle", "wheel_motorbike", "wheel_small",
"1cyl_combustion", "v2_combustion", "i4_combustion", "v6_combustion",
"vehicle_controls", "v8_combustion", "hacksaw", "welder", "motor",
"goggles_welding", "solar_cell", "bearings",
"goggles_welding", "solar_cell", "bearing",
"motor_large", "storage_battery", "solar_panel", "jerrycan", "jerrycan_big", "metal_tank", "jack", NULL);
setvector(
@@ -771,7 +776,7 @@ void game::init_mapitems()
"jackhammer", "jacqueshammer", "dynamite", "UPS_off",
"bio_tools", "bio_flashlight", "bio_lighter", "bio_magnet",
"bio_resonator", "bio_hydraulics",
"jerrycan", "jerrycan_big", NULL);
"jerrycan", "jerrycan_big", "gasoline_lantern", NULL);
setvector(
@@ -798,7 +803,7 @@ void game::init_mapitems()
"wrapper", "string_6", "chain", "rock", "pipe",
"mag_porn", "bottle_plastic", "bottle_glass", "can_drink",
"can_food", "lighter", "matches", "flashlight", "rag", "crowbar",
"spray_can", "jar_glass", "flyer", NULL);
"spray_can", "jar_glass", "flyer", "gasoline_lanern", NULL);
setvector(
&mapitems[mi_sewer],
+222
View File
@@ -0,0 +1,222 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include "catajson.h"
#include "material.h"
#include "enums.h"
#include "game.h"
material_type::material_type()
{
_id = 0;
_ident = "null";
_name = "null";
_bash_resist = 0;
_cut_resist = 0;
_bash_dmg_verb = "damages";
_cut_dmg_verb = "damages";
_acid_resist = 0;
_elec_resist = 0;
_fire_resist = 0;
}
material_type::material_type(unsigned int id, std::string ident, std::string name,
int bash_resist, int cut_resist,
std::string bash_dmg_verb, std::string cut_dmg_verb,
int acid_resist, int elec_resist, int fire_resist)
{
_id = id;
_ident = ident;
_name = name;
_bash_resist = bash_resist;
_cut_resist = cut_resist;
_bash_dmg_verb = bash_dmg_verb;
_cut_dmg_verb = bash_dmg_verb;
_acid_resist = acid_resist;
_elec_resist = elec_resist;
_fire_resist = fire_resist;
}
material_type::material_type(std::string ident)
{
material_type* mat_type = find_material(ident);
_id = mat_type->id();
_name = mat_type->name();
_bash_resist = mat_type->bash_resist();
_cut_resist = mat_type->cut_resist();
_bash_dmg_verb = mat_type->bash_dmg_verb();
_cut_dmg_verb = mat_type->bash_dmg_verb();
_acid_resist = mat_type->acid_resist();
_elec_resist = mat_type->elec_resist();
_fire_resist = mat_type->fire_resist();
}
material_map material_type::_all_materials(material_type::load_materials());
material_map material_type::load_materials()
{
material_map allMaterials;
catajson materialsRaw("data/raw/materials.json");
unsigned int id = 0;
for (materialsRaw.set_begin(); materialsRaw.has_curr(); materialsRaw.next())
{
++id;
catajson currMaterial = materialsRaw.curr();
std::string ident = currMaterial.get("ident").as_string();
std::string name = currMaterial.get("name").as_string();
int bash_resist = currMaterial.get("bash_resist").as_int();
int cut_resist = currMaterial.get("cut_resist").as_int();
std::string bash_dmg_verb = currMaterial.get("bash_dmg_verb").as_string();
std::string cut_dmg_verb = currMaterial.get("cut_dmg_verb").as_string();
int acid_resist = currMaterial.get("acid_resist").as_int();
int elec_resist = currMaterial.get("elec_resist").as_int();
int fire_resist = currMaterial.get("fire_resist").as_int();
material_type newMaterial(id, ident, name, bash_resist, cut_resist, bash_dmg_verb,
cut_dmg_verb, acid_resist, elec_resist, fire_resist);
allMaterials[ident] = newMaterial;
}
return allMaterials;
}
material_type* material_type::find_material(std::string ident)
{
material_map::iterator found = _all_materials.find(ident);
if(found != _all_materials.end()){
return &(found->second);
}
else
{
debugmsg("Tried to get invalid material: %s", ident.c_str());
return NULL;
}
}
// stopgap function for now
material_type* material_type::find_material_from_tag(material mat)
{
std::string ident;
switch(mat)
{
case MNULL: ident = "null"; break;
case VEGGY: ident = "veggy"; break;
case FLESH: ident = "flesh"; break;
case POWDER: ident = "powder"; break;
case HFLESH: ident = "hflesh"; break;
case COTTON: ident = "cotton"; break;
case WOOL: ident = "wool"; break;
case LEATHER: ident = "leather"; break;
case KEVLAR: ident = "kevlar"; break;
case FUR: ident = "fur"; break;
case CHITIN: ident = "chitin"; break;
case STONE: ident = "stone"; break;
case PAPER: ident = "paper"; break;
case WOOD: ident = "wood"; break;
case PLASTIC: ident = "plastic"; break;
case GLASS: ident = "glass"; break;
case IRON: ident = "iron"; break;
case STEEL: ident = "steel"; break;
case SILVER: ident = "silver"; break;
default: ident = "null"; break;
}
material_map::iterator found = _all_materials.find(ident);
if(found != _all_materials.end()){
return &(found->second);
}
else
{
debugmsg("Tried to get invalid material: %s", ident.c_str());
return NULL;
}
}
material_type* material_type::base_material()
{
return material_type::find_material("null");
}
int material_type::dam_resist(damage_type damtype) const
{
switch (damtype)
{
case BASH:
return _bash_resist;
break;
case CUT:
return _cut_resist;
break;
case ACID:
return _acid_resist;
break;
case ELECTRICITY:
return _elec_resist;
break;
case FIRE:
return _fire_resist;
break;
default:
return 0;
break;
}
}
bool material_type::is_null() const
{
return (_ident == "null");
}
unsigned int material_type::id() const
{
return _id;
}
std::string material_type::ident() const
{
return _ident;
}
std::string material_type::name() const
{
return _name;
}
int material_type::bash_resist() const
{
return _bash_resist;
}
int material_type::cut_resist() const
{
return _cut_resist;
}
std::string material_type::bash_dmg_verb() const
{
return _bash_dmg_verb;
}
std::string material_type::cut_dmg_verb() const
{
return _cut_dmg_verb;
}
int material_type::acid_resist() const
{
return _acid_resist;
}
int material_type::elec_resist() const
{
return _elec_resist;
}
int material_type::fire_resist() const
{
return _fire_resist;
}
+58
View File
@@ -0,0 +1,58 @@
#ifndef _MATERIALS_H_
#define _MATERIALS_H_
#include <string>
#include <map>
#include "enums.h"
class material_type;
typedef std::map<std::string, material_type> material_map;
class material_type
{
private:
unsigned int _id;
std::string _ident;
std::string _name;
int _bash_resist; // negative integers means susceptibility
int _cut_resist;
std::string _bash_dmg_verb;
std::string _cut_dmg_verb;
int _acid_resist;
int _elec_resist;
int _fire_resist;
public:
material_type();
material_type(unsigned int id, std::string ident, std::string name,
int bash_resist, int cut_resist,
std::string bash_dmg_verb, std::string cut_dmg_verb,
int acid_resist, int elec_resist, int fire_resist);
material_type(std::string ident);
static material_map _all_materials;
static material_map load_materials();
// functions
static material_type* find_material(std::string ident);
static material_type* find_material_from_tag(material mat);
static material_type* base_material(); // null material
int dam_resist(damage_type damtype) const;
unsigned int id() const;
bool is_null() const;
std::string ident() const;
std::string name() const;
int bash_resist() const;
int cut_resist() const;
std::string bash_dmg_verb() const;
std::string cut_dmg_verb() const;
int acid_resist() const;
int elec_resist() const;
int fire_resist() const;
};
#endif // _MATERIALS_H_
+23 -22
View File
@@ -40,7 +40,7 @@ bool player::is_armed()
bool player::unarmed_attack()
{
return (weapon.typeId() == "null" || weapon.is_style() ||
weapon.has_flag(IF_UNARMED_WEAPON));
weapon.has_flag("UNARMED_WEAPON"));
}
int player::base_to_hit(bool real_life, int stat)
@@ -90,7 +90,7 @@ int player::hit_roll()
}
// Using a spear?
if (weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB)) {
if (weapon.has_flag("SPEAR") || weapon.has_flag("STAB")) {
int stab_bonus = int(skillLevel("stabbing") / 2);
if (stab_bonus > best_bonus)
best_bonus = stab_bonus;
@@ -107,7 +107,8 @@ int player::hit_roll()
}
// Farsightedness makes us hit worse
if (has_trait(PF_HYPEROPIC) && !is_wearing("glasses_reading")) {
if (has_trait(PF_HYPEROPIC) && !is_wearing("glasses_reading")
&& !is_wearing("glasses_bifocal")) {
numdice -= 2;
}
@@ -153,7 +154,7 @@ int player::hit_mon(game *g, monster *z, bool allow_grab) // defaults to true
}
melee_practice(g->turn, *this, false, unarmed_attack(),
weapon.is_bashing_weapon(), weapon.is_cutting_weapon(),
(weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB)));
(weapon.has_flag("SPEAR") || weapon.has_flag("STAB")));
move_cost += stumble_pen;
if (weapon.has_technique(TEC_FEINT, this))
move_cost = rng(move_cost / 3, move_cost);
@@ -254,7 +255,7 @@ void player::hit_player(game *g, player &p, bool allow_grab)
}
melee_practice(g->turn, *this, false, unarmed_attack(),
weapon.is_bashing_weapon(), weapon.is_cutting_weapon(),
(weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB)));
(weapon.has_flag("SPEAR") || weapon.has_flag("STAB")));
move_cost += stumble_pen;
if (weapon.has_technique(TEC_FEINT, this))
move_cost = rng(move_cost / 3, move_cost);
@@ -424,7 +425,7 @@ bool player::scored_crit(int target_dodge)
best_skill = skillLevel("bashing");
if (weapon.is_cutting_weapon() && skillLevel("cutting") > best_skill)
best_skill = skillLevel("cutting");
if ((weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB)) &&
if ((weapon.has_flag("SPEAR") || weapon.has_flag("STAB")) &&
skillLevel("stabbing") > best_skill)
best_skill = skillLevel("stabbing");
if (unarmed_attack() && skillLevel("unarmed") > best_skill)
@@ -583,7 +584,7 @@ int player::roll_bash_damage(monster *z, bool crit)
int player::roll_cut_damage(monster *z, bool crit)
{
if (weapon.has_flag(IF_SPEAR))
if (weapon.has_flag("SPEAR"))
return 0; // Stabs, doesn't cut!
int z_armor_cut = (z == NULL ? 0 : z->armor_cut() - skillLevel("cutting") / 2);
@@ -592,7 +593,7 @@ int player::roll_cut_damage(monster *z, bool crit)
if (z_armor_cut < 0)
z_armor_cut = 0;
int ret = weapon.damage_cut() - z_armor_cut;
double ret = weapon.damage_cut() - z_armor_cut;
if (unarmed_attack() && !wearing_something_on(bp_hands)) {
if (has_trait(PF_CLAWS))
@@ -608,19 +609,19 @@ int player::roll_cut_damage(monster *z, bool crit)
// 80%, 88%, 96%, 104%, 112%, 116%, 120%, 124%, 128%, 132%
if (skillLevel("cutting") <= 5)
ret *= double( 0.8 + 0.08 * skillLevel("cutting") );
ret *= 0.8 + 0.08 * skillLevel("cutting");
else
ret *= double( 0.92 + 0.04 * skillLevel("cutting") );
ret *= 0.92 + 0.04 * skillLevel("cutting");
if (crit)
ret *= double( 1.0 + double(skillLevel("cutting") / 12) );
ret *= 1.0 + (skillLevel("cutting") / 12.0);
return ret;
}
int player::roll_stab_damage(monster *z, bool crit)
{
int ret = 0;
double ret = 0;
int z_armor = (z == NULL ? 0 : z->armor_cut() - 3 * skillLevel("stabbing"));
if (crit)
@@ -636,7 +637,7 @@ int player::roll_stab_damage(monster *z, bool crit)
ret++;
if (has_trait(PF_THORNS))
ret += 4;
} else if (weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB))
} else if (weapon.has_flag("SPEAR") || weapon.has_flag("STAB"))
ret = int((weapon.damage_cut() - z_armor) / 4);
else
return 0; // Can't stab at all!
@@ -654,7 +655,7 @@ int player::roll_stab_damage(monster *z, bool crit)
return 0; // No negative stabbing!
if (crit) {
int multiplier = double( 1.0 + double(skillLevel("stabbing") / 5) );
double multiplier = 1.0 + (skillLevel("stabbing") / 5.0);
if (multiplier > 2.5)
multiplier = 2.5;
ret *= multiplier;
@@ -719,7 +720,7 @@ technique_id player::pick_technique(game *g, monster *z, player *p,
if (possible.empty()) { // Use non-crits only if any crit-onlies aren't used
if (weapon.has_technique(TEC_DISARM, this) && !z &&
p->weapon.typeId() != "null" && !p->weapon.has_flag(IF_UNARMED_WEAPON) &&
p->weapon.typeId() != "null" && !p->weapon.has_flag("UNARMED_WEAPON") &&
dice( dex_cur + skillLevel("unarmed"), 8) >
dice(p->dex_cur + p->skillLevel("melee"), 10))
possible.push_back(TEC_DISARM);
@@ -918,7 +919,7 @@ technique_id player::pick_defensive_technique(game *g, monster *z, player *p)
if (weapon.has_technique(TEC_DEF_DISARM, this) &&
z == NULL && p->weapon.typeId() != "null" &&
!p->weapon.has_flag(IF_UNARMED_WEAPON) &&
!p->weapon.has_flag("UNARMED_WEAPON") &&
dice( dex_cur + skillLevel("unarmed"), 8) >
dice(p->dex_cur + p->skillLevel("melee"), 10))
return TEC_DEF_DISARM;
@@ -1204,7 +1205,7 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
// Getting your weapon stuck
int cutting_penalty = roll_stuck_penalty(z, stab_dam > cut_dam);
if (weapon.has_flag(IF_MESSY)) { // e.g. chainsaws
if (weapon.has_flag("MESSY")) { // e.g. chainsaws
cutting_penalty /= 6; // Harder to get stuck
for (int x = tarposx - 1; x <= tarposx + 1; x++) {
for (int y = tarposy - 1; y <= tarposy + 1; y++) {
@@ -1223,7 +1224,7 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
g->add_msg("Your %s gets stuck in %s, pulling it out of your hands!",
weapon.tname().c_str(), target.c_str());
if (mon) {
if (weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB))
if (weapon.has_flag("SPEAR") || weapon.has_flag("STAB"))
z->speed *= .7;
else
z->speed *= .85;
@@ -1240,7 +1241,7 @@ void player::melee_special_effects(game *g, monster *z, player *p, bool crit,
if (cutting_penalty >= 50 && is_u)
g->add_msg("Your %s gets stuck in %s, but you yank it free.",
weapon.tname().c_str(), target.c_str());
if (mon && (weapon.has_flag(IF_SPEAR) || weapon.has_flag(IF_STAB)))
if (mon && (weapon.has_flag("SPEAR") || weapon.has_flag("STAB")))
z->speed *= .9;
}
@@ -1485,7 +1486,7 @@ std::string melee_verb(technique_id tech, std::string your, player &p,
// verb should be based on how the weapon is used, and the total damage inflicted
// if it's a stabbing weapon or a spear
if (p.weapon.has_flag(IF_SPEAR) || (p.weapon.has_flag(IF_STAB) && stab_dam > cut_dam))
if (p.weapon.has_flag("SPEAR") || (p.weapon.has_flag("STAB") && stab_dam > cut_dam))
{
if (bash_dam + stab_dam + cut_dam >= 30)
return "impale" + s;
@@ -1548,13 +1549,13 @@ void melee_practice(const calendar& turn, player &u, bool hit, bool unarmed,
}
// type of weapon used determines order of practice
if (u.weapon.has_flag(IF_SPEAR))
if (u.weapon.has_flag("SPEAR"))
{
if (stabbing) first = "stabbing";
if (bashing) second = "bashing";
if (cutting) third = "cutting";
}
else if (u.weapon.has_flag(IF_STAB))
else if (u.weapon.has_flag("STAB"))
{
// stabbity weapons have a 50-50 chance of raising either stabbing or cutting first
if (one_in(2))
+228
View File
@@ -222,6 +222,234 @@ of those things now. Can you put her out of her misery for me?";
return "Really... that's too bad.";
}
break;
//patriot mission 1
case MISSION_GET_FLAG:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "Does our flag still yet wave?";
case TALK_MISSION_OFFER:
return "Does our flag still yet wave? We're battered but not yet out of the\
fight, we need the old colors!";
case TALK_MISSION_ACCEPTED:
return "\
Hell ya! Find me one of those big ol' American flags.";
case TALK_MISSION_REJECTED:
return "Seriously? God damned commie...";
case TALK_MISSION_ADVICE:
return "Find a large federal building or school, they must have one.";
case TALK_MISSION_INQUIRE:
return "Rescued the standard yet?";
case TALK_MISSION_SUCCESS:
return "America, fuck ya!";
case TALK_MISSION_SUCCESS_LIE:
return "What?! You liar!";
case TALK_MISSION_FAILURE:
return "You give up? This country fell apart becuase no one could find a\
good man to rely on... might as well give up, I guess.";
}
break;
//patriot mission 2
case MISSION_GET_BLACK_BOX:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "We've got the flag, now we need to locate US forces.";
case TALK_MISSION_OFFER:
return "We have the flag but now we need to locate US troops to see\
what we can do to help. I haven't seen any but I'm figure'n one of\
those choppers that were fly'n round during th outbreak would have a good\
idea. If you can get me a black box from one of the wrecks I'll look\
into where we might open'er at.";
case TALK_MISSION_ACCEPTED:
return "\
Fuck ya, America!";
case TALK_MISSION_REJECTED:
return "Do you have any better ideas?";
case TALK_MISSION_ADVICE:
return "Survivors were talking about them crashing but I don't know\
where. If I were a pilot I'd avoid crash landing in a city or forest\
though.";
case TALK_MISSION_INQUIRE:
return "How 'bout that black box?";
case TALK_MISSION_SUCCESS:
return "America, fuck ya!";
case TALK_MISSION_SUCCESS_LIE:
return "What?! I out'ta whip you're ass.";
case TALK_MISSION_FAILURE:
return "Damn, I'll have to find'er myself.";
}
break;
//patriot mission 3
case MISSION_GET_BLACK_BOX_TRANSCRIPT:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "With the black box in hand, we need to find a lab.";
case TALK_MISSION_OFFER:
return "Thanks to your searching we've got the black box but now we\
need to have a look'n-side her. Now, most buildings don't have power\
anymore but there are a few that might be of use. Have you ever seen\
one of those science labs that have popped up in the middle of nowhere?\
Them suckers have a glowing terminal out front so I know they have power\
somewhere inside'em. If you can get inside and find a computer lab that\
still works you ought to be able to find out what's in the black box.";
case TALK_MISSION_ACCEPTED:
return "\
Fuck ya, America!";
case TALK_MISSION_REJECTED:
return "Do you have any better ideas?";
case TALK_MISSION_ADVICE:
return "When I was play'n with the terminal for the one I ran into it\
kept asking for an ID card. Finding one would be the first order of business.";
case TALK_MISSION_INQUIRE:
return "How 'bout that black box?";
case TALK_MISSION_SUCCESS:
return "America, fuck ya! I was in the guard a few years back so I'm\
confident I can make heads-or-tails of these transmissions.";
case TALK_MISSION_SUCCESS_LIE:
return "What?! I out'ta whip you're ass.";
case TALK_MISSION_FAILURE:
return "Damn, I maybe we can find an egg-head to crack the terminal.";
}
break;
case MISSION_GET_RELIC:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "St. Michael the archangel defend me in battle...";
case TALK_MISSION_OFFER:
return "As the world seems to abandon the reality that we once knew, it \
becomes plausable that the old superstitions that were cast aside may \
have had some truth to them. Please go and find me a religious relic...\
I doubt it will be of much use but I've got to hope in something.";
case TALK_MISSION_ACCEPTED:
return "\
I wish you the best of luck, may whatever god you please guide your path.";
case TALK_MISSION_REJECTED:
return "Ya, I guess the stress may just be getting to me...";
case TALK_MISSION_ADVICE:
return "I suppose a large church or cathedral may have something.";
case TALK_MISSION_INQUIRE:
return "Any luck?";
case TALK_MISSION_SUCCESS:
return "Thankyou, I need some time alone now...";
case TALK_MISSION_SUCCESS_LIE:
return "What good does this do us?";
case TALK_MISSION_FAILURE:
return "It was a lost cause anyways...";
}
break;
case MISSION_GET_RECORD_WEATHER:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "I wonder if a retreat might exist...";
case TALK_MISSION_OFFER:
return "Everyone who dies gets back up, right? Which means that whatever \
is causing this it must be airborne to have infected everyone. I believe that \
if that is the case then there should be regions that were not downwind from \
where-ever the disease was released. We need to find a record of all the \
weather paterns leading up to the outbreak.";
case TALK_MISSION_ACCEPTED:
return "\
Thanks so much, you may save both of us yet.";
case TALK_MISSION_REJECTED:
return "Ya, it was a long shot I admit.";
case TALK_MISSION_ADVICE:
return "I'm not sure, maybe a news station would have what we are looking?";
case TALK_MISSION_INQUIRE:
return "Any luck?";
case TALK_MISSION_SUCCESS:
return "These look more complicated than I thought, just give me some time.";
case TALK_MISSION_SUCCESS_LIE:
return "This isn't what we need.";
case TALK_MISSION_FAILURE:
return "If only we could find a great valley or something.";
}
break;
//humanitarian mission 1
case MISSION_GET_RECORD_PATIENT:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "I hope I don't see many names I know...";
case TALK_MISSION_OFFER:
return "I've lost so many friends... please find me a patient list from the \
regional hospital or doctor's office. I just want to know who might still be out there.";
case TALK_MISSION_ACCEPTED:
return "\
Thankyou, I suppose it wont change what has already happened but it will bring me closure.";
case TALK_MISSION_REJECTED:
return "Please, I just want to know what happened to everyone.";
case TALK_MISSION_ADVICE:
return "I bet you'll run into a lot of those things in the hospital, please be careful.";
case TALK_MISSION_INQUIRE:
return "Any luck?";
case TALK_MISSION_SUCCESS:
return "Oh dear, I thought Timmy would have made it...";
case TALK_MISSION_SUCCESS_LIE:
return "Thanks for trying... I guess.";
case TALK_MISSION_FAILURE:
return "I bet some of them are still out there...";
}
break;
case MISSION_GET_RECORD_ACCOUNTING:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "Those twisted snakes...";
case TALK_MISSION_OFFER:
return "Our world fell apart because our leaders were as crooked as the conmen that \
paid for their elections. Just find me one of those corporate accounting books and I'll \
show you and the rest of the world just who is at fault.";
case TALK_MISSION_ACCEPTED:
return "\
You'll see, I know I'm right.";
case TALK_MISSION_REJECTED:
return "I know it isn't pressing but the big corporations didn't get a chance to destroy \
the evidence yet.";
case TALK_MISSION_ADVICE:
return "Try a big corporate building of some sort, they're bound to have an accounting department.";
case TALK_MISSION_INQUIRE:
return "Any luck?";
case TALK_MISSION_SUCCESS:
return "Great, let's see... uh... hmmm... Fine, I didn't even do my own taxes but I'm sure this \
will prove their guilt if we get an expert to examine it.";
case TALK_MISSION_SUCCESS_LIE:
return "Thanks for trying... I guess.";
case TALK_MISSION_FAILURE:
return "The day of reconing will come for the corporations if it hasn't already.";
}
break;
case MISSION_KILL_JABBERWOCK:
switch (state) {
case TALK_MISSION_DESCRIBE:
return "The eater of the dead... something was ripping zombies to shreads and only leaving a few scattered limbs...";
case TALK_MISSION_OFFER:
return "A few days ago another survivor and I were trying to avoid the cities by staying in the woods \
during the day and foraging for gear at night. It worked well against the normal zed's but one night something \
caught onto our trail and chased us for ten minutes or so until we decided to split up and meet-up back here. My \
buddy never showed up and I don't have the means to kill whatever it was. Can you lend a hand?";
case TALK_MISSION_ACCEPTED:
return "\
Thanks, make sure you're ready for whatever the beast is.";
case TALK_MISSION_REJECTED:
return "Hey, I know I wouldn't volunteer for it either.";
case TALK_MISSION_ADVICE:
return "I'd carry a shotgun at least, it sounded pretty big.";
case TALK_MISSION_INQUIRE:
return "Any luck?";
case TALK_MISSION_SUCCESS:
return "You look a little shaken up, I can't tell you how glad I am that you killed it though.";
case TALK_MISSION_SUCCESS_LIE:
return "Something in the shadows still seems to stare at me when I look at the woods.";
case TALK_MISSION_FAILURE:
return "I'm glad you came back alive... I wasn't sure if I had sent you to your death.";
}
break;
default:
switch (state) {
case TALK_MISSION_DESCRIBE:
+11
View File
@@ -19,6 +19,14 @@ enum mission_id {
MISSION_RESCUE_DOG,
MISSION_KILL_ZOMBIE_MOM,
MISSION_REACH_SAFETY,
MISSION_GET_FLAG,//patriot mission 1
MISSION_GET_BLACK_BOX,//patriot mission 2
MISSION_GET_BLACK_BOX_TRANSCRIPT,//patriot mission 3
MISSION_GET_RELIC,
MISSION_GET_RECORD_WEATHER,
MISSION_GET_RECORD_PATIENT,
MISSION_GET_RECORD_ACCOUNTING,
MISSION_KILL_JABBERWOCK,
NUM_MISSION_IDS
};
@@ -42,6 +50,7 @@ enum mission_goal {
MGOAL_FIND_NPC, // Find a given NPC
MGOAL_ASSASSINATE, // Kill a given NPC
MGOAL_KILL_MONSTER, // Kill a particular hostile monster
NUM_MGOAL
};
@@ -62,7 +71,9 @@ struct mission_start {
void infect_npc (game *, mission *); // DI_INFECTION, remove antibiotics
void place_dog (game *, mission *); // Put a dog in a house!
void place_zombie_mom (game *, mission *); // Put a zombie mom in a house!
void place_jabberwock (game *, mission *); // Put a jabberwok in the woods nearby
void place_npc_software(game *, mission *); // Put NPC-type-dependent software
void reveal_lab_black_box (game *, mission *); // Reveal the nearest lab and give black box
void reveal_hospital (game *, mission *); // Reveal the nearest hospital
void find_safety (game *, mission *); // Goal is set to non-spawn area
void place_book (game *, mission *); // Place a book to retrieve
+33
View File
@@ -67,6 +67,22 @@ void mission_start::place_zombie_mom(game *g, mission *miss)
zomhouse.save(g->cur_om, int(g->turn), house.x * 2, house.y * 2, 0);
}
void mission_start::place_jabberwock(game *g, mission *miss)
{
int dist = 0;
point site = g->cur_om->find_closest(g->om_location(), ot_forest_thick, 1, dist, false);
miss->target = site;
// Make it seen on our map
for (int x = site.x - 6; x <= site.x + 6; x++) {
for (int y = site.y - 6; y <= site.y + 6; y++)
g->cur_om->seen(x, y, 0) = true;
}
tinymap grove(&(g->itypes), &(g->mapitems), &(g->traps));
grove.load(g, site.x * 2, site.y * 2, 0, false);
grove.add_spawn(mon_jabberwock, 1, SEEX, SEEY, false, -1, miss->uid, "NONE");
grove.save(g->cur_om, int(g->turn), site.x * 2, site.y * 2, 0);
}
void mission_start::place_npc_software(game *g, mission *miss)
{
npc* dev = g->find_npc(miss->npc_id);
@@ -195,6 +211,23 @@ void mission_start::place_npc_software(game *g, mission *miss)
compmap.save(g->cur_om, int(g->turn), place.x * 2, place.y * 2, 0);
}
void mission_start::reveal_lab_black_box(game *g, mission *miss)
{
npc* dev = g->find_npc(miss->npc_id);
if (dev != NULL) {
g->u.i_add( item(g->itypes["black_box"], 0) );
g->add_msg("%s gave you back the black box.", dev->name.c_str());
}
int dist = 0;
point place = g->cur_om->find_closest(g->om_location(), ot_lab, 1, dist,
false);
for (int x = place.x - 3; x <= place.x + 3; x++) {
for (int y = place.y - 3; y <= place.y + 3; y++)
g->cur_om->seen(x, y, 0) = true;
}
miss->target = place;
}
void mission_start::reveal_hospital(game *g, mission *miss)
{
npc* dev = g->find_npc(miss->npc_id);
+53 -1
View File
@@ -10,7 +10,7 @@ mission_type(id, name, goal, diff, val, urgent, place, start, end, fail) )
#define ORIGINS(...) setvector(&mission_types[id].origins, __VA_ARGS__, NULL)
#define ITEM(itid) mission_types[id].item_id = itid
#define FOLLOWUP(next_up) mission_types[id].follow_up = next_up
// DEADLINE defines the low and high end time limits, in hours
// Omitting DEADLINE means the mission never times out
#define DEADLINE(low, high) mission_types[id].deadline_low = low * 600;\
@@ -58,6 +58,58 @@ mission_type(id, name, goal, diff, val, urgent, place, start, end, fail) )
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_NULL);
//patriot mission 1
MISSION("Find Flag", MGOAL_FIND_ITEM, 2, 1000, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_OPENER_NPC, ORIGIN_ANY_NPC);
FOLLOWUP(MISSION_GET_BLACK_BOX);
ITEM("american_flag");
//patriot mission 2
MISSION("Retrieve Military Black Box", MGOAL_FIND_ITEM, 2, 1000, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_SECONDARY);
FOLLOWUP(MISSION_GET_BLACK_BOX_TRANSCRIPT);
ITEM("black_box");
//patriot mission 3
MISSION("Retrieve Black Box Transcript", MGOAL_FIND_ITEM, 2, 1500, false,
&mission_place::always, &mission_start::reveal_lab_black_box,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_SECONDARY);
ITEM("black_box_transcript");
MISSION("Find Relic", MGOAL_FIND_ITEM, 2, 1000, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_ANY_NPC);
ITEM("small_relic");
MISSION("Find Weather Log", MGOAL_FIND_ITEM, 2, 500, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_OPENER_NPC, ORIGIN_ANY_NPC);
ITEM("record_weather");
MISSION("Find Patient Records", MGOAL_FIND_ITEM, 2, 1000, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_OPENER_NPC, ORIGIN_ANY_NPC);
ITEM("record_patient");
MISSION("Find Corporate Accounts", MGOAL_FIND_ITEM, 2, 1400, false,
&mission_place::always, &mission_start::standard,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_OPENER_NPC, ORIGIN_ANY_NPC);
ITEM("record_accounting");
MISSION("Kill Jabberwock", MGOAL_KILL_MONSTER, 5, 2500, true,
&mission_place::always, &mission_start::place_jabberwock,
&mission_end::standard, &mission_fail::standard);
ORIGINS(ORIGIN_OPENER_NPC, ORIGIN_ANY_NPC);
MISSION("Find a Book", MGOAL_FIND_ANY_ITEM, 2, 800, false,
&mission_place::always, &mission_start::place_book,
&mission_end::standard, &mission_fail::standard);
+69 -7
View File
@@ -226,13 +226,8 @@ void mattack::resurrect(game *g, monster *z)
if (g->m.i_at(x, y)[n].type->id == "corpse" && one_in(2)) {
if (g->u_see(x, y))
raised++;
int burnt_penalty = g->m.i_at(x, y)[n].burnt;
monster mon(g->m.i_at(x, y)[n].corpse, x, y);
mon.speed = int(mon.speed * .8) - burnt_penalty / 2;
mon.hp = int(mon.hp * .7) - burnt_penalty;
g->m.i_rem(x, y, n);
g->revive_corpse(x, y, n);
n = g->m.i_at(x, y).size(); // Only one body raised per tile
g->z.push_back(mon);
}
}
}
@@ -1433,7 +1428,7 @@ void mattack::bite(game *g, monster *z)
}
body_part hit = random_body_part();
int dam = rng(5, 10), side = rng(0, 1);
g->add_msg("Your %s is bitten for %d damage!", body_part_name(hit, side).c_str(), dam);
g->add_msg("Your %s is bitten!", body_part_name(hit, side).c_str());
g->u.hit(g, hit, side, dam, 0);
if(one_in(10))
{
@@ -1442,3 +1437,70 @@ void mattack::bite(game *g, monster *z)
g->u.practice(g->turn, "dodge", z->type->melee_skill);
}
void mattack::flesh_golem(game *g, monster *z)
{
if (rl_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 1)
{
if (one_in(12)){
int j;
if (rl_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 20 ||
!g->sees_u(z->posx, z->posy, j))
return; // Out of range
z->moves = -200;
z->sp_timeout = z->type->sp_freq; // Reset timer
g->sound(z->posx, z->posy, 80, "a terrifying roar that nearly deafens you!");
}
return;
}
z->sp_timeout = z->type->sp_freq; // Reset timer
g->add_msg("The %s swings a massive claw at you!", z->name().c_str());
z->moves -= 100;
// Can we dodge the attack? Uses player dodge function % chance (melee.cpp)
int dodge_check = std::max(g->u.dodge(g) - rng(0, z->type->melee_skill), 0L);
if (rng(0, 10000) < 10000 / (1 + (99 * exp(-.6 * dodge_check))))
{
g->add_msg("You dodge it!");
g->u.practice(g->turn, "dodge", z->type->melee_skill*2);
return;
}
body_part hit = random_body_part();
int dam = rng(5, 10), side = rng(0, 1);
g->add_msg("Your %s is battered for %d damage!", body_part_name(hit, side).c_str(), dam);
g->u.hit(g, hit, side, dam, 0);
if(one_in(6))
{
g->u.add_disease(DI_DOWNED, 30, g);
}
g->u.practice(g->turn, "dodge", z->type->melee_skill);
}
void mattack::parrot(game *g, monster *z)
{
if (rl_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 50)
return; // Out of range
if (one_in(20)){
z->moves = -100; // It takes a while
z->sp_timeout = z->type->sp_freq; // Reset timer
switch (rng(1,18)) {
case 1: g->sound(z->posx, z->posy, 60, "a woman cry out!"); break;
case 2: g->sound(z->posx, z->posy, 40, "a small girl crying..."); break;
case 3: g->sound(z->posx, z->posy, 20, "'This creature has some form of higher level brain function.'"); break;
case 4: g->sound(z->posx, z->posy, 40, "'Shall we terminate the specimen if power is lost?'"); break;
case 5: g->sound(z->posx, z->posy, 40, "a small girl pleading, 'Mommy, help!'"); break;
case 6: g->sound(z->posx, z->posy, 40, "a child, 'Oh God, my leg! Give it back!'"); break;
case 7: g->sound(z->posx, z->posy, 40, "'Destroy the specimen if it begins to interact with the lock.'"); break;
case 8: g->sound(z->posx, z->posy, 40, "a woman yell, 'I hope you rot in hell for this!'"); break;
case 9: g->sound(z->posx, z->posy, 40, "'Kill them all and let God sort them out!'"); break;
case 10: g->sound(z->posx, z->posy, 40, "'I'm gonna cut your damned limbs off and let you blead out!'"); break;
case 11: g->sound(z->posx, z->posy, 40, "'I wonder if you understand what I'm saying.'"); break;
case 12: g->sound(z->posx, z->posy, 40, "'I believe that it is trying to learn our language.'"); break;
case 13: g->sound(z->posx, z->posy, 40, "'It seems to want to experiment on us... give it a prisoner.'"); break;
case 14: g->sound(z->posx, z->posy, 40, "'It is interested in observing the brain of a living human.'"); break;
case 15: g->sound(z->posx, z->posy, 40, "'Would it react differently with a child?'"); break;
case 16: g->sound(z->posx, z->posy, 40, "'It seems to want to experiment on us... give it a prisoner.'"); break;
case 17: g->sound(z->posx, z->posy, 40, "'Although advanced, its ethics are not our own.'"); break;
case 18: g->sound(z->posx, z->posy, 40, "'It shows no empathy towards the prisoners we... 'gave' it.'"); break;
}
}
}
+2
View File
@@ -46,6 +46,8 @@ class mattack
void upgrade (game *g, monster *z);
void breathe (game *g, monster *z);
void bite (game *g, monster *z);
void flesh_golem (game *g, monster *z);
void parrot (game *g, monster *z);
};
#endif
+6
View File
@@ -318,6 +318,12 @@ void mdeath::zombie(game *g, monster *z)
{
// normal death function first
mdeath::normal(g, z);
// skip clothing generation if the zombie was rezzed rather than spawned
if (z->no_extra_death_drops)
{
return;
}
// now generate appropriate clothing
switch(z->type->id)
+4
View File
@@ -5,6 +5,9 @@
#include "picojson.h"
#include "options.h"
// Default start time, this is the only place it's still used.
#define STARTING_MINUTES 480
//Adding a group:
// 1: Declare it in the MonsterGroupDefs enum in mongroup.h
// 2: Define it in here with the macro Group(your group, default monster)
@@ -225,6 +228,7 @@ void init_translation()
monStr2monId["mon_sewer_fish"] = mon_sewer_fish; monStr2monId["mon_sewer_snake"] = mon_sewer_snake; monStr2monId["mon_sewer_rat"] = mon_sewer_rat; monStr2monId["mon_rat_king"] = mon_rat_king;
monStr2monId["mon_mosquito"] = mon_mosquito; monStr2monId["mon_dragonfly"] = mon_dragonfly; monStr2monId["mon_centipede"] = mon_centipede; monStr2monId["mon_frog"] = mon_frog; monStr2monId["mon_slug"] = mon_slug;
monStr2monId["mon_dermatik_larva"] = mon_dermatik_larva; monStr2monId["mon_dermatik"] = mon_dermatik;
monStr2monId["mon_jabberwock"] = mon_jabberwock;
monStr2monId["mon_spider_wolf"] = mon_spider_wolf; monStr2monId["mon_spider_web"] = mon_spider_web; monStr2monId["mon_spider_jumping"] = mon_spider_jumping; monStr2monId["mon_spider_trapdoor"] = mon_spider_trapdoor;
monStr2monId["mon_spider_widow"] = mon_spider_widow;
monStr2monId["mon_dark_wyrm"] = mon_dark_wyrm; monStr2monId["mon_amigara_horror"] = mon_amigara_horror; monStr2monId["mon_dog_thing"] = mon_dog_thing; monStr2monId["mon_headless_dog_thing"] = mon_headless_dog_thing;
+57 -37
View File
@@ -32,6 +32,7 @@ monster::monster()
morale = 2;
faction_id = -1;
mission_id = -1;
no_extra_death_drops = false;
dead = false;
made_footstep = false;
unique_name = "";
@@ -58,6 +59,7 @@ monster::monster(mtype *t)
morale = t->morale;
faction_id = -1;
mission_id = -1;
no_extra_death_drops = false;
dead = false;
made_footstep = false;
unique_name = "";
@@ -84,6 +86,7 @@ monster::monster(mtype *t, int x, int y)
morale = type->morale;
faction_id = -1;
mission_id = -1;
no_extra_death_drops = false;
dead = false;
made_footstep = false;
unique_name = "";
@@ -279,7 +282,7 @@ void monster::load_info(std::string data, std::vector <mtype*> *mtypes)
dump << data;
dump >> idtmp >> posx >> posy >> wandx >> wandy >> wandf >> moves >> speed >>
hp >> sp_timeout >> plansize >> friendly >> faction_id >> mission_id >>
dead >> anger >> morale;
no_extra_death_drops >> dead >> anger >> morale;
type = (*mtypes)[idtmp];
point ptmp;
for (int i = 0; i < plansize; i++) {
@@ -294,7 +297,7 @@ std::string monster::save_info()
pack << int(type->id) << " " << posx << " " << posy << " " << wandx << " " <<
wandy << " " << wandf << " " << moves << " " << speed << " " << hp <<
" " << sp_timeout << " " << plans.size() << " " << friendly << " " <<
faction_id << " " << mission_id << " " << dead << " " << anger <<
faction_id << " " << mission_id << " " << no_extra_death_drops << " " << dead << " " << anger <<
" " << morale;
for (int i = 0; i < plans.size(); i++) {
pack << " " << plans[i].x << " " << plans[i].y;
@@ -624,41 +627,9 @@ void monster::die(game *g)
{
if (!dead)
dead = true;
// Drop goodies
int total_chance = 0, total_it_chance, cur_chance, selected_location,
selected_item;
bool animal_done = false;
std::vector<items_location_and_chance> it = g->monitems[type->id];
std::vector<itype_id> mapit;
if (type->item_chance != 0 && it.size() == 0)
debugmsg("Type %s has item_chance %d but no items assigned!",
type->name.c_str(), type->item_chance);
else {
for (int i = 0; i < it.size(); i++)
total_chance += it[i].chance;
while (rng(0, 99) < abs(type->item_chance) && !animal_done) {
cur_chance = rng(1, total_chance);
selected_location = -1;
while (cur_chance > 0) {
selected_location++;
cur_chance -= it[selected_location].chance;
}
total_it_chance = 0;
mapit = g->mapitems[it[selected_location].loc];
for (int i = 0; i < mapit.size(); i++)
total_it_chance += g->itypes[mapit[i]]->rarity;
cur_chance = rng(1, total_it_chance);
selected_item = -1;
while (cur_chance > 0) {
selected_item++;
cur_chance -= g->itypes[mapit[selected_item]]->rarity;
}
g->m.spawn_item(posx, posy, g->itypes[mapit[selected_item]], 0);
if (type->item_chance < 0)
animal_done = true; // Only drop ONE item.
}
} // Done dropping items
if (!no_extra_death_drops) {
drop_items_on_death(g);
}
// If we're a queen, make nearby groups of our type start to die out
if (has_flag(MF_QUEEN)) {
@@ -708,6 +679,55 @@ void monster::die(game *g)
}
}
void monster::drop_items_on_death(game *g)
{
int total_chance = 0, total_it_chance, cur_chance, selected_location,
selected_item;
bool animal_done = false;
std::vector<items_location_and_chance> it = g->monitems[type->id];
std::vector<itype_id> mapit;
if (type->item_chance != 0 && it.size() == 0)
{
debugmsg("Type %s has item_chance %d but no items assigned!",
type->name.c_str(), type->item_chance);
return;
}
for (int i = 0; i < it.size(); i++)
{
total_chance += it[i].chance;
}
while (rng(0, 99) < abs(type->item_chance) && !animal_done)
{
cur_chance = rng(1, total_chance);
selected_location = -1;
while (cur_chance > 0)
{
selected_location++;
cur_chance -= it[selected_location].chance;
}
total_it_chance = 0;
mapit = g->mapitems[it[selected_location].loc];
for (int i = 0; i < mapit.size(); i++)
{
total_it_chance += g->itypes[mapit[i]]->rarity;
}
cur_chance = rng(1, total_it_chance);
selected_item = -1;
while (cur_chance > 0)
{
selected_item++;
cur_chance -= g->itypes[mapit[selected_item]]->rarity;
}
g->m.spawn_item(posx, posy, g->itypes[mapit[selected_item]], 0);
if (type->item_chance < 0)
{
animal_done = true; // Only drop ONE item.
}
}
}
void monster::add_effect(monster_effect_type effect, int duration)
{
for (int i = 0; i < effects.size(); i++) {
+2
View File
@@ -113,6 +113,7 @@ class monster {
int dodge_roll(); // For the purposes of comparing to player::hit_roll()
int fall_damage(); // How much a fall hurts us
void die(game *g);
void drop_items_on_death(game *g);
// Other
void add_effect(monster_effect_type effect, int duration);
@@ -143,6 +144,7 @@ class monster {
int faction_id; // If we belong to a faction
int mission_id; // If we're related to a mission
mtype *type;
bool no_extra_death_drops; // if true, don't spawn loot items as part of death
bool dead;
bool made_footstep;
std::string unique_name; // If we're unique
+7 -5
View File
@@ -72,6 +72,7 @@
<ClCompile Include="..\basecamp.cpp" />
<ClCompile Include="..\bionics.cpp" />
<ClCompile Include="..\bodypart.cpp" />
<ClCompile Include="..\building_generation.cpp" />
<ClCompile Include="..\calendar.cpp" />
<ClCompile Include="..\catacurse.cpp" />
<ClCompile Include="..\catajson.cpp" />
@@ -97,9 +98,7 @@
<ClCompile Include="..\item.cpp" />
<ClCompile Include="..\item_factory.cpp" />
<ClCompile Include="..\item_group.cpp" />
<ClCompile Include="..\itypedef.cpp">
<Optimization>Disabled</Optimization>
</ClCompile>
<ClCompile Include="..\itypedef.cpp" />
<ClCompile Include="..\iuse.cpp" />
<ClCompile Include="..\keypress.cpp" />
<ClCompile Include="..\lightmap.cpp" />
@@ -112,6 +111,7 @@
<ClCompile Include="..\mapgen.cpp" />
<ClCompile Include="..\mapgenformat.cpp" />
<ClCompile Include="..\mapitemsdef.cpp" />
<ClCompile Include="..\material.cpp" />
<ClCompile Include="..\melee.cpp" />
<ClCompile Include="..\mission.cpp" />
<ClCompile Include="..\missiondef.cpp" />
@@ -166,6 +166,7 @@
<ClInclude Include="..\basecamp.h" />
<ClInclude Include="..\bionics.h" />
<ClInclude Include="..\bodypart.h" />
<ClInclude Include="..\building_generation.h" />
<ClInclude Include="..\calendar.h" />
<ClInclude Include="..\catacurse.h" />
<ClInclude Include="..\catajson.h" />
@@ -201,6 +202,7 @@
<ClInclude Include="..\mapdata.h" />
<ClInclude Include="..\mapgenformat.h" />
<ClInclude Include="..\mapitems.h" />
<ClInclude Include="..\material.h" />
<ClInclude Include="..\mission.h" />
<ClInclude Include="..\monattack.h" />
<ClInclude Include="..\mondeath.h" />
@@ -216,7 +218,7 @@
<ClInclude Include="..\options.h" />
<ClInclude Include="..\output.h" />
<ClInclude Include="..\overmap.h" />
<ClCompile Include="..\overmapbuffer.h" />
<ClInclude Include="..\overmapbuffer.h" />
<ClInclude Include="..\picojson.h" />
<ClInclude Include="..\player.h" />
<ClInclude Include="..\pldata.h" />
@@ -233,8 +235,8 @@
<ClInclude Include="..\vehicle.h" />
<ClInclude Include="..\veh_interact.h" />
<ClInclude Include="..\veh_type.h" />
<ClInclude Include="..\wdirent.h" />
<ClInclude Include="..\weather.h" />
<ClInclude Include="..\weather_data.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\resource.rc" />
+26 -2
View File
@@ -33,6 +33,9 @@
<ClCompile Include="..\bodypart.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\building_generation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\calendar.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -147,6 +150,9 @@
<ClCompile Include="..\mapitemsdef.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\material.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\melee.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -219,6 +225,9 @@
<ClCompile Include="..\overmap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\overmapbuffer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\player.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -243,6 +252,9 @@
<ClCompile Include="..\skill.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\text_snippets.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\tileray.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -299,6 +311,9 @@
<ClInclude Include="..\bodypart.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\building_generation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\calendar.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -404,6 +419,9 @@
<ClInclude Include="..\mapitems.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\material.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\mission.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -449,6 +467,9 @@
<ClInclude Include="..\overmap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\overmapbuffer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\picojson.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -476,6 +497,9 @@
<ClInclude Include="..\skill.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\text_snippets.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\tileray.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -494,10 +518,10 @@
<ClInclude Include="..\vehicle.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\weather.h">
<ClInclude Include="..\wdirent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\weather_data.h">
<ClInclude Include="..\weather.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
+2
View File
@@ -46,6 +46,8 @@ mon_graboid, mon_worm, mon_halfworm,
mon_boomer, mon_boomer_fungus, mon_skeleton, mon_zombie_necro,
mon_zombie_scientist, mon_zombie_soldier, mon_zombie_grabber,
mon_zombie_master, mon_beekeeper, mon_zombie_child,
// Flesh Golem
mon_jabberwock,
// Triffids
mon_triffid, mon_triffid_young, mon_triffid_queen, mon_creeper_hub,
mon_creeper_vine, mon_biollante, mon_vinebeast, mon_triffid_heart,
+13 -2
View File
@@ -483,6 +483,18 @@ FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_WARM, MF_BASHES, MF_BLEED,
MF_POISON, MF_GUILT, MF_NO_BREATHE, MF_VIS30);
CATEGORIES(MC_CLASSIC);
//Somewhere between a zombie and a blob creature
mon("jabberwock", species_none, 'J', c_dkgray_red, MS_HUGE, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
50,100,100,140, 9, 4, 8, 3, 3, 12, 8, 0,400, 0,
&mdeath::normal, &mattack::flesh_golem, "\
An amalgamation of putrid human and animal\n\
parts that have become fused in this golem\n\
of flesh. The eyes of all the heads dart\n\
rapidly and the mouths scream or groan."
);
FLAGS(MF_SEES, MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_WARM, MF_BASHES,
MF_DESTROYS, MF_ATTACKMON, MF_LEATHER, MF_BONES, MF_VIS50);
// PLANTS & FUNGI
mon("triffid", species_plant, 'F', c_ltgreen, MS_MEDIUM, VEGGY,
@@ -800,7 +812,6 @@ place of a sting."
);
FLAGS(MF_HEARS, MF_SMELLS, MF_STUMBLES, MF_POISON, MF_FLIES);
// SPIDERS
mon("wolf spider",species_insect, 's', c_brown, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
@@ -961,7 +972,7 @@ FLAGS(MF_SEES, MF_SMELLS, MF_HEARS, MF_NOHEAD, MF_HARDTOSHOOT, MF_FLIES,
mon("Mi-go", species_nether, 'H', c_pink, MS_MEDIUM, FLESH,
// dif agr mor spd msk mdi m## cut dge bsh cut itm HP special freq
26, 20, 30,120, 14, 5, 3, 10, 7, 4, 12, 0,110, 0,
&mdeath::normal, &mattack::none, "\
&mdeath::normal, &mattack::parrot, "\
A pinkish, fungoid crustacean-like\n\
creature with numerous pairs of clawed\n\
appendages and a head covered with waving\n\
+13 -14
View File
@@ -347,6 +347,19 @@ void game::init_mutations()
MUTATION(PF_PER_UP_4);
PREREQS (PF_PER_UP_3);
MUTATION(PF_BEAUTIFUL);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_PRETTY);
CHANGES_TO (PF_BEAUTIFUL2);
MUTATION(PF_BEAUTIFUL2);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_BEAUTIFUL);
CHANGES_TO (PF_BEAUTIFUL3);
MUTATION(PF_BEAUTIFUL3);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_BEAUTIFUL2);
// Bad mutations below this point
@@ -382,20 +395,6 @@ void game::init_mutations()
CANCELS (PF_PRETTY, PF_BEAUTIFUL, PF_BEAUTIFUL2, PF_BEAUTIFUL3);
PREREQS (PF_DEFORMED2);
MUTATION(PF_BEAUTIFUL);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_PRETTY);
CHANGES_TO (PF_BEAUTIFUL2);
MUTATION(PF_BEAUTIFUL2);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_BEAUTIFUL);
CHANGES_TO (PF_BEAUTIFUL3);
MUTATION(PF_BEAUTIFUL3);
CANCELS (PF_UGLY, PF_DEFORMED, PF_DEFORMED2, PF_DEFORMED3);
PREREQS (PF_BEAUTIFUL2);
MUTATION(PF_HOLLOW_BONES);
PREREQS (PF_LIGHT_BONES);
+20 -25
View File
@@ -199,19 +199,9 @@ bool player::create(game *g, character_type type, std::string tempname)
first_bio = g->random_good_bionic();
} while (bionics[first_bio]->power_cost > 10);
add_bionic(first_bio);
if (bionics[my_bionics[0].id]->power_cost > 0) {
add_bionic(bionic_id(power_source_bionics[rng(0,power_source_bionics.size()-1)])); // Power Source
max_power_level = 10;
power_level = 10;
} else {
bionic_id tmpbio;
do
tmpbio = bionic_id(unpowered_bionics[rng(0, unpowered_bionics.size()-1)]);
while (bionics[tmpbio]->power_cost > 0);
add_bionic(tmpbio);
max_power_level = 0;
power_level = 0;
}
add_bionic(bionic_id(power_source_bionics[rng(0,power_source_bionics.size()-1)])); // Power Source
max_power_level = 10;
power_level = 10;
}
if (has_trait(PF_MARTIAL_ARTS)) {
@@ -246,8 +236,8 @@ bool player::create(game *g, character_type type, std::string tempname)
for (std::vector<std::string>::const_iterator iter = prof_items.begin(); iter != prof_items.end(); ++iter) {
item tmp = item(item_controller->find_template(*iter), 0, 'a' + worn.size());
if (tmp.is_armor()) {
if (tmp.has_flag(IF_VARSIZE))
tmp.item_flags |= mfb(IF_FIT);
if (tmp.has_flag("VARSIZE"))
tmp.item_tags.insert("FIT");
worn.push_back(tmp);
} else {
inv.push_back(tmp);
@@ -261,15 +251,22 @@ bool player::create(game *g, character_type type, std::string tempname)
}
// The near-sighted get to start with glasses.
if (has_trait(PF_MYOPIC)) {
if (has_trait(PF_MYOPIC) && !has_trait(PF_HYPEROPIC)) {
tmp = item(g->itypes["glasses_eye"], 0, 'a' + worn.size());
worn.push_back(tmp);
}
// And the far-sighted get to start with reading glasses.
if (has_trait(PF_HYPEROPIC)) {
if (has_trait(PF_HYPEROPIC) && !has_trait(PF_MYOPIC)) {
tmp = item(g->itypes["glasses_reading"], 0, 'a' + worn.size());
worn.push_back(tmp);
}
if (has_trait(PF_HYPEROPIC) && has_trait(PF_MYOPIC))
{
tmp = item(g->itypes["glasses_bifocal"], 0, 'a' + worn.size());
worn.push_back(tmp);
}
// Likewise, the asthmatic start with their medication.
if (has_trait(PF_ASTHMA)) {
tmp = item(g->itypes["inhaler"], 0, 'a' + worn.size());
@@ -391,15 +388,13 @@ int set_stats(WINDOW* w, game* g, player *u, int &points)
mvwprintz(w, 8, 2, COL_STAT_ACT, "Intelligence: %d ", u->int_max);
mvwprintz(w, 9, 2, c_ltgray, "Perception: %d ", u->per_max);
mvwprintz(w, 6, 33, COL_STAT_ACT, "Skill comprehension: %d%%%% ",
u->skillLevel("melee").comprehension(u->int_max));
mvwprintz(w, 7, 33, COL_STAT_ACT, "Read times: %d%%%% ",
mvwprintz(w, 6, 33, COL_STAT_ACT, "Read times: %d%%%% ",
u->read_speed(false));
mvwprintz(w, 8, 33, COL_STAT_ACT, " ");
mvwprintz(w, 9, 33, COL_STAT_ACT, "Intelligence is also used when crafting, ");
mvwprintz(w,10, 33, COL_STAT_ACT, "installing bionics, and interacting with ");
mvwprintz(w,11, 33, COL_STAT_ACT, "NPCs. ");
mvwprintz(w,12, 33, COL_STAT_ACT, " ");
mvwprintz(w, 7, 33, COL_STAT_ACT, " ");
mvwprintz(w, 8, 33, COL_STAT_ACT, "Intelligence is also used when crafting, ");
mvwprintz(w, 9, 33, COL_STAT_ACT, "installing bionics, and interacting with ");
mvwprintz(w,10, 33, COL_STAT_ACT, "NPCs. ");
mvwprintz(w,11, 33, COL_STAT_ACT, " ");
break;
case 4:
+114 -84
View File
@@ -50,8 +50,10 @@ npc::npc()
mission = NPC_MISSION_NULL;
myclass = NC_NONE;
patience = 0;
for (int i = 0; i < num_skill_types; i++)
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin();
aSkill != Skill::skills.end(); ++aSkill) {
set_skill_level(*aSkill, 0);
}
setID(-1);
}
@@ -128,8 +130,7 @@ npc& npc::operator= (const npc & rhs)
hp_max[i] = rhs.hp_max[i];
}
for (int i = 0; i < num_skill_types; i++)
sklevel[i] = rhs.sklevel[i];
copy_skill_levels(&rhs);
styles.clear();
for (int i = 0; i < rhs.styles.size(); i++)
@@ -155,8 +156,11 @@ std::string npc::save_info()
dump << my_traits[i] << " ";
for (int i = 0; i < num_hp_parts; i++)
dump << hp_cur[i] << " " << hp_max[i] << " ";
for (int i = 0; i < num_skill_types; i++)
dump << int(sklevel[i]) << " " << skexercise[i] << " ";
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
SkillLevel level = skillLevel(*aSkill);
dump << level;
}
dump << styles.size() << " ";
for (int i = 0; i < styles.size(); i++)
@@ -242,8 +246,9 @@ void npc::load_info(game *g, std::string data)
for (int i = 0; i < num_hp_parts; i++)
dump >> hp_cur[i] >> hp_max[i];
for (int i = 0; i < num_skill_types; i++)
dump >> sklevel[i] >> skexercise[i];
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
dump >> skillLevel(*aSkill);
}
itype_id tmpstyle;
int numstyle;
@@ -329,21 +334,27 @@ void npc::randomize(game *g, npc_class type)
myclass = type;
switch (type) { // Type of character
case NC_NONE: // Untyped; no particular specialization
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(4, 2) - rng(1, 4);
if (!one_in(3))
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = 0;
if (one_in(3))
{
level = dice(4, 2) - rng(1, 4);
}
set_skill_level(*aSkill, level);
}
break;
case NC_HACKER:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(2, 2) - rng(1, 2);
if (!one_in(3))
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = 0;
if (one_in(3))
{
level = dice(2, 2) - rng(1, 2);
}
set_skill_level(*aSkill, level);
}
sklevel[sk_electronics] += rng(1, 4);
sklevel[sk_computer] += rng(3, 6);
boost_skill_level(sk_electronics, rng(1, 4));
boost_skill_level(sk_computer, rng(3, 6));
str_max -= rng(0, 4);
dex_max -= rng(0, 2);
int_max += rng(1, 5);
@@ -353,12 +364,15 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_DOCTOR:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(3, 2) - rng(1, 3);
if (!one_in(3))
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = 0;
if (one_in(3))
{
level = dice(3, 2) - rng(1, 3);
}
set_skill_level(*aSkill, level);
}
sklevel[sk_firstaid] += rng(2, 6);
boost_skill_level(sk_firstaid, rng(2, 6));
str_max -= rng(0, 2);
int_max += rng(0, 2);
per_max += rng(0, 1) * rng(0, 1);
@@ -369,15 +383,18 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_TRADER:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(2, 2) - 2 + (rng(0, 1) * rng(0, 1));
if (!one_in(3))
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = 0;
if (one_in(3))
{
level = dice(2, 2) - 2 + (rng(0, 1) * rng(0, 1));
}
set_skill_level(*aSkill, level);
}
sklevel[sk_mechanics] += rng(0, 2);
sklevel[sk_electronics] += rng(0, 2);
sklevel[sk_speech] += rng(0, 3);
sklevel[sk_barter] += rng(2, 5);
boost_skill_level(sk_mechanics, rng(0, 2));
boost_skill_level(sk_electronics, rng(0, 2));
boost_skill_level(sk_speech, rng(0, 3));
boost_skill_level(sk_barter, rng(2, 5));
int_max += rng(0, 1) * rng(0, 1);
per_max += rng(0, 1) * rng(0, 1);
personality.collector += rng(1, 5);
@@ -385,15 +402,18 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_NINJA:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(2, 2) - rng(1, 2);
if (!one_in(3))
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = 0;
if (one_in(3))
{
level = dice(2, 2) - rng(1, 2);
}
set_skill_level(*aSkill, level);
}
sklevel[sk_dodge] += rng(2, 4);
sklevel[sk_melee] += rng(1, 4);
sklevel[sk_unarmed] += rng(4, 6);
sklevel[sk_throw] += rng(0, 2);
boost_skill_level(sk_dodge, rng(2, 4));
boost_skill_level(sk_melee, rng(1, 4));
boost_skill_level(sk_unarmed, rng(4, 6));
boost_skill_level(sk_throw, rng(0, 2));
str_max -= rng(0, 1);
dex_max += rng(0, 2);
per_max += rng(0, 2);
@@ -405,14 +425,17 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_COWBOY:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(3, 2) - rng(0, 4);
if (sklevel[i] < 0)
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = dice(3, 2) - rng(0, 4);
if (level < 0)
{
level = 0;
}
set_skill_level(*aSkill, level);
}
sklevel[sk_gun] += rng(1, 3);
sklevel[sk_pistol] += rng(1, 3);
sklevel[sk_rifle] += rng(0, 2);
boost_skill_level(sk_gun, rng(1, 3));
boost_skill_level(sk_pistol, rng(1, 3));
boost_skill_level(sk_rifle, rng(0, 2));
int_max -= rng(0, 2);
str_max += rng(0, 1);
per_max += rng(0, 2);
@@ -421,18 +444,21 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_SCIENTIST:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(3, 2) - 4;
if (sklevel[i] < 0)
sklevel[i] = 0;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = dice(3, 2) - 4;
if (level < 0)
{
level = 0;
}
set_skill_level(*aSkill, level);
}
sklevel[sk_computer] += rng(0, 3);
sklevel[sk_electronics] += rng(0, 3);
sklevel[sk_firstaid] += rng(0, 1);
boost_skill_level(sk_computer, rng(0, 3));
boost_skill_level(sk_electronics, rng(0, 3));
boost_skill_level(sk_firstaid, rng(0, 1));
switch (rng(1, 3)) { // pick a specialty
case 1: sklevel[sk_computer] += rng(2, 6); break;
case 2: sklevel[sk_electronics] += rng(2, 6); break;
case 3: sklevel[sk_firstaid] += rng(2, 6); break;
case 1: boost_skill_level(sk_computer, rng(2, 6)); break;
case 2: boost_skill_level(sk_electronics, rng(2, 6)); break;
case 3: boost_skill_level(sk_firstaid, rng(2, 6)); break;
}
if (one_in(4))
flags |= mfb(NF_TECHNOPHILE);
@@ -447,13 +473,16 @@ void npc::randomize(game *g, npc_class type)
break;
case NC_BOUNTY_HUNTER:
for (int i = 1; i < num_skill_types; i++) {
sklevel[i] = dice(3, 2) - 3;
if (sklevel[i] > 0 && one_in(3))
sklevel[i]--;
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin(); aSkill != Skill::skills.end(); ++aSkill) {
int level = dice(3, 2) - 3;
if (level > 0 && one_in(3))
{
level--;
}
set_skill_level(*aSkill, level);
}
sklevel[sk_gun] += rng(2, 4);
sklevel[rng(sk_pistol, sk_rifle)] += rng(3, 5);
boost_skill_level(sk_gun, rng(2, 4));
boost_skill_level(rng(sk_pistol, sk_rifle), rng(3, 5));
personality.aggression += rng(1, 6);
personality.bravery += rng(0, 5);
break;
@@ -598,7 +627,7 @@ void npc::randomize_from_faction(game *g, faction *fac)
personality.altruism += rng(0, 4);
int_max += rng(2, 4);
per_max += rng(0, 2);
sklevel[sk_firstaid] += rng(1, 5);
boost_skill_level(sk_firstaid, rng(1, 5));
}
if (fac->has_job(FACJOB_FARMERS)) {
personality.aggression -= rng(2, 4);
@@ -614,10 +643,10 @@ void npc::randomize_from_faction(game *g, faction *fac)
personality.aggression -= rng(0, 2);
personality.bravery -= rng(0, 2);
switch (rng(1, 4)) {
case 1: sklevel[sk_mechanics] += dice(2, 4); break;
case 2: sklevel[sk_electronics] += dice(2, 4); break;
case 3: sklevel[sk_cooking] += dice(2, 4); break;
case 4: sklevel[sk_tailor] += dice(2, 4); break;
case 1: boost_skill_level(sk_mechanics, dice(2, 4)); break;
case 2: boost_skill_level(sk_electronics, dice(2, 4)); break;
case 3: boost_skill_level(sk_cooking, dice(2, 4)); break;
case 4: boost_skill_level(sk_tailor, dice(2, 4)); break;
}
}
@@ -644,9 +673,9 @@ void npc::randomize_from_faction(game *g, faction *fac)
per_max += rng(0, 2);
int_max += rng(0, 4);
if (one_in(3)) {
sklevel[sk_mechanics] += dice(2, 3);
sklevel[sk_electronics] += dice(2, 3);
sklevel[sk_firstaid] += dice(2, 3);
boost_skill_level(sk_mechanics, dice(2, 3));
boost_skill_level(sk_electronics, dice(2, 3));
boost_skill_level(sk_firstaid, dice(2, 3));
}
}
if (fac->has_value(FACVAL_BOOKS)) {
@@ -662,9 +691,10 @@ void npc::randomize_from_faction(game *g, faction *fac)
dex_max += rng(0, 3);
per_max += rng(0, 2);
int_max += rng(0, 2);
for (int i = 1; i < num_skill_types; i++) {
for (std::vector<Skill*>::iterator aSkill = Skill::skills.begin();
aSkill != Skill::skills.end(); ++aSkill) {
if (one_in(3))
sklevel[i] += rng(2, 4);
boost_skill_level(*aSkill, rng(2, 4));
}
}
if (fac->has_value(FACVAL_ROBOTS)) {
@@ -940,7 +970,7 @@ std::list<item> starting_inv(npc *me, npc_class type, game *g)
// TODO: More specifics.
while (total_space > 0 && !one_in(8)) {
tmp = standard_itype_ids[rng(0, standard_itype_ids.size())];
tmp = standard_itype_ids[rng(0, standard_itype_ids.size()-1)];
if (total_space >= g->itypes[tmp]->volume) {
ret.push_back(item(g->itypes[tmp], 0));
ret.back() = ret.back().in_its_container(&g->itypes);
@@ -1008,11 +1038,11 @@ skill npc::best_skill()
std::vector<int> best_skills;
int highest = 0;
for (int i = sk_unarmed; i <= sk_rifle; i++) {
if (sklevel[i] > highest && i != sk_gun) {
highest = sklevel[i];
if (skillLevel(i) > highest && i != sk_gun) {
highest = skillLevel(i);
best_skills.clear();
}
if (sklevel[i] == highest && i != sk_gun)
if (skillLevel(i) == highest && i != sk_gun)
best_skills.push_back(i);
}
int index = rng(0, best_skills.size() - 1);
@@ -1418,7 +1448,7 @@ std::vector<skill> npc::skills_offered_to(player *p)
if (p == NULL)
return ret;
for (int i = 0; i < num_skill_types; i++) {
if (p->skillLevel(Skill::skill(i)) < sklevel[i])
if (p->skillLevel(Skill::skill(i)) < skillLevel(i))
ret.push_back( skill(i) );
}
return ret;
@@ -1478,15 +1508,15 @@ void npc::decide_needs()
it_gun* gun = dynamic_cast<it_gun*>(weapon.type);
needrank[need_ammo] = 5 * has_ammo(gun->ammo).size();
}
if (weapon.type->id == "null" && sklevel[sk_unarmed] < 4)
if (weapon.type->id == "null" && skillLevel(sk_unarmed) < 4)
needrank[need_weapon] = 1;
else
needrank[need_weapon] = weapon.type->melee_dam + weapon.type->melee_cut +
weapon.type->m_to_hit;
if (!weapon.is_gun())
needrank[need_gun] = sklevel[sk_unarmed] + sklevel[sk_melee] +
sklevel[sk_bashing] + sklevel[sk_cutting] -
sklevel[sk_gun] * 2 + 5;
needrank[need_gun] = skillLevel(sk_unarmed) + skillLevel(sk_melee) +
skillLevel(sk_bashing) + skillLevel(sk_cutting) -
skillLevel(sk_gun) * 2 + 5;
needrank[need_food] = 15 - hunger;
needrank[need_drink] = 15 - thirst;
invslice slice = inv.slice(0, inv.size());
@@ -1556,7 +1586,7 @@ void npc::init_selling(std::vector<item*> &items, std::vector<int> &prices)
val = value(slice[i]->front()) - (slice[i]->front().price() / 50);
if (val <= NPC_LOW_VALUE || mission == NPC_MISSION_SHOPKEEP) {
items.push_back(&slice[i]->front());
price = slice[i]->front().price() / (price_adjustment(sklevel[sk_barter]));
price = slice[i]->front().price() / (price_adjustment(skillLevel(sk_barter)));
prices.push_back(price);
}
}
@@ -1575,7 +1605,7 @@ void npc::init_buying(inventory& you, std::vector<item*> &items,
price = slice[i]->front().price();
if (val >= NPC_VERY_HI_VALUE)
price *= 2;
price *= price_adjustment(sklevel[sk_barter]);
price *= price_adjustment(skillLevel(sk_barter));
prices.push_back(price);
}
}
@@ -1603,7 +1633,7 @@ int npc::value(const item &it)
int ret = it.price() / 50;
skill best = best_skill();
if (best != sk_unarmed) {
int weapon_val = it.weapon_value(sklevel) - weapon.weapon_value(sklevel);
int weapon_val = it.weapon_value(this) - weapon.weapon_value(this);
if (weapon_val > 0)
ret += weapon_val;
}
+34 -27
View File
@@ -542,7 +542,7 @@ npc_action npc::method_of_attack(game *g, int target, int danger)
else if (allowed && enough_time_to_reload(g, target, it)) {
has_empty_gun = true;
empty_guns.push_back(&it);
} else if (it.melee_value(sklevel) > weapon.melee_value(sklevel) * 1.1)
} else if (it.melee_value(this) > weapon.melee_value(this) * 1.1)
has_better_melee = true;
}
@@ -684,7 +684,7 @@ bool npc::alt_attack_available(game *g)
{
for (int i = 0; i < NUM_ALT_ATTACK_ITEMS; i++) {
if ((!is_following() || combat_rules.use_grenades ||
!(g->itypes[ALT_ATTACK_ITEMS[i]]->item_flags & mfb(IF_GRENADE))) &&
!(g->itypes[ALT_ATTACK_ITEMS[i]]->item_tags.count("GRENADE"))) &&
has_amount(ALT_ATTACK_ITEMS[i], 1))
return true;
}
@@ -711,6 +711,9 @@ char npc::choose_escape_item()
}
}
}
// Protect us from accessing an invalid index.
if (ret == -1) { return ret; }
return slice[ret]->front().invlet;
}
@@ -721,6 +724,10 @@ void npc::use_escape_item(game *g, char invlet, int target)
move_pause();
return;
}
if (invlet == -1) {
// No item found.
return;
}
/* There is a static list of items that NPCs consider to be "escape items," so
* we can just use a switch here to decide what to do based on type. See
@@ -770,7 +777,7 @@ int npc::confident_range(char invlet)
deviation += 3.5 * (5 - skillLevel(firing->skill_used));
else
deviation -= 2.5 * (skillLevel(firing->skill_used) - 5);
if (sklevel[sk_gun] < 3)
if (skillLevel("gun") < 3)
deviation += 1.5 * (3 - skillLevel("gun"));
else
deviation -= .5 * (skillLevel("gun") - 3);
@@ -802,10 +809,10 @@ int npc::confident_range(char invlet)
item *thrown = &(inv.item_by_letter(invlet));
max = throw_range(invlet); // The max distance we can throw
int deviation = 0;
if (sklevel[sk_throw] < 8)
deviation += rng(0, 8 - sklevel[sk_throw]);
if (skillLevel(sk_throw) < 8)
deviation += rng(0, 8 - skillLevel(sk_throw));
else
deviation -= sklevel[sk_throw] - 6;
deviation -= skillLevel(sk_throw) - 6;
deviation += throw_dex_mod();
@@ -952,10 +959,10 @@ void npc::move_to(game *g, int x, int y)
moves = 0;
}
if (recoil > 0) { // Start by dropping recoil a little
if (int(str_cur / 2) + sklevel[sk_gun] >= recoil)
if (int(str_cur / 2) + skillLevel(sk_gun) >= recoil)
recoil = 0;
else {
recoil -= int(str_cur / 2) + sklevel[sk_gun];
recoil -= int(str_cur / 2) + skillLevel(sk_gun);
recoil = int(recoil / 2);
}
}
@@ -1169,10 +1176,10 @@ void npc::move_pause()
{
moves = 0;
if (recoil > 0) {
if (str_cur + 2 * sklevel[sk_gun] >= recoil)
if (str_cur + 2 * skillLevel(sk_gun) >= recoil)
recoil = 0;
else {
recoil -= str_cur + 2 * sklevel[sk_gun];
recoil -= str_cur + 2 * skillLevel(sk_gun);
recoil = int(recoil / 2);
}
}
@@ -1415,7 +1422,7 @@ npc_action npc::scan_new_items(game *g, int target)
else if (allowed && enough_time_to_reload(g, target, it)) {
has_empty_gun = true;
empty_guns.push_back(&it);
} else if (it.melee_value(sklevel) > weapon.melee_value(sklevel) * 1.1)
} else if (it.melee_value(this) > weapon.melee_value(this) * 1.1)
has_better_melee = true;
}
@@ -1452,10 +1459,10 @@ void npc::melee_player(game *g, player &foe)
void npc::wield_best_melee(game *g)
{
item& it = inv.best_for_melee(sklevel);
int best_score = it.melee_value(sklevel);
item& it = inv.best_for_melee(this);
int best_score = it.melee_value(this);
if (!styles.empty() && // Wield a style if our skills warrant it
best_score < 15 * sklevel[sk_unarmed] + 8 * sklevel[sk_melee]) {
best_score < 15 * skillLevel(sk_unarmed) + 8 * skillLevel(sk_melee)) {
// TODO: More intelligent style choosing
wield(g, 0 - rng(1, styles.size()));
return;
@@ -1490,7 +1497,7 @@ void npc::alt_attack(game *g, int target)
*/
for (int i = 0; i < NUM_ALT_ATTACK_ITEMS; i++) {
if ((!is_following() || combat_rules.use_grenades ||
!(g->itypes[ALT_ATTACK_ITEMS[i]]->item_flags & mfb(IF_GRENADE))) &&
!(g->itypes[ALT_ATTACK_ITEMS[i]]->item_tags.count("GRENADE"))) &&
has_amount(ALT_ATTACK_ITEMS[i], 1))
which = ALT_ATTACK_ITEMS[i];
}
@@ -1667,16 +1674,16 @@ void npc::heal_player(game *g, player &patient)
int amount_healed;
if (has_amount("1st_aid", 1)) {
switch (worst) {
case hp_head: amount_healed = 10 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 20 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 15 + 2 * sklevel[sk_firstaid];
case hp_head: amount_healed = 10 + 1.6 * skillLevel(sk_firstaid); break;
case hp_torso: amount_healed = 20 + 3 * skillLevel(sk_firstaid); break;
default: amount_healed = 15 + 2 * skillLevel(sk_firstaid);
}
use_charges("1st_aid", 1);
} else if (has_amount("bandages", 1)) {
switch (worst) {
case hp_head: amount_healed = 1 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 4 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 3 + 2 * sklevel[sk_firstaid];
case hp_head: amount_healed = 1 + 1.6 * skillLevel(sk_firstaid); break;
case hp_torso: amount_healed = 4 + 3 * skillLevel(sk_firstaid); break;
default: amount_healed = 3 + 2 * skillLevel(sk_firstaid);
}
use_charges("bandages", 1);
}
@@ -1717,16 +1724,16 @@ void npc::heal_self(game *g)
int amount_healed;
if (has_amount("1st_aid", 1)) {
switch (worst) {
case hp_head: amount_healed = 10 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 20 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 15 + 2 * sklevel[sk_firstaid];
case hp_head: amount_healed = 10 + 1.6 * skillLevel(sk_firstaid); break;
case hp_torso: amount_healed = 20 + 3 * skillLevel(sk_firstaid); break;
default: amount_healed = 15 + 2 * skillLevel(sk_firstaid);
}
use_charges("1st_aid", 1);
} else if (has_amount("bandages", 1)) {
switch (worst) {
case hp_head: amount_healed = 1 + 1.6 * sklevel[sk_firstaid]; break;
case hp_torso: amount_healed = 4 + 3 * sklevel[sk_firstaid]; break;
default: amount_healed = 3 + 2 * sklevel[sk_firstaid];
case hp_head: amount_healed = 1 + 1.6 * skillLevel(sk_firstaid); break;
case hp_torso: amount_healed = 4 + 3 * skillLevel(sk_firstaid); break;
default: amount_healed = 3 + 2 * skillLevel(sk_firstaid);
}
use_charges("bandages", 1);
} else {
+24 -15
View File
@@ -68,6 +68,7 @@ enum oter_id {
ot_apartments_mod_tower_1_entrance,ot_apartments_mod_tower_1,
ot_office_tower_1_entrance, ot_office_tower_1, ot_office_tower_b_entrance, ot_office_tower_b,
ot_church_north, ot_church_east, ot_church_south, ot_church_west,
ot_cathedral_1_entrance, ot_cathedral_1, ot_cathedral_b_entrance, ot_cathedral_b,
ot_s_grocery_north, ot_s_grocery_east, ot_s_grocery_south, ot_s_grocery_west,
ot_s_hardware_north, ot_s_hardware_east, ot_s_hardware_south,
ot_s_hardware_west,
@@ -230,6 +231,10 @@ const oter_t oterlist[num_ter_types] = {
{"church", 'C', c_ltred, 5, build_extras, false, false},
{"church", 'C', c_ltred, 5, build_extras, false, false},
{"church", 'C', c_ltred, 5, build_extras, false, false},
{"cathedral", 'C', i_ltred, 5, no_extras, false, false},
{"cathedral", 'C', i_ltred, 5, no_extras, false, false},
{"cathedral basement", 'C', i_ltred, 5, no_extras, false, false},
{"cathedral basement", 'C', i_ltred, 5, no_extras, false, false},
{"grocery store", '^', c_green, 5, build_extras, false, false},
{"grocery store", '>', c_green, 5, build_extras, false, false},
{"grocery store", 'v', c_green, 5, build_extras, false, false},
@@ -515,6 +520,7 @@ enum omspec_id
OMSPEC_APARTMENT_CON_TOWER,
OMSPEC_APARTMENT_MOD_TOWER,
OMSPEC_OFFICE_TOWER,
OMSPEC_CATHEDRAL,
OMSPEC_SCHOOL,
OMSPEC_HOTEL_TOWER,
OMSPEC_SEWAGE,
@@ -554,7 +560,7 @@ const overmap_special overmap_specials[NUM_OMSPECS] = {
&omspec_place::forest, mfb(OMS_FLAG_CLASSIC)},
{ot_lmoe, 0, 3, 20, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_CLASSIC)},
&omspec_place::wilderness, mfb(OMS_FLAG_CLASSIC)},
{ot_farm, 0, 20, 20, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::wilderness, mfb(OMS_FLAG_3X3_SECOND) |mfb(OMS_FLAG_DIRT_LOT) | mfb(OMS_FLAG_CLASSIC)},
@@ -563,14 +569,14 @@ const overmap_special overmap_specials[NUM_OMSPECS] = {
&omspec_place::forest, 0},
{ot_lab_stairs, 0, 30, 8, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD)},
{ot_fema_entrance, 0, 5, 8, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_3X3_SECOND) | mfb(OMS_FLAG_CLASSIC)},
{ot_fema_entrance, 2, 5, 8, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::by_highway, mfb(OMS_FLAG_3X3_SECOND) | mfb(OMS_FLAG_CLASSIC)},
// Terrain MIN MAX DISTANCE
{ot_bunker, 2, 10, 4, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD)},
{ot_outpost, 0, 10, 4, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::wilderness, 0},
@@ -594,25 +600,28 @@ const overmap_special overmap_specials[NUM_OMSPECS] = {
&omspec_place::by_highway, mfb(OMS_FLAG_3X3_SECOND) | mfb(OMS_FLAG_CLASSIC)},
{ot_public_works_entrance, 1, 3, 2, 10, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
{ot_apartments_con_tower_1_entrance, 1, 5, -1, 2, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
{ot_apartments_mod_tower_1_entrance, 1, 4, -1, 2, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
{ot_office_tower_1_entrance, 1, 5, -1, 4, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
{ot_cathedral_1_entrance, 1, 2, -1, 2, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)},
{ot_school_2, 1, 3, 1, 5, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_3X3_FIXED)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_3X3_FIXED)},
{ot_hotel_tower_1_2, 1, 4, -1, 4, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_3X3_FIXED)},
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_3X3_FIXED)},
{ot_sewage_treatment, 1, 5, 10, 20, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_PARKING_LOT) | mfb(OMS_FLAG_CLASSIC)},
&omspec_place::wilderness, mfb(OMS_FLAG_PARKING_LOT) | mfb(OMS_FLAG_CLASSIC)},
{ot_mine_entrance, 0, 5, 15, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::wilderness, mfb(OMS_FLAG_PARKING_LOT)},
@@ -650,7 +659,7 @@ const overmap_special overmap_specials[NUM_OMSPECS] = {
&omspec_place::by_highway, mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_ROTATE_ROAD)},
{ot_haz_sar_entrance, 1, 2, 15, -1, "GROUP_NULL", 0, 0, 0, 0,
&omspec_place::land, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)}
&omspec_place::wilderness, mfb(OMS_FLAG_ROAD) | mfb(OMS_FLAG_CLASSIC) | mfb(OMS_FLAG_2X2_SECOND)}
};
// Overmap "Zones"
+1
View File
@@ -413,6 +413,7 @@ char option_max_options(option_key id)
break;
case OPT_SEASON_LENGTH:
ret = 127;
break;
case OPT_MOVE_VIEW_OFFSET:
ret = 50; // TODO calculate max for screen size
break;
+45 -14
View File
@@ -418,12 +418,14 @@ std::string string_input_popup(std::string title, int max_length, std::string in
delwin(w);
refresh();
return ret;
} else if ((ch == KEY_BACKSPACE || ch == 127) && posx > startx) {
} else if (ch == KEY_BACKSPACE || ch == 127) {
// Move the cursor back and re-draw it
ret = ret.substr(0, ret.size() - 1);
mvwputch(w, 1, posx, c_ltgray, '_');
posx--;
mvwputch(w, 1, posx, h_ltgray, '_');
if( posx > startx ) { // but silently drop input if we're at 0, instead of adding '^'
ret = ret.substr(0, ret.size() - 1);
mvwputch(w, 1, posx, c_ltgray, '_');
posx--;
mvwputch(w, 1, posx, h_ltgray, '_');
}
} else if(ret.size() < max_length || max_length == 0) {
ret += ch;
mvwputch(w, 1, posx, c_magenta, ch);
@@ -493,20 +495,24 @@ int menu_vec(bool cancelable, const char *mes, std::vector<std::string> options)
if (options[i].length() + 6 > width)
width = options[i].length() + 6;
}
int currsel=-1;
std::string spaces(width-2, ' ');
WINDOW *w = newwin(height, width, (TERMY-height)/2, (TERMX > width) ? (TERMX-width)/2 : 0);
wattron(w, c_white);
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
mvwprintw(w, 1, 1, title.c_str());
for (int i = 0; i < options.size(); i++)
mvwprintw(w, i + 2, 1, "%c: %s", (i < 9? i + '1' :
(i == 9? '0' : 'a' + i - 10)),
options[i].c_str());
long ch;
wrefresh(w);
int res;
do
{
for (int i = 0; i < options.size(); i++) {
mvwprintz(w, i + 2, 1, (i==currsel ? h_white : c_white), "%s", spaces.c_str() );
mvwprintz(w, i + 2, 1, (i==currsel ? h_white : c_white), "%c: %s", (i < 9? i + '1' :
(i == 9? '0' : 'a' + i - 10)),
options[i].c_str());
}
wrefresh(w);
ch = getch();
if (cancelable && ch == KEY_ESCAPE)
res = options.size();
@@ -519,10 +525,21 @@ int menu_vec(bool cancelable, const char *mes, std::vector<std::string> options)
else
if (ch >= 'a' && ch <= 'z')
res = ch - 'a' + 11;
else
if (ch == KEY_DOWN )
currsel++;
else
if (ch == KEY_UP )
currsel--;
else
if(ch == '\n' && currsel >= 0 && currsel < options.size() )
res=currsel+1;
else
res = -1;
if (res > options.size())
res = -1;
if (currsel < -1) currsel = options.size() - 1;
else if ( currsel > 0 && currsel > options.size() ) currsel = 0;
}
while (res == -1);
werase(w);
@@ -728,7 +745,8 @@ void full_screen_popup(const char* mes, ...)
//if sType == "MENU", sPre == "iOffsetY" or "iOffsetX" also do special things
//otherwise if sType == "MENU", iValue can be used to control color
//all this should probably be cleaned up at some point, rather than using a function for things it wasn't meant for
char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string sItemName, std::vector<iteminfo> vItemDisplay, std::vector<iteminfo> vItemCompare)
// well frack, half the game uses it so: optional (int)selected argument causes entry highlight, and enter to return entry's key. Also it now returns int
int compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string sItemName, std::vector<iteminfo> vItemDisplay, std::vector<iteminfo> vItemCompare, int selected)
{
WINDOW* w = newwin(iHeight, iWidth, VIEW_OFFSET_Y, iLeft + VIEW_OFFSET_X);
@@ -737,6 +755,8 @@ char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string
int iStartX = 0;
std::string sPlus;
bool bStartNewLine = true;
int selected_ret='\n';
std::string spaces(iWidth-2, ' ');
for (int i = 0; i < vItemDisplay.size(); i++) {
if (vItemDisplay[i].sType == "MENU") {
if (vItemDisplay[i].sPre == "iOffsetY") {
@@ -746,11 +766,17 @@ char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string
} else {
nc_color nameColor = c_ltgreen; //pre-existing behavior, so make it the default
//patched to allow variable "name" coloring, e.g. for item examining
nc_color bgColor = c_white; //yes the name makes no sense
if (vItemDisplay[i].iValue >= 0) {
nameColor = vItemDisplay[i].iValue == 0 ? c_ltgray : c_ltred;
}
if ( i == selected && vItemDisplay[i].sName != "" ) {
bgColor = h_white;
selected_ret=(int)vItemDisplay[i].sName.c_str()[0]; // fixme: sanity check(?)
}
mvwprintz(w, line_num, 1, bgColor, "%s", spaces.c_str() );
mvwprintz(w, line_num, iStartX, nameColor, "%s", (vItemDisplay[i].sName).c_str());
wprintz(w, c_white, "%s", (vItemDisplay[i].sPre).c_str());
wprintz(w, bgColor, "%s", (vItemDisplay[i].sPre).c_str());
line_num++;
}
} else if (vItemDisplay[i].sType == "DESCRIPTION") {
@@ -826,11 +852,16 @@ char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
char ch = ' ';
int ch = (int)' ';
wrefresh(w);
if (iLeft > 0) {
ch = getch();
ch = (int)getch();
if ( selected > 0 && ( ch == '\n' || ch == KEY_RIGHT ) && selected_ret != 0 ) {
ch=selected_ret;
} else if ( selected == KEY_LEFT ) {
ch=(int)' ';
}
werase(w);
wrefresh(w);
delwin(w);
+1 -1
View File
@@ -62,7 +62,7 @@ void popup_top(const char *mes, ...); // Displayed at the top of the screen
void popup(const char *mes, ...);
void popup_nowait(const char *mes, ...); // Doesn't wait for spacebar
void full_screen_popup(const char *mes, ...);
char compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string sItemName, std::vector<iteminfo> vItemDisplay, std::vector<iteminfo> vItemCompare);
int compare_split_screen_popup(int iLeft, int iWidth, int iHeight, std::string sItemName, std::vector<iteminfo> vItemDisplay, std::vector<iteminfo> vItemCompare, int selected=-1);
nc_color hilite(nc_color c);
nc_color invert_color(nc_color c);
+60 -18
View File
@@ -36,8 +36,8 @@
#define SETTLE_DICE 2
#define SETTLE_SIDES 2
#define HIVECHANCE 180 //Chance that any given forest will be a hive
#define SWAMPINESS 8 //Affects the size of a swamp
#define SWAMPCHANCE 850 // Chance that a swamp will spawn instead of forest
#define SWAMPINESS 4 //Affects the size of a swamp
#define SWAMPCHANCE 8500 // Chance that a swamp will spawn instead of forest
void settlement_building(settlement &set, int x, int y);
@@ -712,11 +712,11 @@ void overmap::generate(game *g, overmap* north, overmap* east, overmap* south,
road_points.push_back(cities[i]);
// And finally connect them via "highways"
place_hiways(road_points, 0, ot_road_null);
// Place specials
place_specials();
// Make the roads out road points;
for (int i = 0; i < roads_out.size(); i++)
ter(roads_out[i].x, roads_out[i].y, 0) = ot_road_nesw;
// Place specials
place_specials();
// Clean up our roads and rivers
polish(0);
@@ -752,6 +752,8 @@ bool overmap::generate_sub(int const z)
std::vector<point> temple_points;
std::vector<point> office_entrance_points;
std::vector<point> office_points;
std::vector<point> cathedral_entrance_points;
std::vector<point> cathedral_points;
std::vector<point> hotel_tower_1_points;
std::vector<point> hotel_tower_2_points;
std::vector<point> hotel_tower_3_points;
@@ -853,6 +855,10 @@ bool overmap::generate_sub(int const z)
office_entrance_points.push_back( point(i, j) );
else if (ter(i, j, z + 1) == ot_office_tower_1)
office_points.push_back( point(i, j) );
else if (ter(i, j, z + 1) == ot_cathedral_1_entrance)
cathedral_entrance_points.push_back( point(i, j) );
else if (ter(i, j, z + 1) == ot_cathedral_1)
cathedral_points.push_back( point(i, j) );
else if (ter(i, j, z + 1) == ot_hotel_tower_1_7)
hotel_tower_1_points.push_back( point(i, j) );
else if (ter(i, j, z + 1) == ot_hotel_tower_1_8)
@@ -870,7 +876,12 @@ bool overmap::generate_sub(int const z)
for (int i = 0; i < subway_points.size(); i++)
ter(subway_points[i].x, subway_points[i].y, z) = ot_subway_station;
for (int i = 0; i < lab_points.size(); i++)
requires_sub |= build_lab(lab_points[i].x, lab_points[i].y, z, lab_points[i].s);
{
bool lab = build_lab(lab_points[i].x, lab_points[i].y, z, lab_points[i].s);
requires_sub |= lab;
if (!lab && ter(lab_points[i].x, lab_points[i].y, z) == ot_lab_core)
ter(lab_points[i].x, lab_points[i].y, z) = ot_lab;
}
for (int i = 0; i < ant_points.size(); i++)
build_anthill(ant_points[i].x, ant_points[i].y, z, ant_points[i].s);
polish(z, ot_subway_ns, ot_subway_nesw);
@@ -932,6 +943,10 @@ bool overmap::generate_sub(int const z)
ter(office_entrance_points[i].x, office_entrance_points[i].y, z) = ot_office_tower_b_entrance;
for (int i = 0; i < office_points.size(); i++)
ter(office_points[i].x, office_points[i].y, z) = ot_office_tower_b;
for (int i = 0; i < cathedral_entrance_points.size(); i++)
ter(cathedral_entrance_points[i].x, cathedral_entrance_points[i].y, z) = ot_cathedral_b_entrance;
for (int i = 0; i < cathedral_points.size(); i++)
ter(cathedral_points[i].x, cathedral_points[i].y, z) = ot_cathedral_b;
for (int i = 0; i < hotel_tower_1_points.size(); i++)
ter(hotel_tower_1_points[i].x, hotel_tower_1_points[i].y, z) = ot_hotel_tower_b_1;
for (int i = 0; i < hotel_tower_2_points.size(); i++)
@@ -1299,21 +1314,24 @@ void overmap::draw(WINDOW *w, game *g, int z, int &cursx, int &cursy,
int distance = rl_dist(origx, origy, target.x, target.y);
mvwprintz(w, 3, om_map_width + 1, c_white, "Distance to target: %d", distance);
}
mvwprintz(w, 17, om_map_width + 1, c_magenta, "Use movement keys to pan. ");
mvwprintz(w, 18, om_map_width + 1, c_magenta, "0 - Center map on character");
mvwprintz(w, 19, om_map_width + 1, c_magenta, "t - Toggle legend ");
mvwprintz(w, 20, om_map_width + 1, c_magenta, "/ - Search ");
mvwprintz(w, 21, om_map_width + 1, c_magenta, "N - Add/Edit a note ");
mvwprintz(w, 22, om_map_width + 1, c_magenta, "D - Delete a note ");
mvwprintz(w, 23, om_map_width + 1, c_magenta, "L - List notes ");
mvwprintz(w, 24, om_map_width + 1, c_magenta, "Esc or q - Return to game ");
mvwprintz(w, 15, om_map_width + 1, c_magenta, "Use movement keys to pan. ");
mvwprintz(w, 16, om_map_width + 1, c_magenta, "0 - Center map on character");
mvwprintz(w, 17, om_map_width + 1, c_magenta, "t - Toggle legend ");
mvwprintz(w, 18, om_map_width + 1, c_magenta, "/ - Search ");
mvwprintz(w, 19, om_map_width + 1, c_magenta, "N - Add/Edit a note ");
mvwprintz(w, 20, om_map_width + 1, c_magenta, "D - Delete a note ");
mvwprintz(w, 21, om_map_width + 1, c_magenta, "L - List notes ");
mvwprintz(w, 22, om_map_width + 1, c_magenta, "Esc or q - Return to game ");
char level_string[10];
sprintf(level_string, "LEVEL %i",z);
mvwprintz(w, getmaxy(w)-1, om_map_width + 1, c_red, level_string);
}
// Done with all drawing!
wrefresh(w);
}
//Start drawing the overmap on the screen using the (m)ap command.
point overmap::draw_overmap(game *g, int const zlevel)
point overmap::draw_overmap(game *g, int zlevel)
{
WINDOW* w_map = newwin(TERMY, TERMX, 0, 0);
WINDOW* w_search = newwin(13, 27, 3, TERMX-27);
@@ -1321,7 +1339,7 @@ point overmap::draw_overmap(game *g, int const zlevel)
bool blink = true;
int cursx = (g->levx + int(MAPSIZE / 2)) / 2,
cursy = (g->levy + int(MAPSIZE / 2)) / 2;
int origx = cursx, origy = cursy;
int origx = cursx, origy = cursy, origz = zlevel;
char ch = 0;
point ret(-1, -1);
overmap hori, vert, diag; // Adjacent maps
@@ -1341,7 +1359,13 @@ point overmap::draw_overmap(game *g, int const zlevel)
} else if (ch == '0') {
cursx = origx;
cursy = origy;
} else if (ch == '\n')
zlevel = origz;
} else if (ch == '>' && zlevel > -OVERMAP_DEPTH) {
zlevel -= 1;
} else if (ch == '<' && zlevel < OVERMAP_HEIGHT) {
zlevel += 1;
}
else if (ch == '\n')
ret = point(cursx, cursy);
else if (ch == KEY_ESCAPE || ch == 'q' || ch == 'Q' || ch == 'm')
ret = point(-1, -1);
@@ -1775,6 +1799,7 @@ void overmap::make_road(int cx, int cy, int cs, int dir, city town)
bool overmap::build_lab(int x, int y, int z, int s)
{
std::vector<point> generated_lab;
ter(x, y, z) = ot_lab;
for (int n = 0; n <= 1; n++) { // Do it in two passes to allow diagonals
for (int i = 1; i <= s; i++) {
@@ -1783,14 +1808,31 @@ bool overmap::build_lab(int x, int y, int z, int s)
if ((ter(lx - 1, ly, z) == ot_lab || ter(lx + 1, ly, z) == ot_lab ||
ter(lx, ly - 1, z) == ot_lab || ter(lx, ly + 1, z) == ot_lab) &&
one_in(i))
ter(lx, ly, z) = ot_lab;
{
ter(lx, ly, z) = ot_lab;
generated_lab.push_back(point(lx,ly));
}
}
}
}
}
bool generate_stairs = true;
for (std::vector<point>::iterator it=generated_lab.begin();
it != generated_lab.end(); it++)
{
if (ter(it->x, it->y, z+1) == ot_lab_stairs)
generate_stairs = false;
}
if (generate_stairs && generated_lab.size() > 0)
{
int v = rng(0,generated_lab.size());
point p = generated_lab[v];
ter(p.x, p.y, z+1) = ot_lab_stairs;
}
ter(x, y, z) = ot_lab_core;
int numstairs = 0;
if (s > 1) { // Build stairs going down
if (s > 0) { // Build stairs going down
while (!one_in(6)) {
int stairx, stairy;
int tries = 0;
+1 -1
View File
@@ -104,7 +104,7 @@ class overmap
point random_house_in_city(int city_id);
int dist_from_city(point p);
// Interactive point choosing; used as the map screen
point draw_overmap(game *g, int const z);
point draw_overmap(game *g, int z);
bool ter_in_type_range(int x, int y, int z, oter_id type, int type_range);
oter_id& ter(int x, int y, int z);
+1074 -426
View File
File diff suppressed because it is too large Load Diff
+24 -8
View File
@@ -12,6 +12,7 @@
#include "artifact.h"
#include "mutation.h"
#include "crafting.h"
#include "vehicle.h"
#include <vector>
#include <string>
#include <map>
@@ -63,6 +64,8 @@ public:
void reset(game *g = NULL);// Resets movement points, stats, applies effects
void update_morale(); // Ticks down morale counters and removes them
void update_mental_focus();
int calc_focus_equilibrium();
void update_bodytemp(game *g); // Maintains body temperature
int current_speed(game *g = NULL); // Number of movement points we get a turn
int run_cost(int base_cost); // Adjust base_cost
@@ -72,6 +75,8 @@ public:
bool has_mutation(int flag) const;
void toggle_trait(int flag);
bool in_climate_control(game *g);
bool has_bionic(bionic_id b) const;
bool has_active_bionic(bionic_id b) const;
void add_bionic(bionic_id b);
@@ -143,7 +148,6 @@ public:
int throw_dex_mod (bool real_life = true);
// Mental skills and stats
int comprehension_percent(skill s, bool real_life = true);
int read_speed (bool real_life = true);
int talk_skill(); // Skill at convincing NPCs of stuff
int intimidation(); // Physical intimidation
@@ -184,6 +188,7 @@ public:
bool has_addiction(add_type type) const;
int addiction_level(add_type type);
void siphon_gas(game *g, vehicle *veh);
void cauterize(game *g);
void suffer(game *g);
void vomit(game *g);
@@ -195,6 +200,7 @@ public:
bool wear(game *g, char let); // Wear item; returns false on fail
bool wear_item(game *g, item *to_wear);
bool takeoff(game *g, char let);// Take off item; returns false on fail
void sort_armor(game *g); // re-order armor layering
void use(game *g, char let); // Use a tool
void use_wielded(game *g);
bool install_bionics(game *g, it_bionic* type); // Install bionics
@@ -221,6 +227,7 @@ public:
int resist(body_part bp); // Infection &c resistance
bool wearing_something_on(body_part bp); // True if wearing something on bp
int adjust_for_focus(int amount);
void practice(const calendar& turn, Skill *s, int amount);
void practice(const calendar& turn, std::string s, int amount);
@@ -243,6 +250,7 @@ public:
bool has_active_item(itype_id id);
int active_item_charges(itype_id id);
void process_active_items(game *g);
bool process_single_active_item(game *g, item *it); // returns false if it needs to be removed
item i_rem(char let); // Remove item from inventory; returns ret_null on fail
item i_rem(itype_id type);// Remove first item w/ this type; fail is ret_null
item remove_weapon();
@@ -258,9 +266,9 @@ public:
// has_amount works ONLY for quantity.
// has_charges works ONLY for charges.
void use_amount(itype_id it, int quantity, bool use_container = false);
std::list<item> use_amount(itype_id it, int quantity, bool use_container = false);
bool use_charges_if_avail(itype_id it, int quantity);// Uses up charges
void use_charges(itype_id it, int quantity);// Uses up charges
std::list<item> use_charges(itype_id it, int quantity);// Uses up charges
bool has_amount(itype_id it, int quantity);
bool has_charges(itype_id it, int quantity);
int amount_of(itype_id it);
@@ -299,6 +307,8 @@ public:
bool my_traits[PF_MAX2];
bool my_mutations[PF_MAX2];
int mutation_category_level[NUM_MUTATION_CATEGORIES];
int next_climate_control_check;
bool last_climate_control_ret;
std::vector<bionic> my_bionics;
// Current--i.e. modified by disease, pain, etc.
int str_cur, dex_cur, int_cur, per_cur;
@@ -321,16 +331,22 @@ public:
std::vector<morale_point> morale;
int xp_pool;
int sklevel[num_skill_types];
int skexercise[num_skill_types];
int sktrain[num_skill_types];
bool sklearn[num_skill_types];
int focus_pool;
SkillLevel& skillLevel(Skill* _skill);
SkillLevel& skillLevel(std::string ident);
SkillLevel& skillLevel(size_t id);
void set_skill_level(Skill* _skill, int level);
void set_skill_level(std::string ident, int level);
void set_skill_level(size_t id, int level);
void boost_skill_level(Skill* _skill, int level);
void boost_skill_level(std::string ident, int level);
void boost_skill_level(size_t id, int level);
void copy_skill_levels(const player *rhs);
std::map<std::string, recipe*> learned_recipes;
inventory inv;
+8 -4
View File
@@ -1,8 +1,9 @@
#ifndef _PLDATA_H_
#define _PLDATA_H_
#include <sstream>
#include "enums.h"
#include <sstream>
#include <vector>
enum character_type {
PLTYPE_CUSTOM,
@@ -110,6 +111,7 @@ struct player_activity
int index;
char invlet;
bool continuous;
bool ignore_trivial;
std::vector<int> values;
point placement;
@@ -124,6 +126,7 @@ struct player_activity
invlet = ch;
placement = point(-1, -1);
continuous = false;
ignore_trivial = false;
}
player_activity(const player_activity &copy)
@@ -134,6 +137,7 @@ struct player_activity
invlet = copy.invlet;
placement = copy.placement;
continuous = copy.continuous;
ignore_trivial = copy.ignore_trivial;
values.clear();
for (int i = 0; i < copy.values.size(); i++)
values.push_back(copy.values[i]);
@@ -410,9 +414,9 @@ Your skin is tough. Cutting damage is slightly reduced for you."},
{"Packmule", 3, 0, 0, "\
You can manage to find space for anything! You can carry 40%% more volume."},
{"Fast Learner", 3, 0, 0, "\
Your skill comprehension is 50%% higher, allowing you to learn skills much\n\
faster than others. Note that this only applies to real-world experience,\n\
not to skill gain from other sources like books."},
You have a flexible mind, allowing you to learn skills much faster than\n\
others. Note that this only applies to real-world experience, not to skill\n\
gain from other sources like books."},
{"Deft", 2, 0, 0, "\
While you're not any better at melee combat, you are better at recovering\n\
from a miss, and will be able to attempt another strike faster."},
+69 -74
View File
@@ -30,7 +30,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
it_ammo *curammo = NULL;
item *weapon = NULL;
if (p.weapon.has_flag(IF_CHARGE)) { // It's a charger gun, so make up a type
if (p.weapon.has_flag("CHARGE")) { // It's a charger gun, so make up a type
// Charges maxes out at 8.
int charges = p.weapon.num_charges();
it_ammo *tmpammo = dynamic_cast<it_ammo*>(itypes["charge_shot"]);
@@ -100,7 +100,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
int num_shots = 1;
if (burst)
num_shots = weapon->burst_size();
if (num_shots > weapon->num_charges() && !weapon->has_flag(IF_CHARGE))
if (num_shots > weapon->num_charges() && !weapon->has_flag("CHARGE"))
num_shots = weapon->num_charges();
if (num_shots == 0)
@@ -208,7 +208,7 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
}
// Use up a round (or 100)
if (weapon->has_flag(IF_FIRE_100))
if (weapon->has_flag("FIRE_100"))
weapon->charges -= 100;
else
weapon->charges--;
@@ -267,35 +267,43 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
}
int dam = weapon->gun_damage();
int tx = trajectory[0].x;
int ty = trajectory[0].y;
int px = trajectory[0].x;
int py = trajectory[0].y;
for (int i = 0; i < trajectory.size() &&
(dam > 0 || (effects & AMMO_FLAME)); i++) {
if (i > 0)
m.drawsq(w_terrain, u, trajectory[i-1].x, trajectory[i-1].y, false, true);
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.
if (u_see(trajectory[i].x, trajectory[i].y)) {
if (u_see(tx, ty)) {
if (i > 0)
{
m.drawsq(w_terrain, u, trajectory[i-1].x, trajectory[i-1].y, false, true);
}
char bullet = '*';
if (effects & mfb(AMMO_FLAME))
bullet = '#';
mvwputch(w_terrain, trajectory[i].y + VIEWY - u.posy,
trajectory[i].x + VIEWX - u.posx, c_red, bullet);
mvwputch(w_terrain, ty + VIEWY - u.posy, tx + VIEWX - u.posx, c_red, bullet);
wrefresh(w_terrain);
if (&p == &u)
nanosleep(&ts, NULL);
}
if (dam <= 0) { // Ran out of momentum.
ammo_effects(this, trajectory[i].x, trajectory[i].y, effects);
ammo_effects(this, tx, ty, effects);
if (is_bolt &&
((curammo->m1 == WOOD && !one_in(4)) ||
(curammo->m1 != WOOD && !one_in(15))))
m.add_item(trajectory[i].x, trajectory[i].y, ammotmp);
m.add_item(tx, ty, ammotmp);
if (weapon->num_charges() == 0)
weapon->curammo = NULL;
return;
}
int tx = trajectory[i].x, ty = trajectory[i].y;
// If there's a monster in the path of our bullet, and either our aim was true,
// OR it's not the monster we were aiming at and we were lucky enough to hit it
int mondex = mon_at(tx, ty);
@@ -338,23 +346,16 @@ void game::fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
m.shoot(this, tx, ty, dam, i == trajectory.size() - 1, effects);
} // Done with the trajectory!
int lastx = trajectory[trajectory.size() - 1].x;
int lasty = trajectory[trajectory.size() - 1].y;
// if damage is zero, ammo field effects should not take hold
// to prevent flamethrowers igniting the target, even if the flame
// does not hit the target
if (dam != 0)
ammo_effects(this, lastx, lasty, effects);
ammo_effects(this, tx, ty, effects);
if (m.move_cost(lastx, lasty) == 0) {
lastx = trajectory[trajectory.size() - 2].x;
lasty = trajectory[trajectory.size() - 2].y;
if (m.move_cost(tx, ty) == 0) {
tx = px;
ty = py;
}
if (is_bolt &&
((curammo->m1 == WOOD && !one_in(5)) ||
(curammo->m1 != WOOD && !one_in(15)) ))
m.add_item(lastx, lasty, ammotmp);
m.add_item(tx, ty, ammotmp);
}
if (weapon->num_charges() == 0)
@@ -522,9 +523,7 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
item *relevent)
{
std::vector<point> ret;
int tarx, tary, tart, junk;
// TODO: [lightmap] Enable auto targeting based on lightmap
int sight_dist = u.sight_range(light_level());
int tarx, tary, junk;
// First, decide on a target among the monsters, if there are any in range
if (t.size() > 0) {
@@ -560,7 +559,7 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
} else {
wprintz(w_target, c_red, "Throwing %s", relevent->tname().c_str());
}
}
}
wprintz(w_target, c_white, " >");
/* Annoying clutter @ 2 3 4. */
mvwprintz(w_target, 9, 1, c_white,
@@ -575,59 +574,51 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
wrefresh(w_target);
char ch;
bool snap_to_target = OPTIONS[OPT_SNAP_TO_TARGET];
// The main loop.
do {
point center;
if (snap_to_target)
center = point(x, y);
else
center = point(u.posx, u.posy);
// Clear the target window.
// for (int i = 5; i < 12; i++) {
// Clear the target window.
for (int i = 1; i < 8; i++) {
for (int j = 1; j < 46; j++)
mvwputch(w_target, i, j, c_white, ' ');
}
m.build_map_cache(this);
m.draw(this, w_terrain, center);
// Draw the Monsters
// Draw the Monsters
for (int i = 0; i < z.size(); i++) {
if (u_see(&(z[i])) && z[i].posx >= lowx && z[i].posy >= lowy &&
z[i].posx <= hix && z[i].posy <= hiy)
if (u_see(&(z[i]))) {
z[i].draw(w_terrain, center.x, center.y, false);
}
}
// Draw the NPCs
// Draw the NPCs
for (int i = 0; i < active_npc.size(); i++) {
if (u_see(active_npc[i]->posx, active_npc[i]->posy))
active_npc[i]->draw(w_terrain, center.x, center.y, false);
}
if (x != u.posx || y != u.posy) {
// Calculate the return vector (and draw it too)
/*
for (int i = 0; i < ret.size(); i++)
m.drawsq(w_terrain, u, ret[i].x, ret[i].y, false, true, center.x, center.y);
*/
// Draw the player
// Draw the player
int atx = VIEWX + u.posx - center.x, aty = VIEWY + u.posy - center.y;
if (atx >= 0 && atx < TERRAIN_WINDOW_WIDTH && aty >= 0 && aty < TERRAIN_WINDOW_HEIGHT)
mvwputch(w_terrain, aty, atx, u.color(), '@');
if (m.sees(u.posx, u.posy, x, y, -1, tart)) {// Selects a valid line-of-sight
ret = line_to(u.posx, u.posy, x, y, tart); // Sets the vector to that LOS
// Draw the trajectory
// Only draw a highlighted trajectory if we can see the endpoint.
// Provides feedback to the player, and avoids leaking information about tiles they can't see.
if (u_see( x, y)) {
ret = line_to(u.posx, u.posy, x, y, 0);
for (int i = 0; i < ret.size(); i++) {
if (abs(ret[i].x - u.posx) <= sight_dist &&
abs(ret[i].y - u.posy) <= sight_dist ) {
int mondex = mon_at(ret[i].x, ret[i].y),
npcdex = npc_at(ret[i].x, ret[i].y);
// NPCs and monsters get drawn with inverted colors
// NPCs and monsters get drawn with inverted colors
if (mondex != -1 && u_see(&(z[mondex])))
z[mondex].draw(w_terrain, center.x, center.y, true);
else if (npcdex != -1)
active_npc[npcdex]->draw(w_terrain, center.x, center.y, true);
else
m.drawsq(w_terrain, u, ret[i].x, ret[i].y, true,true,center.x, center.y);
}
}
}
@@ -639,13 +630,11 @@ std::vector<point> game::target(int &x, int &y, int lowx, int lowy, int hix,
mvwprintw(w_target, 1, 1, "Range: %d", rl_dist(u.posx, u.posy, x, y));
if (mon_at(x, y) == -1) {
// what? mvwprintw(w_status, 0, 9, " ");
if (snap_to_target)
mvwputch(w_terrain, VIEWY, VIEWX, c_red, '*');
else
mvwputch(w_terrain, y + VIEWY - u.posy, x + VIEWX - u.posx, c_red, '*');
} else if (u_see(&(z[mon_at(x, y)]))) {
// mvwprintw(w_target, 0, 1, "< %s >", z[mon_at(x, y)].name().c_str() );
z[mon_at(x, y)].print_info(this, w_target,2);
}
}
@@ -1048,38 +1037,44 @@ void splatter(game *g, std::vector<point> trajectory, int dam, monster* mon)
}
}
void ammo_effects(game *g, int x, int y, long effects)
{
if (effects & mfb(AMMO_EXPLOSIVE))
g->explosion(x, y, 24, 0, false);
void ammo_effects(game *g, int x, int y, long effects) {
if (effects & mfb(AMMO_EXPLOSIVE))
g->explosion(x, y, 24, 0, false);
if (effects & mfb(AMMO_FRAG))
g->explosion(x, y, 12, 28, false);
if (effects & mfb(AMMO_FRAG))
g->explosion(x, y, 12, 28, false);
if (effects & mfb(AMMO_NAPALM))
g->explosion(x, y, 18, 0, true);
if (effects & mfb(AMMO_NAPALM))
g->explosion(x, y, 18, 0, true);
if (effects & mfb(AMMO_EXPLOSIVE_BIG))
g->explosion(x, y, 40, 0, false);
if (effects & mfb(AMMO_TEARGAS)) {
for (int i = -2; i <= 2; i++) {
for (int j = -2; j <= 2; j++)
g->m.add_field(g, x + i, y + j, fd_tear_gas, 3);
if (effects & mfb(AMMO_ACIDBOMB)) {
for (int i = x - 1; i <= x + 1; i++) {
for (int j = y - 1; j <= y + 1; j++) {
g->m.add_field(g, i, j, fd_acid, 3);
}
}
}
}
if (effects & mfb(AMMO_SMOKE)) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++)
g->m.add_field(g, x + i, y + j, fd_smoke, 3);
if (effects & mfb(AMMO_EXPLOSIVE_BIG))
g->explosion(x, y, 40, 0, false);
if (effects & mfb(AMMO_TEARGAS)) {
for (int i = -2; i <= 2; i++) {
for (int j = -2; j <= 2; j++)
g->m.add_field(g, x + i, y + j, fd_tear_gas, 3);
}
}
}
if (effects & mfb(AMMO_FLASHBANG))
g->flashbang(x, y);
if (effects & mfb(AMMO_SMOKE)) {
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++)
g->m.add_field(g, x + i, y + j, fd_smoke, 3);
}
}
if (effects & mfb(AMMO_FLAME))
g->explosion(x, y, 4, 0, true);
if (effects & mfb(AMMO_FLASHBANG))
g->flashbang(x, y);
if (effects & mfb(AMMO_FLAME))
g->explosion(x, y, 4, 0, true);
}
+14 -58
View File
@@ -111,50 +111,13 @@ SkillLevel::SkillLevel(int minLevel, int maxLevel, int minExercise, int maxExerc
}
}
int SkillLevel::comprehension(int intellect, bool fastLearner) {
if (intellect == 0)
return 0;
void SkillLevel::train(int amount) {
_exercise += amount;
int base_comprehension;
if (intellect <= 8) {
base_comprehension = intellect * 10;
} else {
base_comprehension = 80 + (intellect - 8) * 8;
}
if (fastLearner) {
base_comprehension = base_comprehension / 2 * 3;
}
int skill_penalty;
if (_level <= intellect / 2) {
skill_penalty = 0;
} else if (_level <= intellect) {
skill_penalty = _level;
} else {
skill_penalty = _level * 2;
}
if (skill_penalty >= base_comprehension) {
return 1;
} else {
return base_comprehension - skill_penalty;
}
}
int SkillLevel::train(int &level) {
++_exercise;
if (_exercise >= 100) {
if (_exercise >= 100 * (_level + 1)) {
_exercise = 0;
++_level;
}
level = _level;
return _exercise;
}
static int rustRate(int level)
@@ -180,11 +143,11 @@ bool SkillLevel::rust(const calendar& turn, bool forgetful, bool charged_bio_mem
if (OPTIONS[OPT_SKILL_RUST] == 0 || _exercise > 0)
{
if (charged_bio_mem) return one_in(5);
--_exercise;
_exercise -= _level;
if (_exercise < 0)
{
_exercise = 99;
_exercise = (100 * _level) - 1;
--_level;
}
}
@@ -198,23 +161,16 @@ void SkillLevel::practice(const calendar& turn)
_lastPracticed = turn;
}
int SkillLevel::readBook(int minimumGain, int maximumGain, const calendar& turn,
int maximumLevel)
void SkillLevel::readBook(int minimumGain, int maximumGain, const calendar &turn,
int maximumLevel)
{
int gain = rng(minimumGain, maximumGain);
int gain = rng(minimumGain, maximumGain);
int level;
for (int i = 0; i < gain; ++i) {
train(level);
if (level >= maximumLevel)
break;
}
practice(turn);
return _exercise;
if (_level < maximumLevel)
{
train(gain);
}
practice(turn);
}
@@ -229,7 +185,7 @@ std::istream& operator>>(std::istream& is, SkillLevel& obj) {
}
std::ostream& operator<<(std::ostream& os, const SkillLevel& obj) {
os << obj.level() << " " << obj.exercise() << " "
os << obj.level() << " " << obj.exercise(true) << " "
<< obj.isTraining() << " " << obj.lastPracticed() << " ";
return os;
+3 -5
View File
@@ -73,18 +73,16 @@ class SkillLevel {
int level() const { return _level; }
int level(int plevel) { _level = plevel; return plevel; }
int exercise() const { return _exercise; }
int exercise(bool raw = false) const { return raw ? _exercise : _exercise / (_level + 1); }
int lastPracticed() const { return _lastPracticed; }
int comprehension(int intellect, bool fastLearner = false);
int train(int &level);
void train(int amount);
bool isRusting(const calendar& turn) const;
bool rust(const calendar& turn, bool forgetful, bool charged_bio_mem);
void practice(const calendar& turn);
int readBook(int minimumGain, int maximumGain, const calendar& turn, int maximumLevel = 0xFFFFFFFF);
void readBook(int minimumGain, int maximumGain, const calendar& turn, int maximumLevel = 0xFFFFFFFF);
bool operator==(const SkillLevel& b) const { return this->_level == b._level && this->_exercise == b._exercise; }
bool operator< (const SkillLevel& b) const { return this->_level < b._level || (this->_level == b._level && this->_exercise < b._exercise); }
+2 -1
View File
@@ -1,6 +1,7 @@
/* Needs to come before tap lib for some reason? */
#include "player.h"
#include "game.h"
#include "overmapbuffer.h"
#include "item_factory.h"
/* libtap doesn't extern C their headers, so we do it for them. */
@@ -77,7 +78,7 @@ int main(int argc, char *argv[])
dummy.name = "dummy";
fakeworld.m = map( &fakeworld.itypes, &fakeworld.mapitems, &fakeworld.traps );
fakeworld.u = dummy;
fakeworld.cur_om = overmap( &fakeworld, 0, 0 );
fakeworld.cur_om = &overmap_buffer.get(&fakeworld, 0, 0);
fakeworld.m.load( &fakeworld, fakeworld.levx, fakeworld.levy, fakeworld.levz );
+1 -1
View File
@@ -168,7 +168,7 @@ void trapfuncm::crossbow(game *g, monster *z, int x, int y)
g->m.spawn_item(x, y, g->itypes["crossbow"], 0);
g->m.spawn_item(x, y, g->itypes["string_6"], 0);
if (add_bolt)
g->m.spawn_item(x, y, g->itypes["bolt_steel"], 0);
g->m.spawn_item(x, y, g->itypes["bolt_steel"], 0, 0, 1);
}
void trapfunc::shotgun(game *g, int x, int y)
+1 -1
View File
@@ -164,7 +164,7 @@ void tutorial_game::post_action(game *g, action_id act)
itype *it = g->itypes[ g->u.last_item];
if (it->is_armor()) {
it_armor *armor = dynamic_cast<it_armor*>(it);
if (armor->dmg_resist >= 2 || armor->cut_resist >= 4)
if (armor->coverage >= 2 || armor->thickness >= 2)
add_message(g, LESSON_WORE_ARMOR);
if (armor->storage >= 20)
add_message(g, LESSON_WORE_STORAGE);
+38 -8
View File
@@ -69,7 +69,7 @@ void veh_interact::exec (game *gm, vehicle *v, int x, int y)
}
wrefresh(w_grid);
crafting_inv = gm->crafting_inventory();
crafting_inv = gm->crafting_inventory(&gm->u);
int charges = ((it_tool *) g->itypes["welder"])->charges_per_use;
has_wrench = crafting_inv.has_amount("wrench", 1) ||
@@ -81,6 +81,7 @@ void veh_interact::exec (game *gm, vehicle *v, int x, int y)
(crafting_inv.has_amount("toolset", 1) &&
crafting_inv.has_charges("toolset", charges/20));
has_jack = crafting_inv.has_amount("jack", 1);
has_siphon = crafting_inv.has_amount("hose", 1);
display_stats ();
@@ -110,6 +111,7 @@ void veh_interact::exec (game *gm, vehicle *v, int x, int y)
case 'f': do_refill(mval); break;
case 'o': do_remove(mval); break;
case 'e': do_rename(mval); break;
case 's': do_siphon(mval); break;
default:;
}
if (sel_cmd != ' ')
@@ -159,6 +161,8 @@ int veh_interact::cant_do (char mode)
0 )
)
);
case 's': // siphon mode
return veh->fuel_left(AT_GAS) > 0 ? (!has_siphon? 2 : 0) : 1;
default:
return -1;
}
@@ -457,6 +461,26 @@ void veh_interact::do_remove(int reason)
}
}
void veh_interact::do_siphon(int reason)
{
werase (w_msg);
switch (reason)
{
case 1:
mvwprintz(w_msg, 0, 1, c_ltred, "The vehicle has no gasoline to siphon.");
wrefresh (w_msg);
return;
case 2:
mvwprintz(w_msg, 0, 1, c_ltgray, "You need a %s to siphon fuel.",
"hose");
mvwprintz(w_msg, 0, 12, c_red, "hose");
wrefresh (w_msg);
return;
default:;
}
sel_cmd = 's';
}
void veh_interact::do_rename(int reason)
{
std::string name = string_input_popup("Enter new vehicle name", 20);
@@ -655,6 +679,7 @@ void veh_interact::display_mode (char mode)
bool mr = !cant_do('r');
bool mf = !cant_do('f');
bool mo = !cant_do('o');
bool ms = !cant_do('s');
mvwprintz(w_mode, 0, 1, mi? c_ltgray : c_dkgray, "install");
mvwputch (w_mode, 0, 1, mi? c_ltgreen : c_green, 'i');
mvwprintz(w_mode, 0, 9, mr? c_ltgray : c_dkgray, "repair");
@@ -663,9 +688,11 @@ void veh_interact::display_mode (char mode)
mvwputch (w_mode, 0, 18, mf? c_ltgreen : c_green, 'f');
mvwprintz(w_mode, 0, 23, mo? c_ltgray : c_dkgray, "remove");
mvwputch (w_mode, 0, 26, mo? c_ltgreen : c_green, 'o');
mvwprintz(w_mode, 0, 30, ms? c_ltgray : c_dkgray, "siphon");
mvwputch (w_mode, 0, 30, ms? c_ltgreen : c_green, 's');
}
mvwprintz(w_mode, 0, 30, c_ltgray, "rename");
mvwputch (w_mode, 0, 31, c_ltgreen, 'e');
mvwprintz(w_mode, 0, 37, c_ltgray, "rename");
mvwputch (w_mode, 0, 38, c_ltgreen, 'e');
mvwprintz(w_mode, 0, 71, c_ltgreen, "ESC");
mvwprintz(w_mode, 0, 74, c_ltgray, "-back");
wrefresh (w_mode);
@@ -814,7 +841,7 @@ void complete_vehicle (game *g)
if(type!=SEL_JACK) {
tools.push_back(component("welder", welder_charges));
tools.push_back(component("toolset", welder_charges/20));
g->consume_tools(tools);
g->consume_tools(&g->u, tools, true);
g->add_msg ("You install a %s into the %s.",
vpart_list[part].name, veh->name.c_str());
g->u.practice (g->turn, "mechanics", vpart_list[part].difficulty * 5 + 20);
@@ -827,15 +854,15 @@ void complete_vehicle (game *g)
if (veh->parts[part].hp <= 0)
{
used_item = consume_vpart_item (g, veh->parts[part].id);
tools.push_back(component("wrench", 1));
g->consume_tools(tools);
tools.push_back(component("wrench", -1));
g->consume_tools(&g->u, tools, true);
tools.clear();
dd = 0;
veh->insides_dirty = true;
}
tools.push_back(component("welder", welder_charges));
tools.push_back(component("toolset", welder_charges/20));
g->consume_tools(tools);
g->consume_tools(&g->u, tools, true);
veh->parts[part].hp = veh->part_info(part).durability;
g->add_msg ("You repair the %s's %s.",
veh->name.c_str(), veh->part_info(part).name);
@@ -880,7 +907,10 @@ void complete_vehicle (game *g)
veh->part_info(part).name, veh->name.c_str());
veh->remove_part (part);
}
//break;
break;
case 's':
g->u.siphon_gas(g, veh);
break;
default:;
}
}
+2
View File
@@ -53,6 +53,7 @@ private:
bool has_welder;
bool has_hacksaw;
bool has_jack;
bool has_siphon;
inventory crafting_inv;
int part_at (int dx, int dy);
@@ -64,6 +65,7 @@ private:
void do_refill(int reason);
void do_remove(int reason);
void do_rename(int reason);
void do_siphon(int reason);
void display_veh ();
void display_stats ();
+7 -1
View File
@@ -14,6 +14,7 @@ enum vpart_id
// external parts
vp_seat,
vp_saddle,
vp_bed,
vp_frame_h,
vp_frame_v,
@@ -97,6 +98,7 @@ enum vpart_flags
vpf_mount_point, // allows mounting other parts to it
vpf_mount_inner, // allows mounting internal parts inside it (or over it)
vpf_mount_over, // allows mounting parts like cargo trunk over it
vpf_anchor_point, // Allows secure attachment of a seatbelt
vpf_opaque, // can't see through it
vpf_obstacle, // can't pass through it
vpf_openable, // can open/close it
@@ -164,7 +166,10 @@ const vpart_info vpart_list[num_vparts] =
{ "null part", '?', c_red, '?', c_red, 100, 100, 0, 0, "null", 0,
0 },
{ "seat", '#', c_red, '*', c_red, 60, 300, 0, 0, "seat", 1,
mfb(vpf_over) | mfb(vpf_seat) | mfb(vpf_cargo) | mfb(vpf_no_reinforce) },
mfb(vpf_over) | mfb(vpf_seat) | mfb(vpf_cargo) |
mfb(vpf_no_reinforce) | mfb(vpf_anchor_point) },
{ "saddle", '#', c_red, '*', c_red, 20, 200, 0, 0, "saddle", 1,
mfb(vpf_over) | mfb(vpf_seat) | mfb(vpf_no_reinforce) },
{ "bed", '#', c_magenta, '*', c_magenta, 60, 300, 0, 0, "seat", 1,
mfb(vpf_over) | mfb(vpf_bed) | mfb(vpf_cargo) | mfb(vpf_no_reinforce) },
{ "frame", 'h', c_ltgray, '#', c_ltgray, 100, 400, 0, 0, "frame", 1,
@@ -324,6 +329,7 @@ enum vhtype_id
veh_scooter, //Vespa S50 scooter.
veh_armytruck, //Army M35A2 6L gas and/or hydrogen engine if commented parts uncommented.
veh_schoolbus, //Standard schoolbus
veh_car_electric, // electric version of standard car.
num_vehicles
};
+79 -10
View File
@@ -46,7 +46,7 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_saddle);
PART (0, 0, vp_controls);
PART (0, 0, vp_engine_foot_crank);
PART (1, 0, vp_wheel_bicycle);
@@ -62,7 +62,7 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_saddle);
PART (1, 0, vp_frame_handle);
PART (1, 0, vp_fuel_tank_gas);
PART (-1, 0, vp_wheel_motorbike);
@@ -75,7 +75,7 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_saddle);
PART (0, 0, vp_controls);
PART (0, 0, vp_engine_gas_v2);
PART (1, 0, vp_frame_handle);
@@ -93,7 +93,7 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_saddle);
PART (0, 0, vp_controls);
PART (1, 0, vp_frame_cover);
PART (1, 0, vp_engine_gas_v2);
@@ -116,7 +116,7 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_saddle);
PART (1, 0, vp_frame_cover);
PART (-1,0, vp_frame_h);
PART (1, -1, vp_wheel_motorbike);
@@ -217,7 +217,7 @@ void game::init_vehicles()
// 0-^-0
// |"""|
// +###+
// |---|
// |"""|
// |HHH|
// 0HHH0
@@ -255,9 +255,12 @@ void game::init_vehicles()
PART (2, -2, vp_wheel_wide);
PART (2, 2, vp_wheel_wide);
PART (-1, -1, vp_board_h);
PART (-1, 0, vp_board_h);
PART (-1, 1, vp_board_h);
PART (-1, -1, vp_frame_h);
PART (-1, -1, vp_window);
PART (-1, 0, vp_frame_h);
PART (-1, 0, vp_window);
PART (-1, 1, vp_frame_h);
PART (-1, 1, vp_window);
PART (-1, -2, vp_board_b);
PART (-1, -2, vp_fuel_tank_gas);
PART (-1, 2, vp_board_n);
@@ -377,7 +380,9 @@ void game::init_vehicles()
PART (4, -1, vp_frame_v2);
PART (4, -1, vp_engine_gas_v8);
PART (4, 1, vp_frame_h);
PART (4, 1, vp_head_light);
PART (4, -2, vp_frame_h);
PART (4, -2, vp_head_light);
PART (4, 2, vp_wheel_wide);
PART (4, -3, vp_wheel_wide);
@@ -636,7 +641,8 @@ void game::init_vehicles()
// dx, dy, part_id
PART (0, 0, vp_frame_handle);
PART (0, 0, vp_seat);
PART (0, 0, vp_head_light);
PART (0, 0, vp_saddle);
PART (0, 0, vp_engine_gas_1cyl);
PART (0, 0, vp_fuel_tank_gas);
PART (0, 0, vp_controls);
@@ -721,7 +727,9 @@ void game::init_vehicles()
PART (3, 0, vp_frame_v2);
PART (3, -1, vp_frame_h);
PART (3, -1, vp_head_light);
PART (3, 1, vp_frame_h);
PART (3, 1, vp_head_light);
PART (3, 0, vp_engine_gas_v8);
PART (3, 0, vp_steel_plate);
// switch for hydrogen fuel or use both and change (3,0) to (3,1) and (3,-1)
@@ -921,6 +929,67 @@ void game::init_vehicles()
PART ( -8, 2, vp_frame_h);
PART ( -8, 2, vp_window);
// name
VEHICLE ("Car");
// o--o
// |""|
// +##+
// +##+
// #HH#
// o++o
// dx, dy, part_id
PART (0, 0, vp_frame_v2);
PART (0, 0, vp_seat);
PART (0, 0, vp_seatbelt);
PART (0, 0, vp_controls);
PART (0, 0, vp_roof);
PART (0, 1, vp_frame_v2);
PART (0, 1, vp_seat);
PART (0, 1, vp_seatbelt);
PART (0, 1, vp_roof);
PART (0, -1, vp_door);
PART (0, 2, vp_door);
PART (-1, 0, vp_frame_v2);
PART (-1, 0, vp_seat);
PART (-1, 0, vp_seatbelt);
PART (-1, 0, vp_roof);
PART (-1, 1, vp_frame_v2);
PART (-1, 1, vp_seat);
PART (-1, 1, vp_seatbelt);
PART (-1, 1, vp_roof);
PART (-1, -1, vp_door);
PART (-1, 2, vp_door);
PART (1, 0, vp_frame_h);
PART (1, 0, vp_window);
PART (1, 0, vp_head_light);
PART (1, 1, vp_frame_h);
PART (1, 1, vp_window);
PART (1, 1, vp_head_light);
PART (1, -1, vp_frame_v);
PART (1, 2, vp_frame_v);
PART (2, 0, vp_frame_h);
PART (2, 0, vp_engine_motor_large);
PART (2, 1, vp_frame_h);
PART (2, -1, vp_wheel);
PART (2, 2, vp_wheel);
PART (-2, 0, vp_frame_v);
PART (-2, 0, vp_cargo_trunk);
PART (-2, 0, vp_roof);
PART (-2, 1, vp_frame_v);
PART (-2, 1, vp_cargo_trunk);
PART (-2, 1, vp_roof);
PART (-2, -1, vp_board_v);
PART (-2, -1, vp_fuel_tank_batt);
PART (-2, -1, vp_solar_panel);
PART (-2, 2, vp_board_v);
PART (-2, 2, vp_fuel_tank_batt);
PART (-2, 2, vp_solar_panel);
PART (-3, -1, vp_wheel);
PART (-3, 0, vp_door);
PART (-3, 1, vp_door);
PART (-3, 2, vp_wheel);
if (vtypes.size() != num_vehicles)
debugmsg("%d vehicles, %d types", vtypes.size(), num_vehicles);
}
+33 -15
View File
@@ -60,7 +60,7 @@ bool vehicle::player_in_control (player *p)
void vehicle::load (std::ifstream &stin)
{
int t;
int fdir, mdir, skd, prts, cr_on;
int fdir, mdir, skd, prts, cr_on, li_on;
stin >>
t >>
posx >>
@@ -71,6 +71,7 @@ void vehicle::load (std::ifstream &stin)
velocity >>
cruise_velocity >>
cr_on >>
li_on >>
turret_mode >>
skd >>
of_turn_carry >>
@@ -80,6 +81,7 @@ void vehicle::load (std::ifstream &stin)
move.init (mdir);
skidding = skd != 0;
cruise_on = cr_on != 0;
lights_on = li_on != 0;
std::string databuff;
getline(stin, databuff); // Clear EoL
getline(stin, name); // read name
@@ -135,6 +137,7 @@ void vehicle::save (std::ofstream &stout)
velocity << " " <<
cruise_velocity << " " <<
(cruise_on? 1 : 0) << " " <<
(lights_on? 1 : 0) << " " <<
turret_mode << " " <<
(skidding? 1 : 0) << " " <<
of_turn_carry << " " <<
@@ -171,10 +174,10 @@ void vehicle::init_state(game* g, int init_veh_fuel, int init_veh_status)
memset (consistent_bignesses, 0, sizeof(consistent_bignesses));
// veh_fuel_multiplier is percentage of fuel
// 0 is empty, 100 is full tank, -1 is random 10% to 75%
// 0 is empty, 100 is full tank, -1 is random 1% to 7%
int veh_fuel_mult = init_veh_fuel;
if (init_veh_fuel == - 1)
veh_fuel_mult = (rng (10,75)/10);
veh_fuel_mult = rng (1,7);
if (init_veh_fuel > 100)
veh_fuel_mult = 100;
@@ -347,32 +350,42 @@ bool vehicle::can_mount (int dx, int dy, vpart_id id)
}
if (!n3ar)
{
// debugmsg ("can_mount%d(%d,%d): no point to mount", id, dx, dy);
return false; // no point to mount
}
// TODO: seatbelts must require an obstacle part n3arby
std::vector<int> parts_here = parts_at_relative (dx, dy);
if (parts_here.size() < 1)
{
int res = vpart_list[id].flags & mfb(vpf_external);
// if (!res)
// debugmsg ("can_mount: not first or external");
return res; // can be mounted if first and external
}
int flags1 = part_info(parts_here[0]).flags;
if ((vpart_list[id].flags & mfb(vpf_armor)) && flags1 & mfb(vpf_no_reinforce))
{
// debugmsg ("can_mount: armor plates on non-reinforcable part");
return false; // trying to put armor plates on non-reinforcable part
}
// Seatbelts require an anchor point
if( vpart_list[id].flags & mfb(vpf_seatbelt) )
{
bool anchor_found = false;
for( std::vector<int>::iterator it = parts_here.begin();
it != parts_here.end(); ++it )
{
if( part_info(*it).flags & mfb(vpf_anchor_point) )
{
anchor_found = true;
}
}
if( anchor_found == false)
{
return false;
}
}
for (int vf = vpf_func_begin; vf <= vpf_func_end; vf++)
if ((vpart_list[id].flags & mfb(vf)) && part_with_feature(parts_here[0], vf, false) >= 0)
{
// debugmsg ("can_mount%d(%d,%d): already has inner part with same unique feature",id, dx, dy);
return false; // this part already has inner part with same unique feature
}
@@ -384,11 +397,6 @@ bool vehicle::can_mount (int dx, int dy, vpart_id id)
return true; // can mount as internal part or over it
if (allow_over && this_over)
return true; // can mount as part over
// debugmsg ("can_mount%d(%d,%d): allow_i=%c allow_o=%c this_i=%c this_o=%c", id, dx, dy,
// allow_inner? 'y' : 'n',
// allow_over? 'y' : 'n',
// this_inner? 'y' : 'n',
// this_over? 'y' : 'n');
return false;
}
@@ -1636,6 +1644,16 @@ bool vehicle::add_item (int part, item itm)
ammo->type == AT_GAS ||
ammo->type == AT_PLASMA))
return false;
if(itm.charges != -1 && (itm.is_food() || itm.is_ammo())) {
for (int i = 0; i < parts[part].items.size(); i++) {
if(parts[part].items[i].type->id == itm.type->id ) {
parts[part].items[i].charges+=itm.charges;
return true;
}
}
}
parts[part].items.push_back (itm);
return true;
}

Some files were not shown because too many files have changed in this diff Show More