Compare commits
190 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 625a0ec5ec | |||
| 6b79ead016 | |||
| f2504649e9 | |||
| b4326d972d | |||
| 2f23974f81 | |||
| 26c4be927a | |||
| 87baa3cc79 | |||
| 189354b8e9 | |||
| 345c1c0d27 | |||
| c98ee8dbef | |||
| 6b2ab31824 | |||
| 31ad94a1ee | |||
| 33f71fa042 | |||
| 8e35b4dd35 | |||
| 47de02a172 | |||
| 256f1a99de | |||
| 1361276e1a | |||
| 54a996a989 | |||
| d13493e7fe | |||
| d1f3bd9938 | |||
| cb164a8236 | |||
| 88a9b6ce7b | |||
| 97b6d7e4cf | |||
| cf3250e11b | |||
| d1cf4fcf61 | |||
| afd99f6ec0 | |||
| fcfe75b906 | |||
| 17d955042f | |||
| 1a72165a2c | |||
| 834754b3a3 | |||
| 160bd243a6 | |||
| ba6c7353d9 | |||
| 90c1b7b5c1 | |||
| b83267d257 | |||
| c9915d2b0b | |||
| bb38735679 | |||
| 1f2ba5df16 | |||
| 04850d017f | |||
| ac04d717af | |||
| ddbb41e71a | |||
| 856e285427 | |||
| 3d0816a284 | |||
| c1d8ec0cd2 | |||
| dc817bf2b9 | |||
| 9452acb749 | |||
| c850ae3aea | |||
| 7e43f1bfbf | |||
| d0f8c7c6a9 | |||
| 1e3420aa8f | |||
| 62185ef48b | |||
| e851085b9b | |||
| 748a5ed5b5 | |||
| 4b62a06af9 | |||
| f191347e05 | |||
| a195028061 | |||
| 72ccb94cba | |||
| 53541e8e38 | |||
| 40d1691b40 | |||
| d38c685772 | |||
| b56181e59f | |||
| 8496a93690 | |||
| 3984f0197f | |||
| 73827b40c8 | |||
| 42e34087fc | |||
| 7292ac7b92 | |||
| 931236ec82 | |||
| d25a043958 | |||
| 8c2f5c109a | |||
| f2834c0079 | |||
| 487a686c9a | |||
| 5f8eb8d704 | |||
| 8ee5a039d9 | |||
| 6f62316525 | |||
| e86adb7b4a | |||
| bc139be5ac | |||
| 89606d54f1 | |||
| afaeab92a6 | |||
| e2a81e3626 | |||
| 80c519df6b | |||
| 85b70b1bef | |||
| 10c7b24130 | |||
| 725700952e | |||
| 386d664d2f | |||
| d17b905747 | |||
| f6d198b4fb | |||
| 5e81da6827 | |||
| 8c6b82564a | |||
| dd72f62e06 | |||
| 90dd579372 | |||
| c3c77d79ed | |||
| 128d69039e | |||
| 668ca4d4d5 | |||
| 33e7dc1b04 | |||
| 856b06a9d7 | |||
| 6a95b78584 | |||
| b5631470ad | |||
| 757e29b223 | |||
| 6e17b80cd2 | |||
| d9e8b3bb17 | |||
| 3889ef8d11 | |||
| 9d16ab056b | |||
| 339b665712 | |||
| 71c2f0acf9 | |||
| 6c79e7fb41 | |||
| 98220d224f | |||
| c57923f1a9 | |||
| 13beb3e0f4 | |||
| c5e612a48b | |||
| 14cd8db985 | |||
| 194c87c271 | |||
| d5478c5d26 | |||
| ffd16169a8 | |||
| 69321de26f | |||
| 2608758799 | |||
| 1d2f7bff6b | |||
| b7eb63e481 | |||
| c9efd9e07d | |||
| 2fbb555d1f | |||
| d05bb314c6 | |||
| a8202034ed | |||
| a072ef1ac8 | |||
| c779eaa368 | |||
| e252913a04 | |||
| a7a4b27974 | |||
| db309cab30 | |||
| 44eb59a505 | |||
| dedf57fac0 | |||
| e398f9bafd | |||
| 979b06b3d7 | |||
| 764717a692 | |||
| 955ddf5a68 | |||
| c11694c8f5 | |||
| 71c137cb7b | |||
| 236a8eaf2b | |||
| 11584605aa | |||
| 7ba6ddd36c | |||
| 1919ec2d1f | |||
| 4e0431a322 | |||
| 32dfe1835c | |||
| 39c70d5215 | |||
| 53f46d6cbc | |||
| cac6b77701 | |||
| 10a53e345e | |||
| 858cb2c70c | |||
| 55917f29ee | |||
| 8e298bf3c8 | |||
| 2cd7f3b231 | |||
| df8b9c496b | |||
| 26ed97b25e | |||
| 89b144fe69 | |||
| 7a090660f0 | |||
| 1b864a9a90 | |||
| f302db99fd | |||
| aa71c25eee | |||
| 8ddb42e3b7 | |||
| 3d3b660f35 | |||
| b648d80e52 | |||
| aa744bfc9d | |||
| 157c2f3ebc | |||
| 0277830d44 | |||
| 4478b07e9c | |||
| 9fbd2684e8 | |||
| ad69d1bbbe | |||
| c83d72ee59 | |||
| 079f0e3cbc | |||
| 6d26f077ca | |||
| 884582f056 | |||
| dc01a8cb0b | |||
| 843e548735 | |||
| 3f8605b480 | |||
| fb5597ecc2 | |||
| c0f9e865bd | |||
| c406d589a4 | |||
| 2ca266e1f2 | |||
| 0ed563b102 | |||
| 114c25454b | |||
| eedabd57c2 | |||
| 07b6f36115 | |||
| f87bf17412 | |||
| 877552c3a4 | |||
| 07fcf7d196 | |||
| dff69f7269 | |||
| 9654131119 | |||
| ff4619146e | |||
| 0e366475a3 | |||
| b420f16e3c | |||
| 2d50f82c1b | |||
| 7e99570f41 | |||
| 51f537e2fc | |||
| 6e566bb0dd |
+216
@@ -0,0 +1,216 @@
|
||||
!src/chkjson
|
||||
*.7z
|
||||
*.a
|
||||
*.d
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.tmp
|
||||
*.zip
|
||||
*.apk
|
||||
/WinDepend/
|
||||
/bindist/
|
||||
/build/
|
||||
/build-start-time
|
||||
/cmake-build-debug/
|
||||
/config/
|
||||
/data/*.template
|
||||
/data/mods/user-default-mods.json
|
||||
/dep/
|
||||
/doxygen_doc/html/*
|
||||
/doxygen_doc/latex/*
|
||||
/font/
|
||||
/graveyard/
|
||||
/memorial/
|
||||
/mods/
|
||||
/obj/
|
||||
/objwin/
|
||||
/save/
|
||||
/src/version.h
|
||||
/sound/
|
||||
/templates/
|
||||
/tools/format/json_formatter.cgi
|
||||
CataclysmWin.cscope_file_list
|
||||
CataclysmWin.depend
|
||||
CataclysmWin.layout
|
||||
cata_test
|
||||
cata_test-tiles
|
||||
cataclysm
|
||||
cataclysm-tiles
|
||||
cataclysm-vcpkg
|
||||
cataclysmdda-*
|
||||
chkjson*
|
||||
debug.log
|
||||
logg.txt
|
||||
json_formatter
|
||||
|
||||
# Visual Studio files
|
||||
*.code-workspace
|
||||
*.exp
|
||||
*.ilk
|
||||
*.opensdf
|
||||
*.pdb
|
||||
*.lib
|
||||
*.sdf
|
||||
*.suo
|
||||
*.user
|
||||
*.vcxproj.filters
|
||||
.vs/
|
||||
.vscode/
|
||||
Debug*/
|
||||
Release*/
|
||||
|
||||
# Distribution script results
|
||||
/msvc-full-features/distribution
|
||||
|
||||
# Visual Studio 2015
|
||||
/msvc-full-features/*db
|
||||
/msvc-full-features/ipch
|
||||
lnk*.tmp
|
||||
Cataclysm.exe.lastcodeanalysissucceeded
|
||||
|
||||
#Visual Studio 2017
|
||||
/msvc-full-features/PredictedInputCache_Debug_x64.dat
|
||||
|
||||
#vcpkg
|
||||
/msvc-full-features/vcpkg_installed
|
||||
/msvc-object_creator/vcpkg_installed
|
||||
|
||||
# PVS Studio
|
||||
/msvc-full-features/*PVS-Studio*
|
||||
|
||||
# Temporary and backup files
|
||||
*.bak
|
||||
*.cbTemp
|
||||
*.sw?
|
||||
*~
|
||||
\#*
|
||||
gmon.out
|
||||
|
||||
# System Files
|
||||
.DS_Store
|
||||
._.DS_Store
|
||||
Thumbs.db
|
||||
cscope.*
|
||||
tags
|
||||
|
||||
# Generated translation source
|
||||
/lang/po/cataclysm-dda.pot
|
||||
/lang/po/en.po
|
||||
|
||||
# Compiled binary translations
|
||||
/lang/mo/
|
||||
|
||||
# Directory for translatable strings
|
||||
/lang/json/*
|
||||
!/lang/json/README
|
||||
|
||||
# Netbeans IDE folders
|
||||
nbproject/
|
||||
|
||||
# Python runtime files
|
||||
*.pyc
|
||||
|
||||
# vim files
|
||||
*.vim
|
||||
*.session
|
||||
.ycm_extra_conf.py
|
||||
.vimrc
|
||||
|
||||
# taskwarrior files
|
||||
*.task*
|
||||
|
||||
# GitEye files
|
||||
*.project
|
||||
|
||||
# vimdiff backup
|
||||
*.orig
|
||||
|
||||
# OSX
|
||||
Cataclysm.app
|
||||
build-data/osx/AppIcon.icns
|
||||
Cataclysm.dmg
|
||||
|
||||
# Jetbrains CLion
|
||||
.idea/
|
||||
|
||||
# test executables and generated data
|
||||
/tests/obj
|
||||
/tests/cata_test
|
||||
/tests/line_test
|
||||
/tests/map_iterator_test
|
||||
/tests/shadowcasting_test
|
||||
/tests/data/jsionized_overmap.sav
|
||||
/test_user_dir
|
||||
monfactions.txt
|
||||
|
||||
# temporary files generated by tools/reduce_tests.sh
|
||||
/list_of_tests
|
||||
/list_of_tests.ok
|
||||
/log
|
||||
/multidelta.log
|
||||
|
||||
# static library used to link the test executable
|
||||
cataclysm.a
|
||||
|
||||
# coredumps
|
||||
*.core
|
||||
|
||||
# sublime-text workspace
|
||||
*.sublime-workspace
|
||||
|
||||
# cppcheck
|
||||
*cppcheck.xml
|
||||
*.cppcheck
|
||||
|
||||
# clang tooling
|
||||
compile_commands.json
|
||||
.clangd
|
||||
|
||||
# IDA database
|
||||
Cataclysm.i64
|
||||
Cataclysm.id*
|
||||
Cataclysm.til
|
||||
Cataclysm.nam
|
||||
|
||||
# Snapcraft build directories
|
||||
prime
|
||||
snap
|
||||
stage
|
||||
|
||||
# Snapcraft build file
|
||||
*.snap
|
||||
|
||||
# Eclipse IDE
|
||||
.cproject
|
||||
.settings/
|
||||
|
||||
# Apple Xcode IDE
|
||||
Xcode/
|
||||
|
||||
# gdb
|
||||
.gdb_history
|
||||
|
||||
# Flatpak build artifacts
|
||||
/.flatpak-builder/
|
||||
/repo/
|
||||
/build-dir/
|
||||
|
||||
# precompiled headers
|
||||
/pch/pch.hpp.pch
|
||||
/pch/main-pch.hpp.gch
|
||||
/pch/main-pch.hpp.pch
|
||||
/tests/pch/pch.hpp.pch
|
||||
/tests/pch/tests-pch.hpp.gch
|
||||
/tests/pch/tests-pch.hpp.pch
|
||||
/tests/catch/catch.hpp.gch
|
||||
/tests/catch/catch.hpp.pch
|
||||
weather.output
|
||||
|
||||
# bundler local directories and files for jekyll site
|
||||
/.bundle/
|
||||
/_site/
|
||||
/vendor/
|
||||
.sass-cache
|
||||
.jekyll-metadata
|
||||
Gemfile.lock
|
||||
@@ -0,0 +1 @@
|
||||
1e7d902c-02b7-4619-bf01-fe4b9c0ba8ca
|
||||
@@ -0,0 +1,28 @@
|
||||
source "https://rubygems.org"
|
||||
ruby RUBY_VERSION
|
||||
|
||||
# Hello! This is where you manage which Jekyll version is used to run.
|
||||
# When you want to use a different version, change it below, save the
|
||||
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
|
||||
#
|
||||
# bundle exec jekyll serve
|
||||
#
|
||||
# This will help ensure the proper Jekyll version is running.
|
||||
# Happy Jekylling!
|
||||
# gem "jekyll", "3.4.2"
|
||||
|
||||
# This is the default theme for new Jekyll sites. You may change this to anything you like.
|
||||
gem "minima", "~> 2.0"
|
||||
|
||||
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
|
||||
# uncomment the line below. To upgrade, run `bundle update github-pages`.
|
||||
gem "github-pages", group: :jekyll_plugins
|
||||
|
||||
# If you have any plugins, put them here!
|
||||
group :jekyll_plugins do
|
||||
gem "jekyll-feed", "~> 0.6"
|
||||
end
|
||||
|
||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
%
|
||||
Our chemical department has made great strides in the production of a
|
||||
concentrated mutagen, derived from samples of mutated individuals. This
|
||||
substance has been denoted PE012.
|
||||
%
|
||||
Our chemical department has perfected an untargeted stem cell treatment.
|
||||
Consumption of the treatment will reverse the effects of mutation, and may
|
||||
even cure congenital defects. This substance has been denoted PE018.
|
||||
%
|
||||
Both PE012 and PE018 show great stability. A subject was exposed to both
|
||||
substances, alternating between the mutagen and the purifier. Ultimately, the
|
||||
subject returned to baseline state with no apparent side effects.
|
||||
%
|
||||
We have made a fascinating discovery; by creating a miniature portal with low
|
||||
stability and high power, one can transpose into the 4th dimension and return
|
||||
immediately, but shifted by several meters. Our subjects oscillated so
|
||||
quickly that none were even aware that they had visited lower planes.
|
||||
%
|
||||
Our research on teleportation has ground to a halt. For some reason, the
|
||||
creation of a long-range transportation device eludes us, and one can transfer
|
||||
no further than 30 meters.
|
||||
%
|
||||
An incident occured in the teleportation lab, wherein a subject managed to
|
||||
teleport into another subject. The latter was completely destroyed from the
|
||||
inside out, while the former sustained little damage. I would like to explore
|
||||
the phenomenon further, but subjects are expensive.
|
||||
%
|
||||
Test subjects in the teleportation department are showing alarming symptoms.
|
||||
It seems prolonged rapid transposition along the 4th dimension weakens the
|
||||
forces holding one on this plane.
|
||||
%
|
||||
Catastrophe struck in our teleportation department yesterday. It seems that
|
||||
our test subjects are so detached from this plane that they create occasional
|
||||
tunnels along the 4th dimension, allowing life forms to transfer to this
|
||||
plane. All subjects with prolonged exposure have been terminated.
|
||||
%
|
||||
Our lifeform extraction program continues to produce samples of specimen
|
||||
XE037. It seems to be a kind of living, semi-sentient primordal ooze, and is
|
||||
the basis of much of the life we have found.
|
||||
%
|
||||
Specimen XE037, jokingly referred to as "the blob," has been observed entering
|
||||
a kind of dormant state, forming a depression in the floor. Hendelson stepped
|
||||
into one of these pits yesterday, and was immediately coated and attacked.
|
||||
%
|
||||
XE037 shows promise as a catalyst for both cloning and treatments that mimic
|
||||
stem cells. This is further evidence supporting Hendelson's theory of a near
|
||||
universal symbiotic relationship involving XE037.
|
||||
%
|
||||
Several of the more advanced specimens we have retrieved show stunning
|
||||
similarity to XE037. XE142 and XE157 in particular show the same amorphous,
|
||||
slime-like structure as XE037, suggesting a close genetic relationship.
|
||||
%
|
||||
Today we tested weaponry against XE142 and XE157, two amorphous subprime
|
||||
samples. Their form proved to be nearly invulnerable to projectile based
|
||||
weaponry, but they were susceptible to energy weapons and fire.
|
||||
%
|
||||
Our cloning department has failed to produce results. In vats containing stem
|
||||
cell treatments, XE037, and control vats, the subjects simple disintegrated.
|
||||
This suggests that XE037, while compatible with subprime lifeforms, shows only
|
||||
destructive effects on prime plane lifeforms.
|
||||
%
|
||||
The vivisection program has shown mixed results, revealing an incredible
|
||||
degree of variation in subplane lifeforms. Certain specimens have an internal
|
||||
structure that is amazingly similar to that of humans, while others seem to
|
||||
have no internal structure at all.
|
||||
%
|
||||
Our security department has identified several key flaws. Though our surface
|
||||
entrance is quite secure, there are several possible points of entrance below
|
||||
the surface, particularly in the sewage systems.
|
||||
%
|
||||
Today we applied a very small sample of XE037, suspended in water, to subject
|
||||
TP92, prior to necessary termination. During the postmortem examination, the
|
||||
subject went through a revivication progress, but displayed next to no human
|
||||
intelligence.
|
||||
%
|
||||
Mendelson shows a dismaying lack of organization and security consciousness.
|
||||
Containment of all samples of XE037 is of critical importance, as shown by
|
||||
contamination experiments.
|
||||
%
|
||||
Mendelson has been terminated following an incident with XE037. A substantial
|
||||
mobile sample departed his lab and encountered our security forces. Before
|
||||
the sample was destroyed, it managed to kill two men. Alarmingly, their
|
||||
corpses displayed mobility and extreme aggression.
|
||||
%
|
||||
We have created a new department to investigate the effects of XE037 on the
|
||||
human body, specifically to examine the revivification effect observed on two
|
||||
prior occasions. Sadly, our human subject pool is dwindling due to the short
|
||||
lifespan of subjects in this program. More will be acquired soon.
|
||||
%
|
||||
Testing XE037 on non-human mammal subjects does not appear to display the same
|
||||
revivifying effect, oddly enough. Acquiring non-human subjects, sadly, is a
|
||||
long and costly process, and research into this area is lacking.
|
||||
%
|
||||
After our curious results with testing XE037 on non-human mammals, we decided
|
||||
to introduce the substance to some of the insects which have found their way
|
||||
into the lab. Horrifyingly, XE037 caused near-instant mutation and gigantism
|
||||
in the insects, and security intervention was required.
|
||||
%
|
||||
Program S37ZBE, investigation of XE037 on inert human bodies, is making great
|
||||
strides. Recently we found that XE037 has no effect when introduced to a
|
||||
deceased body; revivication only occurs when the subject is exposed to XE037
|
||||
prior to expiration.
|
||||
%
|
||||
S37ZBE, the special investigation into the effects of XE037 on inert human
|
||||
bodies, has made terrific discoveries. It seems that it occasionally displays
|
||||
a mutagenic property which manifests itself after termination of the subject,
|
||||
resulting in a striking variety in postmortem morphology.
|
||||
%
|
||||
S37ZBE may be put on indefinate hold shortly. Postmortem morphological
|
||||
changes have reached extreme levels; this morning one subject nearly doubled
|
||||
in size, acquiring enough strength to reduce a concrete wall to rubble. It
|
||||
required a 6 man team, heavily armed, to re-terminate the subject.
|
||||
%
|
||||
Jakobson insists that S37ZBE must continue, despite the extreme security and
|
||||
safety risks. Nearly half our security forces have been redirected to the
|
||||
project, simply to deal with the occasional escape of a subject.
|
||||
%
|
||||
Jakobson was killed today by one of S37ZBE's subjects; ironic considering how
|
||||
hard he fought to keep the project active. Alarmingly, his corpse revivified
|
||||
immediately. This suggests that XE037 may have contaminated the lab at large.
|
||||
%
|
||||
Termination of a subject which was never a part of S37ZBE has confirmed my
|
||||
fears. XE037 has contaminated most if not all of the laboratory, most likely
|
||||
via the water supply. Research has started immediately into a process to
|
||||
destroy XE037 within the human body.
|
||||
%
|
||||
Despite a wide variety of treatments, we have been completely unsuccessful in
|
||||
removing XE037 from human subjects. Every individual displayed revivication
|
||||
post termination. Interestingly, XE037 seems to be completely inert prior to
|
||||
termination.
|
||||
%
|
||||
We have finally found success in S37BEP, our emergency investigation into the
|
||||
destruction of XE037 in living subjects. 8 of 10 of the subjects showed no
|
||||
revivication, despite confirmed dosages of XE037.
|
||||
%
|
||||
PE062, our "cure" for XE037 contamination, has neared perfection. Sadly, the
|
||||
production of PE062 is a costly and time-consuming process. What is more, the
|
||||
substance shows no effect on postmortem subjects whatsoever; a substance which
|
||||
renders XE037 inert after it has activated would be immensely useful in the
|
||||
case of an outbreak.
|
||||
%
|
||||
An alarming discovery has been made. A colony of XE037 has formed nearly a
|
||||
half mile from the laboratory. It is unclear how it escaped; it is quite
|
||||
possible that it is in the ground water now.
|
||||
%
|
||||
An emergency meeting was held today to discuss the possible implications of
|
||||
widespread XE037 contamination. It was agreed that neturalization must be
|
||||
instated immediately to prevent a catastrophic event.
|
||||
%
|
||||
It has begun. The XE037 contamination has spread for miles, and those who
|
||||
have since deceased have revivified. It is my fear that extremely large
|
||||
populations will be decimated by this pandemic. We must find a way to remove
|
||||
XE037 from revivified bodies.
|
||||
%
|
||||
Today we found our solution, quite by accident. It was found that XE037 is
|
||||
completely removed from a revivified body following a series of extremely-high
|
||||
energy 4th dimensional transpositions. Unfortunately, this invariably allows
|
||||
subplane life forms to pass into the prime plan. The cure is worse than the
|
||||
disease.
|
||||
%
|
||||
@@ -1,11 +0,0 @@
|
||||
CC = g++
|
||||
DEBUG = -g
|
||||
CFLAGS = -Wall -c -lncurses $(DEBUG)
|
||||
LFLAGS = -Wall -lncurses $(DEBUG)
|
||||
CXX = g++
|
||||
CXXFLAGS = -lncurses
|
||||
OBJS = main.o bionics.o bodypart.o crafting.o event.o faction.o field.o game.o help.o item.o itypedef.o iuse.o keypress.o line.o map.o mapgen.o mapitemsdef.o monattack.o mondeath.o mongroupdef.o monitemsdef.o monmove.o monster.o mtypedef.o newcharacter.o npc.o npcmove.o npctalk.o output.o overmap.o player.o rng.o settlement.o setvector.o skill.o trapdef.o trapfunc.o wish.o
|
||||
cataclysm: $(OBJS)
|
||||
$(CC) $(LFLAGS) $(OBJS) -o cataclysm
|
||||
clean:
|
||||
rm -f cataclysm main.o bionics.o bodypart.o crafting.o event.o faction.o field.o game.o help.o item.o itypedef.o iuse.o keypress.o line.o map.o mapgen.o mapitemsdef.o monattack.o mondeath.o mongroupdef.o monitemsdef.o monmove.o monster.o mtypedef.o newcharacter.o npc.o npcmove.o npctalk.o output.o overmap.o player.o rng.o settlement.o setvector.o skill.o trapdef.o trapfunc.o wish.o
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
Emma
|
||||
Isabella
|
||||
Emily
|
||||
Madison
|
||||
Ava
|
||||
Olivia
|
||||
Sophie
|
||||
Abigail
|
||||
Elizabeth
|
||||
Chloe
|
||||
Samantha
|
||||
Addison
|
||||
Natalie
|
||||
Mia
|
||||
Alexis
|
||||
Alyssa
|
||||
Hannah
|
||||
Ashley
|
||||
Ella
|
||||
Sarah
|
||||
Grace
|
||||
Brianna
|
||||
Lily
|
||||
Hailey
|
||||
Anna
|
||||
Victoria
|
||||
Kayla
|
||||
Lillian
|
||||
Lauren
|
||||
Kaylee
|
||||
Allison
|
||||
Savannah
|
||||
Nevaeh
|
||||
Gabriella
|
||||
Sofia
|
||||
Makayla
|
||||
Avery
|
||||
Riley
|
||||
Julia
|
||||
Leah
|
||||
Aubrey
|
||||
Jasmine
|
||||
Audrey
|
||||
Katie
|
||||
Morgan
|
||||
Brooklyn
|
||||
Destiny
|
||||
Sydney
|
||||
Alexa
|
||||
Kylie
|
||||
Brooke
|
||||
Kaitlin
|
||||
Evelyn
|
||||
Layla
|
||||
Madeline
|
||||
Kimberly
|
||||
Kim
|
||||
Zoe
|
||||
Jessica
|
||||
Jessie
|
||||
Alexandra
|
||||
Claire
|
||||
Madelyn
|
||||
Maria
|
||||
Arianna
|
||||
Jocelyn
|
||||
Amelia
|
||||
Angelina
|
||||
Trinity
|
||||
Andrea
|
||||
Maya
|
||||
Valeria
|
||||
Sophie
|
||||
Rachel
|
||||
Vanessa
|
||||
Aaliyah
|
||||
Mariah
|
||||
Gabrielle
|
||||
Katelyn
|
||||
Ariana
|
||||
Bailey
|
||||
Camilla
|
||||
Jennifer
|
||||
Jen
|
||||
Melanie
|
||||
Gianna
|
||||
Charlotte
|
||||
Paige
|
||||
Autumn
|
||||
Payton
|
||||
Faith
|
||||
Sara
|
||||
Isabelle
|
||||
Caroline
|
||||
Genesis
|
||||
Isabel
|
||||
Mary
|
||||
Zoey
|
||||
Gracie
|
||||
Megan
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
Smith
|
||||
Johnson
|
||||
Williams
|
||||
Jones
|
||||
Brown
|
||||
Davis
|
||||
Miller
|
||||
Wilson
|
||||
Moore
|
||||
Taylor
|
||||
Anderson
|
||||
Thomas
|
||||
Jackson
|
||||
White
|
||||
Harris
|
||||
Martin
|
||||
Thompson
|
||||
Garcia
|
||||
Martinez
|
||||
Robinson
|
||||
Clark
|
||||
Rodriguez
|
||||
Lewis
|
||||
Lee
|
||||
Walker
|
||||
Hall
|
||||
Allen
|
||||
Young
|
||||
Hernandez
|
||||
King
|
||||
Wright
|
||||
Lopez
|
||||
Hill
|
||||
Scott
|
||||
Green
|
||||
Adams
|
||||
Baker
|
||||
Gonzalez
|
||||
Nelson
|
||||
Carter
|
||||
Mitchell
|
||||
Perez
|
||||
Roberts
|
||||
Turner
|
||||
Phillips
|
||||
Campbell
|
||||
Parker
|
||||
Evans
|
||||
Edwards
|
||||
Collins
|
||||
Stewart
|
||||
Sanchez
|
||||
Morris
|
||||
Rogers
|
||||
Reed
|
||||
Cook
|
||||
Morgan
|
||||
Bell
|
||||
Murphy
|
||||
Bailey
|
||||
Rivera
|
||||
Cooper
|
||||
Richardson
|
||||
Cox
|
||||
Howard
|
||||
Ward
|
||||
Torres
|
||||
Peterson
|
||||
Gray
|
||||
Ramirez
|
||||
James
|
||||
Watson
|
||||
Brooks
|
||||
Kelly
|
||||
Sanders
|
||||
Price
|
||||
Bennett
|
||||
Wood
|
||||
Barnes
|
||||
Ross
|
||||
Henderson
|
||||
Coleman
|
||||
Jenkins
|
||||
Perry
|
||||
Powell
|
||||
Long
|
||||
Patterson
|
||||
Hughes
|
||||
Flores
|
||||
Washington
|
||||
Butler
|
||||
Simmons
|
||||
Foster
|
||||
Gonzales
|
||||
Bryant
|
||||
Alexander
|
||||
Russell
|
||||
Griffin
|
||||
Diaz
|
||||
Hayes
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
Jacob
|
||||
Michael
|
||||
Ethan
|
||||
Joshua
|
||||
Daniel
|
||||
Alexander
|
||||
Anthony
|
||||
William
|
||||
Christopher
|
||||
Matthew
|
||||
Jayden
|
||||
Andrew
|
||||
Joseph
|
||||
David
|
||||
Noah
|
||||
Aiden
|
||||
James
|
||||
Ryan
|
||||
Logan
|
||||
John
|
||||
Nathan
|
||||
Elijah
|
||||
Christian
|
||||
Gabriel
|
||||
Benjamin
|
||||
Jonathan
|
||||
Tyler
|
||||
Samuel
|
||||
Nicholas
|
||||
Gavin
|
||||
Dylan
|
||||
Jackson
|
||||
Brandon
|
||||
Caleb
|
||||
Mason
|
||||
Angel
|
||||
Isaac
|
||||
Evan
|
||||
Jack
|
||||
Kevin
|
||||
Jose
|
||||
Isaiah
|
||||
Luke
|
||||
Landon
|
||||
Justin
|
||||
Lucas
|
||||
Zachary
|
||||
Jordan
|
||||
Robert
|
||||
Aaron
|
||||
Brayden
|
||||
Thomas
|
||||
Cameron
|
||||
Hunter
|
||||
Austin
|
||||
Adrian
|
||||
Connor
|
||||
Owen
|
||||
Aidan
|
||||
Jason
|
||||
Julian
|
||||
Wyatt
|
||||
Charles
|
||||
Luis
|
||||
Carter
|
||||
Juan
|
||||
Chase
|
||||
Diego
|
||||
Jeremiah
|
||||
Brody
|
||||
Xavier
|
||||
Adam
|
||||
Carlos
|
||||
Sabastian
|
||||
Liam
|
||||
Hayden
|
||||
Nathaniel
|
||||
Henry
|
||||
Jesus
|
||||
Ian
|
||||
Tristan
|
||||
Bryan
|
||||
Sean
|
||||
Cole
|
||||
Alex
|
||||
Eric
|
||||
Brian
|
||||
Jaden
|
||||
Carson
|
||||
Blake
|
||||
Ayden
|
||||
Cooper
|
||||
Dominic
|
||||
Brady
|
||||
Caden
|
||||
Josiah
|
||||
Kyle
|
||||
Colton
|
||||
Kaden
|
||||
Eli
|
||||
@@ -1,187 +0,0 @@
|
||||
Squirrels are pretty yummy, but if you shoot them with a high-powered gun you'll probably be left with no meat! Use a BB gun or maybe a .22 rifle.
|
||||
|
||||
Ever run into those big worm things? If you see trails of churned-up dirt, you can be sure they're around.
|
||||
|
||||
I got chased last week by some big digging creature. I couldn't see it, but I could tell where it was by the trail of churned-up earth.
|
||||
|
||||
Try to stay on the roads as much as you can. Giant worms can't cross them!
|
||||
|
||||
Don't relax after killing a giant worm. Little bits of them can break off and still attack!
|
||||
|
||||
If you see a big mob of zombies coming, RUN! Trying to fight them all is suicide unless you have a big tactical advantage.
|
||||
|
||||
Watch out for those zombies that shriek; they'll let other zombies know where you are, and will attract them from all over.
|
||||
|
||||
Those acid-spitting zombies are pretty nasty, but if you're smart, you can get other zombies to wade through the acid.
|
||||
|
||||
If there's a pool of acid blocking your way, trying tossing a junk item into it. Eating up items will help neutralize the acid faster.
|
||||
|
||||
There's this type of zombie that can shoot bolts of lightning! Stay away from walls and stuff when they do... the electricity can travel along solid surfaces.
|
||||
|
||||
Zombie hulks are NASTY, but they're easy to outsmart. If there's other monsters between you and them, they'll kill the monster for you!
|
||||
|
||||
If you run into a zombie hulk, it's probably a good idea to run. They're fast as hell, but pretty dumb; they'll try to smash through obstacles rather than going around, and that slows them down a lot.
|
||||
|
||||
Zombie brutes and hulks have really tough hide. Don't bother shooting at them with lower-caliber guns, the bullet will bounce right off!
|
||||
|
||||
Try not to kill a boomer if it's standing right next to you. They tend to explode when they die, and that pink goop will get all over you.
|
||||
|
||||
Skeletons are a tough target. They're so skinny and full of holes that bullets fired at them will usually just fly right past.
|
||||
|
||||
Skeletons are too delicate to smash through doors or windows. They also can't smell you, unlike zombies, so if you turn your light off at night you can sneak right past.
|
||||
|
||||
Don't try to take on a skeleton with a bladed weapon... you'll just leave scratch marks. You've got to shatter those bones with a hammer or something.
|
||||
|
||||
It's a good idea to butcher corpses if you have the time, even if you don't plan on eating them. I've seen these weird zombies bring their friends back from the dead!
|
||||
|
||||
Triffids are tough. They've got natural armor, and it takes a lot to bring them down. I don't recommend getting into a fight with them.
|
||||
|
||||
Triffids can't see! They figure out where you are by your smell, but if you mask it with smoke or something, you're as good as invisible.
|
||||
|
||||
I figured out how to take care of those triffids! Let me just say this: they're made of wood, and wood and fire don't mix.
|
||||
|
||||
Have you heard about those queen triffids? You gotta keep your distance from them, unless you like having a tree grow right through your chest.
|
||||
|
||||
I have a buddy who was sleeping in this cabin way out in the woods, when he suddenly woke up to trees and vines growing right up through the floor and walls! He said it was some kind of huge triffid making it happen...
|
||||
|
||||
Oh man, have you gone down into the old subway systems? I'd be careful... there's these things down there that're like zombies, but tougher.
|
||||
|
||||
There's snakes down in most of the old sewer systems. They're slow on land, but boy, those suckers can swim fast!
|
||||
|
||||
If you're planning on wandering around the sewers--not that you'd have a reason too--watch out for those fish. Those suckers are fast, and vicious too!
|
||||
|
||||
Have you seen those eyebots flying around? It's hard to say, but some faction's controlling them--maybe the military. All I know is, I don't want them taking my picture...
|
||||
|
||||
Ever go toe-to-toe with a manhack? Tiny little helicopters covered in knives. Best be packing a shotgun!
|
||||
|
||||
They're rare, but molebots are nasty things. They bore through the ground, then pop up to stab ya. Still, you're safe from them if you stay on pavement...
|
||||
|
||||
Don't fire your gun if you can help it--the noise attracts monsters!
|
||||
|
||||
Standing behind a window is a good tactic. It takes zombies a long time to crawl through, giving you lots of opportunities to hit them.
|
||||
|
||||
Zombies are pretty dumb... heck, most monsters are! If you can get a fire going between you and them, they'll just run straight through it.
|
||||
|
||||
I know it's tempting to just go full-auto and unload as many bullets as possible, but don't except as a last resort. It's inaccurate and wastes ammo.
|
||||
|
||||
If there's a bunch of zombies in a straight line, try unloading a burst from your gun. Be sure to aim at the zombie furthest away; you'll hit more of them that way.
|
||||
|
||||
If you shoot a zombie, but don't quite kill it, try to finish it off with a punch or something instead of wasting a bullet.
|
||||
|
||||
If you're in a corridor or something, and there's a bunch of zombies chasing you down it, try to wound the guy in front badly. He'll start moving slow and cause a serious traffic jam!
|
||||
|
||||
Here's a trick for taking care of a huge swarm of zombies chasing you: head into a liquor store, shoot out as many bottles as you can, then light the alcohol on fire. Then duck out the back door, and watch the zombies run into a burning building!
|
||||
|
||||
Sledge hammers may seem like a great weapon, but swinging them is really slow, and you won't do much damage unless you're really strong.
|
||||
|
||||
For a good melee weapon, you can't beat a machete. I've seen a guy take down a zombie brute with one! Of course, if you can find a katana, that might be even better...
|
||||
|
||||
You know, a glass bottle can make a good weapon in a pinch. If you break it over someone's head, the shattering glass will hurt them extra. Of course, it might hurt your hands, too...
|
||||
|
||||
You know what makes a nice weapon? Take a two by four, or a baseball bat or something, and stick a bunch of nails through the end!
|
||||
|
||||
BB guns may seem like a joke, but they've got their uses. They're good for hunting small game, or getting to know the basics of rifles.
|
||||
|
||||
Crossbows are a great weapon for long term use. Most of the time, you can retrieve the bolt after shooting it, so running out of ammo is less of a concern.
|
||||
|
||||
It's good to keep a pistol handy, in case your main gun runs out of ammo or something. They're also better than most guns at short range.
|
||||
|
||||
Shotguns are nice; you can take out lots of baddies with a single shot. Just remember that they're noisy as hell, and you might end up attracting more than you kill.
|
||||
|
||||
A good submachine gun can't be beat. Most of them use common ammo, they're good at short and long range, and you can burst-fire if you need to!
|
||||
|
||||
Hunting rifles are great at long range, but suck close up. Plus, most of them don't carry many rounds. Keep a pistol as a sidearm if you use a rifle.
|
||||
|
||||
You know, you don't have to go full auto with an assault rifle. Firing single shots is more accurate and efficient!
|
||||
|
||||
I've seen a couple guys running around with laser pistols. They seem like the perfect weapon... quiet, accurate, and deadly. But I've never found one, and I bet ammo is wicked scarce...
|
||||
|
||||
When it comes to footwear, you've got two basic choices as far as I see it; sneakers, for running extra fast, or boots for durability. Depends on your style, I guess.
|
||||
|
||||
You don't really need to wear gloves most of the time, but once in a while they'll really come in handy.
|
||||
|
||||
It's good to keep a filter mask or gas mask handy. You never know when you'll have to go into a smoke-filled room or something.
|
||||
|
||||
There's basically no reason not to wear safety glasses... nothing's worse than taking a hit to the eyes and getting blinded for a few seconds.
|
||||
|
||||
Ski goggles are a great choice if you're worried about getting stuff in your eyes. Perfect for dealing with boomers!
|
||||
|
||||
If you get a pair of night vision goggles, hold on to them! A flashlight will give you away, but with goggles you can be sneaky.
|
||||
|
||||
I know they look dumb, but wearing a fanny pack gives you that extra bit of storage without encumbering you.
|
||||
|
||||
Backpacks let you carry lots of stuff, but they limit your movement a lot. If you're an unarmed fighter, don't wear one!
|
||||
|
||||
Don't underestimate a good book. Not only will it keep you company on lonely nights, but you can learn a hell of a lot from some of them.
|
||||
|
||||
It's a good idea to carry around a couple of empty bottles. You can fill them up with water, gasoline, or whatever!
|
||||
|
||||
If you need a bunch of rags for making molotov cocktails, take a pair of scissors to an old t-shirt or something.
|
||||
|
||||
Carrying a lighter is something all veterans do. It takes up almost no space, and can easily save your life.
|
||||
|
||||
If you can spare the space, you might want to carry a fire extinguisher along. Nothing's worse than being trapped in a burning building!
|
||||
|
||||
Crowbars not only make a pretty good weapon, they're also useful for opening locked doors and lifting manhole covers.
|
||||
|
||||
If you're spending the night in a dangerous area, grab a shovel and dig pits all around your camp.
|
||||
|
||||
A chainsaw may seem like a great weapon, but remember that they're slow, unwieldy, and very noisy.
|
||||
|
||||
Bubblewrap is pretty harmless, but setting it up around you before going to sleep will keep you from waking up to a zombie punching you.
|
||||
|
||||
Beartraps are a nice way to cover an escape. If you place one in a doorway, the first zombie through will get stuck, and the rest won't be able to get past!
|
||||
|
||||
Smoke grenades aren't really offensive weapons, but they'll cover up your scent and hide you from view--perfect for making a quick escape.
|
||||
|
||||
Don't use molotovs indoors. Especially in a liquor store.
|
||||
|
||||
If you're going to be playing with molotov cocktails around a gas station, just make sure you're a long way from those pumps.
|
||||
|
||||
I once knew a guy who figured he'd survive a night in the subway by setting fires blocking off the tunnel in both directions and sleeping between them. He wound up asphyxiating on the smoke.
|
||||
|
||||
Don't light a molotov until you're ready to throw it. Not only can they go out, but if you accidentally drop it or something, you're in trouble.
|
||||
|
||||
If you're weak or clumsy, it might be a good idea not to mess with molotovs or grenades. Accidentally dropping them when you meant to throw them could be deadly.
|
||||
|
||||
If you're wandering in the wilderness, or following a road, keep an eye out for wild strawberries or blueberries.
|
||||
|
||||
Be careful eating wild mushrooms. Some are poisonous, and others can make you hallucinate.
|
||||
|
||||
Try to go around swamps, if you can. Some of them have sinkholes that can pull you right underground.
|
||||
|
||||
I heard about this group that raided a bee hive a while ago. Everyone got massacred but one, and he came home with this weird, magic honey stuff.
|
||||
|
||||
If you need to, you can swim across a river to escape; most monsters can't swim. Just make sure you drop as much stuff as possible first, and maybe strip naked, or you'll sink like a rock.
|
||||
|
||||
Houses can be a surprisingly good resource for all kinds of stuff; clothing, medication, food, books, and more.
|
||||
|
||||
While there's not much to loot, gas stations are a good source for gasoline, to power tools or to make molotov cocktails.
|
||||
|
||||
It's not like in the movies--shooting a gas pump won't make it explode. But it WILL make it leak all over the place, which is a definite fire hazard.
|
||||
|
||||
I know grocery stores and stuff are full of fruit, but be careful, it's probably rotten.
|
||||
|
||||
Next time you visit a grocery store, load up on canned goods. They never go bad!
|
||||
|
||||
I've found more good weapons in hardware stores than anywhere else. Except gun stores, of course.
|
||||
|
||||
Liquor stores are a great place to pick up non-alcoholic beverages, too. Not that I mind alcohol!
|
||||
|
||||
Most gun stores follow pretty similar layouts. The restricted stuff--SMGs, assault rifles, and most importantly ammo--are always behind the counter.
|
||||
|
||||
I've spent many nights in the changing rooms at the back of clothing stores. Walls on four sides, far from the store's entrance, a corridor for easy defense... it's perfect!
|
||||
|
||||
If you're getting chased by a hoarde of zombies, try ducking into the subways and traveling a block or two, then coming back up.
|
||||
|
||||
Have you seen those weird science labs out in the middle of nowhere? I think you need some kind of special ID card to get in.
|
||||
|
||||
I've thought about raiding an ant hill before, but I realized it wasn't worth the risk. I doubt they have any loot beyond some scraps of food, you know?
|
||||
|
||||
This guy I know was walking through the subway when he came across a giant rift in the earth, with lava far below. Weird, huh?
|
||||
|
||||
In a lot of places, there's little hallways connecting the subways with the sewers, with heavy metal doors on both ends. It's a perfect place to sleep!
|
||||
|
||||
Be careful of drinking water from rivers and stuff, it's a good way to get sick. But if you have a water purifier, it'll make it safe.
|
||||
|
||||
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
# Welcome to Jekyll!
|
||||
#
|
||||
# This config file is meant for settings that affect your whole blog, values
|
||||
# which you are expected to set up once and rarely edit after that. If you find
|
||||
# yourself editing this file very often, consider using Jekyll's data files
|
||||
# feature for the data you need to update frequently.
|
||||
#
|
||||
# For technical reasons, this file is *NOT* reloaded automatically when you use
|
||||
# 'bundle exec jekyll serve'. If you change this file, please restart the server process.
|
||||
|
||||
# Site settings
|
||||
# These are used to personalize your new site. If you look in the HTML files,
|
||||
# you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
|
||||
# You can create any custom variable you would like, and they will be accessible
|
||||
# in the templates via {{ site.myvariable }}.
|
||||
title: "Cataclysm: Dark Days Ahead"
|
||||
email: kevin.granade@gmail.com
|
||||
description: > # this means to ignore newlines until "baseurl:"
|
||||
Official homepage of Cataclysm: Dark Days Ahead open source turn-based survival RPG development project.
|
||||
Hosts downloads of game and links to community sites and resources.
|
||||
baseurl: "" # the subpath of your site, e.g. /blog
|
||||
url: "https://cataclysmdda.org" # the base hostname & protocol for your site, e.g. http://example.com
|
||||
repository: CleverRaven/Cataclysm-DDA
|
||||
|
||||
# Build settings
|
||||
markdown: kramdown
|
||||
theme: minima
|
||||
plugins:
|
||||
- jekyll-feed
|
||||
exclude:
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- vendor
|
||||
include:
|
||||
- .well-known
|
||||
@@ -0,0 +1,18 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>{% if page.title %}{{ page.title | escape }}{% else %}{{ site.title | escape }}{% endif %}</title>
|
||||
<meta name="description" content="{{ page.excerpt | default: site.description | strip_html | normalize_whitespace | truncate: 160 | escape }}">
|
||||
|
||||
<link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
|
||||
<link rel="canonical" href="{{ page.url | replace:'index.html','' | absolute_url }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ site.title | escape }}" href="{{ "/feed.xml" | relative_url }}">
|
||||
<link rel="me" href="https://mastodon.gamedev.place/@kevingranade">
|
||||
<link rel="me" href="https://social.treehouse.systems/@itsmaya">
|
||||
|
||||
{% if jekyll.environment == 'production' and site.google_analytics %}
|
||||
{% include google-analytics.html %}
|
||||
{% endif %}
|
||||
</head>
|
||||
@@ -0,0 +1,31 @@
|
||||
<header class="site-header">
|
||||
|
||||
<div class="wrapper">
|
||||
{%- assign default_paths = site.pages | map: "path" -%}
|
||||
{%- assign page_paths = site.header_pages | default: default_paths -%}
|
||||
{%- assign titles_size = site.pages | map: 'title' | join: '' | size -%}
|
||||
<a class="site-title" rel="author" href="{{ "/" | relative_url }}">{{ site.title | escape }}</a>
|
||||
|
||||
{%- if titles_size > 0 -%}
|
||||
<nav class="site-nav">
|
||||
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
||||
<label for="nav-trigger">
|
||||
<span class="menu-icon">
|
||||
<svg viewBox="0 0 18 15" width="18px" height="15px">
|
||||
<path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/>
|
||||
</svg>
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="trigger">
|
||||
<a class="page-link" href="/">Home</a>
|
||||
<a class="page-link" href="/releases/">Releases</a>
|
||||
<!--<a class="page-link" href="/changes/">Changes</a>-->
|
||||
<a class="page-link" href="/contributions/">Contribution Guidelines</a>
|
||||
<a class="page-link" href="/donations/">Donations</a>
|
||||
<a class="page-link" href="https://github.com/CleverRaven/Cataclysm-DDA/">GitHub</a>
|
||||
</div>
|
||||
</nav>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
</header>
|
||||
-189
@@ -1,189 +0,0 @@
|
||||
#ifndef _ADDICTION_H_
|
||||
#define _ADDICTION_H_
|
||||
|
||||
#include "rng.h"
|
||||
#include "game.h"
|
||||
#include <sstream>
|
||||
|
||||
void addict_effect(game *g, addiction &add)
|
||||
{
|
||||
int in = add.intensity;
|
||||
|
||||
switch (add.type) {
|
||||
case ADD_CIG:
|
||||
g->u.int_cur--;
|
||||
if (in > 20 || one_in((500 - 20 * in))) {
|
||||
g->add_msg("You %s a cigarette.",
|
||||
rng(0, 6) < in ? "need" : "could use");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
if (one_in(800 - 50 * in))
|
||||
g->u.fatigue++;
|
||||
if (one_in(400 - 20 * in))
|
||||
g->u.stim--;
|
||||
if (one_in((800 - 10 * in)))
|
||||
g->u.morale--;
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_CAFFEINE:
|
||||
g->u.str_cur--;
|
||||
g->u.moves -= 2;
|
||||
if (in > 20 || one_in((500 - 20 * in))) {
|
||||
g->add_msg("You want some caffeine.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
if (rng(0, 10) < in)
|
||||
g->u.stim--;
|
||||
if (in > 19 || one_in((1000 - 50 * in)))
|
||||
g->u.morale--;
|
||||
if (rng(8, 400) < in) {
|
||||
g->add_msg("Your hands start shaking... you need it bad!");
|
||||
g->u.add_disease(DI_SHAKES, 20, g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_ALCOHOL:
|
||||
g->u.per_cur--;
|
||||
g->u.int_cur--;
|
||||
if (rng(40, 1200) <= in * 10)
|
||||
g->u.health--;
|
||||
if (one_in(20) && rng(0, 20) < in) {
|
||||
g->add_msg("You could use a drink.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.morale -= rng(1, 4);
|
||||
} else if (rng(8, 300) < in) {
|
||||
g->add_msg("Your hands start shaking... you need a drink bad!");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.add_disease(DI_SHAKES, 50, g);
|
||||
} else if (!g->u.has_disease(DI_HALLU) && rng(10, 1600) < in)
|
||||
g->u.add_disease(DI_HALLU, 3600, g);
|
||||
break;
|
||||
|
||||
case ADD_SLEEP:
|
||||
// No effects here--just in player::can_sleep()
|
||||
// EXCEPT! Prolong this addiction longer than usual.
|
||||
if (one_in(2) && add.sated < 0)
|
||||
add.sated++;
|
||||
break;
|
||||
|
||||
case ADD_PKILLER:
|
||||
g->u.str_cur -= 1 + int(in / 7);
|
||||
g->u.per_cur--;
|
||||
g->u.dex_cur--;
|
||||
if (g->u.pain < in * 3)
|
||||
g->u.pain++;
|
||||
if (g->u.morale > 0 - in)
|
||||
g->u.morale--;
|
||||
if ((in >= 25 || g->turn % (100 - in * 4) == 0) && g->u.pkill > 0)
|
||||
g->u.pkill--; // Tolerance increases!
|
||||
if (in >= 40 || one_in((1200 - 30 * in)))
|
||||
g->u.health--;
|
||||
if (one_in(20) && dice(2, 20) < in) {
|
||||
g->add_msg("Your hands start shaking... you need some painkillers.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.add_disease(DI_SHAKES, 20 + in * 5, g);
|
||||
} else if (one_in(20) && dice(2, 30) < in) {
|
||||
g->add_msg("You feel anxious. You need your painkillers!");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.morale -= 5;
|
||||
} else if (one_in(50) && dice(3, 50) < in) {
|
||||
g->add_msg("You throw up heavily!");
|
||||
g->cancel_activity_query("Throwing up.");
|
||||
g->u.vomit(g);
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_SPEED:
|
||||
g->u.moves -= in;
|
||||
if (g->u.morale > 0 - in)
|
||||
g->u.morale--;
|
||||
g->u.int_cur--;
|
||||
g->u.str_cur--;
|
||||
if (in >= 20 || g->turn % (100 - in * 5) == 0)
|
||||
g->u.stim--;
|
||||
if (rng(0, 150) <= in)
|
||||
g->u.health--;
|
||||
if (dice(2, 100) < in) {
|
||||
g->add_msg("You feel depressed. Speed would help.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.morale -= rng(1, 1 + int(in / 3));
|
||||
} else if (one_in(10) && dice(2, 80) < in) {
|
||||
g->add_msg("Your hands start shaking... you need a pick-me-up.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.add_disease(DI_SHAKES, in * 20, g);
|
||||
} else if (one_in(50) && dice(2, 100) < in) {
|
||||
g->add_msg("You stop suddenly, feeling bewildered.");
|
||||
g->cancel_activity();
|
||||
g->u.moves -= 300;
|
||||
} else if (!g->u.has_disease(DI_HALLU) && one_in(20) &&
|
||||
8 + dice(2, 80) < in) {
|
||||
g->u.add_disease(DI_HALLU, 3600, g);
|
||||
}
|
||||
break;
|
||||
|
||||
case ADD_COKE:
|
||||
g->u.int_cur--;
|
||||
g->u.per_cur--;
|
||||
if (g->u.morale > -20 && (in >= 30 || one_in((900 - 30 * in)))) {
|
||||
g->add_msg("You feel like you need a bump.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.morale -= 2;
|
||||
}
|
||||
if (dice(2, 80) <= in) {
|
||||
g->add_msg("You feel like you need a bump.");
|
||||
g->cancel_activity_query("You have a craving.");
|
||||
g->u.stim--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string addiction_name(addiction cur)
|
||||
{
|
||||
switch (cur.type) {
|
||||
case ADD_CIG: return "Nicotine Withdrawal";
|
||||
case ADD_CAFFEINE: return "Caffeine Withdrawal";
|
||||
case ADD_ALCOHOL: return "Alcohol Withdrawal";
|
||||
case ADD_SLEEP: return "Sleeping Pill Dependance";
|
||||
case ADD_PKILLER: return "Opiate Withdrawal";
|
||||
case ADD_SPEED: return "Amphetamine Withdrawal";
|
||||
case ADD_COKE: return "Cocaine Withdrawal";
|
||||
default: return "Erroneous addiction";
|
||||
}
|
||||
}
|
||||
|
||||
std::string addiction_text(addiction cur)
|
||||
{
|
||||
std::stringstream dump;
|
||||
int strpen = 1 + int(cur.intensity / 7);
|
||||
switch (cur.type) {
|
||||
case ADD_CIG:
|
||||
return "Intelligence - 1; Occasional cravings";
|
||||
|
||||
case ADD_CAFFEINE:
|
||||
return "Strength - 1; Slight sluggishness; Occasional cravings";
|
||||
|
||||
case ADD_ALCOHOL:
|
||||
return "\
|
||||
Perception - 1; Intelligence - 1; Occasional Cravings;\n\
|
||||
Risk of delirium tremens";
|
||||
|
||||
case ADD_SLEEP:
|
||||
return "You may find it difficult to sleep without medication.";
|
||||
|
||||
case ADD_PKILLER:
|
||||
dump << "Strength -" << strpen << "; Perception - 1; Dexterity - 1;" <<
|
||||
std::endl <<
|
||||
"Depression and physical pain to some degree. Frequent cravings. Vomiting.";
|
||||
return dump.str();
|
||||
|
||||
case ADD_SPEED:
|
||||
return "Strength - 1; Intelligence - 1;\n\
|
||||
Movement rate reduction. Depression. Weak immune system. Frequent cravings.";
|
||||
|
||||
case ADD_COKE:
|
||||
return "Perception - 1; Intelligence - 1; Frequent cravings.";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
#ifndef _ARTIFACT_H_
|
||||
#define _ARTIFACT_H_
|
||||
|
||||
#include "itype.h"
|
||||
|
||||
struct it_artifact : itype
|
||||
{
|
||||
itype base;
|
||||
virtual bool is_artifact() { return true; }
|
||||
// is_* returns the value for the base type
|
||||
virtual bool is_food() { return base.is_food(); };
|
||||
virtual bool is_ammo() { return base.is_ammo(); };
|
||||
virtual bool is_armor() { return base.is_armor(); };
|
||||
virtual bool is_book() { return base.is_book(); };
|
||||
virtual bool is_tool() { return base.is_tool(); };
|
||||
virtual bool is_container() { return base.is_container(); };
|
||||
// Can have one or two invoked uses
|
||||
void (iuse::*use1)(game *, item *, bool);
|
||||
void (iuse::*use2)(game *, item *, bool);
|
||||
// *wield is every-turn effect while wielded or worn
|
||||
void (iuse::*wield)(game *, item *, bool);
|
||||
// *unwield is effect upon unwielding or taking off
|
||||
void (iuse::*unwield)(game *, item *, bool);
|
||||
// *carry is every-turn effect while it's in your inventory
|
||||
void (iuse::*carry)(game *, item *, bool);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
-331
@@ -1,331 +0,0 @@
|
||||
#include "player.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
#include "keypress.h"
|
||||
#include "item.h"
|
||||
#include "bionics.h"
|
||||
#include "line.h"
|
||||
|
||||
|
||||
// Why put this in a Big Switch? Why not let bionics have pointers to
|
||||
// functions, much like monsters and items?
|
||||
//
|
||||
// Well, because like diseases, which are also in a Big Switch, bionics don't
|
||||
// share functions....
|
||||
void player::activate_bionic(int b, game *g)
|
||||
{
|
||||
bionic bio = my_bionics[b];
|
||||
if (power_level < bionics[bio.id].power_cost) {
|
||||
if (my_bionics[b].powered) {
|
||||
g->add_msg("Your %s powers down.", bionics[bio.id].name.c_str());
|
||||
my_bionics[b].powered = false;
|
||||
} else {
|
||||
g->add_msg("You cannot power your %s", bionics[bio.id].name.c_str());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (my_bionics[b].powered && my_bionics[b].charge > 0) {
|
||||
// Already-on units just lose a bit of charge
|
||||
my_bionics[b].charge--;
|
||||
} else {
|
||||
// Not-on units, or those with zero charge, have to pay the power cost
|
||||
if (bionics[bio.id].charge_time > 0) {
|
||||
my_bionics[b].powered = true;
|
||||
my_bionics[b].charge = bionics[bio.id].charge_time;
|
||||
}
|
||||
power_level -= bionics[bio.id].power_cost;
|
||||
}
|
||||
|
||||
std::string junk;
|
||||
std::vector<point> traj;
|
||||
std::vector<std::string> good;
|
||||
std::vector<std::string> bad;
|
||||
WINDOW *w;
|
||||
int dirx, diry, t, l, index;
|
||||
item tmp_item;
|
||||
switch (bio.id) {
|
||||
case bio_painkiller:
|
||||
pkill += 6;
|
||||
pain -= 2;
|
||||
if (pkill > pain)
|
||||
pkill = pain;
|
||||
break;
|
||||
case bio_nanobots:
|
||||
healall(4);
|
||||
break;
|
||||
case bio_resonator:
|
||||
g->sound(posx, posy, 30, "VRRRRMP!");
|
||||
for (int i = posx - 1; i <= posx + 1; i++) {
|
||||
for (int j = posy - 1; j <= posy + 1; j++) {
|
||||
g->m.bash(i, j, 40, junk);
|
||||
g->m.bash(i, j, 40, junk); // Multibash effect, so that doors &c will fall
|
||||
g->m.bash(i, j, 40, junk);
|
||||
if (g->m.is_destructable(i, j) && rng(1, 10) >= 4)
|
||||
g->m.ter(i, j) = t_rubble;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case bio_time_freeze:
|
||||
moves += 100 * power_level;
|
||||
power_level = 0;
|
||||
g->add_msg("Your speed suddenly increases!");
|
||||
if (one_in(3)) {
|
||||
g->add_msg("Your muscles tear with the strain.");
|
||||
hurt(g, bp_arms, 0, rng(5, 10));
|
||||
hurt(g, bp_arms, 1, rng(5, 10));
|
||||
hurt(g, bp_legs, 0, rng(7, 12));
|
||||
hurt(g, bp_legs, 1, rng(7, 12));
|
||||
hurt(g, bp_torso, 0, rng(5, 15));
|
||||
}
|
||||
if (one_in(5))
|
||||
add_disease(DI_TELEGLOW, rng(50, 400), g);
|
||||
break;
|
||||
case bio_teleport:
|
||||
g->teleport();
|
||||
add_disease(DI_TELEGLOW, 300, g);
|
||||
break;
|
||||
// TODO: More stuff here (and bio_blood_filter)
|
||||
case bio_blood_anal:
|
||||
w = newwin(20, 40, 3, 10);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
if (has_disease(DI_FUNGUS))
|
||||
bad.push_back("Fungal Parasite");
|
||||
if (has_disease(DI_POISON))
|
||||
bad.push_back("Poison");
|
||||
if (radiation > 0)
|
||||
bad.push_back("Irradiated");
|
||||
if (has_disease(DI_PKILL1))
|
||||
good.push_back("Minor Painkiller");
|
||||
if (has_disease(DI_PKILL2))
|
||||
good.push_back("Moderate Painkiller");
|
||||
if (has_disease(DI_PKILL3))
|
||||
good.push_back("Heavy Painkiller");
|
||||
if (has_disease(DI_PKILL_L))
|
||||
good.push_back("Slow-Release Painkiller");
|
||||
if (has_disease(DI_DRUNK))
|
||||
good.push_back("Alcohol");
|
||||
if (has_disease(DI_CIG))
|
||||
good.push_back("Nicotine");
|
||||
if (has_disease(DI_HIGH))
|
||||
good.push_back("Intoxicant: Other");
|
||||
if (has_disease(DI_TOOK_PROZAC))
|
||||
good.push_back("Prozac");
|
||||
if (has_disease(DI_TOOK_FLUMED))
|
||||
good.push_back("Antihistamines");
|
||||
if (has_disease(DI_ADRENALINE))
|
||||
good.push_back("Adrenaline Spike");
|
||||
if (good.size() == 0 && bad.size() == 0)
|
||||
mvwprintz(w, 1, 1, c_white, "No effects.");
|
||||
else {
|
||||
for (int line = 1; line < 39 && line <= good.size() + bad.size(); line++) {
|
||||
if (line < bad.size())
|
||||
mvwprintz(w, line, 1, c_red, bad[line - 1].c_str());
|
||||
else
|
||||
mvwprintz(w, line, 1, c_green, good[line - 1 - bad.size()].c_str());
|
||||
}
|
||||
}
|
||||
wrefresh(w);
|
||||
refresh();
|
||||
getch();
|
||||
break;
|
||||
case bio_blood_filter:
|
||||
rem_disease(DI_FUNGUS);
|
||||
rem_disease(DI_POISON);
|
||||
rem_disease(DI_PKILL1);
|
||||
rem_disease(DI_PKILL2);
|
||||
rem_disease(DI_PKILL3);
|
||||
rem_disease(DI_PKILL_L);
|
||||
rem_disease(DI_DRUNK);
|
||||
rem_disease(DI_CIG);
|
||||
rem_disease(DI_HIGH);
|
||||
rem_disease(DI_TOOK_PROZAC);
|
||||
rem_disease(DI_TOOK_FLUMED);
|
||||
rem_disease(DI_ADRENALINE);
|
||||
pkill = rng(0, pkill);
|
||||
stim = rng(0, stim);
|
||||
break;
|
||||
case bio_evap:
|
||||
if (query_yn("Drink directly? Otherwise you will need a container.")) {
|
||||
tmp_item = item(g->itypes[itm_water], 0);
|
||||
thirst -= 50;
|
||||
if (has_trait(PF_GOURMAND) && thirst < -60) {
|
||||
g->add_msg("You can't finish it all!");
|
||||
thirst = -60;
|
||||
} else if (!has_trait(PF_GOURMAND) && thirst < -20) {
|
||||
g->add_msg("You can't finish it all!");
|
||||
thirst = -20;
|
||||
}
|
||||
} else {
|
||||
t = g->inv("Choose a container:");
|
||||
if (i_at(t).type == 0) {
|
||||
g->add_msg("You don't have that item!");
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else if (!i_at(t).is_container()) {
|
||||
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else {
|
||||
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
|
||||
if (i_at(t).volume_contained() + 1 > cont->contains) {
|
||||
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else if (!(cont->flags & con_wtight)) {
|
||||
g->add_msg("Your %s isn't watertight!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_evap].power_cost;
|
||||
} else {
|
||||
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
|
||||
i_at(t).put_in(item(g->itypes[itm_water], 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case bio_lighter:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Torch in which direction?");
|
||||
get_direction(dirx, diry, input());
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_lighter].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
diry += posy;
|
||||
if (!g->m.add_field(g, dirx, diry, fd_fire, 1)) // Unsuccessful.
|
||||
g->add_msg("You can't light a fire there.");
|
||||
break;
|
||||
case bio_claws:
|
||||
if (weapon.type->id == itm_bio_claws) {
|
||||
g->add_msg("You withdraw your claws.");
|
||||
weapon = ret_null;
|
||||
} else if (weapon.type->id != 0) {
|
||||
g->add_msg("Your claws extend, forcing you to drop your %s.",
|
||||
weapon.tname().c_str());
|
||||
g->m.add_item(posx, posy, weapon);
|
||||
weapon = item(g->itypes[itm_bio_claws], 0);
|
||||
} else {
|
||||
g->add_msg("Your claws extend!");
|
||||
weapon = item(g->itypes[itm_bio_claws], 0);
|
||||
}
|
||||
break;
|
||||
case bio_blaster:
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes[itm_bio_blaster], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_bio_fusion]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
break;
|
||||
case bio_laser:
|
||||
tmp_item = weapon;
|
||||
weapon = item(g->itypes[itm_v29], 0);
|
||||
weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_laser_pack]);
|
||||
weapon.charges = 1;
|
||||
g->refresh_all();
|
||||
g->plfire(false);
|
||||
weapon = tmp_item;
|
||||
break;
|
||||
case bio_emp:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Fire EMP in which direction?");
|
||||
get_direction(dirx, diry, input());
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_emp].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
diry += posy;
|
||||
g->emp_blast(dirx, diry);
|
||||
break;
|
||||
case bio_hydraulics:
|
||||
g->add_msg("Your muscles hiss as hydraulic strength fills them!");
|
||||
break;
|
||||
case bio_water_extractor:
|
||||
for (int i = 0; i < g->m.i_at(posx, posy).size(); i++) {
|
||||
item tmp = g->m.i_at(posx, posy)[i];
|
||||
if (tmp.type->id == itm_corpse && query_yn("Extract water from the %s",
|
||||
tmp.tname().c_str())) {
|
||||
i = g->m.i_at(posx, posy).size() + 1; // Loop is finished
|
||||
t = g->inv("Choose a container:");
|
||||
if (i_at(t).type == 0) {
|
||||
g->add_msg("You don't have that item!");
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else if (!i_at(t).is_container()) {
|
||||
g->add_msg("That %s isn't a container!", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else {
|
||||
it_container *cont = dynamic_cast<it_container*>(i_at(t).type);
|
||||
if (i_at(t).volume_contained() + 1 > cont->contains) {
|
||||
g->add_msg("There's no space left in your %s.", i_at(t).tname().c_str());
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
} else {
|
||||
g->add_msg("You pour water into your %s.", i_at(t).tname().c_str());
|
||||
i_at(t).put_in(item(g->itypes[itm_water], 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == g->m.i_at(posx, posy).size() - 1) // We never chose a corpse
|
||||
power_level += bionics[bio_water_extractor].power_cost;
|
||||
}
|
||||
break;
|
||||
case bio_magnet:
|
||||
for (int i = posx - 10; i <= posx + 10; i++) {
|
||||
for (int j = posy - 10; j <= posy + 10; j++) {
|
||||
if (g->m.i_at(i, j).size() > 0) {
|
||||
if (g->m.sees(i, j, posx, posy, -1, t))
|
||||
traj = line_to(i, j, posx, posy, t);
|
||||
else
|
||||
traj = line_to(i, j, posx, posy, 0);
|
||||
}
|
||||
for (int k = 0; k < g->m.i_at(i, j).size(); k++) {
|
||||
if (g->m.i_at(i, j)[k].made_of(IRON) || g->m.i_at(i, j)[k].made_of(STEEL)){
|
||||
tmp_item = g->m.i_at(i, j)[k];
|
||||
g->m.i_rem(i, j, k);
|
||||
for (l = 0; l < traj.size(); l++) {
|
||||
index = g->mon_at(traj[l].x, traj[l].y);
|
||||
if (index != -1) {
|
||||
if (g->z[index].hurt(tmp_item.weight() * tmp_item.volume()))
|
||||
g->kill_mon(index);
|
||||
g->m.add_item(traj[l].x, traj[l].y, tmp_item);
|
||||
l = traj.size() + 1;
|
||||
} else if (l > 0 && g->m.move_cost(traj[l].x, traj[l].y) == 0) {
|
||||
g->m.bash(traj[l].x, traj[l].y, tmp_item.weight() * tmp_item.volume(),
|
||||
junk);
|
||||
g->sound(traj[l].x, traj[l].y, 12, junk);
|
||||
if (g->m.move_cost(traj[l].x, traj[l].y) == 0) {
|
||||
g->m.add_item(traj[l - 1].x, traj[l - 1].y, tmp_item);
|
||||
l = traj.size() + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (l == traj.size())
|
||||
g->m.add_item(posx, posy, tmp_item);
|
||||
k--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case bio_lockpick:
|
||||
g->draw();
|
||||
mvprintw(0, 0, "Unlock in which direction?");
|
||||
get_direction(dirx, diry, input());
|
||||
if (dirx == -2) {
|
||||
g->add_msg("Invalid direction.");
|
||||
power_level += bionics[bio_lockpick].power_cost;
|
||||
return;
|
||||
}
|
||||
dirx += posx;
|
||||
diry += posy;
|
||||
if (g->m.ter(dirx, diry) == t_door_locked) {
|
||||
moves -= 40;
|
||||
g->add_msg("You unlock the door.");
|
||||
g->m.ter(dirx, diry) = t_door_c;
|
||||
} else
|
||||
g->add_msg("You can't unlock that %s", g->m.tername(dirx, diry).c_str());
|
||||
break;
|
||||
}
|
||||
delwin(w);
|
||||
}
|
||||
@@ -1,297 +0,0 @@
|
||||
#ifndef _BIONICS_H_
|
||||
#define _BIONICS_H_
|
||||
#include <string>
|
||||
|
||||
/* Thought: Perhaps a HUD bionic that changes the display of the game?
|
||||
* Showing more information or something. */
|
||||
|
||||
enum bionic_id {
|
||||
// Power sources
|
||||
bio_batteries, bio_metabolics, bio_solar, bio_furnace, bio_ethanol,
|
||||
// Automatic / Always-On
|
||||
bio_memory, bio_ears,
|
||||
bio_eye_enhancer, bio_membrane, bio_targeting,
|
||||
bio_gills, bio_purifier,
|
||||
bio_climate, bio_storage, bio_recycler, bio_digestion, // TODO: Ynnn
|
||||
bio_tools, bio_shock, bio_heat_absorb,
|
||||
bio_carbon, bio_armor_head, bio_armor_torso, bio_armor_arms, bio_armor_legs,
|
||||
// Player Activated
|
||||
bio_flashlight, bio_night_vision, bio_infrared,
|
||||
bio_face_mask, // TODO
|
||||
bio_ads, bio_ods, bio_scent_mask, bio_cloak, bio_painkiller, bio_nanobots,
|
||||
bio_heatsink, bio_resonator, bio_time_freeze, bio_teleport, bio_blood_anal,
|
||||
bio_blood_filter, bio_alarm,
|
||||
bio_evap, bio_lighter, bio_claws, bio_blaster, bio_laser, bio_emp,
|
||||
// TODO: fingerhack
|
||||
bio_hydraulics, bio_water_extractor, bio_magnet, bio_fingerhack, bio_lockpick,
|
||||
bio_ground_sonar,
|
||||
max_bio_start,
|
||||
// EVERYTHING below this point is not available to brand-new players
|
||||
// TODO: all these suckers
|
||||
bio_banish, bio_gate_out, bio_gate_in, bio_nightfall, bio_drilldown,
|
||||
bio_heatwave, bio_lightning, bio_tremor, bio_flashflood,
|
||||
max_bio
|
||||
};
|
||||
|
||||
struct bionic_data {
|
||||
std::string name;
|
||||
bool power_source;
|
||||
bool activated; // If true, then the below function only happens when
|
||||
// activated; otherwise, it happens every turn
|
||||
int power_cost;
|
||||
int charge_time; // How long, when activated, between drawing power_cost
|
||||
// If 0, it draws power once
|
||||
std::string description;
|
||||
};
|
||||
|
||||
struct bionic {
|
||||
bionic_id id;
|
||||
char invlet;
|
||||
bool powered;
|
||||
int charge;
|
||||
bionic() {
|
||||
id = bio_batteries;
|
||||
invlet = 'a';
|
||||
powered = false;
|
||||
charge = 0;
|
||||
}
|
||||
bionic(bionic_id pid, char pinvlet) {
|
||||
id = pid;
|
||||
invlet = pinvlet;
|
||||
powered = false;
|
||||
charge = 0;
|
||||
};
|
||||
};
|
||||
|
||||
const bionic_data bionics[] = {
|
||||
{"Battery System", true, false, 0, 0, "\
|
||||
You have a battery draining attachment, and thus can make use of the energy\n\
|
||||
contained in normal, everyday batteries."},
|
||||
{"Metabolic Interchange", true, false, 0, 0, "\
|
||||
Your digestive system and power supply are interconnected. Any drain on\n\
|
||||
energy instead increases your hunger."},
|
||||
{"Solar Panels", true, false, 0, 0, "\
|
||||
You have a few solar panels installed. While in direct sunlight, your power\n\
|
||||
level will slowly recharge."},
|
||||
{"Internal Furnace", true, false, 0, 0, "\
|
||||
You can burn nearly any organic material as fuel (use 'E'), recharging your\n\
|
||||
power level. Some materials will burn better than others."},
|
||||
{"Ethanol Burner", true, false, 0, 0, "\
|
||||
You burn alcohol as fuel in an extremely efficient reaction. However, you\n\
|
||||
will still suffer the inebriating effects of the substance."},
|
||||
|
||||
{"Enhanced Memory Banks", false, false, 1, 0, "\
|
||||
Your memory has been enhanced with small quantum storage drives. Any time\n\
|
||||
you start to forget a skill, you have a chance at retaining all knowledge, at\n\
|
||||
the cost of a small amount of power."},
|
||||
{"Enhanced Hearing", false, false, 0, 0, "\
|
||||
Your hearing has been drastically improved, allowing you to hear ten times\n\
|
||||
better than the average person. Additionally, high-intensity sounds will be\n\
|
||||
automatically dampened before they can damage your hearing."},
|
||||
{"Diamond Cornea", false, false, 0, 0, "\
|
||||
Your vision is greatly enhanced, giving you a +2 bonus to perception."},
|
||||
{"Nictating Membrane", false, false, 0, 0, "\
|
||||
Your eyes have a thin membrane that closes over your eyes while underwater,\n\
|
||||
negating any vision penalties."},
|
||||
{"Targeting System", false, false, 0, 0, "\
|
||||
Your eyes are equipped with range finders, and their movement is synced with\n\
|
||||
that of your arms, to a degree. Shots you fire will be much more accurate,\n\
|
||||
particularly at long range."},
|
||||
{"Membrane Oxygenator", false, false, 1, 0, "\
|
||||
An oxygen interchange system automatically switches on while underwater,\n\
|
||||
slowly draining your energy reserves but providing oxygen."},
|
||||
{"Air Filtration System", false, false, 1, 0, "\
|
||||
Implanted in your trachea is an advanced filtration system. If toxins find\n\
|
||||
their way into your windpipe, the filter will attempt to remove them, at the\n\
|
||||
cost of a small amount of power."},
|
||||
{"Internal Climate Control", false, false, 0, 0, "\
|
||||
Throughout your body lies a network of thermal piping which eases the effects\n\
|
||||
of high and low ambient temperatures. It has an operating range of 0 to 140\n\
|
||||
degrees Fahrenheit."},
|
||||
{"Internal Storage", false, false, 0, 0, "\
|
||||
Space inside your chest cavity has been converted into a storage area. You\n\
|
||||
may carry an extra 8 units of volume."},
|
||||
{"Recycler Unit", false, false, 0, 0, "\
|
||||
Your digestive system has been outfitted with a series of filters and\n\
|
||||
processors, allowing you to reclaim waste liquid and, to a lesser degree,\n\
|
||||
nutrients. The net effect is a greatly reduced need to eat and drink."},
|
||||
{"Expanded Digestive System", false, false, 0, 0, "\
|
||||
You have been outfitted with three synthetic stomachs and industrial-grade\n\
|
||||
intestines. Not only can you extract much more nutrition from food, but you\n\
|
||||
are highly resistant to food-born illness, and can sometimes eat rotten food."},
|
||||
{"Integrated Toolset", false, false, 0, 0, "\
|
||||
Implanted in your hands and fingers is a complete tool set - screwdriver,\n\
|
||||
hammer, wrench, and much more. You no longer need any tools when crafting."},
|
||||
{"Electroshock Unit", false, false, 1, 0, "\
|
||||
While fighting unarmed, or with a weapon that conducts electricity, there is\n\
|
||||
a chance that a successful hit will shock your opponent, inflicting extra\n\
|
||||
damage and disabling them temporarily at the cost of some energy."},
|
||||
{"Heat Drain", false, false, 1, 0, "\
|
||||
While fighting unarmed against a warm-blooded opponent, there is a chance\n\
|
||||
that a successful hit will drain body heat, inflicting a small amount of\n\
|
||||
extra damage, and increasing your power reserves slightly."},
|
||||
{"Subdermal Carbon Filament", false, false, 0, 0, "\
|
||||
Lying just beneath your skin is a thin armor made of carbon nanotubes. This\n\
|
||||
reduces bashing damage by 2 and cutting damage by 4, but also reduces your\n\
|
||||
dexterity by 2."},
|
||||
{"Alloy Plating - Head", false, false, 0, 0, "\
|
||||
The flesh on your head has been replaced by a strong armor, protecting both\n\
|
||||
your head and jaw regions, but increasing encumberance by 2 and decreasing\n\
|
||||
perception by 1."},
|
||||
{"Alloy Plating - Torso", false, false, 0, 0, "\
|
||||
The flesh on your torso has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but increasing your encumberance by 2 and decreasing dexterity by 1."},
|
||||
{"Alloy Plating - Arms", false, false, 0, 0, "\
|
||||
The flesh on your arms has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but decreasing your dexterity by 2."},
|
||||
{"Alloy Plating - Legs", false, false, 0, 0, "\
|
||||
The flesh on your legs has been replaced by a strong armor, protecting you\n\
|
||||
greatly, but decreasing your speed by 15."},
|
||||
|
||||
{"Cranial Flashlight", false, true, 1, 30, "\
|
||||
Mounted between your eyes is a small but powerful LED flashlight."},
|
||||
{"Implanted Night Vision", false, true, 1, 20, "\
|
||||
Your eyes have been modified to amplify existing light, allowing you to see\n\
|
||||
in the dark."},
|
||||
{"Infrared Vision", false, true, 1, 4, "\
|
||||
Your range of vision extends into the infrared, allowing you to see warm-\n\
|
||||
blooded creatures in the dark, and even through walls."},
|
||||
{"Facial Distortion", false, true, 1, 10, "\
|
||||
Your face is actually made of a compound which may be molded by electrical\n\
|
||||
impulses, making you impossible to recognize. While not powered, however,\n\
|
||||
the compound reverts to its default shape."},
|
||||
{"Active Defense System", false, true, 1, 7, "\
|
||||
A thin forcefield surrounds your body, continually draining power. Anything\n\
|
||||
attempting to penetrate this field has a chance of being deflected at the\n\
|
||||
cost of more energy. Melee attacks will be stopped more often than bullets."},
|
||||
{"Offensive Defense System", false, true, 1, 6, "\
|
||||
A thin forcefield surrounds your body, continually draining power. This\n\
|
||||
field does not deflect penetration, but rather delivers a very strong shock,\n\
|
||||
damaging unarmed attackers and those with a conductive weapon."},
|
||||
{"Olfactory Mask", false, true, 1, 8, "\
|
||||
While this system is powered, your body will produce very little odor, making\n\
|
||||
it nearly impossible for creatures to track you by scent."},
|
||||
{"Cloaking System", false, true, 2, 1, "\
|
||||
This high-power system uses a set of cameras and LEDs to make you blend into\n\
|
||||
your background, rendering you fully invisible to normal vision. However,\n\
|
||||
you may be detected by infrared, sonar, etc."},
|
||||
{"Sensory Dulling", false, true, 2, 0, "\
|
||||
Your nervous system is wired to allow you to inhibit the signals of pain,\n\
|
||||
allowing you to dull your senses at will. However, the use of this system\n\
|
||||
may cause delayed reaction time and drowsiness."},
|
||||
{"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."},
|
||||
{"Thermal Dissapation", 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."},
|
||||
{"Sonic Resonator", false, true, 4, 0, "\
|
||||
Your entire body may resonate at very high power, creating a short-range\n\
|
||||
shockwave. While it will not to much damage to flexible creatures, stiff\n\
|
||||
items such as walls, doors, and even robots will be severely damaged."},
|
||||
{"Time Dilation", false, true, 3, 0, "\
|
||||
At an immense cost of power, you may increase your body speed and reactions\n\
|
||||
dramatically, essentially freezing time. You are still delicate, however,\n\
|
||||
and violent or rapid movements may damage you due to friction."},
|
||||
{"Teleportation Unit", false, true, 10, 0, "\
|
||||
This highly experimental unit folds space over short distances, instantly\n\
|
||||
transporting your body up to 25 feet at the cost of much power. Note that\n\
|
||||
prolonged or frequent use may have dangerous side effects."},
|
||||
{"Blood Analysis", false, true, 1, 0, "\
|
||||
Small sensors have been implanted in your heart, allowing you to analyse your\n\
|
||||
blood. This will detect many illnesses, drugs, and other conditions."},
|
||||
{"Blood Filter", false, true, 3, 0, "\
|
||||
A filtration system in your heart allows you to actively filter out chemical\n\
|
||||
impurities, primarily drugs. It will have limited impact on viruses. Note\n\
|
||||
that it is not a targeted filter; ALL drugs in your system will be affected."},
|
||||
{"Alarm System", false, true, 1, 400, "\
|
||||
A motion-detecting alarm system will notice almost all movement within a\n\
|
||||
fifteen-foot radius, and will silently alert you. This is very useful during\n\
|
||||
sleep, or if you suspect a cloaked pursuer."},
|
||||
{"Aero-Evaporator", false, true, 8, 0, "\
|
||||
This unit draws moisture from the surrounding air, which then is poured from\n\
|
||||
a fingertip in the form of water. It may fail in very dry environments."},
|
||||
{"Mini-Flamethrower", false, true, 3, 0, "\
|
||||
The index fingers of both hands have powerful fire starters which extend from\n\
|
||||
the tip."},
|
||||
{"Adamantium Claws", false, true, 3, 0, "\
|
||||
Your fingers can withdraw into your hands, allowing a set of vicious claws to\n\
|
||||
extend. These do considerable cutting damage, but prevent you from holding\n\
|
||||
anything else."},
|
||||
{"Fusion Blaster Arm", false, true, 2, 0, "\
|
||||
Your left arm has been replaced by a heavy-duty fusion blaster! You may use\n\
|
||||
your energy banks to fire a damaging heat ray; however, you are unable to use\n\
|
||||
or carry two-handed items, and may only fire handguns."},
|
||||
{"Finger-Mounter Laser", false, true, 2, 0, "\
|
||||
One of your fingers has a small high-powered laser embedded in it. This long\n\
|
||||
range weapon is not incredibly damaging, but is very accurate, and has the\n\
|
||||
potential to start fires."},
|
||||
{"Directional EMP", false, true, 4, 0, "\
|
||||
Mounted in the palms of your hand are small parabolic EMP field generators.\n\
|
||||
You may use power to fire a short-ranged blast which will disable electronics\n\
|
||||
and robots."},
|
||||
{"Hydraulic Muscles", false, true, 1, 3, "\
|
||||
While activated, the muslces in your arms will be greatly enchanced,\n\
|
||||
increasing your strength by 20."},
|
||||
{"Water Extraction Unit", false, true, 2, 0, "\
|
||||
Nanotubs embedded in the palm of your hand will pump any available fluid out\n\
|
||||
of a dead body, cleanse it of impurities and convert it into drinkable water.\n\
|
||||
You must, however, have a container to store the water in."},
|
||||
{"Electromagnetic Unit", false, true, 2, 0, "\
|
||||
Embedded in your hand is a powerful electromagnet, allowing you to pull items\n\
|
||||
made of iron over short distances."},
|
||||
{"Fingerhack", false, true, 1, 0, "\
|
||||
One of your fingers has an electrohack embedded in it; an all-purpose hacking\n\
|
||||
unit used to override control panels and the like (but not computers). Skill\n\
|
||||
in computers is important, and a failed use may damage your circuits."},
|
||||
{"Fingerpick", false, true, 1, 0, "\
|
||||
One of your fingers has an electronic lockpick embedded in it. This auto-\n\
|
||||
matic system will quickly unlock all but the most advanced key locks without\n\
|
||||
any skill required on the part of the user."},
|
||||
{"Terranian Sonar", false, true, 1, 5, "\
|
||||
Your feet are equipped with precision sonar equipment, allowing you to detect\n\
|
||||
the movements of creatures below the ground."},
|
||||
|
||||
{"max_bio_start - BUG", false, false, 0, 0, "\
|
||||
This is a placeholder bionic meant to demarkate those which a new character\n\
|
||||
can start with. If you are reading this, you have found a bug!"},
|
||||
|
||||
{"Banishment", false, true, 40, 0, "\
|
||||
You can briefly open a one-way gate to the nether realm, banishing a single\n\
|
||||
target there permanently. This is not without its dangers, however, as the\n\
|
||||
inhabitants of the nether world may take notice."},
|
||||
{"Gate Out", false, true, 55, 0, "\
|
||||
You can temporarily open a two-way gate to the nether realm, accessible only\n\
|
||||
by you. This will remove you from immediate danger, but may attract the\n\
|
||||
attention of the nether world's inhabitants..."},
|
||||
{"Gate In", false, true, 35, 0, "\
|
||||
You can temporarily open a one-way gate from the nether realm. This will\n\
|
||||
attract the attention of its horrifying inhabitants, who may begin to pour\n\
|
||||
into reality."},
|
||||
{"Artificial Night", false, true, 5, 1, "\
|
||||
Photon absorbtion panels will attract and obliterate photons within a 100'\n\
|
||||
radius, casting an area around you into pitch darkness."},
|
||||
{"Borehole Drill", false, true, 30, 0, "\
|
||||
Your legs can transform into a powerful drill which will bury you 50 feet\n\
|
||||
into the earth. Be careful to only drill down when you know you will be able\n\
|
||||
to get out, or you'll simply dig your own tomb."},
|
||||
{"Heatwave", false, true, 45, 0, "\
|
||||
At the cost of immense power, you can cause dramatic spikes in the ambient\n\
|
||||
temperature around you. These spikes are very short-lived, but last long\n\
|
||||
enough to ignite wood, paper, gunpowder, and other substances."},
|
||||
{"Chain Lightning", false, true, 48, 0, "\
|
||||
Powerful capacitors unleash an electrical storm at your command, sending a\n\
|
||||
chain of highly-damaging lightning through the air. It has the power to\n\
|
||||
injure several opponents before grounding itself."},
|
||||
{"Tremor Pads", false, true, 40, 0, "\
|
||||
Using tremor pads in your feet, you can cause a miniature earthquake. The\n\
|
||||
shockwave will damage enemies (particularly those digging underground), tear\n\
|
||||
down walls, and churn the earth."},
|
||||
{"Flashflood", false, true, 35, 0, "\
|
||||
By drawing the moisture from the air, and synthesizing water from in-air\n\
|
||||
elements, you can create a massive puddle around you. The effects are more\n\
|
||||
powerful when used near a body of water."}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,58 +0,0 @@
|
||||
#include "bodypart.h"
|
||||
#include "rng.h"
|
||||
|
||||
std::string body_part_name (body_part bp, int side)
|
||||
{
|
||||
switch (bp) {
|
||||
case bp_head:
|
||||
return "head";
|
||||
case bp_eyes:
|
||||
return "eyes";
|
||||
case bp_mouth:
|
||||
return "jaw";
|
||||
case bp_torso:
|
||||
return "torso";
|
||||
case bp_arms:
|
||||
if (side == 0)
|
||||
return "left arm";
|
||||
if (side == 1)
|
||||
return "right arm";
|
||||
return "arms";
|
||||
case bp_hands:
|
||||
if (side == 0)
|
||||
return "left hand";
|
||||
if (side == 1)
|
||||
return "right hand";
|
||||
return "hands";
|
||||
case bp_legs:
|
||||
if (side == 0)
|
||||
return "left leg";
|
||||
if (side == 1)
|
||||
return "right leg";
|
||||
return "legs";
|
||||
case bp_feet:
|
||||
if (side == 0)
|
||||
return "left foot";
|
||||
if (side == 1)
|
||||
return "right foot";
|
||||
return "feet";
|
||||
default:
|
||||
return "appendix";
|
||||
}
|
||||
}
|
||||
|
||||
body_part random_body_part()
|
||||
{
|
||||
int rn = rng(0, 30);
|
||||
if (rn == 0)
|
||||
return bp_eyes;
|
||||
if (rn <= 2)
|
||||
return bp_mouth;
|
||||
if (rn <= 6)
|
||||
return bp_head;
|
||||
if (rn <= 12)
|
||||
return bp_legs;
|
||||
if (rn <= 20)
|
||||
return bp_arms;
|
||||
return bp_torso;
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
#ifndef _BODYPART_H_
|
||||
#define _BODYPART_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
enum body_part {
|
||||
bp_head = 0,
|
||||
bp_eyes,
|
||||
bp_mouth,
|
||||
bp_torso,
|
||||
bp_arms,
|
||||
bp_hands,
|
||||
bp_legs,
|
||||
bp_feet,
|
||||
num_bp
|
||||
};
|
||||
|
||||
std::string body_part_name(body_part bp, int side);
|
||||
body_part random_body_part();
|
||||
|
||||
#endif
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: page
|
||||
title: Changes
|
||||
permalink: /changes/
|
||||
---
|
||||
{% for pull in site.github.pulls %}
|
||||
{{ pull.title }}
|
||||
------------------
|
||||
|
||||
{{ pull.body }}
|
||||
{% endfor %}
|
||||
@@ -1,72 +0,0 @@
|
||||
#ifndef _COLOR_H_
|
||||
#define _COLOR_H
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
#ifndef _COLOR_LIST_
|
||||
#define _COLOR_LIST_
|
||||
|
||||
enum col_attribute {
|
||||
WA_NULL = 0,
|
||||
HI = 1,
|
||||
INV = 2
|
||||
};
|
||||
|
||||
enum nc_color {
|
||||
c_black = COLOR_PAIR(23),
|
||||
c_white = COLOR_PAIR(1) | A_BOLD,
|
||||
c_ltgray = COLOR_PAIR(1),
|
||||
c_dkgray = COLOR_PAIR(23) | A_BOLD,
|
||||
c_red = COLOR_PAIR(2),
|
||||
c_green = COLOR_PAIR(3),
|
||||
c_blue = COLOR_PAIR(4),
|
||||
c_cyan = COLOR_PAIR(5),
|
||||
c_magenta = COLOR_PAIR(6),
|
||||
c_brown = COLOR_PAIR(7),
|
||||
c_ltred = COLOR_PAIR(2) | A_BOLD,
|
||||
c_ltgreen = COLOR_PAIR(3) | A_BOLD,
|
||||
c_ltblue = COLOR_PAIR(4) | A_BOLD,
|
||||
c_ltcyan = COLOR_PAIR(5) | A_BOLD,
|
||||
c_pink = COLOR_PAIR(6) | A_BOLD,
|
||||
c_yellow = COLOR_PAIR(7) | A_BOLD,
|
||||
|
||||
h_black = COLOR_PAIR(20),
|
||||
h_white = COLOR_PAIR(15) | A_BOLD,
|
||||
h_ltgray = COLOR_PAIR(15),
|
||||
h_dkgray = COLOR_PAIR(20) | A_BOLD,
|
||||
h_red = COLOR_PAIR(16),
|
||||
h_green = COLOR_PAIR(17),
|
||||
h_blue = COLOR_PAIR(20),
|
||||
h_cyan = COLOR_PAIR(19),
|
||||
h_magenta = COLOR_PAIR(21),
|
||||
h_brown = COLOR_PAIR(22),
|
||||
h_ltred = COLOR_PAIR(16) | A_BOLD,
|
||||
h_ltgreen = COLOR_PAIR(17) | A_BOLD,
|
||||
h_ltblue = COLOR_PAIR(18) | A_BOLD,
|
||||
h_ltcyan = COLOR_PAIR(19) | A_BOLD,
|
||||
h_pink = COLOR_PAIR(21) | A_BOLD,
|
||||
h_yellow = COLOR_PAIR(22) | A_BOLD,
|
||||
|
||||
i_black = COLOR_PAIR(23),
|
||||
i_white = COLOR_PAIR(8) | A_BLINK,
|
||||
i_ltgray = COLOR_PAIR(8),
|
||||
i_dkgray = COLOR_PAIR(23) | A_BLINK,
|
||||
i_red = COLOR_PAIR(9),
|
||||
i_green = COLOR_PAIR(10),
|
||||
i_blue = COLOR_PAIR(11),
|
||||
i_cyan = COLOR_PAIR(12),
|
||||
i_magenta = COLOR_PAIR(13),
|
||||
i_brown = COLOR_PAIR(14),
|
||||
i_ltred = COLOR_PAIR(9) | A_BLINK,
|
||||
i_ltgreen = COLOR_PAIR(10) | A_BLINK,
|
||||
i_ltblue = COLOR_PAIR(11) | A_BLINK,
|
||||
i_ltcyan = COLOR_PAIR(12) | A_BLINK,
|
||||
i_pink = COLOR_PAIR(13) | A_BLINK,
|
||||
i_yellow = COLOR_PAIR(14) | A_BLINK
|
||||
};
|
||||
|
||||
void setattr(nc_color &col, col_attribute attr);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Contribution Guidelines"
|
||||
permalink: /contributions/
|
||||
---
|
||||
|
||||
# Contribute
|
||||
|
||||
**Opening a new issue?** Please read our [issue guidelines]({{ site.baseurl }}{% link pages/issues.md %}) first.
|
||||
|
||||
**Contributing code?** Check the [code contribution guidelines]({{ site.baseurl }}{% link pages/code_contributions.md %}).
|
||||
|
||||
**Investigating bugs?** These [debugging commands]({{ site.baseurl }}{% link pages/debugging.md %}) can help.
|
||||
|
||||
**Need help with git?** [git howto]({{ site.baseurl }}{% link pages/branch_management.md %}) might be what you're looking for.
|
||||
|
||||
Contributing code or data to Cataclysm: Dark Days Ahead is easy - simply fork the repository on our [GitHub](https://github.com/CleverRaven/Cataclysm-DDA/), make your changes, and then send us a pull request.
|
||||
|
||||
Cataclysm: Dark Days Ahead is released under the Creative Commons Attribution ShareAlike 3.0 license. The code and content of the game is free to use, modify, and redistribute for any purpose whatsoever. See [https://creativecommons.org/licenses/by-sa/3.0/](https://creativecommons.org/licenses/by-sa/3.0/) for details.
|
||||
This means any contribution you make to the project will also be covered by the same license, and this license is irrevocable.
|
||||
|
||||
## Guidelines
|
||||
|
||||
There are a couple of guidelines we suggest sticking to:
|
||||
|
||||
* Add the repository as an `upstream` remote.
|
||||
* Keep your `master` branch clean. This means you can easily pull changes made to this repository into yours.
|
||||
* Create a new branch for each new feature or set of related bug fixes.
|
||||
* Never merge from your local branches into your `master` branch. Only update `master` by pulling from `upstream/master`.
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
#### Why does `git pull --ff-only` result in an error?
|
||||
|
||||
If `git pull --ff-only` shows an error, it means that you've committed directly to your local `master` branch. To fix this, you can create a new branch with these commits, find the point at which you diverged from `upstream/master`, and then reset `master` to that point.
|
||||
|
||||
$ git pull --ff-only upstream master
|
||||
From https://github.com/CleverRaven/Cataclysm-DDA
|
||||
* branch master -> FETCH_HEAD
|
||||
fatal: Not possible to fast-forward, aborting.
|
||||
$ git branch new_branch master # mark the current commit with a tmp branch
|
||||
$ git merge-base master upstream/master
|
||||
cc31d0... # the last commit before we committed directly to master
|
||||
$ git reset --hard cc31d0....
|
||||
HEAD is now at cc31d0... ...
|
||||
|
||||
Now that `master` has been cleaned up, you can easily pull from `upstream/master`, and then continue working on `new_branch`.
|
||||
|
||||
$ git pull --ff-only upstream master
|
||||
# gets changes from the "upstream" remote for the matching branch, in this case "master"
|
||||
$ git checkout new_branch
|
||||
|
||||
#### How does the project work anyway?
|
||||
|
||||
I-am-Erk has written a guide outlining project governance.
|
||||
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/development_process.md
|
||||
-825
@@ -1,825 +0,0 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "keypress.h"
|
||||
#include "game.h"
|
||||
#include "output.h"
|
||||
#include "crafting.h"
|
||||
#include "setvector.h"
|
||||
|
||||
void draw_recipe_tabs(WINDOW *w, craft_cat tab);
|
||||
|
||||
void game::init_recipes()
|
||||
{
|
||||
int id = -1;
|
||||
int tl, cl;
|
||||
|
||||
#define RECIPE(result, cat, sk1, sk2, diff, time) \
|
||||
tl = 0; cl = 0; id++;\
|
||||
recipes.push_back( recipe(id, result, cat, sk1, sk2, diff, time) )
|
||||
#define TOOL(...) setvector(recipes[id].tools[tl], __VA_ARGS__); tl++
|
||||
#define COMP(...) setvector(recipes[id].components[cl], __VA_ARGS__); cl++
|
||||
|
||||
/* A recipe will not appear in your menu until your level in the primary skill
|
||||
* is at least equal to the difficulty. At that point, your chance of success
|
||||
* is still not great; a good 25% improvement over the difficulty is important
|
||||
*/
|
||||
RECIPE(itm_spear_wood, CC_WEAPON, sk_null, sk_null, 0, 800);
|
||||
TOOL(itm_hatchet, -1, itm_knife_steak, -1, itm_knife_butcher, -1,
|
||||
itm_knife_combat, -1, itm_machete, -1, NULL);
|
||||
COMP(itm_stick, 1, itm_broom, 1, itm_mop, 1, itm_2x4, 1, NULL);
|
||||
|
||||
RECIPE(itm_nailboard, CC_WEAPON, sk_null, sk_null, 0, 1000);
|
||||
TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
|
||||
COMP(itm_2x4, 1, itm_bat, 1, NULL);
|
||||
COMP(itm_nail, 6, NULL);
|
||||
|
||||
RECIPE(itm_molotov, CC_WEAPON, sk_null, sk_null, 0, 500);
|
||||
COMP(itm_rag, 1, NULL);
|
||||
COMP(itm_whiskey, 1, itm_vodka, 1, itm_rum, 1, itm_tequila, 1,
|
||||
itm_gasoline, 1, NULL);
|
||||
|
||||
RECIPE(itm_shotgun_sawn, CC_WEAPON, sk_gun, sk_null, 1, 500);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
COMP(itm_shotgun_d, 1, itm_remington_870, 1, itm_mossberg_500, 1,
|
||||
itm_saiga_12, 1, NULL);
|
||||
|
||||
RECIPE(itm_bolt_wood, CC_WEAPON, sk_mechanics, sk_gun, 1, 5000);
|
||||
TOOL(itm_hatchet, -1, itm_knife_steak, -1, itm_knife_butcher, -1,
|
||||
itm_knife_combat, -1, itm_machete, -1, NULL);
|
||||
COMP(itm_stick, 1, itm_broom, 1, itm_mop, 1, itm_2x4, 1, itm_bee_sting, 1,
|
||||
NULL);
|
||||
|
||||
RECIPE(itm_crossbow, CC_WEAPON, sk_mechanics, sk_gun, 3, 15000);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_2x4, 1, itm_stick, 4, NULL);
|
||||
COMP(itm_hose, 1, NULL);
|
||||
|
||||
RECIPE(itm_rifle_22, CC_WEAPON, sk_mechanics, sk_gun, 3, 12000);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
COMP(itm_2x4, 1, NULL);
|
||||
|
||||
RECIPE(itm_rifle_9mm, CC_WEAPON, sk_mechanics, sk_gun, 3, 14000);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
COMP(itm_2x4, 1, NULL);
|
||||
|
||||
RECIPE(itm_smg_9mm, CC_WEAPON, sk_mechanics, sk_gun, 5, 18000);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_hammer, -1, itm_rock, -1, itm_hatchet, -1, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
COMP(itm_2x4, 2, NULL);
|
||||
COMP(itm_nail, 4, NULL);
|
||||
|
||||
RECIPE(itm_smg_45, CC_WEAPON, sk_mechanics, sk_gun, 5, 20000);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_hammer, -1, itm_rock, -1, itm_hatchet, -1, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
COMP(itm_2x4, 2, NULL);
|
||||
COMP(itm_nail, 4, NULL);
|
||||
|
||||
RECIPE(itm_grenade, CC_WEAPON, sk_mechanics, sk_null, 2, 5000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_superglue, 1, itm_string_36, 1, NULL);
|
||||
COMP(itm_can_food, 1, itm_can_drink, 1, itm_canister_empty, 1, NULL);
|
||||
COMP(itm_nail, 30, itm_bb, 100, NULL);
|
||||
COMP(itm_shot_bird, 6, itm_shot_00, 3, itm_shot_slug, 2,
|
||||
itm_gasoline, 1, NULL);
|
||||
|
||||
RECIPE(itm_chainsaw_off, CC_WEAPON, sk_mechanics, sk_null, 4, 20000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_hammer, -1, itm_hatchet, -1, NULL);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
COMP(itm_motor, 1, NULL);
|
||||
COMP(itm_chain, 1, NULL);
|
||||
|
||||
RECIPE(itm_smokebomb, CC_WEAPON, sk_cooking, sk_mechanics, 3, 7500);
|
||||
TOOL(itm_screwdriver, -1, itm_wrench, -1, NULL);
|
||||
COMP(itm_water, 1, itm_water_dirty, 1, itm_salt_water, 1, NULL);
|
||||
COMP(itm_candy, 1, itm_cola, 1, NULL);
|
||||
COMP(itm_vitamins, 10, itm_aspirin, 8, NULL);
|
||||
COMP(itm_canister_empty, 1, itm_can_food, 1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
|
||||
RECIPE(itm_gasbomb, CC_WEAPON, sk_cooking, sk_mechanics, 4, 8000);
|
||||
TOOL(itm_screwdriver, -1, itm_wrench, -1, NULL);
|
||||
COMP(itm_bleach, 2, NULL);
|
||||
COMP(itm_ammonia, 2, NULL);
|
||||
COMP(itm_canister_empty, 1, itm_can_food, 1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
|
||||
RECIPE(itm_landmine, CC_WEAPON, sk_traps, sk_mechanics, 5, 10000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
COMP(itm_can_food, 1, itm_steel_chunk, 1, itm_canister_empty, 1, NULL);
|
||||
COMP(itm_nail, 100, itm_bb, 100, NULL);
|
||||
COMP(itm_shot_bird, 30, itm_shot_00, 18, itm_shot_slug, 15, itm_gasoline, 3,
|
||||
itm_grenade, 1, NULL);
|
||||
|
||||
RECIPE(itm_mininuke, CC_WEAPON, sk_mechanics, sk_electronics, 10, 40000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
COMP(itm_can_food, 2, itm_steel_chunk, 2, itm_canister_empty, 1, NULL);
|
||||
COMP(itm_plut_cell, 6, NULL);
|
||||
COMP(itm_battery, 2, NULL);
|
||||
COMP(itm_power_supply, 1, NULL);
|
||||
|
||||
RECIPE(itm_meat_cooked, CC_FOOD, sk_cooking, sk_null, 0, 5000);
|
||||
TOOL(itm_hotplate, 7, NULL);
|
||||
TOOL(itm_pan, -1, itm_pot, -1, NULL);
|
||||
COMP(itm_meat, 1, NULL);
|
||||
|
||||
RECIPE(itm_veggy_cooked, CC_FOOD, sk_cooking, sk_null, 0, 4000);
|
||||
TOOL(itm_hotplate, 5, NULL);
|
||||
TOOL(itm_pan, -1, itm_pot, -1, NULL);
|
||||
COMP(itm_veggy, 1, NULL);
|
||||
|
||||
RECIPE(itm_spaghetti_cooked, CC_FOOD, sk_cooking, sk_null, 0, 10000);
|
||||
TOOL(itm_hotplate, 4, NULL);
|
||||
TOOL(itm_pot, -1, NULL);
|
||||
COMP(itm_spaghetti_raw, 1, NULL);
|
||||
COMP(itm_water, 1, itm_water_dirty, 1, NULL);
|
||||
|
||||
RECIPE(itm_macaroni_cooked, CC_FOOD, sk_cooking, sk_null, 1, 10000);
|
||||
TOOL(itm_hotplate, 4, NULL);
|
||||
TOOL(itm_pot, -1, NULL);
|
||||
COMP(itm_macaroni_raw, 1, NULL);
|
||||
COMP(itm_water, 1, itm_water_dirty, 1, NULL);
|
||||
|
||||
RECIPE(itm_jerky, CC_FOOD, sk_cooking, sk_null, 2, 30000);
|
||||
TOOL(itm_hotplate, 10, NULL);
|
||||
COMP(itm_salt_water, 1, NULL);
|
||||
COMP(itm_meat, 1, NULL);
|
||||
|
||||
RECIPE(itm_V8, CC_FOOD, sk_cooking, sk_null, 2, 5000);
|
||||
COMP(itm_can_drink, 1, NULL);
|
||||
COMP(itm_tomato, 1, NULL);
|
||||
COMP(itm_broccoli, 1, NULL);
|
||||
COMP(itm_zucchini, 1, NULL);
|
||||
|
||||
RECIPE(itm_meth, CC_FOOD, sk_cooking, sk_null, 4, 20000);
|
||||
TOOL(itm_hotplate, 15, NULL);
|
||||
TOOL(itm_bottle_glass, -1, itm_hose, -1, NULL);
|
||||
COMP(itm_dayquil, 2, itm_royal_jelly, 1, NULL);
|
||||
COMP(itm_aspirin, 40, NULL);
|
||||
COMP(itm_caffeine, 20, itm_adderall, 5, itm_energy_drink, 2, NULL);
|
||||
|
||||
RECIPE(itm_royal_jelly, CC_FOOD, sk_cooking, sk_null, 5, 5000);
|
||||
COMP(itm_honeycomb, 1, NULL);
|
||||
COMP(itm_bleach, 2, itm_purifier, 1, NULL);
|
||||
|
||||
RECIPE(itm_heroin, CC_FOOD, sk_cooking, sk_null, 6, 2000);
|
||||
TOOL(itm_hotplate, 3, itm_lighter, 25, NULL);
|
||||
TOOL(itm_pan, -1, itm_pot, -1, NULL);
|
||||
COMP(itm_salt_water, 1, NULL);
|
||||
COMP(itm_oxycodone, 40, NULL);
|
||||
|
||||
RECIPE(itm_mutagen, CC_FOOD, sk_cooking, sk_firstaid, 8, 10000);
|
||||
TOOL(itm_hotplate, 25, NULL);
|
||||
COMP(itm_meat_tainted, 3, itm_veggy_tainted, 5, itm_fetus, 1, itm_arm, 2,
|
||||
itm_leg, 2, NULL);
|
||||
COMP(itm_bleach, 2, NULL);
|
||||
COMP(itm_ammonia, 1, NULL);
|
||||
|
||||
RECIPE(itm_purifier, CC_FOOD, sk_cooking, sk_firstaid, 9, 10000);
|
||||
TOOL(itm_hotplate, 25, NULL);
|
||||
COMP(itm_royal_jelly, 3, itm_mutagen, 1, NULL);
|
||||
COMP(itm_bleach, 3, NULL);
|
||||
COMP(itm_ammonia, 2, NULL);
|
||||
|
||||
RECIPE(itm_antenna, CC_ELECTRONIC, sk_null, sk_null, 0, 3000);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
COMP(itm_radio, 1, itm_two_way_radio, 1, itm_motor, 1, itm_knife_butter, 2,
|
||||
NULL);
|
||||
|
||||
RECIPE(itm_amplifier, CC_ELECTRONIC, sk_electronics, sk_null, 2, 4000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_flashlight, 1, itm_radio, 1, itm_two_way_radio, 1, itm_geiger, 1,
|
||||
itm_goggles_nv, 1, itm_transponder, 2, NULL);
|
||||
|
||||
RECIPE(itm_power_supply, CC_ELECTRONIC, sk_electronics, sk_null, 2, 6500);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 3, NULL);
|
||||
COMP(itm_amplifier, 2, itm_soldering_iron, 1, itm_electrohack, 1,
|
||||
itm_battery, 800, itm_geiger, 1, NULL);
|
||||
|
||||
RECIPE(itm_receiver, CC_ELECTRONIC, sk_electronics, sk_null, 3, 12000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 4, NULL);
|
||||
COMP(itm_amplifier, 2, itm_radio, 1, itm_two_way_radio, 1, NULL);
|
||||
|
||||
RECIPE(itm_transponder, CC_ELECTRONIC, sk_electronics, sk_null, 3, 14000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 7, NULL);
|
||||
COMP(itm_receiver, 3, itm_two_way_radio, 1, NULL);
|
||||
|
||||
RECIPE(itm_flashlight, CC_ELECTRONIC, sk_electronics, sk_null, 1, 10000);
|
||||
COMP(itm_amplifier, 1, NULL);
|
||||
COMP(itm_bottle_plastic, 1, itm_bottle_glass, 1, itm_can_drink, 1, NULL);
|
||||
|
||||
RECIPE(itm_soldering_iron, CC_ELECTRONIC, sk_electronics, sk_null, 1, 20000);
|
||||
COMP(itm_screwdriver, 1, itm_antenna, 1, itm_xacto, 1, itm_knife_butter, 1,
|
||||
NULL);
|
||||
COMP(itm_power_supply, 1, NULL);
|
||||
|
||||
RECIPE(itm_battery, CC_ELECTRONIC, sk_electronics, sk_mechanics, 2, 5000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_ammonia, 1, itm_lemon, 1, NULL);
|
||||
COMP(itm_steel_chunk, 1, itm_knife_butter, 1, itm_knife_steak, 1,
|
||||
itm_bolt_steel, 1, NULL);
|
||||
COMP(itm_can_drink, 1, itm_can_food, 1, NULL);
|
||||
|
||||
RECIPE(itm_radio, CC_ELECTRONIC, sk_electronics, sk_null, 2, 25000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 10, NULL);
|
||||
COMP(itm_receiver, 1, NULL);
|
||||
COMP(itm_antenna, 1, NULL);
|
||||
|
||||
RECIPE(itm_water_purifier, CC_ELECTRONIC, sk_mechanics,sk_electronics,3,25000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_hotplate, 1, NULL);
|
||||
COMP(itm_bottle_glass, 2, itm_bottle_plastic, 5, NULL);
|
||||
COMP(itm_hose, 1, NULL);
|
||||
|
||||
RECIPE(itm_hotplate, CC_ELECTRONIC, sk_electronics, sk_null, 3, 30000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_soldering_iron, 1, itm_amplifier, 1, NULL);
|
||||
COMP(itm_pan, 1, itm_pot, 1, itm_knife_butcher, 2, itm_knife_steak, 6,
|
||||
itm_knife_butter, 6, itm_muffler, 1, NULL);
|
||||
|
||||
RECIPE(itm_two_way_radio, CC_ELECTRONIC, sk_electronics, sk_null, 4, 30000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 14, NULL);
|
||||
COMP(itm_amplifier, 1, NULL);
|
||||
COMP(itm_transponder, 1, NULL);
|
||||
COMP(itm_receiver, 1, NULL);
|
||||
COMP(itm_antenna, 1, NULL);
|
||||
|
||||
RECIPE(itm_electrohack, CC_ELECTRONIC, sk_electronics, sk_computer, 4, 35000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 10, NULL);
|
||||
COMP(itm_processor, 1, NULL);
|
||||
COMP(itm_RAM, 1, NULL);
|
||||
|
||||
RECIPE(itm_geiger, CC_ELECTRONIC, sk_electronics, sk_null, 5, 35000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 14, NULL);
|
||||
COMP(itm_power_supply, 1, NULL);
|
||||
COMP(itm_amplifier, 2, NULL);
|
||||
|
||||
RECIPE(itm_teleporter, CC_ELECTRONIC, sk_electronics, sk_null, 8, 50000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
TOOL(itm_soldering_iron, 16, NULL);
|
||||
COMP(itm_power_supply, 3, itm_plut_cell, 5, NULL);
|
||||
COMP(itm_amplifier, 3, NULL);
|
||||
COMP(itm_transponder, 3, NULL);
|
||||
|
||||
RECIPE(itm_mocassins, CC_ARMOR, sk_tailor, sk_null, 1, 30000);
|
||||
TOOL(itm_sewing_kit, 5, NULL);
|
||||
COMP(itm_fur, 2, NULL);
|
||||
|
||||
RECIPE(itm_hat_fur, CC_ARMOR, sk_tailor, sk_null, 1, 40000);
|
||||
TOOL(itm_sewing_kit, 8, NULL);
|
||||
COMP(itm_fur, 3, NULL);
|
||||
|
||||
RECIPE(itm_tshirt, CC_ARMOR, sk_tailor, sk_null, 2, 40000);
|
||||
TOOL(itm_sewing_kit, 10, NULL);
|
||||
COMP(itm_rag, 6, NULL);
|
||||
|
||||
RECIPE(itm_tank_top, CC_ARMOR, sk_tailor, sk_null, 2, 38000);
|
||||
TOOL(itm_sewing_kit, 8, NULL);
|
||||
COMP(itm_rag, 4, NULL);
|
||||
|
||||
RECIPE(itm_coat_fur, CC_ARMOR, sk_tailor, sk_null, 3, 100000);
|
||||
TOOL(itm_sewing_kit, 20, NULL);
|
||||
COMP(itm_fur, 10, NULL);
|
||||
|
||||
RECIPE(itm_mask_filter, CC_ARMOR, sk_mechanics, sk_tailor, 2, 5000);
|
||||
COMP(itm_bottle_plastic, 1, itm_bag_plastic, 2, NULL);
|
||||
COMP(itm_muffler, 1, itm_bandana, 2, itm_rag, 2, itm_wrapper, 4, NULL);
|
||||
|
||||
RECIPE(itm_mask_gas, CC_ARMOR, sk_tailor, sk_null, 5, 20000);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
COMP(itm_goggles_swim, 2, itm_goggles_ski, 1, NULL);
|
||||
COMP(itm_mask_filter, 3, itm_muffler, 1, NULL);
|
||||
COMP(itm_hose, 1, NULL);
|
||||
|
||||
RECIPE(itm_goggles_nv, CC_ARMOR, sk_electronics, sk_tailor, 6, 40000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_goggles_ski, 1, itm_goggles_welding, 1, itm_mask_gas, 1, NULL);
|
||||
COMP(itm_power_supply, 1, NULL);
|
||||
COMP(itm_amplifier, 3, NULL);
|
||||
|
||||
RECIPE(itm_jacket_leather, CC_ARMOR, sk_tailor, sk_null, 7, 150000);
|
||||
TOOL(itm_sewing_kit, 30, NULL);
|
||||
COMP(itm_leather, 8, NULL);
|
||||
|
||||
RECIPE(itm_helmet_chitin, CC_ARMOR, sk_tailor, sk_null, 9, 200000);
|
||||
COMP(itm_string_36, 1, itm_string_6, 5, NULL);
|
||||
COMP(itm_chitin_piece, 5, NULL);
|
||||
|
||||
RECIPE(itm_armor_chitin, CC_ARMOR, sk_tailor, sk_null, 10, 500000);
|
||||
COMP(itm_string_36, 2, itm_string_6, 12, NULL);
|
||||
COMP(itm_chitin_piece, 15, NULL);
|
||||
|
||||
RECIPE(itm_superglue, CC_MISC, sk_cooking, sk_null, 2, 12000);
|
||||
TOOL(itm_hotplate, 5, NULL);
|
||||
COMP(itm_water, 1, itm_water_dirty, 1, NULL);
|
||||
COMP(itm_milk, 3, itm_bleach, 2, itm_ant_egg, 1, NULL);
|
||||
|
||||
RECIPE(itm_2x4, CC_MISC, sk_null, sk_null, 0, 8000);
|
||||
TOOL(itm_saw, -1, NULL);
|
||||
COMP(itm_stick, 1, NULL);
|
||||
|
||||
RECIPE(itm_crowbar, CC_MISC, sk_mechanics, sk_null, 1, 1000);
|
||||
TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
|
||||
RECIPE(itm_tripwire, CC_MISC, sk_traps, sk_null, 1, 500);
|
||||
COMP(itm_string_36, 1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
|
||||
RECIPE(itm_board_trap, CC_MISC, sk_traps, sk_null, 2, 2500);
|
||||
TOOL(itm_hatchet, -1, itm_hammer, -1, itm_rock, -1, NULL);
|
||||
COMP(itm_2x4, 3, NULL);
|
||||
COMP(itm_nail, 20, NULL);
|
||||
|
||||
RECIPE(itm_beartrap, CC_MISC, sk_mechanics, sk_traps, 2, 3000);
|
||||
TOOL(itm_wrench, -1, NULL);
|
||||
COMP(itm_steel_chunk, 2, NULL);
|
||||
|
||||
RECIPE(itm_crossbow_trap, CC_MISC, sk_mechanics, sk_traps, 3, 4500);
|
||||
COMP(itm_crossbow, 1, NULL);
|
||||
COMP(itm_bolt_steel, 1, NULL);
|
||||
COMP(itm_string_36, 1, itm_string_6, 2, NULL);
|
||||
|
||||
RECIPE(itm_shotgun_trap, CC_MISC, sk_mechanics, sk_traps, 3, 5000);
|
||||
COMP(itm_shotgun_sawn, 1, NULL);
|
||||
COMP(itm_shot_00, 2, NULL);
|
||||
COMP(itm_string_36, 1, itm_string_6, 2, NULL);
|
||||
|
||||
RECIPE(itm_blade_trap, CC_MISC, sk_mechanics, sk_traps, 4, 8000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_motor, 1, NULL);
|
||||
COMP(itm_machete, 1, NULL);
|
||||
COMP(itm_string_36, 1, NULL);
|
||||
|
||||
RECIPE(itm_bandages, CC_MISC, sk_firstaid, sk_null, 1, 500);
|
||||
COMP(itm_rag, 1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
|
||||
RECIPE(itm_silencer, CC_MISC, sk_mechanics, sk_null, 1, 650);
|
||||
TOOL(itm_hacksaw, -1, NULL);
|
||||
COMP(itm_muffler, 1, itm_rag, 4, NULL);
|
||||
COMP(itm_pipe, 1, NULL);
|
||||
|
||||
RECIPE(itm_pheromone, CC_MISC, sk_cooking, sk_null, 3, 1200);
|
||||
TOOL(itm_hotplate, 18, NULL);
|
||||
COMP(itm_meat_tainted, 1, NULL);
|
||||
COMP(itm_ammonia, 1, NULL);
|
||||
|
||||
RECIPE(itm_laser_pack, CC_MISC, sk_electronics, sk_null, 5, 10000);
|
||||
TOOL(itm_screwdriver, -1, NULL);
|
||||
COMP(itm_superglue, 1, NULL);
|
||||
COMP(itm_plut_cell, 1, NULL);
|
||||
|
||||
}
|
||||
|
||||
void game::craft()
|
||||
{
|
||||
WINDOW *w_head = newwin( 3, 80, 0, 0);
|
||||
WINDOW *w_data = newwin(22, 80, 3, 0);
|
||||
craft_cat tab = CC_WEAPON;
|
||||
std::vector<recipe*> current;
|
||||
std::vector<bool> available;
|
||||
item tmp;
|
||||
int line = 0, xpos, ypos;
|
||||
bool redraw = true;
|
||||
bool done = false;
|
||||
char ch;
|
||||
|
||||
do {
|
||||
if (redraw) { // When we switch tabs, redraw the header
|
||||
redraw = false;
|
||||
line = 0;
|
||||
draw_recipe_tabs(w_head, tab);
|
||||
current.clear();
|
||||
available.clear();
|
||||
pick_recipes(current, available, tab);
|
||||
werase(w_data);
|
||||
mvwprintz(w_data, 24, 0, c_white, "\
|
||||
Press ? to describe object. Press <ENTER> to attempt to craft object.");
|
||||
wrefresh(w_data);
|
||||
}
|
||||
|
||||
// Clear the screen of recipe data, and draw it anew
|
||||
werase(w_data);
|
||||
wrefresh(w_data);
|
||||
for (int i = 0; i < current.size() && i < 23; i++) {
|
||||
if (i == line)
|
||||
mvwprintz(w_data, i, 0, (available[i] ? h_white : h_dkgray),
|
||||
itypes[current[i]->result]->name.c_str());
|
||||
else
|
||||
mvwprintz(w_data, i, 0, (available[i] ? c_white : c_dkgray),
|
||||
itypes[current[i]->result]->name.c_str());
|
||||
}
|
||||
if (current.size() > 0) {
|
||||
nc_color col = (available[line] ? c_white : c_dkgray);
|
||||
mvwprintz(w_data, 0, 30, col, "Primary skill: %s",
|
||||
(current[line]->sk_primary == sk_null ? "N/A" :
|
||||
skill_name(current[line]->sk_primary).c_str()));
|
||||
mvwprintz(w_data, 1, 30, col, "Secondary skill: %s",
|
||||
(current[line]->sk_secondary == sk_null ? "N/A" :
|
||||
skill_name(current[line]->sk_secondary).c_str()));
|
||||
mvwprintz(w_data, 2, 30, col, "Difficulty: %d", current[line]->difficulty);
|
||||
if (current[line]->sk_primary == sk_null)
|
||||
mvwprintz(w_data, 3, 30, col, "Your skill level: N/A");
|
||||
else
|
||||
mvwprintz(w_data, 3, 30, col, "Your skill level: %d",
|
||||
u.sklevel[current[line]->sk_primary]);
|
||||
if (current[line]->time >= 1000)
|
||||
mvwprintz(w_data, 4, 30, col, "Time to complete: %d minutes",
|
||||
int(current[line]->time / 1000));
|
||||
else
|
||||
mvwprintz(w_data, 4, 30, col, "Time to complete: %d turns",
|
||||
int(current[line]->time / 100));
|
||||
mvwprintz(w_data, 5, 30, col, "Tools required:");
|
||||
if (current[line]->tools[0].size() == 0) {
|
||||
mvwputch(w_data, 6, 30, col, '>');
|
||||
mvwprintz(w_data, 6, 32, c_green, "NONE");
|
||||
ypos = 6;
|
||||
} else {
|
||||
ypos = 5;
|
||||
// Loop to print the required tools
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (current[line]->tools[i].size() > 0) {
|
||||
ypos++;
|
||||
mvwputch(w_data, ypos, 30, col, '>');
|
||||
}
|
||||
xpos = 32;
|
||||
for (int j = 0; j < current[line]->tools[i].size(); j++) {
|
||||
itype_id type = current[line]->tools[i][j].type;
|
||||
int charges = current[line]->tools[i][j].count;
|
||||
nc_color toolcol = c_red;
|
||||
if (charges < 0 && u.has_amount(type, 1))
|
||||
toolcol = c_green;
|
||||
else if (charges > 0 && u.has_charges(type, charges))
|
||||
toolcol = c_green;
|
||||
if (u.has_bionic(bio_tools))
|
||||
toolcol = c_green;
|
||||
std::stringstream toolinfo;
|
||||
toolinfo << itypes[type]->name + " ";
|
||||
if (charges > 0)
|
||||
toolinfo << "(" << charges << " charges) ";
|
||||
std::string toolname = toolinfo.str();
|
||||
if (xpos + toolname.length() >= 80) {
|
||||
xpos = 32;
|
||||
ypos++;
|
||||
}
|
||||
mvwprintz(w_data, ypos, xpos, toolcol, toolname.c_str());
|
||||
xpos += toolname.length();
|
||||
if (j < current[line]->tools[i].size() - 1) {
|
||||
if (xpos >= 77) {
|
||||
xpos = 32;
|
||||
ypos++;
|
||||
}
|
||||
mvwprintz(w_data, ypos, xpos, c_white, "OR ");
|
||||
xpos += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Loop to print the required components
|
||||
ypos++;
|
||||
mvwprintz(w_data, ypos, 30, col, "Components required:");
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (current[line]->components[i].size() > 0) {
|
||||
ypos++;
|
||||
mvwputch(w_data, ypos, 30, col, '>');
|
||||
}
|
||||
xpos = 32;
|
||||
for (int j = 0; j < current[line]->components[i].size(); j++) {
|
||||
int count = current[line]->components[i][j].count;
|
||||
itype_id type = current[line]->components[i][j].type;
|
||||
nc_color compcol = (u.has_number(type, count) ? c_green : c_red);
|
||||
std::stringstream dump;
|
||||
dump << count << "x " << itypes[type]->name << " ";
|
||||
std::string compname = dump.str();
|
||||
if (xpos + compname.length() >= 80) {
|
||||
ypos++;
|
||||
xpos = 32;
|
||||
}
|
||||
mvwprintz(w_data, ypos, xpos, compcol, compname.c_str());
|
||||
xpos += compname.length();
|
||||
if (j < current[line]->components[i].size() - 1) {
|
||||
if (xpos >= 77) {
|
||||
ypos++;
|
||||
xpos = 32;
|
||||
}
|
||||
mvwprintz(w_data, ypos, xpos, c_white, "OR ");
|
||||
xpos += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wrefresh(w_data);
|
||||
ch = input();
|
||||
switch (ch) {
|
||||
case '<':
|
||||
if (tab == CC_WEAPON)
|
||||
tab = CC_MISC;
|
||||
else
|
||||
tab = craft_cat(int(tab) - 1);
|
||||
redraw = true;
|
||||
break;
|
||||
case '>':
|
||||
if (tab == CC_MISC)
|
||||
tab = CC_WEAPON;
|
||||
else
|
||||
tab = craft_cat(int(tab) + 1);
|
||||
redraw = true;
|
||||
break;
|
||||
case 'j':
|
||||
line++;
|
||||
break;
|
||||
case 'k':
|
||||
line--;
|
||||
break;
|
||||
case '\n':
|
||||
if (!available[line])
|
||||
popup("You can't do that!");
|
||||
else {
|
||||
make_craft(current[line]);
|
||||
done = true;
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
tmp = item(itypes[current[line]->result], 0);
|
||||
full_screen_popup(tmp.info(true).c_str());
|
||||
redraw = true;
|
||||
break;
|
||||
}
|
||||
if (line < 0)
|
||||
line = current.size() - 1;
|
||||
else if (line >= current.size())
|
||||
line = 0;
|
||||
} while (ch != KEY_ESCAPE && ch != 'q' && ch != 'Q' && !done);
|
||||
|
||||
werase(w_head);
|
||||
werase(w_data);
|
||||
delwin(w_head);
|
||||
delwin(w_data);
|
||||
refresh_all();
|
||||
}
|
||||
|
||||
void draw_recipe_tabs(WINDOW *w, craft_cat tab)
|
||||
{
|
||||
werase(w);
|
||||
for (int i = 0; i < 80; i++) {
|
||||
mvwputch(w, 2, i, c_ltgray, LINE_OXOX);
|
||||
if ((i > 4 && i < 14) || (i > 20 && i < 27) || (i > 33 && i < 47) ||
|
||||
(i > 53 && i < 61) || (i > 67 && i < 74))
|
||||
mvwputch(w, 0, i, c_ltgray, LINE_OXOX);
|
||||
}
|
||||
|
||||
|
||||
mvwputch(w, 0, 4, c_ltgray, LINE_OXXO);
|
||||
mvwputch(w, 0, 20, c_ltgray, LINE_OXXO);
|
||||
mvwputch(w, 0, 33, c_ltgray, LINE_OXXO);
|
||||
mvwputch(w, 0, 53, c_ltgray, LINE_OXXO);
|
||||
mvwputch(w, 0, 67, c_ltgray, LINE_OXXO);
|
||||
mvwputch(w, 2, 4, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 20, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 33, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 53, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 67, c_ltgray, LINE_XXOX);
|
||||
|
||||
mvwputch(w, 0, 14, c_ltgray, LINE_OOXX);
|
||||
mvwputch(w, 0, 27, c_ltgray, LINE_OOXX);
|
||||
mvwputch(w, 0, 47, c_ltgray, LINE_OOXX);
|
||||
mvwputch(w, 0, 61, c_ltgray, LINE_OOXX);
|
||||
mvwputch(w, 0, 74, c_ltgray, LINE_OOXX);
|
||||
mvwputch(w, 2, 14, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 27, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 47, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 61, c_ltgray, LINE_XXOX);
|
||||
mvwputch(w, 2, 74, c_ltgray, LINE_XXOX);
|
||||
|
||||
mvwprintz(w, 1, 0, c_ltgray, "\
|
||||
WEAPONS FOOD ELECTRONICS ARMOR MISC");
|
||||
mvwputch(w, 1, 4, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 20, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 33, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 53, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 67, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 14, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 27, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 47, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 61, c_ltgray, LINE_XOXO);
|
||||
mvwputch(w, 1, 74, c_ltgray, LINE_XOXO);
|
||||
|
||||
switch (tab) {
|
||||
case CC_WEAPON:
|
||||
for (int i = 5; i < 14; i++)
|
||||
mvwputch(w, 2, i, c_black, ' ');
|
||||
mvwprintz(w, 1, 6, h_ltgray, "WEAPONS");
|
||||
mvwputch(w, 2, 4, c_ltgray, LINE_XOOX);
|
||||
mvwputch(w, 2, 14, c_ltgray, LINE_XXOO);
|
||||
mvwputch(w, 1, 2, h_ltgray, '<');
|
||||
mvwputch(w, 1, 16, h_ltgray, '>');
|
||||
break;
|
||||
case CC_FOOD:
|
||||
for (int i = 21; i < 27; i++)
|
||||
mvwputch(w, 2, i, c_black, ' ');
|
||||
mvwprintz(w, 1, 22, h_ltgray, "FOOD");
|
||||
mvwputch(w, 2, 20, c_ltgray, LINE_XOOX);
|
||||
mvwputch(w, 2, 27, c_ltgray, LINE_XXOO);
|
||||
mvwputch(w, 1, 18, h_ltgray, '<');
|
||||
mvwputch(w, 1, 29, h_ltgray, '>');
|
||||
break;
|
||||
case CC_ELECTRONIC:
|
||||
for (int i = 34; i < 47; i++)
|
||||
mvwputch(w, 2, i, c_black, ' ');
|
||||
mvwprintz(w, 1, 35, h_ltgray, "ELECTRONICS");
|
||||
mvwputch(w, 2, 33, c_ltgray, LINE_XOOX);
|
||||
mvwputch(w, 2, 47, c_ltgray, LINE_XXOO);
|
||||
mvwputch(w, 1, 31, h_ltgray, '<');
|
||||
mvwputch(w, 1, 49, h_ltgray, '>');
|
||||
break;
|
||||
case CC_ARMOR:
|
||||
for (int i = 54; i < 61; i++)
|
||||
mvwputch(w, 2, i, c_black, ' ');
|
||||
mvwprintz(w, 1, 55, h_ltgray, "ARMOR");
|
||||
mvwputch(w, 2, 53, c_ltgray, LINE_XOOX);
|
||||
mvwputch(w, 2, 61, c_ltgray, LINE_XXOO);
|
||||
mvwputch(w, 1, 51, h_ltgray, '<');
|
||||
mvwputch(w, 1, 63, h_ltgray, '>');
|
||||
break;
|
||||
case CC_MISC:
|
||||
for (int i = 68; i < 74; i++)
|
||||
mvwputch(w, 2, i, c_black, ' ');
|
||||
mvwprintz(w, 1, 69, h_ltgray, "MISC");
|
||||
mvwputch(w, 2, 67, c_ltgray, LINE_XOOX);
|
||||
mvwputch(w, 2, 74, c_ltgray, LINE_XXOO);
|
||||
mvwputch(w, 1, 65, h_ltgray, '<');
|
||||
mvwputch(w, 1, 76, h_ltgray, '>');
|
||||
break;
|
||||
}
|
||||
wrefresh(w);
|
||||
}
|
||||
|
||||
void game::pick_recipes(std::vector<recipe*> ¤t,
|
||||
std::vector<bool> &available, craft_cat tab)
|
||||
{
|
||||
bool have_tool[5], have_comp[5];
|
||||
current.clear();
|
||||
available.clear();
|
||||
for (int i = 0; i < recipes.size(); i++) {
|
||||
// Check if the category matches the tab, and we have the requisite skills
|
||||
if (recipes[i].category == tab &&
|
||||
(recipes[i].sk_primary == sk_null ||
|
||||
u.sklevel[recipes[i].sk_primary] >= recipes[i].difficulty) &&
|
||||
(recipes[i].sk_secondary == sk_null ||
|
||||
u.sklevel[recipes[i].sk_secondary] > 0))
|
||||
current.push_back(&(recipes[i]));
|
||||
available.push_back(false);
|
||||
}
|
||||
for (int i = 0; i < current.size() && i < 22; i++) {
|
||||
//Check if we have the requisite tools and components
|
||||
for (int j = 0; j < 5; j++) {
|
||||
have_tool[j] = false;
|
||||
have_comp[j] = false;
|
||||
if (current[i]->tools[j].size() == 0)
|
||||
have_tool[j] = true;
|
||||
else {
|
||||
for (int k = 0; k < current[i]->tools[j].size(); k++) {
|
||||
itype_id type = current[i]->tools[j][k].type;
|
||||
int req = current[i]->tools[j][k].count; // -1 => 1
|
||||
if (u.has_bionic(bio_tools) ||
|
||||
(req < 0 && u.has_amount(type, 1)) ||
|
||||
(req > 0 && u.has_charges(type, req))) {
|
||||
have_tool[j] = true;
|
||||
k = current[i]->tools[j].size();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (current[i]->components[j].size() == 0)
|
||||
have_comp[j] = true;
|
||||
else {
|
||||
for (int k = 0; k < current[i]->components[j].size(); k++) {
|
||||
itype_id type = current[i]->components[j][k].type;
|
||||
int count = current[i]->components[j][k].count;
|
||||
if (u.has_number(type, count)) {
|
||||
have_comp[j] = true;
|
||||
k = current[i]->components[j].size();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (have_tool[0] && have_tool[1] && have_tool[2] && have_tool[3] &&
|
||||
have_tool[4] && have_comp[0] && have_comp[1] && have_comp[2] &&
|
||||
have_comp[3] && have_comp[4])
|
||||
available[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void game::make_craft(recipe *making)
|
||||
{
|
||||
u.activity = player_activity(ACT_CRAFT, making->time, making->id);
|
||||
u.moves = 0;
|
||||
}
|
||||
|
||||
void game::complete_craft()
|
||||
{
|
||||
std::vector<component> will_use;
|
||||
recipe making = recipes[u.activity.index];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (making.components[i].size() > 0) {
|
||||
std::vector<component> you_have;
|
||||
for (int j = 0; j < making.components[i].size(); j++) {
|
||||
if (u.has_number(making.components[i][j].type,
|
||||
making.components[i][j].count))
|
||||
you_have.push_back(making.components[i][j]);
|
||||
}
|
||||
if (you_have.size() == 1)
|
||||
will_use.push_back(component(you_have[0].type, you_have[0].count));
|
||||
else { // Let the player pick which component they want to use
|
||||
WINDOW* w = newwin(you_have.size() + 2, 30, 10, 25);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
mvwprintz(w, 0, 5, c_red, "Use which component?");
|
||||
for (int j = 0; j < you_have.size(); j++)
|
||||
mvwprintz(w, j + 1, 1, c_white, "%d: %s", j + 1,
|
||||
itypes[you_have[j].type]->name.c_str());
|
||||
wrefresh(w);
|
||||
char ch;
|
||||
do
|
||||
ch = getch();
|
||||
while (ch < '1' || ch >= '1' + you_have.size());
|
||||
ch -= '1';
|
||||
will_use.push_back(component(you_have[ch].type, you_have[ch].count));
|
||||
}
|
||||
}
|
||||
if (making.tools[i].size() > 0) {
|
||||
for (int j = 0; j < making.tools[i].size(); j++) {
|
||||
if (making.tools[i][j].count > 0)
|
||||
u.use_charges(making.tools[i][j].type, making.tools[i][j].count);
|
||||
}
|
||||
}
|
||||
}
|
||||
int skill_roll = (making.difficulty == 0 ? 1 :
|
||||
dice(u.sklevel[making.sk_primary] * 3 +
|
||||
u.sklevel[making.sk_secondary], 20 + u.int_cur));
|
||||
int diff_roll = (making.difficulty == 0 ? 0 :
|
||||
dice(making.difficulty * 4, 28));
|
||||
if (making.sk_primary != sk_null)
|
||||
u.practice(making.sk_primary, making.difficulty * 4 + 12);
|
||||
if (making.sk_secondary != sk_null)
|
||||
u.practice(making.sk_secondary, 5);
|
||||
if (diff_roll >= skill_roll * (1 + 0.1 * rng(1, 5))) {
|
||||
add_msg("You fail to make the %s, and waste some materials.",
|
||||
itypes[making.result]->name.c_str());
|
||||
int num_lost = rng(1, will_use.size());
|
||||
for (int i = 0; i < num_lost; i++) {
|
||||
int n = rng(0, will_use.size() - 1);
|
||||
u.use_amount(will_use[n].type, will_use[n].count);
|
||||
will_use.erase(will_use.begin() + n);
|
||||
}
|
||||
u.activity.type = ACT_NULL;
|
||||
return;
|
||||
} else if (diff_roll > skill_roll) {
|
||||
add_msg("You fail to make the %s, but don't waste any materials.",
|
||||
itypes[making.result]->name.c_str());
|
||||
u.activity.type = ACT_NULL;
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < will_use.size(); i++)
|
||||
u.use_amount(will_use[i].type, will_use[i].count);
|
||||
int iter = 0;
|
||||
item newit(itypes[making.result], turn, nextinv);
|
||||
do {
|
||||
newit.invlet = nextinv;
|
||||
advance_nextinv();
|
||||
iter++;
|
||||
} while (u.has_item(newit.invlet) && iter < 52);
|
||||
newit = newit.in_its_container(&itypes);
|
||||
if (iter == 52 || u.volume_carried()+newit.volume() > u.volume_capacity()) {
|
||||
add_msg("There's no room in your inventory for the %s, so you drop it.",
|
||||
newit.tname().c_str());
|
||||
m.add_item(u.posx, u.posy, newit);
|
||||
} else if (u.weight_carried() + newit.volume() > u.weight_capacity()) {
|
||||
add_msg("The %s is too heavy to carry, so you drop it.",
|
||||
newit.tname().c_str());
|
||||
m.add_item(u.posx, u.posy, newit);
|
||||
} else {
|
||||
u.i_add(newit);
|
||||
add_msg("%c - %s", newit.invlet, newit.tname().c_str());
|
||||
}
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
#ifndef _CRAFTING_H_
|
||||
#define _CRAFTING_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "itype.h"
|
||||
#include "skill.h"
|
||||
#include "rng.h"
|
||||
|
||||
enum craft_cat {
|
||||
CC_NULL = 0,
|
||||
CC_WEAPON,
|
||||
CC_FOOD,
|
||||
CC_ELECTRONIC,
|
||||
CC_ARMOR,
|
||||
CC_MISC,
|
||||
NUM_CC
|
||||
};
|
||||
|
||||
struct component
|
||||
{
|
||||
itype_id type;
|
||||
int count;
|
||||
component() { type = itm_null; count = 0; }
|
||||
component(itype_id TYPE, int COUNT) : type (TYPE), count (COUNT) {}
|
||||
};
|
||||
|
||||
struct recipe
|
||||
{
|
||||
int id;
|
||||
itype_id result;
|
||||
craft_cat category;
|
||||
skill sk_primary;
|
||||
skill sk_secondary;
|
||||
int difficulty;
|
||||
int time;
|
||||
|
||||
std::vector<component> tools[5];
|
||||
std::vector<component> components[5];
|
||||
|
||||
recipe() { id = 0; result = itm_null; category = CC_NULL; sk_primary = sk_null;
|
||||
sk_secondary = sk_null; difficulty = 0; time = 0; }
|
||||
recipe(int pid, itype_id pres, craft_cat cat, skill p1, skill p2, int pdiff,
|
||||
int ptime) :
|
||||
id (pid), result (pres), category (cat), sk_primary (p1), sk_secondary (p2),
|
||||
difficulty (pdiff), time (ptime) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
#include "player.h"
|
||||
#include "output.h"
|
||||
#include "npc.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
struct dialogue {
|
||||
player *alpha;
|
||||
npc *beta;
|
||||
WINDOW *win;
|
||||
bool done;
|
||||
std::vector<std::string> history;
|
||||
|
||||
int opt(std::string challenge, ...);
|
||||
};
|
||||
|
||||
std::string talk_okay[10] = {
|
||||
"okay", "get it", "you dig", "dig", "got it", "you see", "see, <name_g>",
|
||||
"savvy", "that clear"};
|
||||
|
||||
std::string talk_bad_names[10] = {
|
||||
"punk", "bitch", "mark", "asshole", "fucker",
|
||||
"sucker", "fuckwad", "fuckface", "motherfucker", "shithead"};
|
||||
|
||||
std::string talk_good_names[10] = {
|
||||
"stranger", "friend", "pilgrim", "traveler", "pal",
|
||||
"fella", "you", "dude", "buddy", "man"};
|
||||
|
||||
std::string talk_greeting_gen[10] = {
|
||||
"Hey <name_g>.", "Greetings <name_g>.", "Hi <name_g><punc> You okay?",
|
||||
"<name_g><punc> Let's talk.", "Well hey there.",
|
||||
"<name_g><punc> Hello.", "What's up, <name_g>?", "You okay, <name_g>?",
|
||||
"Hello, <name_g>.", "Hi <name_g>"};
|
||||
|
||||
std::string ill_die[10] = {
|
||||
"I'm not gonna last much longer", "I'll be dead soon", "I'll be a goner",
|
||||
"I'm dead, <name_g>,", "I'm dead meat", "I'm in serious trouble", "I'm doomed",
|
||||
"I'm done for", "I won't last much longer", "my days are numbered"};
|
||||
|
||||
std::string talk_needs[num_needs][5] = {
|
||||
{"", "", "", "", ""},
|
||||
{"Hey<punc> You got any <ammo>?", "I'll need some <ammo> soon, got any?",
|
||||
"I really need some <ammo><punc>", "I need <ammo> for my <mywp>, got any?",
|
||||
"I need some <ammo> bad<punc>"},
|
||||
{"Got anything I can use as a weapon?",
|
||||
"<ill_die> without a good weapon<punc>",
|
||||
"I'm sick of fighting with my <mywp>, got something better?",
|
||||
"Hey <name_g>, care to sell me a weapon?",
|
||||
"My <mywp> just won't cut it, I need a real weapon..."},
|
||||
{"Hey <name_g>, I could really use a gun.",
|
||||
"Hey, you got a spare gun? It'd be better than my <mywp><punc>",
|
||||
"<ill_die> if I don't find a gun soon!",
|
||||
"<name_g><punc> Feel like selling me a gun?",
|
||||
"I need a gun, any kind will do!"},
|
||||
{"I could use some food, here.", "I need some food, real bad!",
|
||||
"Man, am I glad to see you! Got any food to trade?",
|
||||
"<ill_die> unless I get some food in me... got any?",
|
||||
"Please tell me you have some food to trade!"},
|
||||
{"Got anything to drink?", "I need some water or something.",
|
||||
"<name_g>, I need some water... got any?",
|
||||
"<ill_die> without something to drink.", "You got anything to drink?"}
|
||||
/*
|
||||
{"<ill_die> unless I get healed<punc>", "You gotta heal me up, <name_g><punc>",
|
||||
"Help me<punc> <ill_die> if you don't heal me<punc>",
|
||||
"Please... I need medical help<punc>", "
|
||||
*/
|
||||
};
|
||||
|
||||
std::string talk_drop_weap[10] = {
|
||||
"Drop your weapon!",
|
||||
"Okay <name_b>, drop your weapon!",
|
||||
"Put your weapon down!",
|
||||
"Drop the <yrwp>, <name_b>!",
|
||||
"Drop the <yrwp>!",
|
||||
"Drop your <yrwp>!",
|
||||
"Put down the <yrwp>!",
|
||||
"Drop your weapon, <name_b>!",
|
||||
"Put down your <yrwp>!",
|
||||
"Alright, drop the <yrwp>!"
|
||||
};
|
||||
|
||||
std::string talk_hands_up[10] = {
|
||||
"Put your hands up!",
|
||||
"Put your hands up, <name_b>!",
|
||||
"Reach for the sky!",
|
||||
"Hands up!",
|
||||
"Hands in the air!",
|
||||
"Hands up, <name_b>!",
|
||||
"Hands where I can see them!",
|
||||
"Okay <name_b>, hands up!",
|
||||
"Okay <name_b><punc> hands up!",
|
||||
"Hands in the air, <name_b>!"
|
||||
};
|
||||
|
||||
std::string talk_no_faction[10] = {
|
||||
"I'm unaffiliated.",
|
||||
"I don't run with a crew.",
|
||||
"I'm a solo artist, <okay>?",
|
||||
"I don't kowtow to any group, <okay>?",
|
||||
"I'm a freelancer.",
|
||||
"I work alone, <name_g>.",
|
||||
"I'm a free agent, more money that way.",
|
||||
"I prefer to work uninhibited by that kind of connection.",
|
||||
"I haven't found one that's good enough for me.",
|
||||
"I don't belong to a faction, <name_g>"
|
||||
};
|
||||
@@ -1,652 +0,0 @@
|
||||
#ifndef _DISEASE_H_
|
||||
#define _DISEASE_H_
|
||||
|
||||
#include "rng.h"
|
||||
#include "game.h"
|
||||
#include "bodypart.h"
|
||||
#include <sstream>
|
||||
|
||||
struct game;
|
||||
|
||||
void dis_msg(game *g, dis_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case DI_HEATSTROKE:
|
||||
g->add_msg("You have heatstroke!");
|
||||
break;
|
||||
case DI_FBFACE:
|
||||
g->add_msg("Your face is frostbitten.");
|
||||
break;
|
||||
case DI_FBHANDS:
|
||||
g->add_msg("Your hands are frostbitten.");
|
||||
break;
|
||||
case DI_FBFEET:
|
||||
g->add_msg("Your feet are frostbitten.");
|
||||
break;
|
||||
case DI_ONFIRE:
|
||||
g->add_msg("You're on fire!");
|
||||
break;
|
||||
case DI_SMOKE:
|
||||
g->add_msg("You inhale a lungful of thick smoke.");
|
||||
break;
|
||||
case DI_TEARGAS:
|
||||
g->add_msg("You inhale a lungful of tear gas.");
|
||||
break;
|
||||
case DI_BOOMERED:
|
||||
g->add_msg("You're covered in bile!");
|
||||
break;
|
||||
case DI_SPORES:
|
||||
g->add_msg("You're covered in tiny spores!");
|
||||
break;
|
||||
case DI_SLIMED:
|
||||
g->add_msg("You're covered in thick goo!");
|
||||
break;
|
||||
case DI_LYING_DOWN:
|
||||
g->add_msg("You lie down to go to sleep...");
|
||||
break;
|
||||
case DI_DRUNK:
|
||||
case DI_HIGH:
|
||||
g->add_msg("You feel lightheaded.");
|
||||
break;
|
||||
case DI_ADRENALINE:
|
||||
g->add_msg("You feel a surge of adrenaline!");
|
||||
g->u.moves += 800;
|
||||
break;
|
||||
case DI_ASTHMA:
|
||||
g->add_msg("You can't breathe... asthma attack!");
|
||||
break;
|
||||
case DI_BLIND:
|
||||
g->add_msg("You're blinded!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dis_effect(game *g, player &p, disease &dis)
|
||||
{
|
||||
int bonus;
|
||||
int junk;
|
||||
switch (dis.type) {
|
||||
case DI_HEATSTROKE:
|
||||
p.moves -= 15;
|
||||
p.str_cur -= 2;
|
||||
p.per_cur -= 1;
|
||||
p.int_cur -= 2;
|
||||
break;
|
||||
case DI_FBFACE:
|
||||
p.per_cur -= 2;
|
||||
break;
|
||||
case DI_FBHANDS:
|
||||
p.dex_cur -= 4;
|
||||
break;
|
||||
case DI_FBFEET:
|
||||
p.moves -= 40;
|
||||
p.str_cur -= 1;
|
||||
break;
|
||||
case DI_SMOKE:
|
||||
p.str_cur--;
|
||||
p.dex_cur--;
|
||||
if (one_in(5)) {
|
||||
if (!p.is_npc()) {
|
||||
g->add_msg("You cough heavily.");
|
||||
g->sound(p.posx, p.posy, 12, "");
|
||||
} else
|
||||
g->sound(p.posx, p.posy, 12, "a hacking cough.");
|
||||
p.moves -= 80;
|
||||
p.hurt(g, bp_torso, 0, 1 - (rng(0, 1) * rng(0, 1)));
|
||||
}
|
||||
break;
|
||||
case DI_TEARGAS:
|
||||
p.str_cur -= 2;
|
||||
p.dex_cur -= 2;
|
||||
p.int_cur -= 1;
|
||||
p.per_cur -= 4;
|
||||
if (one_in(3)) {
|
||||
if (!p.is_npc()) {
|
||||
g->add_msg("You cough heavily.");
|
||||
g->sound(p.posx, p.posy, 12, "");
|
||||
} else
|
||||
g->sound(p.posx, p.posy, 12, "a hacking cough");
|
||||
p.moves -= 100;
|
||||
p.hurt(g, bp_torso, 0, rng(0, 3) * rng(0, 1));
|
||||
}
|
||||
break;
|
||||
case DI_ONFIRE:
|
||||
p.hurtall(3);
|
||||
for (int i = 0; i < p.worn.size(); i++) {
|
||||
if (p.worn[i].made_of(VEGGY) || p.worn[i].made_of(PAPER) ||
|
||||
p.worn[i].made_of(PAPER)) {
|
||||
p.worn.erase(p.worn.begin() + i);
|
||||
i--;
|
||||
} else if ((p.worn[i].made_of(COTTON) || p.worn[i].made_of(WOOL)) &&
|
||||
one_in(10)) {
|
||||
p.worn.erase(p.worn.begin() + i);
|
||||
i--;
|
||||
} else if (p.worn[i].made_of(PLASTIC) && one_in(50)) {
|
||||
p.worn.erase(p.worn.begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DI_BOOMERED:
|
||||
p.per_cur -= 5;
|
||||
break;
|
||||
case DI_SPORES:
|
||||
p.moves -= 40;
|
||||
if (one_in(30))
|
||||
p.add_disease(DI_FUNGUS, -1, g);
|
||||
break;
|
||||
case DI_FUNGUS:
|
||||
bonus = 0;
|
||||
if (p.has_trait(PF_POISRESIST))
|
||||
bonus = 100;
|
||||
p.moves -= 10;
|
||||
p.str_cur -= 1;
|
||||
p.dex_cur -= 1;
|
||||
if (dis.duration > -600) { // First hour symptoms
|
||||
if (one_in(160 + bonus)) {
|
||||
if (!p.is_npc()) {
|
||||
g->add_msg("You cough heavily.");
|
||||
g->sound(p.posx, p.posy, 12, "");
|
||||
} else
|
||||
g->sound(p.posx, p.posy, 12, "a hacking cough");
|
||||
p.pain++;
|
||||
}
|
||||
if (one_in(100 + bonus)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You feel nauseous.");
|
||||
}
|
||||
if (one_in(100 + bonus)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You smell and taste mushrooms.");
|
||||
}
|
||||
} else if (dis.duration > -3600) { // One to six hours
|
||||
if (one_in(600 + bonus * 3)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You spasm suddenly!");
|
||||
p.moves = 0;
|
||||
p.hurt(g, bp_torso, 0, 5);
|
||||
}
|
||||
if ((p.has_trait(PF_WEAKSTOMACH) && one_in(1600 + bonus * 8)) ||
|
||||
one_in(2000 + bonus * 10)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You vomit a thick, gray goop.");
|
||||
else if (g->u_see(p.posx, p.posy, junk))
|
||||
g->add_msg("%s vomits a thick, gray goop.", p.name.c_str());
|
||||
p.moves = -200;
|
||||
p.hunger += 50;
|
||||
p.thirst += 68;
|
||||
}
|
||||
} else { // Full symptoms
|
||||
if (one_in(1000 + bonus * 8)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You double over, spewing live spores from your mouth!");
|
||||
else if (g->u_see(p.posx, p.posy, junk))
|
||||
g->add_msg("%s coughs up a stream of live spores!", p.name.c_str());
|
||||
p.moves = -500;
|
||||
int sporex, sporey;
|
||||
monster spore(g->mtypes[mon_spore]);
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
sporex = p.posx + i;
|
||||
sporey = p.posy + j;
|
||||
if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
|
||||
if (g->mon_at(sporex, sporey) >= 0) { // Spores hit a monster
|
||||
if (g->u_see(sporex, sporey, junk))
|
||||
g->add_msg("The %s is covered in tiny spores!",
|
||||
g->z[g->mon_at(sporex, sporey)].name().c_str());
|
||||
if (!g->z[g->mon_at(sporex, sporey)].make_fungus(g))
|
||||
g->kill_mon(g->mon_at(sporex, sporey));
|
||||
} else {
|
||||
spore.spawn(sporex, sporey);
|
||||
g->z.push_back(spore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (one_in(6000 + bonus * 20)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("Fungus stalks burst through your hands!");
|
||||
else if (g->u_see(p.posx, p.posy, junk))
|
||||
g->add_msg("Fungus stalks burst through %s's hands!", p.name.c_str());
|
||||
p.hurt(g, bp_arms, 0, 60);
|
||||
p.hurt(g, bp_arms, 1, 60);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DI_SLIMED:
|
||||
p.moves -= 30;
|
||||
if (p.moves < 1)
|
||||
p.moves = 1;
|
||||
p.dex_cur -= 2;
|
||||
break;
|
||||
case DI_LYING_DOWN:
|
||||
p.moves = 0;
|
||||
if (p.can_sleep(g)) {
|
||||
dis.duration = 1;
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You fall asleep.");
|
||||
p.add_disease(DI_SLEEP, 6000, g);
|
||||
}
|
||||
if (dis.duration == 1 && !p.has_disease(DI_SLEEP))
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You try to sleep, but can't...");
|
||||
break;
|
||||
case DI_SLEEP:
|
||||
p.moves = 0;
|
||||
if (g->turn % 25 == 0) {
|
||||
if (p.fatigue > 0)
|
||||
p.fatigue -= rng(1, 2);
|
||||
if (p.has_trait(PF_FASTHEALER) && one_in(2))
|
||||
p.healall(rng(0, 1)); // Sum chance of 1/4, PLUS normal rate
|
||||
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 (g->turn % 100 == 0) {
|
||||
// Hunger and thirst advance more slowly while we sleep.
|
||||
p.hunger--;
|
||||
p.thirst--;
|
||||
}
|
||||
if (rng(2, 80) + rng(0, 100) + rng(0, 120) + rng(0, p.fatigue) <
|
||||
g->light_level() && (one_in(p.fatigue / 10) || p.fatigue < 10)) {
|
||||
g->add_msg("The light wakes you up.");
|
||||
dis.duration = 1;
|
||||
}
|
||||
break;
|
||||
case DI_PKILL1:
|
||||
if (dis.duration <= 70 && dis.duration % 7 == 0 && p.pkill < 35)
|
||||
p.pkill++;
|
||||
break;
|
||||
case DI_PKILL2:
|
||||
if (dis.duration % 7 == 0 &&
|
||||
(one_in(p.addiction_level(ADD_PKILLER)) ||
|
||||
one_in(p.addiction_level(ADD_PKILLER)) ))
|
||||
p.pkill += 2;
|
||||
break;
|
||||
case DI_PKILL3:
|
||||
if (dis.duration % 2 == 0 &&
|
||||
(one_in(p.addiction_level(ADD_PKILLER)) ||
|
||||
one_in(p.addiction_level(ADD_PKILLER)) ))
|
||||
p.pkill++;
|
||||
break;
|
||||
case DI_PKILL_L:
|
||||
if (dis.duration % 20 == 0 && p.pkill < 49 &&
|
||||
(one_in(p.addiction_level(ADD_PKILLER)) ||
|
||||
one_in(p.addiction_level(ADD_PKILLER)) ))
|
||||
p.pkill++;
|
||||
break;
|
||||
case DI_TOOK_XANAX:
|
||||
if (dis.duration % 25 == 0 && (p.stim > 0 || one_in(2)))
|
||||
p.stim--;
|
||||
break;
|
||||
case DI_DRUNK:
|
||||
// We get 600 turns, or one hour, of DI_DRUNK for each drink we have (on avg)
|
||||
// So, the duration of DI_DRUNK is a good indicator of how much alcohol is in
|
||||
// our system.
|
||||
p.per_cur -= int(dis.duration / 800);
|
||||
p.dex_cur -= int(dis.duration / 800);
|
||||
p.int_cur -= int(dis.duration / 800);
|
||||
p.str_cur -= int(dis.duration / 1000);
|
||||
if (dis.duration <= 600)
|
||||
p.str_cur += 1;
|
||||
if (dis.duration > 2000 + 100 * dice(2, 100) &&
|
||||
(p.has_trait(PF_WEAKSTOMACH) || one_in(20)))
|
||||
p.vomit(g);
|
||||
if (!p.has_disease(DI_SLEEP) && dis.duration >= 4500 &&
|
||||
one_in(500 - int(dis.duration / 80))) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You pass out.");
|
||||
p.add_disease(DI_SLEEP, dis.duration / 2, g);
|
||||
}
|
||||
break;
|
||||
case DI_CIG:
|
||||
if (dis.duration >= 200) { // Smoked too much
|
||||
p.str_cur -= 1;
|
||||
p.dex_cur -= 1;
|
||||
if (dis.duration >= 500 && (one_in(50) ||
|
||||
one_in(20) && p.has_trait(PF_WEAKSTOMACH)))
|
||||
p.vomit(g);
|
||||
} else {
|
||||
p.dex_cur++;
|
||||
p.int_cur++;
|
||||
p.per_cur++;
|
||||
}
|
||||
break;
|
||||
case DI_HIGH:
|
||||
p.dex_cur--;
|
||||
p.int_cur--;
|
||||
p.per_cur--;
|
||||
break;
|
||||
case DI_POISON:
|
||||
if ((!p.has_trait(PF_POISRESIST) && one_in(150)) ||
|
||||
( p.has_trait(PF_POISRESIST) && one_in(900)) ) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You're suddenly wracked with pain!");
|
||||
p.pain += 2;
|
||||
p.hurt(g, bp_torso, 0, rng(0, 2) * rng(0, 1));
|
||||
}
|
||||
p.per_cur--;
|
||||
p.dex_cur--;
|
||||
if (!p.has_trait(PF_POISRESIST))
|
||||
p.str_cur -= 2;
|
||||
break;
|
||||
case DI_FOODPOISON:
|
||||
bonus = 0;
|
||||
if (p.has_trait(PF_POISRESIST))
|
||||
bonus = 600;
|
||||
if (one_in(300 + bonus)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You're suddenly wracked with pain and nausea!");
|
||||
p.pain += 2;
|
||||
p.hurt(g, bp_torso, 0, 2);
|
||||
}
|
||||
if ((p.has_trait(PF_WEAKSTOMACH) && one_in(350 + bonus)) ||
|
||||
one_in(900 + bonus))
|
||||
p.vomit(g);
|
||||
p.moves -= 35;
|
||||
p.str_cur -= 3;
|
||||
p.dex_cur--;
|
||||
p.per_cur--;
|
||||
if (p.has_trait(PF_POISRESIST)) {
|
||||
p.moves += 15;
|
||||
p.str_cur += 2;
|
||||
}
|
||||
break;
|
||||
case DI_SHAKES:
|
||||
p.dex_cur -= 4;
|
||||
p.str_cur--;
|
||||
break;
|
||||
case DI_HALLU:
|
||||
// This assumes that we were given DI_HALLU with a 3600 (6-hour) lifespan
|
||||
if (dis.duration > 3000) { // First hour symptoms
|
||||
if (one_in(300)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You feel a little strange.");
|
||||
}
|
||||
} else if (dis.duration > 2400) { // Coming up
|
||||
if (one_in(100) || (p.has_trait(PF_WEAKSTOMACH) && one_in(100))) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You feel nauseous.");
|
||||
p.hunger -= 5;
|
||||
}
|
||||
if (!p.is_npc()) {
|
||||
if (one_in(200))
|
||||
g->add_msg("Huh? What was that?");
|
||||
else if (one_in(200))
|
||||
g->add_msg("Oh god, what's happening?");
|
||||
else if (one_in(200))
|
||||
g->add_msg("Of course... it's all fractals!");
|
||||
}
|
||||
} else if (dis.duration == 2400) // Visuals start
|
||||
p.add_disease(DI_VISUALS, 2400, g);
|
||||
else { // Full symptoms
|
||||
p.per_cur -= 2;
|
||||
p.int_cur -= 1;
|
||||
p.dex_cur -= 2;
|
||||
p.str_cur -= 1;
|
||||
if (one_in(50)) { // Generate phantasm
|
||||
monster phantasm(g->mtypes[mon_hallu_zom + rng(0, 3)]);
|
||||
phantasm.spawn(p.posx + rng(-10, 10), p.posy + rng(-10, 10));
|
||||
g->z.push_back(phantasm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DI_ADRENALINE:
|
||||
if (dis.duration > 400) { // 20 minutes positive effects
|
||||
p.moves += rng(40, 100);
|
||||
p.str_cur += 5;
|
||||
p.dex_cur += 3;
|
||||
p.int_cur -= 8;
|
||||
p.per_cur += 1;
|
||||
} else if (dis.duration == 400) { // 40 minutes come-down
|
||||
if (!p.is_npc())
|
||||
g->add_msg("Your adrenaline rush wears off. You feel AWFUL!");
|
||||
p.moves -= 300;
|
||||
} else {
|
||||
p.str_cur -= 2;
|
||||
p.dex_cur -= 1;
|
||||
p.int_cur -= 1;
|
||||
p.per_cur -= 1;
|
||||
}
|
||||
break;
|
||||
case DI_ASTHMA:
|
||||
if (dis.duration > 1200) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("Your asthma overcomes you. You stop breathing and die...");
|
||||
p.hurtall(500);
|
||||
}
|
||||
p.moves -= dis.duration / 5;
|
||||
p.str_cur -= 2;
|
||||
p.dex_cur -= 3;
|
||||
break;
|
||||
case DI_METH:
|
||||
if (dis.duration > 600) {
|
||||
p.str_cur += 2;
|
||||
p.dex_cur += 2;
|
||||
p.int_cur += 2;
|
||||
p.per_cur += 2;
|
||||
p.moves += 50;
|
||||
} else {
|
||||
p.str_cur -= 3;
|
||||
p.dex_cur -= 2;
|
||||
p.int_cur -= 1;
|
||||
p.moves -= 40;
|
||||
}
|
||||
break;
|
||||
case DI_TELEGLOW:
|
||||
// Default we get around 300 duration points per teleport (possibly more
|
||||
// depending on the source).
|
||||
// TODO: Include a chance to teleport to the nether realm.
|
||||
if (dis.duration > 6000) { // 20 teles (no decay; in practice at least 21)
|
||||
if (one_in(1000 - ((dis.duration - 6000) / 10))) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("Glowing lights surround you, and you teleport.");
|
||||
g->teleport();
|
||||
if (one_in(4))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
if (one_in(1200 - ((dis.duration - 6000) / 5)) && one_in(20)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You pass out.");
|
||||
p.add_disease(DI_SLEEP, 1200, g);
|
||||
if (one_in(6))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
}
|
||||
if (dis.duration > 3600) { // 12 teles
|
||||
if (one_in(4000 - int(.25 * (dis.duration - 3600)))) {
|
||||
int range = g->moncats[mcat_nether].size();
|
||||
mon_id type = (g->moncats[mcat_nether])[rng(0, range - 1)];
|
||||
monster beast(g->mtypes[type]);
|
||||
int x, y, tries = 0;
|
||||
do {
|
||||
x = p.posx + rng(-4, 4);
|
||||
y = p.posy + rng(-4, 4);
|
||||
} while ((x == p.posx && y == p.posy) || g->mon_at(x, y) != -1);
|
||||
if (g->m.move_cost(x, y) == 0)
|
||||
g->m.ter(x, y) = t_rubble;
|
||||
beast.spawn(x, y);
|
||||
g->z.push_back(beast);
|
||||
if (g->u_see(x, y, junk))
|
||||
g->add_msg("A portal opens nearby, and a monster crawls through!");
|
||||
if (one_in(2))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
if (one_in(3500 - int(.25 * (dis.duration - 3600)))) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You shudder suddenly.");
|
||||
p.mutate(g);
|
||||
if (one_in(4))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
}
|
||||
if (dis.duration > 2400) { // 8 teleports
|
||||
if (one_in(10000 - dis.duration))
|
||||
p.add_disease(DI_SHAKES, rng(40, 80), g);
|
||||
if (one_in(12000 - dis.duration)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("Your vision is filled with bright lights...");
|
||||
p.add_disease(DI_BLIND, rng(10, 20), g);
|
||||
if (one_in(8))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
if (one_in(5000) && !p.has_disease(DI_HALLU)) {
|
||||
p.add_disease(DI_HALLU, 3600, g);
|
||||
if (one_in(5))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
}
|
||||
if (one_in(4000)) {
|
||||
if (!p.is_npc())
|
||||
g->add_msg("You're suddenly covered in ectoplasm.");
|
||||
p.add_disease(DI_BOOMERED, 100, g);
|
||||
if (one_in(4))
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
if (one_in(10000)) {
|
||||
p.add_disease(DI_FUNGUS, -1, g);
|
||||
p.rem_disease(DI_TELEGLOW);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string dis_name(disease dis)
|
||||
{
|
||||
switch (dis.type) {
|
||||
case DI_NULL: return "";
|
||||
case DI_HEATSTROKE: return "Heatstroke";
|
||||
case DI_FBFACE: return "Frostbite - Face";
|
||||
case DI_FBHANDS: return "Frostbite - Hands";
|
||||
case DI_FBFEET: return "Frostbite - Feet";
|
||||
case DI_SMOKE: return "Smoke";
|
||||
case DI_TEARGAS: return "Tear gas";
|
||||
case DI_ONFIRE: return "On Fire";
|
||||
case DI_BOOMERED: return "Boomered";
|
||||
case DI_SPORES: return "Spores";
|
||||
case DI_SLIMED: return "Slimed";
|
||||
case DI_BLIND: return "Blind";
|
||||
case DI_POISON: return "Poisoned";
|
||||
case DI_FOODPOISON: return "Food Poisoning";
|
||||
case DI_SHAKES: return "Shakes";
|
||||
case DI_DRUNK:
|
||||
if (dis.duration > 2200)
|
||||
return "Wasted";
|
||||
if (dis.duration > 1400)
|
||||
return "Trashed";
|
||||
if (dis.duration > 800)
|
||||
return "Drunk";
|
||||
return "Tipsy";
|
||||
case DI_CIG: return "Cigarette";
|
||||
case DI_HIGH: return "High";
|
||||
case DI_VISUALS: return "Hallucinating";
|
||||
case DI_ADRENALINE:
|
||||
if (dis.duration > 400)
|
||||
return "Adrenaline Rush";
|
||||
return "Adrenaline Comedown";
|
||||
case DI_ASTHMA:
|
||||
if (dis.duration > 800)
|
||||
return "Heavy Asthma";
|
||||
return "Asthma";
|
||||
case DI_METH:
|
||||
if (dis.duration > 600)
|
||||
return "High on Meth";
|
||||
return "Meth Comedown";
|
||||
case DI_IN_PIT: return "Stuck in Pit";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string dis_description(disease dis)
|
||||
{
|
||||
int strpen, allpen;
|
||||
std::stringstream stream;
|
||||
switch (dis.type) {
|
||||
case DI_NULL:
|
||||
return "None";
|
||||
case DI_HEATSTROKE: return "\
|
||||
Speed -15%; Strength - 2; Intelligence - 2; Perception - 1";
|
||||
case DI_FBFACE: return "\
|
||||
Perception - 2";
|
||||
case DI_FBHANDS: return "\
|
||||
Dexterity - 2";
|
||||
case DI_FBFEET: return "\
|
||||
Speed -40%; Strength - 1";
|
||||
case DI_SMOKE: return "\
|
||||
Strength - 1; Dexterity - 1;\n\
|
||||
Occasionally you will cough, costing movement and creating noise.\n\
|
||||
Loss of health - Torso";
|
||||
case DI_TEARGAS: return "\
|
||||
Strength - 2; Dexterity - 2; Intelligence - 1; Perception - 4\n\
|
||||
Occasionally you will cough, costing movement and creating noise.\n\
|
||||
Loss of health - Torso";
|
||||
case DI_ONFIRE: return "\
|
||||
Loss of health - Entire Body\n\
|
||||
Your clothing and other equipment may be consumed by the flames.";
|
||||
case DI_BOOMERED: return "\
|
||||
Perception - 5\n\
|
||||
Range of Sight: 1; All sight is tinted magenta";
|
||||
case DI_SPORES: return "\
|
||||
Speed -40%\
|
||||
You can feel the tiny spores sinking directly into your flesh.";
|
||||
case DI_SLIMED: return "\
|
||||
Speed -40%; Dexterity - 2";
|
||||
case DI_BLIND: return "\
|
||||
Range of Sight: 0";
|
||||
case DI_POISON: return "\
|
||||
Perception - 1; Dexterity - 1; Strength - 2 IF not resistant\n\
|
||||
Occasional pain and/or damage.";
|
||||
case DI_FOODPOISON: return "\
|
||||
Speed - 35%; Strength - 3; Dexterity - 1; Perception - 1\n\
|
||||
Your stomach is extremely upset, and you keep having pangs of pain and nausea.";
|
||||
case DI_SHAKES: return "\
|
||||
Strength - 1; Dexterity - 4;";
|
||||
case DI_DRUNK:
|
||||
strpen = int(dis.duration / 1000);
|
||||
allpen = int(dis.duration / 800);
|
||||
stream << "Strength - " << strpen << "; Dexterity - " << allpen <<
|
||||
"; Intelligence - " << allpen << "; Perception - " << allpen;
|
||||
|
||||
return stream.str();
|
||||
case DI_CIG:
|
||||
if (dis.duration > 200)
|
||||
return "\
|
||||
Strength - 1; Dexterity - 1\n\
|
||||
You smoked too much.";
|
||||
return "\
|
||||
Dexterity + 1; Intelligence + 1; Perception + 1";
|
||||
case DI_HIGH:
|
||||
return "\
|
||||
Dexterity - 1; Intelligence - 1; Perception - 1";
|
||||
case DI_VISUALS:
|
||||
return "\
|
||||
You can't trust everything that you see.";
|
||||
case DI_ADRENALINE:
|
||||
if (dis.duration > 400)
|
||||
return "\
|
||||
Speed +80; Strength + 5; Dexterity + 3; Intelligence - 8; Perception + 1";
|
||||
return "\
|
||||
Strength - 2; Dexterity - 1; Intelligence - 1; Perception - 1";
|
||||
case DI_ASTHMA:
|
||||
stream<< "Speed - " << int(dis.duration / 5) << "%; Strength - 2; " <<
|
||||
"Dexterity - 3";
|
||||
return stream.str();
|
||||
case DI_METH:
|
||||
if (dis.duration > 600)
|
||||
return "\
|
||||
Speed +50; Strength + 2; Dexterity + 2; Intelligence + 2; Perception + 2";
|
||||
return "\
|
||||
Speed -30; Strength - 3; Dexterity - 2; Intelligence - 2";
|
||||
case DI_IN_PIT:
|
||||
return "\
|
||||
You're stuck in a pit. Sight distance is limited and you have to climb out.";
|
||||
default:
|
||||
return "Who knows?";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
docker run --rm \
|
||||
--volume="$PWD:/srv/jekyll" \
|
||||
--volume="$PWD/vendor/bundle:/usr/local/bundle" \
|
||||
-p 4000:4000 \
|
||||
-it jekyll/jekyll \
|
||||
jekyll serve
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Donations"
|
||||
permalink: /donations/
|
||||
---
|
||||
|
||||
If ever you wanted to give back to Cataclysm: Dark Days Ahead, this is the place! There are multiple ways to give out monetary help: you can either help fund the forums through the [official Patreon](https://www.patreon.com/user?u=15922455) or help sponsor individual developers.
|
||||
|
||||
|
||||
### Sponsor a developer
|
||||
[KorGgenT](https://github.com/CleverRaven/Cataclysm-DDA/pulls?utf8=%E2%9C%93&q=is%3Apr+is%3Amerged+author%3AKorGgenT) - [Donate via Github Sponsors](https://github.com/sponsors/KorGgenT)
|
||||
|
||||
[John-Candlebury](https://github.com/CleverRaven/Cataclysm-DDA/pulls?q=is%3Apr+is%3Amerged+author%3AJohn-Candlebury) - [Donate via Patreon](https://www.patreon.com/Candlebury)
|
||||
|
||||
[gettingusedto](https://github.com/I-am-Erk/CDDA-Tilesets/pulls?q=is%3Apr+is%3Amerged+author%3Agettingusedto+) - [Donate via Ko-fi](https://ko-fi.com/gettingusedto)
|
||||
|
||||
[nameless-kitty](https://github.com/CleverRaven/Cataclysm-DDA/pulls?q=is%3Apr+is%3Amerged+author%3Akuutekitty) - [Donate via Ko-fi](https://ko-fi.com/namelesskitty)
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef _ENUMS_H_
|
||||
#define _ENUMS_H_
|
||||
|
||||
#ifndef sgn
|
||||
#define sgn(x) (((x) < 0) ? -1 : 1)
|
||||
#endif
|
||||
|
||||
enum material {
|
||||
MNULL = 0,
|
||||
//Food Materials
|
||||
LIQUID, VEGGY, FLESH, POWDER,
|
||||
//Clothing
|
||||
COTTON, WOOL, LEATHER, KEVLAR,
|
||||
//Other
|
||||
STONE, PAPER, WOOD, PLASTIC, GLASS, IRON, STEEL, SILVER
|
||||
};
|
||||
|
||||
struct point {
|
||||
int x;
|
||||
int y;
|
||||
point(int X = 0, int Y = 0) : x (X), y (Y) {}
|
||||
~point(){}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,29 +0,0 @@
|
||||
#include "event.h"
|
||||
#include "npc.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
|
||||
void event::actualize(game *g)
|
||||
{
|
||||
npc tmp;
|
||||
switch (type) {
|
||||
case EVENT_HELP:
|
||||
if (relevant_faction == NULL) {
|
||||
tmp.randomize(g);
|
||||
tmp.attitude = NPCATT_DEFEND;
|
||||
tmp.posx = g->u.posx - SEEX * 2 + rng(-5, 5);
|
||||
tmp.posy = g->u.posy - SEEY * 2 + rng(-5, 5);
|
||||
g->active_npc.push_back(tmp);
|
||||
} else {
|
||||
int num = rng(1, 6);
|
||||
for (int i = 0; i < num; i++) {
|
||||
tmp.randomize_from_fact(g, relevant_faction);
|
||||
tmp.attitude = NPCATT_DEFEND;
|
||||
tmp.posx = g->u.posx - SEEX * 2 + rng(-5, 5);
|
||||
tmp.posy = g->u.posy - SEEY * 2 + rng(-5, 5);
|
||||
g->active_npc.push_back(tmp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef _EVENT_H_
|
||||
#define _EVENT_H_
|
||||
|
||||
#include "faction.h"
|
||||
|
||||
class game;
|
||||
|
||||
enum event_type {
|
||||
EVENT_NULL,
|
||||
EVENT_HELP,
|
||||
NUM_EVENT_TYPES
|
||||
};
|
||||
|
||||
struct event {
|
||||
event_type type;
|
||||
int turn;
|
||||
faction* relevant_faction;
|
||||
|
||||
event() {
|
||||
type = EVENT_NULL;
|
||||
turn = 0;
|
||||
relevant_faction = NULL;
|
||||
}
|
||||
|
||||
event(event_type e_t, int t, faction* r_f) {
|
||||
type = e_t;
|
||||
turn = t;
|
||||
relevant_faction = r_f;
|
||||
}
|
||||
|
||||
void actualize(game *g);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,106 +0,0 @@
|
||||
#include <string>
|
||||
|
||||
std::string faction_adj_pos[15] = {
|
||||
"Shining", "Sacred", "Golden", "Holy", "Righteous", "Devoted", "Virtuous",
|
||||
"Splendid", "Divine", "Radiant", "Noble", "Venerable", "Immaculate"
|
||||
"Heroic", "Bright"};
|
||||
std::string faction_adj_neu[15] = {
|
||||
"Original", "Crystal", "Metal", "Mighty", "Powerful", "Solid", "Stone",
|
||||
"Firey", "Colossal", "Famous", "Supreme", "Invincible", "Unlimited",
|
||||
"Great", "Electric"};
|
||||
std::string faction_adj_bad[15] = {
|
||||
"Poisonous", "Deadly", "Foul", "Nefarious", "Wicked", "Vile", "Ruinous",
|
||||
"Horror", "Devastating", "Vicious", "Sinister", "Baleful", "Pestilent",
|
||||
"Pernicious", "Dread"};
|
||||
|
||||
std::string faction_noun_strong[15] = {
|
||||
"Fists", "Slayers", "Furies", "Dervishes", "Tigers", "Destroyers",
|
||||
"Berserkers", "Samurai", "Valkyries", "Army", "Killers", "Paladins",
|
||||
"Knights", "Warriors", "Huntsmen"};
|
||||
std::string faction_noun_sneak[15] = {
|
||||
"Snakes", "Rats", "Assassins", "Ninja", "Agents", "Shadows", "Guerillas",
|
||||
"Eliminators", "Snipers", "Smoke", "Arachnids", "Creepers", "Shade",
|
||||
"Stalkers", "Eels"};
|
||||
std::string faction_noun_crime[15] = {
|
||||
"Bandits", "Punks", "Family", "Mafia", "Mob", "Gang", "Vandals", "Sharks",
|
||||
"Muggers", "Cutthroats", "Guild", "Faction", "Thugs", "Racket", "Crooks"};
|
||||
std::string faction_noun_cult[15] = {
|
||||
"Brotherhood", "Church", "Ones", "Crucible", "Sect", "Creed", "Doctrine",
|
||||
"Priests", "Tenet", "Monks", "Clerics", "Pastors", "Gnostics", "Elders",
|
||||
"Inquisitors"};
|
||||
std::string faction_noun_none[15] = {
|
||||
"Settlers", "People", "Men", "Faction", "Tribe", "Clan", "Society", "Folk",
|
||||
"Nation", "Republic", "Colony", "State", "Kingdom", "Party", "Company"};
|
||||
|
||||
|
||||
struct faction_value_datum {
|
||||
std::string name;
|
||||
int good; // A measure of how "good" the value is (naming purposes &c)
|
||||
int strength;
|
||||
int sneak;
|
||||
int crime;
|
||||
int cult;
|
||||
};
|
||||
|
||||
faction_value_datum facgoal_data[NUM_FACGOALS] = {
|
||||
// "Their ultimate goal is <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"Null", 0, 0, 0, 0, 0},
|
||||
{"basic survival", 0, 0, 0, 0, 0},
|
||||
{"financial wealth", 0, -1, 0, 2, -1},
|
||||
{"dominance of the region", -1, 1, -1, 1, -1},
|
||||
{"the extermination of monsters",1, 3, -1, -1, -1},
|
||||
{"contact with unseen powers", -1, 0, 1, 0, 4},
|
||||
{"bringing the apocalypse", -5, 1, 2, 0, 7},
|
||||
{"general chaos and anarchy", -3, 2, -3, 2, -1},
|
||||
{"the cultivation of knowledge", 2, -3, -1, -1, 0},
|
||||
{"harmony with nature", 2, -2, 0, -1, 2},
|
||||
{"rebuilding civilization", 2, 1, -2, -2, -4}
|
||||
};
|
||||
// TOTAL: -3 2 -5 0 3
|
||||
|
||||
faction_value_datum facjob_data[NUM_FACJOBS] = {
|
||||
// "They earn money via <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"Null", 0, 0, 0, 0, 0},
|
||||
{"protection rackets", -3, 2, -1, 4, 0},
|
||||
{"the sale of information", -1, -1, 4, 1, 0},
|
||||
{"their bustling trade centers", 1, -1, -2, -4, -4},
|
||||
{"trade caravans", 2, -1, -1, -3, -2},
|
||||
{"scavenging supplies", 0, -1, 0, -1, -1},
|
||||
{"mercenary work", 0, 3, -1, 1, -1},
|
||||
{"assassinations", -1, 2, 2, 1, 1},
|
||||
{"raiding settlements", -4, 4, -3, 3, -2},
|
||||
{"the theft of property", -3, -1, 4, 4, 1},
|
||||
{"gambling parlors", -1, -2, -1, 1, -1},
|
||||
{"medical aid", 4, -3, -2, -3, 0},
|
||||
{"farming & selling food", 3, -4, -2, -4, 1},
|
||||
{"drug dealing", -2, 0, -1, 2, 0},
|
||||
{"selling manufactured goods", 1, 0, -1, -2, 0}
|
||||
};
|
||||
// TOTAL: -5 -3 -5 0 -6
|
||||
|
||||
faction_value_datum facval_data[NUM_FACVALS] = {
|
||||
// "They are known for <name>"
|
||||
//Name Good Str Sneak Crime Cult
|
||||
{"Null", 0, 0, 0, 0, 0},
|
||||
{"their charitable nature", 5, -1, -1, -2, -2},
|
||||
{"their isolationism", 0, -2, 1, 0, 2},
|
||||
{"exploring extensively", 1, 0, 0, -2, -1},
|
||||
{"collecting rare artifacts", 0, 1, 1, -1, 3},
|
||||
{"their knowledge of bionics", 1, 2, 0, 0, 0},
|
||||
{"their libraries", 1, -3, 0, -2, 1},
|
||||
{"their elite training", 0, 4, 2, 0, 2},
|
||||
{"their robotics factories", 0, 3, -1, 0, -2},
|
||||
{"treachery", -3, 0, 1, 3, 0},
|
||||
{"the avoidance of drugs", 1, 0, 0, -2, 1},
|
||||
{"their adherance to the law", 2, -1, -1, -4, -1},
|
||||
{"their cruelty", -3, 1, -1, 4, 1}
|
||||
};
|
||||
// TOTALS: 5 4 1 -6 4
|
||||
/* Note: It's nice to keep the totals around 0 for Good, and about even for the
|
||||
* other four. It's okay if Good is slightly negative (after all, in a post-
|
||||
* apocalyptic world people might be a LITTLE less virtuous), and to keep
|
||||
* strength valued a bit higher than the others.
|
||||
*/
|
||||
|
||||
-480
@@ -1,480 +0,0 @@
|
||||
#include "faction.h"
|
||||
#include "facdata.h"
|
||||
#include "rng.h"
|
||||
#include "math.h"
|
||||
#include "output.h"
|
||||
#include "omdata.h"
|
||||
#include "game.h"
|
||||
|
||||
std::string invent_name();
|
||||
std::string invent_adj();
|
||||
|
||||
faction::faction()
|
||||
{
|
||||
name = "";
|
||||
values = 0;
|
||||
likes_u = 0;
|
||||
respects_u = 0;
|
||||
known_by_u = false;
|
||||
goal = FACGOAL_NULL;
|
||||
job1 = FACJOB_NULL;
|
||||
job2 = FACJOB_NULL;
|
||||
}
|
||||
|
||||
faction::~faction()
|
||||
{
|
||||
}
|
||||
|
||||
void faction::randomize()
|
||||
{
|
||||
// Set up values
|
||||
// TODO: Not always in overmap 0,0
|
||||
omx = 0;
|
||||
omy = 0;
|
||||
mapx = rng(OMAPX / 10, OMAPX - OMAPX / 10);
|
||||
mapy = rng(OMAPY / 10, OMAPY - OMAPY / 10);
|
||||
// Pick an overall goal.
|
||||
goal = faction_goal(rng(1, NUM_FACGOALS - 1));
|
||||
if (one_in(4))
|
||||
goal = FACGOAL_NONE; // Slightly more likely to not have a real goal
|
||||
good = facgoal_data[goal].good;
|
||||
strength = facgoal_data[goal].strength;
|
||||
sneak = facgoal_data[goal].sneak;
|
||||
crime = facgoal_data[goal].crime;
|
||||
cult = facgoal_data[goal].cult;
|
||||
job1 = faction_job(rng(1, NUM_FACJOBS - 1));
|
||||
do
|
||||
job2 = faction_job(rng(0, NUM_FACJOBS - 1));
|
||||
while (job2 == job1);
|
||||
good += facjob_data[job1].good + facjob_data[job2].good;
|
||||
strength += facjob_data[job1].strength + facjob_data[job2].strength;
|
||||
sneak += facjob_data[job1].sneak + facjob_data[job2].sneak;
|
||||
crime += facjob_data[job1].crime + facjob_data[job2].crime;
|
||||
cult += facjob_data[job1].cult + facjob_data[job2].cult;
|
||||
|
||||
int num_values = 0;
|
||||
int tries = 0;
|
||||
values = 0;
|
||||
do {
|
||||
int v = rng(1, NUM_FACVALS - 1);
|
||||
if (!has_value(faction_value(v)) && matches_us(faction_value(v))) {
|
||||
values |= mfb(v);
|
||||
tries = 0;
|
||||
num_values++;
|
||||
good += facval_data[v].good;
|
||||
strength += facval_data[v].strength;
|
||||
sneak += facval_data[v].sneak;
|
||||
crime += facval_data[v].crime;
|
||||
cult += facval_data[v].cult;
|
||||
} else
|
||||
tries++;
|
||||
} while((one_in(num_values) || one_in(num_values)) && tries < 15);
|
||||
|
||||
std::string noun;
|
||||
int sel = 1, best = strength;
|
||||
if (sneak > best) {
|
||||
sel = 2;
|
||||
best = sneak;
|
||||
}
|
||||
if (crime > best) {
|
||||
sel = 3;
|
||||
best = crime;
|
||||
}
|
||||
if (cult > best)
|
||||
sel = 4;
|
||||
if (strength <= 0 && sneak <= 0 && crime <= 0 && cult <= 0)
|
||||
sel = 0;
|
||||
|
||||
switch (sel) {
|
||||
case 1:
|
||||
noun = faction_noun_strong[rng(0, 14)];
|
||||
power = dice(5, 20);
|
||||
size = dice(5, 6);
|
||||
break;
|
||||
case 2:
|
||||
noun = faction_noun_sneak [rng(0, 14)];
|
||||
power = dice(5, 8);
|
||||
size = dice(5, 8);
|
||||
break;
|
||||
case 3:
|
||||
noun = faction_noun_crime [rng(0, 14)];
|
||||
power = dice(5, 16);
|
||||
size = dice(5, 8);
|
||||
break;
|
||||
case 4:
|
||||
noun = faction_noun_cult [rng(0, 14)];
|
||||
power = dice(8, 8);
|
||||
size = dice(4, 6);
|
||||
break;
|
||||
default:
|
||||
noun = faction_noun_none [rng(0, 14)];
|
||||
power = dice(6, 8);
|
||||
size = dice(6, 6);
|
||||
}
|
||||
|
||||
if (one_in(4)) {
|
||||
do
|
||||
name = "The " + noun + " of " + invent_name();
|
||||
while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
else if (one_in(2)) {
|
||||
do
|
||||
name = "The " + invent_adj() + " " + noun;
|
||||
while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
else {
|
||||
do {
|
||||
std::string adj;
|
||||
if (good >= 3)
|
||||
adj = faction_adj_pos[rng(0, 14)];
|
||||
else if (good <= -3)
|
||||
adj = faction_adj_bad[rng(0, 14)];
|
||||
else
|
||||
adj = faction_adj_neu[rng(0, 14)];
|
||||
name = "The " + adj + " " + noun;
|
||||
if (one_in(4))
|
||||
name += " of " + invent_name();
|
||||
} while (name.length() > MAX_FAC_NAME_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void faction::make_army()
|
||||
{
|
||||
name = "The army";
|
||||
omx = 0;
|
||||
omy = 0;
|
||||
mapx = OMAPX / 2;
|
||||
mapy = OMAPY / 2;
|
||||
size = OMAPX * 2;
|
||||
power = OMAPX;
|
||||
goal = FACGOAL_DOMINANCE;
|
||||
job1 = FACJOB_MERCENARIES;
|
||||
job2 = FACJOB_NULL;
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_CHARITABLE);
|
||||
if (!one_in(4))
|
||||
values |= mfb(FACVAL_EXPLORATION);
|
||||
if (one_in(3))
|
||||
values |= mfb(FACVAL_BIONICS);
|
||||
if (one_in(3))
|
||||
values |= mfb(FACVAL_ROBOTS);
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_TREACHERY);
|
||||
if (one_in(4))
|
||||
values |= mfb(FACVAL_STRAIGHTEDGE);
|
||||
if (!one_in(3))
|
||||
values |= mfb(FACVAL_LAWFUL);
|
||||
if (one_in(8))
|
||||
values |= mfb(FACVAL_CRUELTY);
|
||||
id = 0;
|
||||
}
|
||||
|
||||
bool faction::has_job(faction_job j)
|
||||
{
|
||||
return (job1 == j || job2 == j);
|
||||
}
|
||||
|
||||
bool faction::has_value(faction_value v)
|
||||
{
|
||||
return values & mfb(v);
|
||||
}
|
||||
|
||||
bool faction::matches_us(faction_value v)
|
||||
{
|
||||
int numvals = 2;
|
||||
if (job2 != FACJOB_NULL)
|
||||
numvals++;
|
||||
for (int i = 0; i < NUM_FACVALS; i++) {
|
||||
if (has_value(faction_value(i)))
|
||||
numvals++;
|
||||
}
|
||||
if (has_job(FACJOB_DRUGS) && v == FACVAL_STRAIGHTEDGE) // Mutually exclusive
|
||||
return false;
|
||||
int avggood = (good / numvals + good) / 2;
|
||||
int avgstrength = (strength / numvals + strength) / 2;
|
||||
int avgsneak = (sneak / numvals + sneak / 2);
|
||||
int avgcrime = (crime / numvals + crime / 2);
|
||||
int avgcult = (cult / numvals + cult / 2);
|
||||
/*
|
||||
debugmsg("AVG: GOO %d STR %d SNK %d CRM %d CLT %d\n\
|
||||
VAL: GOO %d STR %d SNK %d CRM %d CLT %d (%s)", avggood, avgstrength,
|
||||
avgsneak, avgcrime, avgcult, facval_data[v].good, facval_data[v].strength,
|
||||
facval_data[v].sneak, facval_data[v].crime, facval_data[v].cult,
|
||||
facval_data[v].name.c_str());
|
||||
*/
|
||||
if ((abs(facval_data[v].good - avggood) <= 3 ||
|
||||
(avggood >= 5 && facval_data[v].good >= 1) ||
|
||||
(avggood <= -5 && facval_data[v].good <= 0)) &&
|
||||
(abs(facval_data[v].strength - avgstrength) <= 5 ||
|
||||
(avgstrength >= 5 && facval_data[v].strength >= 3) ||
|
||||
(avgstrength <= -5 && facval_data[v].strength <= -1)) &&
|
||||
(abs(facval_data[v].sneak - avgsneak) <= 4 ||
|
||||
(avgsneak >= 5 && facval_data[v].sneak >= 1) ||
|
||||
(avgsneak <= -5 && facval_data[v].sneak <= -1)) &&
|
||||
(abs(facval_data[v].crime - avgcrime) <= 4 ||
|
||||
(avgcrime >= 5 && facval_data[v].crime >= 0) ||
|
||||
(avgcrime <= -5 && facval_data[v].crime <= -1)) &&
|
||||
(abs(facval_data[v].cult - avgcult) <= 3 ||
|
||||
(avgcult >= 5 && facval_data[v].cult >= 1) ||
|
||||
(avgcult <= -5 && facval_data[v].cult <= -1)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string faction::describe()
|
||||
{
|
||||
std::string ret = name + " have the ultimate goal of " +
|
||||
facgoal_data[goal].name + ". Their primary concern is " +
|
||||
facjob_data[job1].name;
|
||||
if (job2 == FACJOB_NULL)
|
||||
ret += ".";
|
||||
else
|
||||
ret += ", but they are also involved in " + facjob_data[job2].name + ".";
|
||||
if (values != 0) {
|
||||
ret += " They are known for ";
|
||||
for (int i = 0; i < NUM_FACVALS; i++) {
|
||||
if (has_value(faction_value(i)))
|
||||
ret += facval_data[i].name + ", ";
|
||||
}
|
||||
}
|
||||
size_t pos = ret.find_last_of(",");
|
||||
if (pos != std::string::npos) {
|
||||
ret.replace(pos, 2, ".");
|
||||
pos = ret.find_last_of(",");
|
||||
if (pos != std::string::npos)
|
||||
ret.replace(pos, 2, ", and ");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int faction::response_time(game *g)
|
||||
{
|
||||
int base = abs(mapx - g->levx);
|
||||
if (abs(mapy - g->levy) > base)
|
||||
base = abs(mapy - g->levy);
|
||||
if (base > size) // Out of our sphere of influence
|
||||
base *= 2.5;
|
||||
base *= 24; // 24 turns to move one overmap square
|
||||
int maxdiv = 10;
|
||||
if (goal == FACGOAL_DOMINANCE)
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_CARAVANS))
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_SCAVENGE))
|
||||
maxdiv++;
|
||||
if (has_job(FACJOB_MERCENARIES))
|
||||
maxdiv += 2;
|
||||
if (has_job(FACJOB_FARMERS))
|
||||
maxdiv -= 2;
|
||||
if (has_value(FACVAL_EXPLORATION))
|
||||
maxdiv += 2;
|
||||
if (has_value(FACVAL_LONERS))
|
||||
maxdiv -= 3;
|
||||
if (has_value(FACVAL_TREACHERY))
|
||||
maxdiv -= rng(0, 3);
|
||||
int mindiv = (maxdiv > 9 ? maxdiv - 9 : 1);
|
||||
base /= rng(mindiv, maxdiv);// We might be in the field
|
||||
base -= likes_u; // We'll hurry, if we like you
|
||||
if (base < 100)
|
||||
base = 100;
|
||||
return base;
|
||||
}
|
||||
|
||||
|
||||
// END faction:: MEMBER FUNCTIONS
|
||||
|
||||
|
||||
std::string invent_name()
|
||||
{
|
||||
std::string ret = "";
|
||||
std::string tmp;
|
||||
int syllables = rng(2, 3);
|
||||
for (int i = 0; i < syllables; i++) {
|
||||
switch (rng(0, 25)) {
|
||||
case 0: tmp = "ab"; break;
|
||||
case 1: tmp = "bon"; break;
|
||||
case 2: tmp = "cor"; break;
|
||||
case 3: tmp = "den"; break;
|
||||
case 4: tmp = "el"; break;
|
||||
case 5: tmp = "fes"; break;
|
||||
case 6: tmp = "gun"; break;
|
||||
case 7: tmp = "hit"; break;
|
||||
case 8: tmp = "id"; break;
|
||||
case 9: tmp = "jan"; break;
|
||||
case 10: tmp = "kal"; break;
|
||||
case 11: tmp = "ler"; break;
|
||||
case 12: tmp = "mal"; break;
|
||||
case 13: tmp = "nor"; break;
|
||||
case 14: tmp = "or"; break;
|
||||
case 15: tmp = "pan"; break;
|
||||
case 16: tmp = "qua"; break;
|
||||
case 17: tmp = "ros"; break;
|
||||
case 18: tmp = "sin"; break;
|
||||
case 19: tmp = "tor"; break;
|
||||
case 20: tmp = "urr"; break;
|
||||
case 21: tmp = "ven"; break;
|
||||
case 22: tmp = "wel"; break;
|
||||
case 23: tmp = "oxo"; break;
|
||||
case 24: tmp = "yen"; break;
|
||||
case 25: tmp = "zu"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
}
|
||||
ret[0] += 'A' - 'a';
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string invent_adj()
|
||||
{
|
||||
int syllables = dice(2, 2) - 1;
|
||||
std::string ret, tmp;
|
||||
switch (rng(0, 25)) {
|
||||
case 0: ret = "Ald"; break;
|
||||
case 1: ret = "Brogg"; break;
|
||||
case 2: ret = "Cald"; break;
|
||||
case 3: ret = "Dredd"; break;
|
||||
case 4: ret = "Eld"; break;
|
||||
case 5: ret = "Forr"; break;
|
||||
case 6: ret = "Gugg"; break;
|
||||
case 7: ret = "Horr"; break;
|
||||
case 8: ret = "Ill"; break;
|
||||
case 9: ret = "Jov"; break;
|
||||
case 10: ret = "Kok"; break;
|
||||
case 11: ret = "Lill"; break;
|
||||
case 12: ret = "Moom"; break;
|
||||
case 13: ret = "Nov"; break;
|
||||
case 14: ret = "Orb"; break;
|
||||
case 15: ret = "Perv"; break;
|
||||
case 16: ret = "Quot"; break;
|
||||
case 17: ret = "Rar"; break;
|
||||
case 18: ret = "Suss"; break;
|
||||
case 19: ret = "Torr"; break;
|
||||
case 20: ret = "Umbr"; break;
|
||||
case 21: ret = "Viv"; break;
|
||||
case 22: ret = "Warr"; break;
|
||||
case 23: ret = "Xen"; break;
|
||||
case 24: ret = "Yend"; break;
|
||||
case 25: ret = "Zor"; break;
|
||||
}
|
||||
for (int i = 0; i < syllables - 2; i++) {
|
||||
switch (rng(0, 17)) {
|
||||
case 0: tmp = "al"; break;
|
||||
case 1: tmp = "arn"; break;
|
||||
case 2: tmp = "astr"; break;
|
||||
case 3: tmp = "antr"; break;
|
||||
case 4: tmp = "ent"; break;
|
||||
case 5: tmp = "ell"; break;
|
||||
case 6: tmp = "ev"; break;
|
||||
case 7: tmp = "emm"; break;
|
||||
case 8: tmp = "empr"; break;
|
||||
case 9: tmp = "ill"; break;
|
||||
case 10: tmp = "ial"; break;
|
||||
case 11: tmp = "ior"; break;
|
||||
case 12: tmp = "ordr"; break;
|
||||
case 13: tmp = "oth"; break;
|
||||
case 14: tmp = "omn"; break;
|
||||
case 15: tmp = "uv"; break;
|
||||
case 16: tmp = "ulv"; break;
|
||||
case 17: tmp = "urn"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
}
|
||||
switch (rng(0, 24)) {
|
||||
case 0: tmp = ""; break;
|
||||
case 1: tmp = "al"; break;
|
||||
case 2: tmp = "an"; break;
|
||||
case 3: tmp = "ard"; break;
|
||||
case 4: tmp = "ate"; break;
|
||||
case 5: tmp = "e"; break;
|
||||
case 6: tmp = "ed"; break;
|
||||
case 7: tmp = "en"; break;
|
||||
case 8: tmp = "er"; break;
|
||||
case 9: tmp = "ial"; break;
|
||||
case 10: tmp = "ian"; break;
|
||||
case 11: tmp = "iated"; break;
|
||||
case 12: tmp = "ier"; break;
|
||||
case 13: tmp = "ious"; break;
|
||||
case 14: tmp = "ish"; break;
|
||||
case 15: tmp = "ive"; break;
|
||||
case 16: tmp = "oo"; break;
|
||||
case 17: tmp = "or"; break;
|
||||
case 18: tmp = "oth"; break;
|
||||
case 19: tmp = "old"; break;
|
||||
case 20: tmp = "ous"; break;
|
||||
case 21: tmp = "ul"; break;
|
||||
case 22: tmp = "un"; break;
|
||||
case 23: tmp = "ule"; break;
|
||||
case 24: tmp = "y"; break;
|
||||
}
|
||||
ret += tmp;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Used in game.cpp
|
||||
std::string fac_ranking_text(int val)
|
||||
{
|
||||
if (val <= -100)
|
||||
return "Archenemy";
|
||||
if (val <= -80)
|
||||
return "Wanted Dead";
|
||||
if (val <= -60)
|
||||
return "Enemy of the People";
|
||||
if (val <= -40)
|
||||
return "Wanted Criminal";
|
||||
if (val <= -20)
|
||||
return "Not Welcome";
|
||||
if (val <= -10)
|
||||
return "Pariah";
|
||||
if (val <= -5)
|
||||
return "Disliked";
|
||||
if (val >= 100)
|
||||
return "Hero";
|
||||
if (val >= 80)
|
||||
return "Idol";
|
||||
if (val >= 60)
|
||||
return "Beloved";
|
||||
if (val >= 40)
|
||||
return "Highly Valued";
|
||||
if (val >= 20)
|
||||
return "Valued";
|
||||
if (val >= 10)
|
||||
return "Well-Liked";
|
||||
if (val >= 5)
|
||||
return "Liked";
|
||||
|
||||
return "Neutral";
|
||||
}
|
||||
|
||||
// Used in game.cpp
|
||||
std::string fac_respect_text(int val)
|
||||
{
|
||||
// Respected, feared, etc.
|
||||
if (val >= 100)
|
||||
return "Legendary";
|
||||
if (val >= 80)
|
||||
return "Unchallenged";
|
||||
if (val >= 60)
|
||||
return "Mighty";
|
||||
if (val >= 40)
|
||||
return "Famous";
|
||||
if (val >= 20)
|
||||
return "Well-Known";
|
||||
if (val >= 10)
|
||||
return "Spoken Of";
|
||||
|
||||
// Disrepected, laughed at, etc.
|
||||
if (val <= -100)
|
||||
return "Worthless Scum";
|
||||
if (val <= -80)
|
||||
return "Vermin";
|
||||
if (val <= -60)
|
||||
return "Despicable";
|
||||
if (val <= -40)
|
||||
return "Parasite";
|
||||
if (val <= -20)
|
||||
return "Leech";
|
||||
if (val <= -10)
|
||||
return "Laughingstock";
|
||||
|
||||
return "Neutral";
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
#ifndef _FACTION_H_
|
||||
#define _FACTION_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// TODO: Redefine?
|
||||
#define MAX_FAC_NAME_SIZE 40
|
||||
|
||||
#ifndef mfb
|
||||
#define mfb(n) int(pow(2,(int)n))
|
||||
#endif
|
||||
|
||||
std::string fac_ranking_text(int val);
|
||||
std::string fac_respect_text(int val);
|
||||
|
||||
class game;
|
||||
|
||||
enum faction_goal {
|
||||
FACGOAL_NULL = 0, // Not meant to be used; denotes a bug
|
||||
FACGOAL_NONE, // No particular goal outside of prosperity
|
||||
FACGOAL_WEALTH, // Financial wealth
|
||||
FACGOAL_DOMINANCE, // Complete military dominance
|
||||
FACGOAL_CLEANSE, // Destroy zombies &c
|
||||
FACGOAL_SHADOW, // Contact, control, etc. of the shadow world
|
||||
FACGOAL_APOCALYPSE, // Destroy the world!
|
||||
FACGOAL_ANARCHY, // Nihilistic; destroy anything
|
||||
FACGOAL_KNOWLEDGE, // Golden age of knowledge; a new renaissance
|
||||
FACGOAL_NATURE, // Golden age of ecological harmony
|
||||
FACGOAL_CIVILIZATION, // Rebuilding society as it was before
|
||||
NUM_FACGOALS
|
||||
};
|
||||
|
||||
enum faction_job {
|
||||
FACJOB_NULL = 0,
|
||||
FACJOB_EXTORTION, // Protection rackets, etc
|
||||
FACJOB_INFORMATION, // Gathering & sale of information
|
||||
FACJOB_TRADE, // Bazaars, etc.
|
||||
FACJOB_CARAVANS, // Transportation of goods
|
||||
FACJOB_SCAVENGE, // Scavenging & sale of general supplies
|
||||
FACJOB_MERCENARIES, // General fighters-for-hire
|
||||
FACJOB_ASSASSINS, // Targeted discreet killing
|
||||
FACJOB_RAIDERS, // Raiding settlements, trade routes, &c
|
||||
FACJOB_THIEVES, // Less violent; theft of property without killing
|
||||
FACJOB_GAMBLING, // Maitenance of gambling parlors
|
||||
FACJOB_DOCTORS, // Doctors for hire
|
||||
FACJOB_FARMERS, // Farming & sale of food
|
||||
FACJOB_DRUGS, // Drug dealing
|
||||
FACJOB_MANUFACTURE, // Manufacturing & selling goods
|
||||
NUM_FACJOBS
|
||||
};
|
||||
|
||||
enum faction_value {
|
||||
FACVAL_NULL = 0,
|
||||
FACVAL_CHARITABLE, // Give their job for free (often)
|
||||
FACVAL_LONERS, // Avoid associating with outsiders
|
||||
FACVAL_EXPLORATION, // Like to explore new territory
|
||||
FACVAL_ARTIFACTS, // Seek out unique items
|
||||
FACVAL_BIONICS, // Collection & installation of bionic parts
|
||||
FACVAL_BOOKS, // Collection of books
|
||||
FACVAL_TRAINING, // Training among themselves and others
|
||||
FACVAL_ROBOTS, // Creation / use of robots
|
||||
FACVAL_TREACHERY, // Untrustworthy
|
||||
FACVAL_STRAIGHTEDGE, // No drugs, alcohol, etc.
|
||||
FACVAL_LAWFUL, // Abide by the old laws
|
||||
FACVAL_CRUELTY, // Torture, murder, etc.
|
||||
NUM_FACVALS
|
||||
};
|
||||
|
||||
struct faction {
|
||||
faction();
|
||||
~faction();
|
||||
|
||||
void randomize();
|
||||
void make_army();
|
||||
bool has_job(faction_job j);
|
||||
bool has_value(faction_value v);
|
||||
bool matches_us(faction_value v);
|
||||
std::string describe();
|
||||
|
||||
int response_time(game *g); // Time it takes for them to get to u
|
||||
|
||||
std::string name;
|
||||
unsigned values : NUM_FACVALS; // Bitfield of values
|
||||
faction_goal goal;
|
||||
faction_job job1, job2;
|
||||
std::vector<int> opinion_of;
|
||||
int likes_u;
|
||||
int respects_u;
|
||||
bool known_by_u;
|
||||
int id;
|
||||
int strength, sneak, crime, cult, good; // Defining values
|
||||
int omx, omy; // Which overmap are we based in?
|
||||
int mapx, mapy;// Where in that overmap are we?
|
||||
int size; // How big is our sphere of influence?
|
||||
int power; // General measure of our power
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,494 +0,0 @@
|
||||
#include "rng.h"
|
||||
#include "map.h"
|
||||
#include "game.h"
|
||||
|
||||
bool vector_has(std::vector <item> vec, itype_id type);
|
||||
|
||||
bool map::process_fields(game *g)
|
||||
{
|
||||
bool found_field = false;
|
||||
field *cur;
|
||||
field_id curtype;
|
||||
for (int x = 0; x < SEEX * 3; x++) {
|
||||
for (int y = 0; y < SEEY * 3; y++) {
|
||||
cur = &field_at(x, y);
|
||||
curtype = cur->type;
|
||||
if (!found_field && curtype != fd_null)
|
||||
found_field = true;
|
||||
if (cur->density > 3)
|
||||
debugmsg("Whoooooa density of %d", cur->density);
|
||||
|
||||
if (cur->age == 0) // Don't process "newborn" fields
|
||||
curtype = fd_null;
|
||||
|
||||
switch (curtype) {
|
||||
|
||||
case fd_null:
|
||||
break; // Do nothing, obviously. OBVIOUSLY.
|
||||
|
||||
case fd_blood:
|
||||
case fd_bile:
|
||||
if (has_flag(swimmable, x, y)) // Dissipate faster in water
|
||||
cur->age += 250;
|
||||
break;
|
||||
|
||||
case fd_acid:
|
||||
if (has_flag(swimmable, x, y)) // Dissipate faster in water
|
||||
cur->age += 20;
|
||||
for (int i = 0; i < i_at(x, y).size(); i++) {
|
||||
if (i_at(x, y)[i].made_of(LIQUID) || i_at(x, y)[i].made_of(VEGGY) ||
|
||||
i_at(x, y)[i].made_of(FLESH) || i_at(x, y)[i].made_of(POWDER) ||
|
||||
i_at(x, y)[i].made_of(COTTON) || i_at(x, y)[i].made_of(WOOL) ||
|
||||
i_at(x, y)[i].made_of(PAPER) || i_at(x, y)[i].made_of(PLASTIC) ||
|
||||
i_at(x, y)[i].made_of(GLASS)) { // Whew! Acid-destructable.
|
||||
cur->age += i_at(x, y)[i].volume();
|
||||
for (int m = 0; m < i_at(x, y)[i].contents.size(); m++)
|
||||
i_at(x, y).push_back( i_at(x, y)[i].contents[m] );
|
||||
i_at(x, y).erase(i_at(x, y).begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_fire:
|
||||
// Consume items as fuel to help us grow/last longer.
|
||||
bool destroyed;
|
||||
int vol;
|
||||
for (int i = 0; i < i_at(x, y).size(); i++) {
|
||||
destroyed = false;
|
||||
vol = i_at(x, y)[i].volume();
|
||||
if (i_at(x, y)[i].is_ammo()) {
|
||||
cur->age /= 2;
|
||||
cur->age -= 300;
|
||||
destroyed = true;
|
||||
} else if (i_at(x, y)[i].made_of(PAPER)) {
|
||||
cur->age -= vol * 10;
|
||||
destroyed = true;
|
||||
} else if ((i_at(x, y)[i].made_of(WOOD) || i_at(x, y)[i].made_of(VEGGY)) &&
|
||||
(vol <= cur->density*10-(cur->age>0 ? rng(0,cur->age/10) : 0) ||
|
||||
cur->density == 3)) {
|
||||
cur->age -= vol * 10;
|
||||
destroyed = true;
|
||||
} else if ((i_at(x, y)[i].made_of(COTTON) || i_at(x, y)[i].made_of(FLESH)||
|
||||
i_at(x, y)[i].made_of(WOOL)) &&
|
||||
(vol <= cur->density*2 || (cur->density == 3 && one_in(vol)))) {
|
||||
cur->age -= vol * 5;
|
||||
destroyed = true;
|
||||
} else if (i_at(x, y)[i].made_of(LIQUID) || i_at(x, y)[i].made_of(POWDER)||
|
||||
i_at(x, y)[i].made_of(PLASTIC)||
|
||||
(cur->density >= 2 && i_at(x, y)[i].made_of(GLASS)) ||
|
||||
(cur->density == 3 && i_at(x, y)[i].made_of(IRON))) {
|
||||
switch (i_at(x, y)[i].type->id) { // TODO: Make this be not a hack.
|
||||
case itm_whiskey:
|
||||
case itm_vodka:
|
||||
case itm_rum:
|
||||
case itm_tequila:
|
||||
cur->age -= 220;
|
||||
break;
|
||||
}
|
||||
destroyed = true;
|
||||
}
|
||||
if (destroyed) {
|
||||
for (int m = 0; m < i_at(x, y)[i].contents.size(); m++)
|
||||
i_at(x, y).push_back( i_at(x, y)[i].contents[m] );
|
||||
i_at(x, y).erase(i_at(x, y).begin() + i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
// Consume the terrain we're on
|
||||
if (terlist[ter(x, y)].flags & mfb(flammable) && one_in(8 - cur->density)) {
|
||||
cur->age -= cur->density * cur->density * 40;
|
||||
if (cur->density == 3)
|
||||
ter(x, y) = t_rubble;
|
||||
} else if (terlist[ter(x, y)].flags & mfb(explodes)) {
|
||||
ter(x, y) = t_gas_pump_smashed;
|
||||
cur->age = 0;
|
||||
cur->density = 3;
|
||||
g->explosion(x, y, 40, 0, true);
|
||||
} else if (terlist[ter(x, y)].flags & mfb(swimmable))
|
||||
cur->age += 800; // Flames die quickly on water
|
||||
// If we consumed a lot, the flames grow higher
|
||||
while (cur->density < 3 && cur->age < 0) {
|
||||
cur->age += 300;
|
||||
cur->density++;
|
||||
}
|
||||
// If the flames are REALLY big, they contribute to adjacent flames
|
||||
if (cur->density == 3 && cur->age < 0) {
|
||||
// Randomly offset our x/y shifts by 0-2, to randomly pick a square to spread to
|
||||
int starti = rng(0, 2);
|
||||
int startj = rng(0, 2);
|
||||
for (int i = 0; i < 3 && cur->age < 0; i++) {
|
||||
for (int j = 0; j < 3 && cur->age < 0; j++) {
|
||||
if (field_at(x+((i+starti)%3), y+((j+startj)%3)).type == fd_fire &&
|
||||
field_at(x+((i+starti)%3), y+((j+startj)%3)).density < 3) {
|
||||
field_at(x+((i+starti)%3), y+((j+startj)%3)).density++;
|
||||
field_at(x+((i+starti)%3), y+((j+startj)%3)).age = 0;
|
||||
cur->age = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Consume adjacent fuel / terrain to spread.
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
if (x+i >= 0 && y+j >= 0 && x+i < SEEX * 3 && y+j <= SEEY * 3) {
|
||||
if (has_flag(explodes, x + i, y + j) && one_in(8 - cur->density)) {
|
||||
ter(x+i, y+j) = t_gas_pump_smashed;
|
||||
g->explosion(x+i, y+j, 40, 0, true);
|
||||
} else if ((i != 0 || j != 0) && (i_at(x+i, y+j).size() > 0 ||
|
||||
rng(15, 120) < cur->density * 10)) {
|
||||
if (field_at(x+i, y+j).type == fd_smoke)
|
||||
field_at(x+i, y+j) = field(fd_fire, 1, 0);
|
||||
else
|
||||
add_field(g, x+i, y+j, fd_fire, 1);
|
||||
// If we're not spreading, maybe we'll stick out some smoke, huh?
|
||||
} else if (move_cost(x+i, y+j) > 0 &&
|
||||
rng(7, 40) < cur->density * 10 && cur->age < 1000) {
|
||||
add_field(g, x+i, y+j, fd_smoke, rng(1, cur->density));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_smoke:
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++)
|
||||
g->scent(x+i, y+j) = 0;
|
||||
}
|
||||
if (one_in(3)) {
|
||||
std::vector <point> spread;
|
||||
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).is_null() && move_cost(x+a, y+b) > 0))
|
||||
spread.push_back(point(x+a, y+b));
|
||||
}
|
||||
}
|
||||
if (cur->density > 0 && cur->age > 0 && spread.size() > 0) {
|
||||
point p = spread[rng(0, spread.size() - 1)];
|
||||
if (field_at(p.x, p.y).type == fd_smoke &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
|
||||
add_field(g, p.x, p.y, fd_smoke, 1)){
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_tear_gas:
|
||||
// Reset nearby scents to zero
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++)
|
||||
g->scent(x+i, y+j) = 0;
|
||||
}
|
||||
// One in three chance that it spreads (less than smoke!)
|
||||
if (one_in(3)) {
|
||||
std::vector <point> spread;
|
||||
// Pick all eligible points to spread to
|
||||
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).type == fd_tear_gas) &&
|
||||
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));
|
||||
}
|
||||
}
|
||||
// Then, spread to a nearby point
|
||||
if (cur->density > 0 && cur->age > 0 && spread.size() > 0) {
|
||||
point p = spread[rng(0, spread.size() - 1)];
|
||||
// Nearby teargas grows thicker
|
||||
if (field_at(p.x, p.y).type == fd_tear_gas &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
// Nearby smoke is converted into teargas
|
||||
} else if (field_at(p.x, p.y).type == fd_smoke) {
|
||||
field_at(p.x, p.y).type = fd_tear_gas;
|
||||
// Or, just create a new field.
|
||||
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
|
||||
add_field(g, p.x, p.y, fd_tear_gas, 1)) {
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_nuke_gas:
|
||||
// Reset nearby scents to zero
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++)
|
||||
g->scent(x+i, y+j) = 0;
|
||||
}
|
||||
// Increase long-term radiation in the land underneath
|
||||
radiation(x, y) += rng(0, cur->density);
|
||||
if (one_in(2)) {
|
||||
std::vector <point> spread;
|
||||
// Pick all eligible points to spread to
|
||||
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).type == fd_tear_gas ||
|
||||
field_at(x+a, y+b).type == fd_nuke_gas ) &&
|
||||
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));
|
||||
}
|
||||
}
|
||||
// Then, spread to a nearby point
|
||||
if (cur->density > 0 && cur->age > 0 && spread.size() > 0) {
|
||||
point p = spread[rng(0, spread.size() - 1)];
|
||||
// Nearby nukegas grows thicker
|
||||
if (field_at(p.x, p.y).type == fd_nuke_gas &&
|
||||
field_at(p.x, p.y).density < 3) {
|
||||
field_at(p.x, p.y).density++;
|
||||
cur->density--;
|
||||
// Nearby smoke & teargas is converted into nukegas
|
||||
} else if (field_at(p.x, p.y).type == fd_smoke ||
|
||||
field_at(p.x, p.y).type == fd_tear_gas) {
|
||||
field_at(p.x, p.y).type = fd_nuke_gas;
|
||||
// Or, just create a new field.
|
||||
} else if (cur->density > 0 && move_cost(p.x, p.y) > 0 &&
|
||||
add_field(g, p.x, p.y, fd_nuke_gas, 1)) {
|
||||
cur->density--;
|
||||
field_at(p.x, p.y).age = cur->age;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case fd_electricity:
|
||||
if (!one_in(5)) { // 4 in 5 chance to spread
|
||||
std::vector<point> valid;
|
||||
if (move_cost(x, y) == 0 && cur->density > 1) { // We're grounded
|
||||
int tries = 0;
|
||||
while (tries < 10 && cur->age < 50) {
|
||||
int cx = x + rng(-1, 1), cy = y + rng(-1, 1);
|
||||
if (move_cost(cx, cy) != 0 && field_at(cx, cy).is_null()) {
|
||||
add_field(g, cx, cy, fd_electricity, 1);
|
||||
cur->density--;
|
||||
tries = 0;
|
||||
} else
|
||||
tries++;
|
||||
}
|
||||
} else { // We're not grounded; attempt to ground
|
||||
for (int a = -1; a <= 1; a++) {
|
||||
for (int b = -1; b <= 1; b++) {
|
||||
if (move_cost(x + a, y + b) == 0 && // Grounded tiles first
|
||||
field_at(x + a, y + b).is_null())
|
||||
valid.push_back(point(x + a, y + b));
|
||||
}
|
||||
}
|
||||
if (valid.size() == 0) { // Spread to adjacent space, then
|
||||
int px = x + rng(-1, 1), py = y + rng(-1, 1);
|
||||
if (move_cost(px, py) > 0 && field_at(px, py).type == fd_electricity &&
|
||||
field_at(px, py).density < 3)
|
||||
field_at(px, py).density++;
|
||||
else if (move_cost(px, py) > 0)
|
||||
add_field(g, px, py, fd_electricity, 1);
|
||||
cur->density--;
|
||||
}
|
||||
while (valid.size() > 0 && cur->density > 0) {
|
||||
int index = rng(0, valid.size() - 1);
|
||||
add_field(g, valid[index].x, valid[index].y, fd_electricity, 1);
|
||||
cur->density--;
|
||||
valid.erase(valid.begin() + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (cur->type != fd_null) {
|
||||
cur->age++;
|
||||
if (cur->age > 0 &&
|
||||
dice(3, cur->age) > dice(3, fieldlist[cur->type].halflife)) {
|
||||
cur->age = 0;
|
||||
cur->density--;
|
||||
}
|
||||
if (cur->density <= 0)
|
||||
field_at(x, y) = field();
|
||||
}
|
||||
}
|
||||
}
|
||||
return found_field;
|
||||
}
|
||||
|
||||
void map::step_in_field(int x, int y, game *g)
|
||||
{
|
||||
field *cur = &field_at(x, y);
|
||||
switch (cur->type) {
|
||||
case fd_null:
|
||||
case fd_blood: // It doesn't actually do anything
|
||||
case fd_bile: // Ditto
|
||||
return;
|
||||
|
||||
case fd_acid:
|
||||
if (cur->density == 3) {
|
||||
g->add_msg("The acid burns your legs and feet!");
|
||||
g->u.hit(g, bp_feet, 0, 0, rng(4, 10));
|
||||
g->u.hit(g, bp_feet, 1, 0, rng(4, 10));
|
||||
g->u.hit(g, bp_legs, 0, 0, rng(2, 8));
|
||||
g->u.hit(g, bp_legs, 1, 0, rng(2, 8));
|
||||
} else {
|
||||
g->add_msg("The acid burns your feet!");
|
||||
g->u.hit(g, bp_feet, 0, 0, rng(cur->density, 4 * cur->density));
|
||||
g->u.hit(g, bp_feet, 1, 0, rng(cur->density, 4 * cur->density));
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_fire:
|
||||
if (!g->u.has_active_bionic(bio_heatsink)) {
|
||||
if (cur->density == 1) {
|
||||
g->add_msg("You burn your legs and feet!");
|
||||
g->u.hit(g, bp_feet, 0, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_feet, 1, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_legs, 0, 0, rng(1, 4));
|
||||
g->u.hit(g, bp_legs, 1, 0, rng(1, 4));
|
||||
} else if (cur->density == 2) {
|
||||
g->add_msg("You're burning up!");
|
||||
g->u.hit(g, bp_legs, 0, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_legs, 1, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_torso, 0, 4, rng(4, 9));
|
||||
g->u.infect(DI_SMOKE, bp_mouth, 5, 20, g);
|
||||
} else if (cur->density == 3) {
|
||||
g->add_msg("You're set ablaze!");
|
||||
g->u.hit(g, bp_legs, 0, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_legs, 1, 0, rng(2, 6));
|
||||
g->u.hit(g, bp_torso, 0, 4, rng(4, 9));
|
||||
g->u.add_disease(DI_ONFIRE, 5, g);
|
||||
g->u.infect(DI_SMOKE, bp_mouth, 7, 30, g);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case fd_smoke:
|
||||
if (cur->density == 3)
|
||||
g->u.infect(DI_SMOKE, bp_mouth, 4, 15, g);
|
||||
break;
|
||||
case fd_tear_gas:
|
||||
if (cur->density > 1 || !one_in(3))
|
||||
g->u.infect(DI_TEARGAS, bp_mouth, 5, 20, g);
|
||||
break;
|
||||
case fd_nuke_gas:
|
||||
g->u.radiation += rng(0, cur->density * (cur->density + 1));
|
||||
if (cur->density == 3) {
|
||||
g->add_msg("This radioactive gas burns!");
|
||||
g->u.hurtall(rng(1, 3));
|
||||
}
|
||||
break;
|
||||
case fd_electricity:
|
||||
g->add_msg("You're electrocuted!");
|
||||
g->u.hurtall(rng(1, cur->density));
|
||||
if (one_in(8 - cur->density) && !one_in(30 - g->u.str_cur)) {
|
||||
g->add_msg("You're paralyzed!");
|
||||
g->u.moves -= cur->density * 150;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void map::mon_in_field(int x, int y, game *g, monster *z)
|
||||
{
|
||||
if (z->has_flag(MF_DIGS))
|
||||
return; // Digging monsters are immune to fields
|
||||
field *cur = &field_at(x, y);
|
||||
int dam = 0, j;
|
||||
switch (cur->type) {
|
||||
case fd_null:
|
||||
case fd_blood: // It doesn't actually do anything
|
||||
case fd_bile: // Ditto
|
||||
break;
|
||||
|
||||
case fd_acid:
|
||||
if (!z->has_flag(MF_DIGS) && !z->has_flag(MF_ACIDPROOF)) {
|
||||
if (cur->density == 3)
|
||||
dam = rng(4, 10) + rng(2, 8);
|
||||
else
|
||||
dam = rng(cur->density, cur->density * 4);
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_fire:
|
||||
if (z->made_of(FLESH))
|
||||
dam = 3;
|
||||
if (z->made_of(VEGGY))
|
||||
dam = 12;
|
||||
if (z->made_of(PAPER) || z->made_of(LIQUID) || z->made_of(POWDER) ||
|
||||
z->made_of(WOOD) || z->made_of(COTTON) || z->made_of(WOOL))
|
||||
dam = 50;
|
||||
if (z->made_of(STONE) || z->made_of(KEVLAR) || z->made_of(STEEL))
|
||||
dam = -25;
|
||||
if (z->has_flag(MF_FLIES))
|
||||
dam -= 20;
|
||||
|
||||
if (cur->density == 1)
|
||||
dam += rng(4, 12);
|
||||
else if (cur->density == 2) {
|
||||
dam += rng(6, 18);
|
||||
z->moves -= 50;
|
||||
} else if (cur->density == 3) {
|
||||
dam += rng(10, 30);
|
||||
z->moves -= 80;
|
||||
}
|
||||
break;
|
||||
|
||||
case fd_smoke:
|
||||
if (cur->density == 3)
|
||||
z->speed -= rng(10, 20);
|
||||
if (z->made_of(VEGGY)) // Plants suffer from smoke even worse
|
||||
z->speed -= rng(1, cur->density * 12);
|
||||
break;
|
||||
|
||||
case fd_tear_gas:
|
||||
if (cur->density == 3) {
|
||||
z->speed -= rng(30, 60);
|
||||
dam = rng(8, 20);
|
||||
} else if (cur->density == 2) {
|
||||
z->speed -= rng(10, 25);
|
||||
dam = rng(4, 10);
|
||||
} else
|
||||
z->speed -= rng(0, 6);
|
||||
if (z->made_of(VEGGY)) {
|
||||
z->speed -= rng(cur->density * 5, cur->density * 12);
|
||||
dam += cur->density * 10;
|
||||
}
|
||||
break;
|
||||
case fd_nuke_gas:
|
||||
if (cur->density == 3) {
|
||||
z->speed -= rng(60, 120);
|
||||
dam = rng(30, 50);
|
||||
} else if (cur->density == 2) {
|
||||
z->speed -= rng(20, 50);
|
||||
dam = rng(10, 25);
|
||||
} else {
|
||||
z->speed -= rng(0, 15);
|
||||
dam = rng(0, 12);
|
||||
}
|
||||
if (z->made_of(VEGGY)) {
|
||||
z->speed -= rng(cur->density * 5, cur->density * 12);
|
||||
dam *= cur->density;
|
||||
}
|
||||
break;
|
||||
case fd_electricity:
|
||||
dam = rng(1, cur->density);
|
||||
if (one_in(8 - cur->density) && one_in(z->armor()))
|
||||
z->moves -= cur->density * 150;
|
||||
break;
|
||||
}
|
||||
z->hurt(dam);
|
||||
}
|
||||
|
||||
bool vector_has(std::vector <item> vec, itype_id type)
|
||||
{
|
||||
for (int i = 0; i < vec.size(); i++) {
|
||||
if (vec[i].type->id == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
+184
File diff suppressed because one or more lines are too long
@@ -1,209 +0,0 @@
|
||||
#ifndef _GAME_H_
|
||||
#define _GAME_H_
|
||||
|
||||
#include "mtype.h"
|
||||
#include "monster.h"
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
#include "overmap.h"
|
||||
#include "omdata.h"
|
||||
#include "mapitems.h"
|
||||
#include "crafting.h"
|
||||
#include "trap.h"
|
||||
#include "npc.h"
|
||||
#include "tutorial.h"
|
||||
#include "faction.h"
|
||||
#include "event.h"
|
||||
#include <vector>
|
||||
|
||||
enum tut_type {
|
||||
TUT_NULL,
|
||||
TUT_BASIC, TUT_COMBAT,
|
||||
TUT_MAX
|
||||
};
|
||||
|
||||
struct mtype;
|
||||
class map;
|
||||
class player;
|
||||
|
||||
class game
|
||||
{
|
||||
public:
|
||||
game();
|
||||
~game();
|
||||
bool do_turn();
|
||||
void tutorial_message(tut_lesson lesson);
|
||||
void draw();
|
||||
void draw_ter();
|
||||
void advance_nextinv(); // Increment the next inventory letter
|
||||
void add_msg(const char* msg, ...);
|
||||
void add_event(event_type type, int on_turn, faction* rel);
|
||||
// Sound at (x, y) of intensity (vol), described to the player is (description)
|
||||
void sound(int x, int y, int vol, std::string description);
|
||||
// Explosion at (x, y) of intensity (power), with (shrapnel) chunks of shrapnel
|
||||
void explosion(int x, int y, int power, int shrapnel, bool fire);
|
||||
// Move the player vertically, if (force) then they fell
|
||||
void vertical_move(int z, bool force);
|
||||
void use_computer(int x, int y);
|
||||
void resonance_cascade(int x, int y);
|
||||
void emp_blast(int x, int y);
|
||||
int npc_at(int x, int y); // Index of the npc at (x, y); -1 for none
|
||||
int mon_at(int x, int y); // Index of the monster at (x, y); -1 for none
|
||||
void kill_mon(int index); // Kill that monster; fixes any pointers etc
|
||||
void plfire(bool burst); // Player fires a gun (setup of target)...
|
||||
// ... a gun is fired, maybe by an NPC (actual damage, etc.).
|
||||
void fire(player &p, int tarx, int tary, std::vector<point> &trajectory,
|
||||
bool burst);
|
||||
void throw_item(player &p, int tarx, int tary, item &thrown,
|
||||
std::vector<point> &trajectory);
|
||||
void cancel_activity();
|
||||
void cancel_activity_query(std::string message);
|
||||
void teleport();
|
||||
int& scent(int x, int y);
|
||||
unsigned char light_level();
|
||||
bool sees_u(int x, int y, int &t);
|
||||
bool u_see (int x, int y, int &t);
|
||||
bool u_see (monster *mon, int &t);
|
||||
bool pl_sees(player *p, monster *mon, int &t);
|
||||
void refresh_all();
|
||||
|
||||
char inv(std::string title = "INVENTORY:");
|
||||
faction* list_factions(std::string title = "FACTIONS:");
|
||||
point find_item(item *it);
|
||||
void remove_item(item *it);
|
||||
|
||||
std::vector <itype*> itypes;
|
||||
std::vector <mtype*> mtypes;
|
||||
std::vector <trap*> traps;
|
||||
std::vector <itype_id> mapitems[num_itloc]; // Items at various map types
|
||||
std::vector <items_location_and_chance> monitems[num_monsters];
|
||||
unsigned int turn;
|
||||
char nextinv; // Determines which letter the next inv item will have
|
||||
overmap cur_om;
|
||||
map m;
|
||||
int levx, levy, levz; // Placement inside the overmap
|
||||
player u;
|
||||
std::vector<monster> z;
|
||||
std::vector<monster> monbuff;
|
||||
int monbuffx, monbuffy, monbuffz, monbuff_turn;
|
||||
std::vector<npc> active_npc;
|
||||
std::vector<mon_id> moncats[num_moncats];
|
||||
std::vector<faction> factions;
|
||||
bool debugmon;
|
||||
// Display data... TODO: Make this more portable?
|
||||
WINDOW *w_terrain;
|
||||
WINDOW *w_minimap;
|
||||
WINDOW *w_HP;
|
||||
WINDOW *w_moninfo;
|
||||
WINDOW *w_messages;
|
||||
WINDOW *w_status;
|
||||
private:
|
||||
// Game-start procedures
|
||||
bool opening_screen();
|
||||
void load(std::string name);
|
||||
void save();
|
||||
void start_game();
|
||||
void start_tutorial(tut_type type);
|
||||
|
||||
// Data Initialization
|
||||
void init_itypes();
|
||||
void init_mapitems();
|
||||
void init_mtypes();
|
||||
void init_moncats();
|
||||
void init_monitems();
|
||||
void init_traps();
|
||||
void init_recipes();
|
||||
void init_factions();
|
||||
|
||||
// Player actions
|
||||
void wish();
|
||||
void plmove(int x, int y);
|
||||
void plswim(int x, int y);
|
||||
void update_map(int &x, int &y); // Called by plmove, sometimes
|
||||
void spawn_mon(int shift, int shifty); // Called by update_map, sometimes
|
||||
mon_id valid_monster_from(std::vector<mon_id> group);
|
||||
int valid_group(mon_id type, int x, int y);
|
||||
moncat_id mt_to_mc(mon_id type);
|
||||
void wait();
|
||||
void open();
|
||||
void close();
|
||||
void smash();
|
||||
void craft(); // See crafting.cpp
|
||||
void make_craft(recipe *making); // See crafting.cpp
|
||||
void complete_craft(); // See crafting.cpp
|
||||
void pick_recipes(std::vector<recipe*> ¤t,
|
||||
std::vector<bool> &available, craft_cat tab);// crafting.cpp
|
||||
void examine();
|
||||
void look_around();
|
||||
void pickup(int posx, int posy, int min);
|
||||
void drop();
|
||||
void butcher();
|
||||
void eat();
|
||||
void use_item();
|
||||
void wear();
|
||||
void takeoff();
|
||||
void reload();
|
||||
void unload();
|
||||
void wield();
|
||||
void read();
|
||||
void chat(); // Chat to an NPC
|
||||
void plthrow();
|
||||
std::vector<point> target(int &x, int &y, int lowx, int lowy, int hix,
|
||||
int hiy, std::vector <monster> t, int &target,
|
||||
item *relevent);
|
||||
void help();
|
||||
|
||||
// Routine loop functions, approximately in order of execution
|
||||
void monmove();
|
||||
void om_npcs_move();
|
||||
void check_warmth();
|
||||
void update_skills();
|
||||
void process_events();
|
||||
void process_activity();
|
||||
void hallucinate();
|
||||
void mon_info();
|
||||
void get_input();
|
||||
void update_scent();
|
||||
bool is_game_over();
|
||||
void gameover();
|
||||
void write_msg();
|
||||
void draw_minimap();
|
||||
void draw_HP();
|
||||
|
||||
// On-request draw functions
|
||||
void draw_overmap();
|
||||
void disp_kills();
|
||||
void disp_NPCs();
|
||||
|
||||
// If x & y are OOB, gens a new overmap returns the proper terrain; also, may
|
||||
// mark the square as seen by the player
|
||||
oter_id ter_at(int x, int y, bool& mark_as_seen);
|
||||
|
||||
// Debug functions
|
||||
void debug();
|
||||
void display_scent();
|
||||
void mondebug();
|
||||
void groupdebug();
|
||||
// Data
|
||||
signed char last_target;// The last monster targeted
|
||||
char run_mode; // 0 - Normal run always; 1 - Running allowed, but if a new
|
||||
// monsters spawns, go to 2 - No movement allowed
|
||||
int mostseen; // # of mons seen last turn; if this increases, run_mode++
|
||||
|
||||
bool uquit;
|
||||
|
||||
int nextspawn;
|
||||
signed char temp;
|
||||
std::vector <std::string> messages;
|
||||
char curmes; // The last-seen message. Older than 256 is deleted.
|
||||
int grscent[SEEX * 3][SEEY * 3]; // The scent map
|
||||
int nulscent; // Returned for OOB scent checks
|
||||
std::vector<recipe> recipes;
|
||||
std::vector<event> events;
|
||||
int kills[num_monsters];
|
||||
|
||||
bool tutorials_seen[NUM_LESSONS]; // Which tutorial lessons have we learned
|
||||
bool in_tutorial;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,482 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "keypress.h"
|
||||
|
||||
#ifndef LINE_XOXO
|
||||
#define LINE_XOXO 4194424
|
||||
#define LINE_OXOX 4194417
|
||||
#define LINE_XXOO 4194413
|
||||
#define LINE_OXXO 4194412
|
||||
#define LINE_OOXX 4194411
|
||||
#define LINE_XOOX 4194410
|
||||
#define LINE_XXXO 4194420
|
||||
#define LINE_XXOX 4194422
|
||||
#define LINE_XOXX 4194421
|
||||
#define LINE_OXXX 4194423
|
||||
#define LINE_XXXX 4194414
|
||||
#endif
|
||||
|
||||
void game::help()
|
||||
{
|
||||
char ch;
|
||||
do {
|
||||
erase();
|
||||
mvprintz(0, 38, c_red, "HELP");
|
||||
mvprintz(1, 0, c_white, "\
|
||||
Please press one of the following for\n\
|
||||
help on that topic:\n\
|
||||
\n\
|
||||
a: Introduction\n\
|
||||
b: Movement\n\
|
||||
c: Hunger, Thirst, and Sleep\n\
|
||||
d: Pain and Stimulatants\n\
|
||||
e: Addiction\n\
|
||||
f: Morale\n\
|
||||
g: Radioactivity and Mutation\n\
|
||||
h: Bionics\n\
|
||||
i: Crafting\n\
|
||||
j: Items overview\n\
|
||||
k: Combat\n\
|
||||
l: Survival tips\n\
|
||||
\n\
|
||||
1: List of all commands\n\
|
||||
2: List of item types and data\n\
|
||||
3: Description of map symbols\n\
|
||||
\n\
|
||||
q: Return to game");
|
||||
|
||||
ch = getch();
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
case 'A':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Cataclysm is a roguelike with a monster apocalypse setting. You have survived\n\
|
||||
the original onslaught, and are ready to set out in search of safety.\n\
|
||||
\n\
|
||||
Cataclysm differs from most roguelikes in several ways. Rather than exploring\n\
|
||||
an underground dungeon, with a limited area on each level, you are exploring\n\
|
||||
a truly infinite world, stretching in all four cardinal directions.\n\
|
||||
As in most roguelikes, you will have to find food; you also need to keep\n\
|
||||
yourself hydrated, and sleep periodically.\n\
|
||||
\n\
|
||||
While Cataclysm has more challenges than many roguelikes, the near-future\n\
|
||||
setting makes some tasks easier. Firearms, medications, and a wide variety of\n\
|
||||
tools are all available to help you survive.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
case 'B':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Movement is performed using the numpad, or vikeys. Each step will take 100\n\
|
||||
movement points (or more, depending on the terrain); you\n\
|
||||
y k u 7 8 9 will then replenish a variable amount of movement points,\n\
|
||||
\\ | / \\ | / depending on many factors (press '@' to see the exact\n\
|
||||
\\|/ \\|/ amount). To attempt to hit a monster with your weapon,\n\
|
||||
h--.--l 4--5--6 simply move into it. You may find doors, ('+'); these may\n\
|
||||
/|\\ /|\\ be opened with 'o' or closed with 'c'. Some doors are\n\
|
||||
/ | \\ / | \\ locked. Locked doors, windows, and some other obstacles\n\
|
||||
b j n 1 2 3 can be destroyed by smashing them ('s', then choose a\n\
|
||||
direction). Smashing down obstacles is much easier with a\n\
|
||||
good weapon or a strong character.\n\
|
||||
\n\
|
||||
There may be times when you want to move more quickly by holding down a\n\
|
||||
movement key. However, fast movement in this fashion may lead to the player\n\
|
||||
getting into a dangerous situation or even killed before they have a chance\n\
|
||||
to react. Pressing '!' will toggle \"Run Mode.\" While this is on, any\n\
|
||||
movement will be ignored if new monsters enter the player's view.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
case 'C':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
As time passes, you will begin to feel hunger and thirst. A status warning\n\
|
||||
at the bottom of the screen will appear. As hunger and thirst reach critical\n\
|
||||
levels, you will begin to suffer movement penalties. Thirst is more dangerous\n\
|
||||
than hunger. Finding food in a city is usually easy; outside of a city, you\n\
|
||||
may have to hunt an animal, then stand over its corpse and 'B'utcher it into\n\
|
||||
small chunks of meat. Likewise, outside of a city you may have to drink water\n\
|
||||
from a river or other natural source; stand in shallow water and press 'g' or\n\
|
||||
',' to pick it up. You'll need a watertight container.\n\
|
||||
\n\
|
||||
Every 14 to 20 hours, you'll find yourself growing sleepy. If you do not\n\
|
||||
sleep by pressing '$', you'll start suffering stat and movement penalties.\n\
|
||||
You may not always fall asleep right away. Sleeping indoors, especially on a\n\
|
||||
bed, will help; or you can always use sleeping pills. While sleeping, you'll\n\
|
||||
slowly replenish lost hit points. You'll also be vulnerable to attack, so\n\
|
||||
try to find a safe place, or set traps for unwary intruders.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
case 'D':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
When you take damage from almost any source, you'll start to feel pain. Pain\n\
|
||||
slows you down and reduces your stats, and finding a way to manage pain is an\n\
|
||||
early imperative. The most common is drugs; aspirin, codeine, tramadol,\n\
|
||||
oxycodone, and more are all great options. Be aware that while under the\n\
|
||||
influence of a lot of painkillers, the physiological effects may slow you or\n\
|
||||
reduce your stats.\n\
|
||||
\n\
|
||||
Pain will also disappear with time, so if drugs aren't available and you're\n\
|
||||
in a lot of pain, it may be wise to find a safe spot and simply rest for an\n\
|
||||
extended period of time.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
case 'E':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Many drugs have a potential for addiction. Each time you consume such a drug\n\
|
||||
there is a chance that you will grow dependant on it. Consuming more of that\n\
|
||||
drug will increase your dependance. Effects vary greatly between drugs, but\n\
|
||||
all addictions have only one cure; going cold turkey. The process may last\n\
|
||||
days, and will leave you very weak, so try to do it in a safe area.\n\
|
||||
\n\
|
||||
If you are suffering from drug withdrawal, taking more of the drug will cause\n\
|
||||
the effects to cease immediately, but may deepen your dependance.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
case 'F':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Your character has a morale level, which affects you in many ways. The\n\
|
||||
depressing post-apocalypse world is tough to deal with, and your mood will\n\
|
||||
naturally decrease very slowly.\n\
|
||||
\n\
|
||||
There are lots of options for increasing morale; reading an entertaining\n\
|
||||
book, eating delicious food, and taking recreational drugs are but a few\n\
|
||||
options. Most morale-boosting activities can only take you to a certain\n\
|
||||
level before they grow boring.\n\
|
||||
\n\
|
||||
There are also lots of ways for your morale to decrease, beyond its natural\n\
|
||||
decay. Eating disgusting food, reading a boring technical book, or going\n\
|
||||
through drug withdrawal are some prominent examples.\n\
|
||||
\n\
|
||||
Low morale will make you sluggish and unmotivated. It will also reduce your\n\
|
||||
stats, particularly intelligence. If your morale drops very low, you may\n\
|
||||
even commit suicide. Very high morale fills you with gusto and energy, and\n\
|
||||
you will find yourself moving faster. At extremely high levels, you will\n\
|
||||
receive stat bonuses.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case 'G':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Though it is relatively rare, certain areas of the world may be contamiated\n\
|
||||
with radiation. It will gradually accumulate in your body, weakening you\n\
|
||||
more and more. While in radiation-free areas, your radiation level will\n\
|
||||
slowly decrease. Taking iodine tablets will help speed the process.\n\
|
||||
\n\
|
||||
If you become very irradiated, you may develop mutations. Most of the time,\n\
|
||||
these mutations will be negative; however, many are beneficial, and others\n\
|
||||
have both positive and negative effects. Your mutations may change your play\n\
|
||||
style considerably. They are extremely rare, but it is possible to find\n\
|
||||
substances that will remove mutations.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case 'H':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Bionics are biomechanical upgrades to your body. While many are simply\n\
|
||||
'built-in' versions of items you would otherwise have to carry, some bionics\n\
|
||||
have unique effects that are otherwise unobtainable.\n\
|
||||
\n\
|
||||
Most bionics require a source of power, and you will need an internal battery\n\
|
||||
to store energy for them. Your current amount of energy is displayed below\n\
|
||||
your health. Replenishing energy can be done in a variety of ways, but all\n\
|
||||
require the installation of a special bionic just for fuel consumption.\n\
|
||||
\n\
|
||||
Bionics come in ready-to-install canisters, most of which contain supplies\n\
|
||||
for several different modules. Installing a bionic will consume the entire\n\
|
||||
canister, so choose your upgrade carefully. Installation of a bionic is best\n\
|
||||
left to a trained professional; however, you may attempt to perform a self-\n\
|
||||
installation. Performing such a task requires high levels of surgery,\n\
|
||||
mechanics, and/or electrions, and failure may cripple you! Bionics canisters\n\
|
||||
are difficult to find, but they may be purchased from certain NPCs for a very\n\
|
||||
high price.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
Many important items can be very hard to find, or will cost a great deal of\n\
|
||||
money to trade for. Fortunately, it is possible to craft a wide variety of\n\
|
||||
goods with the proper tools, materials, and training.\n\
|
||||
\n\
|
||||
Some recipes require a set of tools. These are not used up when crafting, so\n\
|
||||
you can keep your tool set. All recipes require one or more ingredients.\n\
|
||||
These ARE used up in crafting.\n\
|
||||
\n\
|
||||
To craft items, press '&'. There are five categories; Weapons, Food,\n\
|
||||
Electronics, Armor, and Miscellaneous. While a few items require no skill to\n\
|
||||
create, the majority require you to have some knowledge:\n\
|
||||
\n\
|
||||
->Mechanic skill is used for weapons, traps, and a few tools.\n\
|
||||
->Cooking skill, at low levels, is used for making tasty recipes; at higher\n\
|
||||
levels, you have an understanding of chemistry and can make chemical weapons\n\
|
||||
and beneficial elixirs.\n\
|
||||
->Electronics skill lets you make a wide variety of tools with intricate uses.\n\
|
||||
->Tailoring skill is used to create basic clothing, and later tough armor.\n\
|
||||
\n\
|
||||
In addition to the primary crafting skills, other skills may be necessary to\n\
|
||||
create certain items. Traps skill, Firearms skill, and First Aid skill are\n\
|
||||
all required for certain items.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
case 'J':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
There are a wide variety of items available for your use. You may find them\n\
|
||||
lying on the ground; if so, simply press ',' or 'g' to pick up items on the\n\
|
||||
same square. Some items are found inside a container, drawn as a { with a\n\
|
||||
blue background. Pressing 'e', then a direction, will allow you to examine\n\
|
||||
these containers and loot their contents.\n\
|
||||
\n\
|
||||
All items may be used as a melee weapon, though some are better than others.\n\
|
||||
You can check the melee attributes of an item you're carrying by hitting 'i'\n\
|
||||
to enter your inventory, then pressing the letter of the item. There are 3\n\
|
||||
values, displayed as (B#/C#/H#). B indicates the bashing damage dealt, C is\n\
|
||||
cutting damage, and H is a bonus (or penalty) to your chance to hit.\n\
|
||||
Bashing damage is universally effective, but is capped by low strength.\n\
|
||||
Cutting damage is a guaranteed increase in damage, but it may be reduced by\n\
|
||||
a monster's natural armor.\n\
|
||||
\n\
|
||||
To wield an item as a weapon, press 'w' then the proper letter. Pressing '-'\n\
|
||||
in lieu of a letter will make you wield nothing. A wielded weapon will not\n\
|
||||
contribute to your volume carried, so holding a large item in your hands may\n\
|
||||
be a good option for travel. When unwielding your weapon, it will go back in\n\
|
||||
your inventory, or will be dropped on the ground if there is no space.\n\
|
||||
\n\
|
||||
To wear a piece of clothing, press 'W' then the proper letter. Armor reduces\n\
|
||||
damage and helps you resist things like smoke. To take off an item, press\n\
|
||||
'T' then the proper letter.");
|
||||
getch();
|
||||
break;
|
||||
case 'k':
|
||||
case 'K':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
After 30 minutes of warmup time, monsters will begin to appear. They are\n\
|
||||
represented by letters on your screen; a list of monster names, and their\n\
|
||||
positions relative to you, is displayed on the right side of the screen.\n\
|
||||
\n\
|
||||
To attack a monster with a melee weapon, simply move into them. The time it\n\
|
||||
takes to attack depends on the size and weight of your weapon. Small, light\n\
|
||||
weapons are the fastest; unarmed attacks increase in speed with your Unarmed\n\
|
||||
Combat skill, and will eventually be VERY fast. A successful hit will stun\n\
|
||||
the monster temporarily, and most one-on-one fights will be easily won by the\n\
|
||||
player. On the other hand, a miss will make you stumble and cost YOU\n\
|
||||
movement points.\n\
|
||||
\n\
|
||||
Swarms of monsters may call for firearms. If you find one, wield it first,\n\
|
||||
then reload by pressing 'r'. If you wish to change ammo, you must unload the\n\
|
||||
weapon by pressing 'U', then reload again. To fire, press 'f', move the\n\
|
||||
cursor to the relevant space, then hit '.' or 'f'. Some guns have automatic\n\
|
||||
fire; to shoot a burst, press 'F'. This will severely reduce accuracy. If\n\
|
||||
you are hit, your clothing will absorb some damage, but you will suffer\n\
|
||||
the excess.\n\
|
||||
\n\
|
||||
Unlike most roguelikes, fleeing will often be your best option, especially\n\
|
||||
when overwhelmed by a swarm of zombies. Try to avoid getting cornered inside\n\
|
||||
a building. Ducking down into the subways or sewers is often an excellent\n\
|
||||
escape tactic.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
getch();
|
||||
break;
|
||||
case 'l':
|
||||
case 'L':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
The first thing to do is to check your home for useful items. Your initial\n\
|
||||
storage is limited, and a backpack, trenchcoat, or other storage medium will\n\
|
||||
let you carry a lot more. Finding a weapon is important; frying pans, butcher\n\
|
||||
knives, and more are common in your home; hardware stores may carry others.\n\
|
||||
Unless you plan on concentrating on melee combat, seek out gun stores as soon\n\
|
||||
as possible and load up on more than one type.\n\
|
||||
\n\
|
||||
It's also important to carry a few medications; painkillers are a must-have,\n\
|
||||
and drugs such as cigarettes will make life easier (but beware addiction).\n\
|
||||
Leave cities as soon as you have a good stockpile of equipment. Their high\n\
|
||||
concentration of zombies makes them a deathtrap--but a necessary resource for\n\
|
||||
food and ammunition.\n\
|
||||
\n\
|
||||
Combat is much easier if you can fight just one monster at once. Use doorways\n\
|
||||
as a choke point, or stand behind a window and strike as the zombies slowly\n\
|
||||
climb through. Never be afraid to just run if you can outpace your enemies.\n\
|
||||
Irregular terrain, like forests, may help you lose monsters.\n\
|
||||
\n\
|
||||
Firearms are the easiest way to kill an enemy, but the sound will attract\n\
|
||||
unwanted attention. Save the guns for emergencies, and melee when you can.\n\
|
||||
\n\
|
||||
Try to keep your inventory as full as possible without being overloaded. You\n\
|
||||
never know when you might need an item, and most are good to sell, and you\n\
|
||||
can easily drop unwanted items on the floor.");
|
||||
getch();
|
||||
break;
|
||||
|
||||
case '1':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "MOVEMENT:");
|
||||
mvprintz(1, 0, c_ltgray, "\
|
||||
vikeys or numpad - Movement or attack . or 5 - Pause for one turn\n\
|
||||
o - Open a door c - Close a door\n\
|
||||
s - Smash terrain , or g - Pick up items\n\
|
||||
e - Examine terrain, open container < or > - Go up or down stairs\n\
|
||||
$ - Lie down to sleep ^ - Long wait\n\
|
||||
! - Toggle Run Mode");
|
||||
mvprintz(7, 0, c_white, "ITEMS:");
|
||||
mvprintz(8, 0, c_ltgray, "\
|
||||
i - View Inventory d - Drop item\n\
|
||||
w - Wield item t - Throw item\n\
|
||||
W - Wear item T - Take off item\n\
|
||||
a - Activate tool E - Eat comestible\n\
|
||||
r - Reload wielded gun or tool U - Unload wielded gun or tool\n\
|
||||
f - Fire gun F - Burst-fire gun\n\
|
||||
p - Power up / List bionics R - Read book\n\
|
||||
& - Craft items B - Butcher a corpse");
|
||||
mvprintz(16, 0, c_white, "INFORMATION:");
|
||||
mvprintz(17, 0, c_ltgray, "\
|
||||
@ - View character status # - List factions\n\
|
||||
: - Open world map ; - Look around\n\
|
||||
C - Chat with NPC ? - Help page\n\
|
||||
% - View kill counts");
|
||||
mvprintz(21, 0, c_white, "META:");
|
||||
mvprintz(22, 0, c_ltgray, "\
|
||||
S - Save game Q - Quit w/o saving");
|
||||
mvprintz(23, 0, c_red, "\
|
||||
Note that 'a' is context-sensitive, and can be used in place of 'W', 'E', or\n\
|
||||
'R', if you like.");
|
||||
getch();
|
||||
break;
|
||||
case '2':
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
ITEM TYPES:\n\
|
||||
~ Liquid\n\
|
||||
%%%% Food\n\
|
||||
! Medication\n\
|
||||
These are all consumed by using 'E'. They provide a certain amount of\n\
|
||||
nutrition, quench your thirst, may be a stimulant or a depressant, and may\n\
|
||||
provide morale. There may also be more subtle effects.\n\
|
||||
\n\
|
||||
/ Large weapon\n\
|
||||
; Small weapon or tool\n\
|
||||
, Tiny item\n\
|
||||
These are all generic items, useful only to be wielded as a weapon.\n\
|
||||
However, some have special uses; they will show up under the TOOLS section\n\
|
||||
in your inventory. Press 'a' to use these.\n\
|
||||
\n\
|
||||
) Container\n\
|
||||
These items may hold other items. Someare passable weapons. Many will be\n\
|
||||
listed with their contents, e.g. \"plastic bottle of water\". Those containing\n\
|
||||
comestibles may be eaten with 'E'; this may leave you with an empty container.\n\
|
||||
Press any key to continue...");
|
||||
getch();
|
||||
clear();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
ITEM TYPES:\n\
|
||||
[ Clothing\n\
|
||||
This may be worn with the 'W' key or removed with the 'T' key. It may\n\
|
||||
cover one or more body parts; you can wear multiple articles of clothing on\n\
|
||||
any given body part, but this will encumber you severely. Each article of\n\
|
||||
clothing may provide storage space, warmth, an encumberment, and a resistance\n\
|
||||
to bashing and/or cutting attacks. Some may protect against environmental\n\
|
||||
effects.\n\
|
||||
\n\
|
||||
( Firearm\n\
|
||||
This weapon may be loaded with ammunition with 'r', unloaded with 'U', and\n\
|
||||
fired with 'f'. Some have automatic fire, which may be used with 'F' at a\n\
|
||||
penalty to accuracy. The color refers to the type; handguns are gray, shotguns\n\
|
||||
are red, submachine guns are cyan, rifles are brown, assault rifles are blue,\n\
|
||||
and heavy machine guns are green. Each has an accuracy rating, a bonus to\n\
|
||||
damage, a rate of fire, and a maximum load. Note that most firearms load\n\
|
||||
fully in one action, while shotguns must be loaded one shell at a time.\n\
|
||||
\n\
|
||||
= Ammunition\n\
|
||||
Ammunition is worthless without a gun to load it into. Generally, there\n\
|
||||
are several variants for any particular calibre. Ammunition has a damage\n\
|
||||
rating, an accuracy, a range, and an armor-piercing quality.\n\
|
||||
Press any key to continue...");
|
||||
getch();
|
||||
erase();
|
||||
mvprintz(0, 0, c_white, "\
|
||||
ITEM TYPES:\n\
|
||||
\n\
|
||||
* Thrown weapon; simple projectile or grenade\n\
|
||||
These items are suited for throwing, and many are only useful when\n\
|
||||
thrown, such as grenades, molotov cocktails, or tear gas.\n\
|
||||
\n\
|
||||
+ Book or magazine\n\
|
||||
This can be read for training or entertainment by pressing 'R'. Most\n\
|
||||
require a basic level of intelligence; some require some base knowledge in\n\
|
||||
the relevant subject.");
|
||||
getch();
|
||||
erase();
|
||||
break;
|
||||
case '3':
|
||||
erase();
|
||||
mvprintz( 0, 0, c_ltgray, "MAP SYMBOLS:");
|
||||
mvprintz( 1, 0, c_brown, "\
|
||||
. Field - Empty grassland, occasional wild fruit.");
|
||||
mvprintz( 2, 0, c_green, "\
|
||||
F Forest - May be dense or sparse. Slow moving; foragable food.");
|
||||
mvprintz( 3, 0, c_dkgray, "\
|
||||
%c%c%c%c%c%c%c%c%c%c%c Road - Safe from burrowing animals.", LINE_XOXO,
|
||||
LINE_OXOX, LINE_XXOO, LINE_OXXO, LINE_OOXX, LINE_XOOX, LINE_XXXO,
|
||||
LINE_XXOX, LINE_XOXX, LINE_OXXX, LINE_XXXX);
|
||||
mvprintz( 4, 0, c_dkgray, "\
|
||||
H= Highway - Like roads, but lined with guard rails.");
|
||||
mvprintz( 5, 0, c_dkgray, "\
|
||||
|- Bridge - Helps you cross rivers.");
|
||||
mvprintz( 6, 0, c_blue, "\
|
||||
R River - Most creatures can not swim across them, but you may.");
|
||||
mvprintz( 7, 0, c_dkgray, "\
|
||||
O Parking lot - Empty lot, few items. Mostly useless.");
|
||||
mvprintz( 8, 0, c_ltgreen, "\
|
||||
^>v< House - Filled with a variety of items. Good place to sleep.");
|
||||
mvprintz( 9, 0, c_ltblue, "\
|
||||
^>v< Gas station - Good place to collect gasoline. Risk of explosion.");
|
||||
mvprintz(10, 0, c_ltred, "\
|
||||
^>v< Pharmacy - The best source for vital medications.");
|
||||
mvprintz(11, 0, c_green, "\
|
||||
^>v< Grocery store - Good source of canned food and other supplies.");
|
||||
mvprintz(12, 0, c_cyan, "\
|
||||
^>v< Hardware store - Home to tools, melee weapons and crafting goods.");
|
||||
mvprintz(13, 0, c_ltcyan, "\
|
||||
^>v< Sporting Goods store - Several survival tools and melee weapons.");
|
||||
mvprintz(14, 0, c_magenta, "\
|
||||
^>v< Liquor store - Alcohol is good for crafting molotov cocktails.");
|
||||
mvprintz(15, 0, c_red, "\
|
||||
^>v< Gun store - Firearms and ammunition are very valuable.");
|
||||
mvprintz(16, 0, c_blue, "\
|
||||
^>v< Clothing store - High-capacity clothing, some light armor.");
|
||||
mvprintz(17, 0, c_brown, "\
|
||||
^>v< Library - Home to books, both entertaining and informative.");
|
||||
mvprintz(18, 0, c_white, "\
|
||||
^>v< are always man-made buildings. The pointed side indicates the front door."
|
||||
);
|
||||
mvprintw(22, 0, "There are many others out there... search for them!");
|
||||
getch();
|
||||
erase();
|
||||
break;
|
||||
}
|
||||
} while (ch != 'q' && ch != KEY_ESCAPE);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Cataclysm: Dark Days Ahead"
|
||||
---
|
||||
|
||||
Cataclysm: Dark Days Ahead is a turn-based survival game set in a post-apocalyptic world. Struggle to survive in a harsh, persistent, procedurally generated world. Scavenge the remnants of a dead civilization for food, equipment, or, if you are lucky, a vehicle with a full tank of gas to get you the hell out of Dodge. Fight to defeat or escape from a wide variety of powerful monstrosities, from zombies to giant insects to killer robots and things far stranger and deadlier, and against the others like yourself, that want what you have...
|
||||
|
||||
<figure>
|
||||
<img src="assets/images/showcase-ultica.png" alt="Showcase image. Tileset: UltiCa">
|
||||
<figcaption>
|
||||
<em>Tileset: UltiCa</em>
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
||||
|
||||
## Gameplay
|
||||
|
||||
As your game begins, you awaken with hazy memories of violence and terror from when the world suddenly unravelled around you. Now you need to explore your surroundings, and secure food, water and safety. After that, who knows? Long term survival will mean tapping abilities you haven't used before, learning to survive in this new environment, and developing new skills.
|
||||
|
||||
## Project Managed Resources
|
||||
These sites are owned and managed by the project directly.
|
||||
* [GitHub repository](https://github.com/CleverRaven/Cataclysm-DDA)
|
||||
* [Forums](https://discourse.cataclysmdda.org)
|
||||
* [Development-oriented Discord](https://discord.gg/jFEc7Yp)
|
||||
* [Cataclysm_DDA subreddit](https://reddit.com/r/Cataclysm_DDA)
|
||||
* IRC channel: #CataclysmDDA on Libera Chat, [webchat](https://web.libera.chat/#CataclysmDDA)
|
||||
|
||||
## Community Managed Resources
|
||||
These are resources provided by third parties, or managed by *some* members of the development team. The project does not provide support for these directly.
|
||||
* [Hitchhiker's Guide to the Cataclysm](https://cdda-guide.nornagon.net)
|
||||
* [Documentation For Developers](https://docs.cataclysmdda.org/)
|
||||
* [Game Launcher](https://github.com/Fris0uman/CDDA-Game-Launcher)
|
||||
* [Community Discord](https://discord.gg/byxwnAU)
|
||||
* [Steam](https://store.steampowered.com/app/2330750/Cataclysm_Dark_Days_Ahead/)
|
||||
* [Android Play Store](https://play.google.com/store/apps/details?id=com.cleverraven.cataclysmdda)
|
||||
|
||||
|
||||
## System Requirements
|
||||
### Minimum
|
||||
"I played catadda 0.B on Lego EV3 brick through ssh about a year ago. Every simple move took a noticeable fraction of a second (like 0.3-0.5 second), crafting and such was very slow as well. The specs were - 300 MhZ CPU, 64 Mb Ram (+ another 64 Mb swap on microsd flash) running ev3dev (stripped ubuntu basically), ssh over USB CDC connection." -burgerpro
|
||||
|
||||
"I used to test the game on an Asus EEE 700. That's a 900MHz mobile cpu with 500MB of ram." -Kevin Granade
|
||||
|
||||
Tilesets increase the amount of RAM required dramatically. I recommend at least 1GB of ram for tilesets, and there are reports of instability due to RAM exhaustion when certain tilesets are used. (The larger the size of the individual tiles, the more RAM is used)
|
||||
|
||||
### Recommended
|
||||
"I regularly test the game now on a Windows netbook with a sub 2GHz single core CPU, 1GB of ram, and no graphics acceleration." -Kevin Granade
|
||||
|
||||
Graphical builds run much faster with some kind of graphics acceleration. 2GB of RAM pretty much guarantees you will never have trouble with memory shortages.
|
||||
|
||||
## Downloads
|
||||
|
||||
Cataclysm has official builds for Windows, Linux, OSX and Android.
|
||||
The Linux and OSX builds are available in both terminal and graphical flavors.
|
||||
Windows and Android builds are graphical only, though there is a "text rendering" mode in the graphical build.
|
||||
There is a very old and unsupported fork for iOS.
|
||||
|
||||
### Latest Stable
|
||||
The most recent stable release is {{ site.github.latest_release.tag_name }} {{ site.github.latest_release.name }}. We recommend stable for the most bug-free experience available. You can download it from the [Releases Page]({{ site.baseurl }}{% link releases.md %}).
|
||||
|
||||
### Latest Experimental
|
||||
Cataclysm: DDA is under constant development. As such, stable can lag behind with features. If you would like access to the bleeding edge of features and any bugs that may come along with them, you can download the [latest experimental builds]({{ site.baseurl }}{% link pages/experimental.md %}).
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
#### Is there a tutorial?
|
||||
|
||||
Yes, you can find the tutorial in the **Special** menu at the main menu. You can also access documentation in-game via the `?` key.
|
||||
|
||||
#### How can I change the key bindings?
|
||||
|
||||
Press the `?` key, followed by the `1` key to see the full list of key commands. Press the `+` key to add a key binding, select which action with the corresponding letter key `a-w`, and then the key you wish to assign to that action.
|
||||
|
||||
#### How can I start a new world?
|
||||
|
||||
**World** on the main menu will generate a fresh world for you. Select **Create World**.
|
||||
|
||||
#### I've found a bug / I would like to make a suggestion. What should I do?
|
||||
|
||||
Please submit an issue on [our GitHub page](https://github.com/CleverRaven/Cataclysm-DDA/issues/). If you're not able to, send an email to `kevin.granade@gmail.com`. In either case, please consider reading our [issue guidelines]({{ site.baseurl }}{% link pages/issues.md %}) first.
|
||||
|
||||
#### I'd like to contribute financially to Cataclysm: Dark Days Ahead
|
||||
|
||||
Check out [our donations page]({{ site.baseurl }}{% link donations.md %}) for ways to donate.
|
||||
@@ -1,888 +0,0 @@
|
||||
#include "item.h"
|
||||
#include "player.h"
|
||||
#include "output.h"
|
||||
#include "skill.h"
|
||||
#include "game.h"
|
||||
#include <sstream>
|
||||
#include <ncurses.h>
|
||||
|
||||
bool is_flammable(material m);
|
||||
|
||||
|
||||
item::item()
|
||||
{
|
||||
name = "";
|
||||
charges = -1;
|
||||
bday = 0;
|
||||
invlet = 0;
|
||||
damage = 0;
|
||||
curammo = NULL;
|
||||
corpse = NULL;
|
||||
active = false;
|
||||
owned = false;
|
||||
}
|
||||
|
||||
item::item(itype* it, unsigned int turn)
|
||||
{
|
||||
type = it;
|
||||
bday = turn;
|
||||
name = "";
|
||||
invlet = 0;
|
||||
damage = 0;
|
||||
active = false;
|
||||
if (it->is_gun()) {
|
||||
charges = 0;
|
||||
} else if (it->is_ammo()) {
|
||||
it_ammo* ammo = dynamic_cast<it_ammo*>(it);
|
||||
charges = ammo->count;
|
||||
} else if (it->is_food()) {
|
||||
it_comest* comest = dynamic_cast<it_comest*>(it);
|
||||
if (comest->charges == 1)
|
||||
charges = -1;
|
||||
else
|
||||
charges = comest->charges;
|
||||
} else if (it->is_tool()) {
|
||||
it_tool* tool = dynamic_cast<it_tool*>(it);
|
||||
if (tool->max_charges == 0)
|
||||
charges = -1;
|
||||
else
|
||||
charges = tool->def_charges;
|
||||
} else {
|
||||
charges = -1;
|
||||
}
|
||||
curammo = NULL;
|
||||
corpse = NULL;
|
||||
owned = false;
|
||||
}
|
||||
|
||||
item::item(itype *it, unsigned int turn, char let)
|
||||
{
|
||||
type = it;
|
||||
bday = turn;
|
||||
name = "";
|
||||
damage = 0;
|
||||
active = false;
|
||||
if (it->is_gun()) {
|
||||
charges = 0;
|
||||
} else if (it->is_ammo()) {
|
||||
it_ammo* ammo = dynamic_cast<it_ammo*>(it);
|
||||
charges = ammo->count;
|
||||
} else if (it->is_food()) {
|
||||
it_comest* comest = dynamic_cast<it_comest*>(it);
|
||||
if (comest->charges == 1)
|
||||
charges = -1;
|
||||
else
|
||||
charges = comest->charges;
|
||||
} else if (it->is_tool()) {
|
||||
it_tool* tool = dynamic_cast<it_tool*>(it);
|
||||
if (tool->max_charges == 0)
|
||||
charges = -1;
|
||||
else
|
||||
charges = tool->def_charges;
|
||||
} else {
|
||||
charges = -1;
|
||||
}
|
||||
curammo = NULL;
|
||||
corpse = NULL;
|
||||
owned = false;
|
||||
invlet = let;
|
||||
}
|
||||
|
||||
void item::make_corpse(itype* it, mtype* mt, unsigned int turn)
|
||||
{
|
||||
name = "";
|
||||
charges = -1;
|
||||
invlet = 0;
|
||||
damage = 0;
|
||||
curammo = NULL;
|
||||
active = false;
|
||||
type = it;
|
||||
corpse = mt;
|
||||
bday = turn;
|
||||
}
|
||||
|
||||
item::item(std::string itemdata, game *g)
|
||||
{
|
||||
load_info(itemdata, g);
|
||||
}
|
||||
|
||||
item::~item()
|
||||
{
|
||||
}
|
||||
|
||||
void item::make(itype* it)
|
||||
{
|
||||
type = it;
|
||||
contents.clear();
|
||||
}
|
||||
|
||||
item item::in_its_container(std::vector<itype*> *itypes)
|
||||
{
|
||||
if (!is_food() || (dynamic_cast<it_comest*>(type))->container == itm_null)
|
||||
return *this;
|
||||
it_comest *food = dynamic_cast<it_comest*>(type);
|
||||
item ret((*itypes)[food->container], bday);
|
||||
ret.contents.push_back(*this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void item::put_in(item payload)
|
||||
{
|
||||
contents.push_back(payload);
|
||||
}
|
||||
|
||||
std::string item::save_info()
|
||||
{
|
||||
unsigned int ammotmp = 0;
|
||||
std::stringstream dump;// (std::stringstream::in | std::stringstream::out);
|
||||
if (is_gun() && curammo != NULL)
|
||||
ammotmp = curammo->id;
|
||||
dump << " " << int(invlet) << " " << int(type->id) << " " << int(charges) <<
|
||||
" " << int(damage) << " " << int(ammotmp) << " " << int(bday);
|
||||
if (active)
|
||||
dump << " 1";
|
||||
else
|
||||
dump << " 0";
|
||||
if (owned)
|
||||
dump << " 1";
|
||||
else
|
||||
dump << " 0";
|
||||
if (type->id == itm_corpse)
|
||||
dump << " " << corpse->id;
|
||||
dump << " '" << name << "'";
|
||||
return dump.str();
|
||||
}
|
||||
|
||||
void item::load_info(std::string data, game *g)
|
||||
{
|
||||
std::stringstream dump;
|
||||
dump << data;
|
||||
int idtmp, ammotmp, lettmp, damtmp, acttmp, owntmp;
|
||||
dump >> lettmp >> idtmp >> charges >> damtmp >> ammotmp >> bday >> acttmp >>
|
||||
owntmp;
|
||||
if (idtmp == itm_corpse) {
|
||||
int corp;
|
||||
dump >> corp;
|
||||
corpse = g->mtypes[corp];
|
||||
}
|
||||
getline(dump, name);
|
||||
if (name == " ''")
|
||||
name = "";
|
||||
else
|
||||
name = name.substr(2, name.size() - 3);
|
||||
make(g->itypes[idtmp]);
|
||||
invlet = char(lettmp);
|
||||
damage = damtmp;
|
||||
active = false;
|
||||
if (acttmp == 1)
|
||||
active = true;
|
||||
owned = false;
|
||||
if (owntmp == 1)
|
||||
owned = true;
|
||||
if (is_gun() && ammotmp > 0)
|
||||
curammo = dynamic_cast<it_ammo*>(g->itypes[ammotmp]);
|
||||
}
|
||||
|
||||
std::string item::info(bool showtext)
|
||||
{
|
||||
std::stringstream dump;
|
||||
dump << " Volume: " << volume() << " Weight: " << weight() << "\n" <<
|
||||
" Bash: " << int(type->melee_dam) << " Cut: " <<
|
||||
int(type->melee_cut) << " To-hit bonus: " <<
|
||||
(type->m_to_hit > 0 ? "+" : "" ) << int(type->m_to_hit) << "\n";
|
||||
char buff[256];
|
||||
if (is_food()) {
|
||||
it_comest* food = dynamic_cast<it_comest*>(type);
|
||||
dump << " Nutrituion: " << int(food->nutr) << "\n Quench: " <<
|
||||
int(food->quench) << "\n Enjoyability: " << int(food->fun);
|
||||
} else if (is_food_container()) {
|
||||
it_comest* food = dynamic_cast<it_comest*>(contents[0].type);
|
||||
dump << " Nutrituion: " << int(food->nutr) << "\n Quench: " <<
|
||||
int(food->quench) << "\n Enjoyability: " << int(food->fun);
|
||||
} else if (is_ammo()) {
|
||||
it_ammo* ammo = dynamic_cast<it_ammo*>(type);
|
||||
dump << " Type: " << ammo_name(ammo->type) << "\n Damage: " <<
|
||||
int(ammo->damage) << "\n Armor-pierce: " << int(ammo->pierce) <<
|
||||
"\n Range: " << int(ammo->range) << "\n Accuracy: " <<
|
||||
int(100 - ammo->accuracy) << "\n Recoil: " << int(ammo->recoil);
|
||||
} else if (is_gun()) {
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
dump << " Skill used: " << skill_name(gun->skill_used) << "\n Ammunition: " <<
|
||||
clip_size() << " rounds of " << ammo_name(ammo()) <<
|
||||
"\n Damage bonus: " << (gun_damage() > 0 ? "+" : "" ) <<
|
||||
gun_damage() << "\n Accuracy: " << int(100 - accuracy()) <<
|
||||
"\n Recoil: " << recoil() << "\n";
|
||||
if (burst_size() == 0)
|
||||
dump << " Semi-automatic.";
|
||||
else
|
||||
dump << " Burst size: " << burst_size();
|
||||
if (contents.size() > 0)
|
||||
dump << "\n";
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
dump << "\n+" << contents[i].tname();
|
||||
} else if (is_gunmod()) {
|
||||
it_gunmod* mod = dynamic_cast<it_gunmod*>(type);
|
||||
if (mod->accuracy != 0)
|
||||
dump << " Accuracy: " << (mod->accuracy > 0 ? "+" : "") <<
|
||||
int(mod->accuracy);
|
||||
if (mod->damage != 0)
|
||||
dump << "\n Damage: " << (mod->damage > 0 ? "+" : "") << int(mod->damage);
|
||||
if (mod->clip != 0)
|
||||
dump << "\n Clip: " << (mod->clip > 0 ? "+" : "") << int(mod->damage) << "%";
|
||||
if (mod->recoil != 0)
|
||||
dump << "\n Recoil: " << int(mod->recoil);
|
||||
if (mod->burst != 0)
|
||||
dump << "\n Burst: " << (mod->clip > 0 ? "+" : "") << int(mod->clip);
|
||||
if (mod->newtype != AT_NULL)
|
||||
dump << "\n " << ammo_name(mod->newtype);
|
||||
dump << "\n Used on: ";
|
||||
if (mod->used_on_pistol)
|
||||
dump << "Pistols. ";
|
||||
if (mod->used_on_shotgun)
|
||||
dump << "Shotguns. ";
|
||||
if (mod->used_on_smg)
|
||||
dump << "SMGs. ";
|
||||
if (mod->used_on_rifle)
|
||||
dump << "Rifles.";
|
||||
} else if (is_armor()) {
|
||||
it_armor* armor = dynamic_cast<it_armor*>(type);
|
||||
dump << " Covers: ";
|
||||
if (armor->covers & mfb(bp_head))
|
||||
dump << "The head. ";
|
||||
if (armor->covers & mfb(bp_eyes))
|
||||
dump << "The eyes. ";
|
||||
if (armor->covers & mfb(bp_mouth))
|
||||
dump << "The mouth. ";
|
||||
if (armor->covers & mfb(bp_torso))
|
||||
dump << "The torso. ";
|
||||
if (armor->covers & mfb(bp_hands))
|
||||
dump << "The hands. ";
|
||||
if (armor->covers & mfb(bp_legs))
|
||||
dump << "The legs. ";
|
||||
if (armor->covers & mfb(bp_feet))
|
||||
dump << "The feet. ";
|
||||
dump << "\n Encumberment: " << int(armor->encumber) <<
|
||||
"\n Bashing protection: " << int(armor->dmg_resist) <<
|
||||
"\n Cut protection: " << int(armor->cut_resist) <<
|
||||
"\n Environmental protection: " << int(armor->env_resist) <<
|
||||
"\n Warmth: " << int(armor->warmth) <<
|
||||
"\n Storage: " << int(armor->storage);
|
||||
} else if (is_book()) {
|
||||
it_book* book = dynamic_cast<it_book*>(type);
|
||||
if (book->type == sk_null)
|
||||
dump << " Just for fun.\n";
|
||||
else {
|
||||
dump << " Can bring your " << skill_name(book->type) << " skill to " <<
|
||||
int(book->level) << std::endl;
|
||||
if (book->req == 0)
|
||||
dump << " It can be understood by beginners.\n";
|
||||
else
|
||||
dump << " Requires " << skill_name(book->type) << " level " <<
|
||||
int(book->req) << " to understand.\n";
|
||||
}
|
||||
dump << " Requires intelligence of " << int(book->intel) << std::endl;
|
||||
if (book->fun != 0)
|
||||
dump << " Reading this book affects your morale by " <<
|
||||
(book->fun > 0 ? "+" : "") << int(book->fun) << std::endl;
|
||||
dump << " This book takes " << int(book->time) << " minutes to read.";
|
||||
} else if (is_tool()) {
|
||||
it_tool* tool = dynamic_cast<it_tool*>(type);
|
||||
dump << " Maximum " << tool->max_charges << "charges";
|
||||
if (tool->ammo == AT_NULL)
|
||||
dump << ".";
|
||||
else
|
||||
dump << " of " << ammo_name(tool->ammo) << ".";
|
||||
}
|
||||
if (showtext) {
|
||||
dump << "\n\n " << type->description << "\n";
|
||||
if (contents.size() > 0) {
|
||||
if (is_gun()) {
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
dump << "\n " << contents[i].type->description;
|
||||
} else
|
||||
dump << "\n " << contents[0].type->description;
|
||||
dump << "\n";
|
||||
}
|
||||
}
|
||||
return dump.str();
|
||||
}
|
||||
|
||||
char item::symbol()
|
||||
{
|
||||
return type->sym;
|
||||
}
|
||||
|
||||
std::string item::tname()
|
||||
{
|
||||
std::string ret;
|
||||
if (type->id == itm_corpse) {
|
||||
ret = corpse->name + " corpse";
|
||||
if (name != "")
|
||||
ret += " of " + name;
|
||||
return ret;
|
||||
}
|
||||
if (is_gun() && contents.size() > 0) {
|
||||
ret = type->name;
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
ret += "+";
|
||||
} else if (contents.size() == 1)
|
||||
ret = type->name + " of " + contents[0].tname();
|
||||
else if (contents.size() > 0)
|
||||
ret = type->name + ", full";
|
||||
else
|
||||
ret = type->name;
|
||||
if (damage != 0) {
|
||||
std::string damtext;
|
||||
switch (type->m1) {
|
||||
case VEGGY:
|
||||
case FLESH:
|
||||
damtext = "partially eaten ";
|
||||
break;
|
||||
case COTTON:
|
||||
case WOOL:
|
||||
if (damage ==-1) damtext = "reinforced ";
|
||||
if (damage == 1) damtext = "ripped ";
|
||||
if (damage == 2) damtext = "torn ";
|
||||
if (damage == 3) damtext = "shredded ";
|
||||
if (damage == 4) damtext = "tattered ";
|
||||
break;
|
||||
case LEATHER:
|
||||
if (damage ==-1) damtext = "reinforced ";
|
||||
if (damage == 1) damtext = "scratched ";
|
||||
if (damage == 2) damtext = "cut ";
|
||||
if (damage == 3) damtext = "torn ";
|
||||
if (damage == 4) damtext = "tattered ";
|
||||
break;
|
||||
case KEVLAR:
|
||||
if (damage ==-1) damtext = "reinforced ";
|
||||
if (damage == 1) damtext = "marked ";
|
||||
if (damage == 2) damtext = "dented ";
|
||||
if (damage == 3) damtext = "scarred ";
|
||||
if (damage == 4) damtext = "broken ";
|
||||
break;
|
||||
case PAPER:
|
||||
if (damage == 1) damtext = "torn ";
|
||||
if (damage >= 2) damtext = "shredded ";
|
||||
break;
|
||||
case WOOD:
|
||||
if (damage == 1) damtext = "scratched ";
|
||||
if (damage == 2) damtext = "chipped ";
|
||||
if (damage == 3) damtext = "cracked ";
|
||||
if (damage == 4) damtext = "splintered ";
|
||||
break;
|
||||
case PLASTIC:
|
||||
case GLASS:
|
||||
if (damage == 1) damtext = "scratched ";
|
||||
if (damage == 2) damtext = "cut ";
|
||||
if (damage == 3) damtext = "cracked ";
|
||||
if (damage == 4) damtext = "shattered ";
|
||||
break;
|
||||
case IRON:
|
||||
if (damage == 1) damtext = "lightly rusted ";
|
||||
if (damage == 2) damtext = "rusted ";
|
||||
if (damage == 3) damtext = "very rusty ";
|
||||
if (damage == 4) damtext = "thoroughly rusted ";
|
||||
break;
|
||||
default:
|
||||
damtext = "damaged ";
|
||||
}
|
||||
ret = damtext + ret;
|
||||
}
|
||||
if (owned)
|
||||
ret += " (owned)";
|
||||
return ret;
|
||||
}
|
||||
|
||||
nc_color item::color()
|
||||
{
|
||||
if (type->id == itm_corpse)
|
||||
return corpse->color;
|
||||
return type->color;
|
||||
}
|
||||
|
||||
int item::price()
|
||||
{
|
||||
int ret = type->price;
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
ret += contents[i].price();
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int item::weight()
|
||||
{
|
||||
if (type->id == itm_corpse) {
|
||||
int ret;
|
||||
switch (corpse->size) {
|
||||
case MS_TINY: ret = 5; break;
|
||||
case MS_SMALL: ret = 60; break;
|
||||
case MS_MEDIUM: ret = 520; break;
|
||||
case MS_LARGE: ret = 2000; break;
|
||||
case MS_HUGE: ret = 4000; break;
|
||||
}
|
||||
if (made_of(VEGGY))
|
||||
ret /= 10;
|
||||
else if (made_of(IRON) || made_of(STEEL) || made_of(STONE))
|
||||
ret *= 5;
|
||||
return ret;
|
||||
}
|
||||
int ret = type->weight;
|
||||
if (is_ammo()) {
|
||||
ret *= charges;
|
||||
ret /= 100;
|
||||
}
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
ret += contents[i].weight();
|
||||
return ret;
|
||||
}
|
||||
|
||||
unsigned int item::volume()
|
||||
{
|
||||
if (type->id == itm_corpse) {
|
||||
switch (corpse->size) {
|
||||
case MS_TINY: return 2;
|
||||
case MS_SMALL: return 40;
|
||||
case MS_MEDIUM: return 75;
|
||||
case MS_LARGE: return 160;
|
||||
case MS_HUGE: return 600;
|
||||
}
|
||||
}
|
||||
int ret = type->volume;
|
||||
if (is_gun()) {
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
ret += contents[i].volume();
|
||||
}
|
||||
return type->volume;
|
||||
}
|
||||
|
||||
unsigned char item::volume_contained()
|
||||
{
|
||||
int ret = 0;
|
||||
for (int i = 0; i < contents.size(); i++)
|
||||
ret += contents[i].volume();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int item::weapon_value(int skills[num_skill_types])
|
||||
{
|
||||
int my_value = 0;
|
||||
if (is_gun()) {
|
||||
int gun_value = 14;
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
gun_value += gun->dmg_bonus;
|
||||
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]));
|
||||
my_value += gun_value;
|
||||
}
|
||||
|
||||
my_value += int(type->melee_dam * (1 + .3 * skills[sk_bashing] +
|
||||
.1 * skills[sk_melee] ));
|
||||
//debugmsg("My value: (+bash) %d", my_value);
|
||||
|
||||
my_value += int(type->melee_cut * (1 + .4 * skills[sk_cutting] +
|
||||
.1 * skills[sk_melee] ));
|
||||
//debugmsg("My value: (+cut) %d", my_value);
|
||||
|
||||
my_value += int(type->m_to_hit * (1.2 + .3 * skills[sk_melee]));
|
||||
//debugmsg("My value: (+hit) %d", my_value);
|
||||
|
||||
return my_value;
|
||||
}
|
||||
|
||||
bool item::is_two_handed(player *u)
|
||||
{
|
||||
if (is_gun() && (dynamic_cast<it_gun*>(type))->skill_used != sk_pistol)
|
||||
return true;
|
||||
return (volume() > 10 || weight() > u->str_cur * 4);
|
||||
}
|
||||
|
||||
bool item::made_of(material mat)
|
||||
{
|
||||
if (type->id == itm_corpse)
|
||||
return (corpse->mat == mat);
|
||||
return (type->m1 == mat || type->m2 == mat);
|
||||
}
|
||||
|
||||
bool item::conductive()
|
||||
{
|
||||
if ((type->m1 == IRON || type->m1 == STEEL || type->m1 == SILVER) &&
|
||||
(type->m2 == IRON || type->m2 == STEEL || type->m2 == SILVER) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool item::is_gun()
|
||||
{
|
||||
return type->is_gun();
|
||||
}
|
||||
|
||||
bool item::is_gunmod()
|
||||
{
|
||||
return type->is_gunmod();
|
||||
}
|
||||
|
||||
bool item::is_ammo()
|
||||
{
|
||||
return type->is_ammo();
|
||||
}
|
||||
|
||||
bool item::is_food(player *u)
|
||||
{
|
||||
if (type->is_food())
|
||||
return true;
|
||||
if (u->has_bionic(bio_batteries) && is_ammo() &&
|
||||
(dynamic_cast<it_ammo*>(type))->type == AT_BATT)
|
||||
return true;
|
||||
if (u->has_bionic(bio_furnace) && is_flammable(type->m1) &&
|
||||
is_flammable(type->m2))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool item::is_food_container(player *u)
|
||||
{
|
||||
return (contents.size() >= 1 && contents[0].is_food(u));
|
||||
}
|
||||
|
||||
bool item::is_food()
|
||||
{
|
||||
if (type->is_food())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool item::is_food_container()
|
||||
{
|
||||
return (contents.size() >= 1 && contents[0].is_food());
|
||||
}
|
||||
|
||||
bool item::is_drink()
|
||||
{
|
||||
return type->is_food() && type->m1 == LIQUID;
|
||||
}
|
||||
|
||||
bool item::is_weap()
|
||||
{
|
||||
if (is_gun() || is_food() || is_ammo() || is_food_container() || is_armor() ||
|
||||
is_book() || is_tool())
|
||||
return false;
|
||||
return (type->melee_dam > 7 || type->melee_cut > 5);
|
||||
}
|
||||
|
||||
bool item::is_bashing_weapon()
|
||||
{
|
||||
return (type->melee_dam > 7);
|
||||
}
|
||||
|
||||
bool item::is_cutting_weapon()
|
||||
{
|
||||
return (type->melee_cut > 5);
|
||||
}
|
||||
|
||||
bool item::is_armor()
|
||||
{
|
||||
return type->is_armor();
|
||||
}
|
||||
|
||||
bool item::is_book()
|
||||
{
|
||||
return type->is_book();
|
||||
}
|
||||
|
||||
bool item::is_container()
|
||||
{
|
||||
return type->is_container();
|
||||
}
|
||||
|
||||
bool item::is_tool()
|
||||
{
|
||||
return type->is_tool();
|
||||
}
|
||||
|
||||
int item::reload_time(player &u)
|
||||
{
|
||||
int ret = 0;
|
||||
if (is_gun()) {
|
||||
it_gun* reloading = dynamic_cast<it_gun*>(type);
|
||||
switch (reloading->skill_used) {
|
||||
case (sk_pistol):
|
||||
if (u.sklevel[sk_pistol] > 8)
|
||||
ret = 30;
|
||||
else
|
||||
ret = (350 - 40 * u.sklevel[sk_pistol]);
|
||||
break;
|
||||
case (sk_shotgun):
|
||||
if (u.sklevel[sk_shotgun] > 10)
|
||||
ret = 20;
|
||||
else
|
||||
ret = (120 - 10 * u.sklevel[sk_shotgun]);
|
||||
break;
|
||||
case (sk_smg):
|
||||
if (u.sklevel[sk_smg] > 8)
|
||||
ret = 50;
|
||||
else
|
||||
ret = (450 - 50 * u.sklevel[sk_smg]);
|
||||
break;
|
||||
case (sk_rifle):
|
||||
if (u.sklevel[sk_rifle] > 8)
|
||||
ret = 60;
|
||||
else
|
||||
ret = (500 - 55 * u.sklevel[sk_rifle]);
|
||||
break;
|
||||
default:
|
||||
debugmsg("Why is reloading %s using %s skill?", (reloading->name).c_str(),
|
||||
skill_name(reloading->skill_used).c_str());
|
||||
}
|
||||
if (ret <= 0)
|
||||
debugmsg("Reloading %s takes %d moves!", (reloading->name).c_str(), ret);
|
||||
} else if (is_tool())
|
||||
ret = 100 + volume() + weight();
|
||||
if (type->id == itm_crossbow) // Crossbows are special, they take longer
|
||||
ret += 150 - u.str_cur * 10;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::clip_size()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
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()) {
|
||||
int bonus = (ret * (dynamic_cast<it_gunmod*>(contents[i].type))->clip) / 100;
|
||||
ret = int(ret + bonus);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::accuracy()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
int ret = gun->accuracy;
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
if (contents[i].is_gunmod())
|
||||
ret -= (dynamic_cast<it_gunmod*>(contents[i].type))->accuracy;
|
||||
}
|
||||
ret += damage * 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::gun_damage()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
int ret = gun->dmg_bonus;
|
||||
if (curammo != NULL)
|
||||
ret += curammo->damage;
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
if (contents[i].is_gunmod())
|
||||
ret += (dynamic_cast<it_gunmod*>(contents[i].type))->damage;
|
||||
}
|
||||
ret -= damage * 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::noise()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
int ret = 0;
|
||||
if (curammo != NULL)
|
||||
ret = curammo->damage * .8;
|
||||
if (ret >= 5)
|
||||
ret += 20;
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
if (contents[i].is_gunmod())
|
||||
ret += (dynamic_cast<it_gunmod*>(contents[i].type))->loudness;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::burst_size()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
int ret = gun->burst;
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
if (contents[i].is_gunmod())
|
||||
ret += (dynamic_cast<it_gunmod*>(contents[i].type))->burst;
|
||||
}
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int item::recoil()
|
||||
{
|
||||
if (!is_gun())
|
||||
return 0;
|
||||
it_gun* gun = dynamic_cast<it_gun*>(type);
|
||||
int ret = gun->recoil;
|
||||
if (curammo != NULL)
|
||||
ret += curammo->recoil;
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
if (contents[i].is_gunmod())
|
||||
ret += (dynamic_cast<it_gunmod*>(contents[i].type))->recoil;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
ammotype item::ammo()
|
||||
{
|
||||
if (is_gun()) {
|
||||
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()) {
|
||||
it_gunmod* mod = dynamic_cast<it_gunmod*>(contents[i].type);
|
||||
if (mod->newtype != AT_NULL)
|
||||
ret = mod->newtype;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
} else if (is_tool()) {
|
||||
it_tool* tool = dynamic_cast<it_tool*>(type);
|
||||
return tool->ammo;
|
||||
} else
|
||||
return AT_NULL;
|
||||
}
|
||||
|
||||
int item::pick_reload_ammo(player &u, bool interactive)
|
||||
{
|
||||
if (!type->is_gun() && !type->is_tool()) {
|
||||
debugmsg("RELOADING NON-GUN NON-TOOL");
|
||||
return false;
|
||||
}
|
||||
bool single_load = false;
|
||||
int max_load = 0;
|
||||
std::vector<int> am; // List of indicies of valid ammo
|
||||
|
||||
if (type->is_gun()) {
|
||||
if (charges > 0) {
|
||||
itype_id aid = itype_id(curammo->id);
|
||||
for (int i = 0; i < u.inv.size(); i++) {
|
||||
if (u.inv[i].type->id == aid)
|
||||
am.push_back(i);
|
||||
}
|
||||
} else {
|
||||
it_gun* tmp = dynamic_cast<it_gun*>(type);
|
||||
am = u.has_ammo(ammo());
|
||||
max_load = tmp->clip;
|
||||
if (tmp->skill_used == sk_shotgun)
|
||||
single_load = true;
|
||||
}
|
||||
} else {
|
||||
it_tool* tmp = dynamic_cast<it_tool*>(type);
|
||||
am = u.has_ammo(ammo());
|
||||
max_load = tmp->max_charges;
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
|
||||
if (am.size() > 1 && interactive) {// More than one option; list 'em and pick
|
||||
WINDOW* w_ammo = newwin(am.size() + 1, 80, 0, 0);
|
||||
if (charges == 0) {
|
||||
char ch;
|
||||
clear();
|
||||
it_ammo* ammo_type;
|
||||
mvwprintw(w_ammo, 0, 0, "\
|
||||
Choose ammo type: Damage Armor Pierce Range Accuracy");
|
||||
for (int i = 0; i < am.size(); i++) {
|
||||
ammo_type = dynamic_cast<it_ammo*>(u.inv[am[i]].type);
|
||||
mvwaddch(w_ammo, i + 1, 1, i + 'a');
|
||||
mvwprintw(w_ammo, i + 1, 3, "%s (%d)", u.inv[am[i]].tname().c_str(),
|
||||
u.inv[am[i]].charges);
|
||||
mvwprintw(w_ammo, i + 1, 27, "%d", ammo_type->damage);
|
||||
mvwprintw(w_ammo, i + 1, 38, "%d", ammo_type->pierce);
|
||||
mvwprintw(w_ammo, i + 1, 55, "%d", ammo_type->range);
|
||||
mvwprintw(w_ammo, i + 1, 65, "%d", 100 - ammo_type->accuracy);
|
||||
}
|
||||
refresh();
|
||||
wrefresh(w_ammo);
|
||||
do
|
||||
ch = getch();
|
||||
while ((ch < 'a' || ch - 'a' > am.size() - 1) && ch != ' ' && ch != 27);
|
||||
werase(w_ammo);
|
||||
delwin(w_ammo);
|
||||
erase();
|
||||
if (ch == ' ' || ch == 27)
|
||||
index = -1;
|
||||
else
|
||||
index = am[ch - 'a'];
|
||||
} else {
|
||||
int smallest = 500;
|
||||
for (int i = 0; i < am.size(); i++) {
|
||||
if (u.inv[am[i]].type->id == curammo->id &&
|
||||
u.inv[am[i]].charges < smallest) {
|
||||
smallest = u.inv[am[i]].charges;
|
||||
index = am[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (am.size() == 1 || !interactive)
|
||||
index = am[0];
|
||||
return index;
|
||||
}
|
||||
|
||||
bool item::reload(player &u, int index)
|
||||
{
|
||||
bool single_load;
|
||||
int max_load;
|
||||
if (is_gun()) {
|
||||
it_gun* reloading = dynamic_cast<it_gun*>(type);
|
||||
single_load = (reloading->skill_used == sk_shotgun);
|
||||
max_load = clip_size();
|
||||
} else if (is_tool()) {
|
||||
it_tool* tool = dynamic_cast<it_tool*>(type);
|
||||
single_load = false;
|
||||
max_load = tool->max_charges;
|
||||
}
|
||||
if (index > -1) {
|
||||
// If the gun is currently loaded with a different type of ammo, reloading fails
|
||||
if (is_gun() && charges > 0 && curammo->id != u.inv[index].type->id)
|
||||
return false;
|
||||
if (is_gun())
|
||||
curammo = dynamic_cast<it_ammo*>((u.inv[index].type));
|
||||
if (single_load) { // Only insert one cartridge!
|
||||
charges++;
|
||||
u.inv[index].charges--;
|
||||
} else {
|
||||
charges += u.inv[index].charges;
|
||||
u.inv[index].charges = 0;
|
||||
if (charges > max_load) {
|
||||
// More bullets than the clip holds, put some back
|
||||
u.inv[index].charges += charges - max_load;
|
||||
charges = max_load;
|
||||
}
|
||||
}
|
||||
if (u.inv[index].charges == 0) {
|
||||
u.i_remn(index);
|
||||
}
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
void item::use(player &u)
|
||||
{
|
||||
if (charges > 0)
|
||||
charges--;
|
||||
}
|
||||
|
||||
|
||||
bool is_flammable(material m)
|
||||
{
|
||||
if (m == VEGGY || m == FLESH || m == POWDER || m == COTTON || m == WOOL ||
|
||||
m == LEATHER || m == PAPER || m == WOOD || m == MNULL)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
#ifndef _ITEM_H_
|
||||
#define _ITEM_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "itype.h"
|
||||
#include "mtype.h"
|
||||
//#include "npc.h"
|
||||
|
||||
class player;
|
||||
class npc;
|
||||
|
||||
class item
|
||||
{
|
||||
public:
|
||||
item();
|
||||
item(itype* it, unsigned int turn);
|
||||
item(itype* it, unsigned int turn, char let);
|
||||
void make_corpse(itype* it, mtype* mt, unsigned int turn); // Corpse
|
||||
item(std::string itemdata, game *g);
|
||||
~item();
|
||||
void make(itype* it);
|
||||
// returns the default container of this item, with this item in it
|
||||
item in_its_container(std::vector<itype*> *itypes);
|
||||
|
||||
std::string tname();
|
||||
void use(player &u);
|
||||
|
||||
// Firearm specifics
|
||||
int reload_time(player &u);
|
||||
int clip_size();
|
||||
int accuracy();
|
||||
int gun_damage();
|
||||
int noise();
|
||||
int burst_size();
|
||||
int recoil();
|
||||
ammotype ammo();
|
||||
int pick_reload_ammo(player &u, bool interactive);
|
||||
bool reload(player &u, int index);
|
||||
|
||||
std::string save_info(); // Formatted for save files
|
||||
void load_info(std::string data, game *g);
|
||||
std::string info(bool showtext = false); // Formatted for human viewing
|
||||
char symbol();
|
||||
nc_color color();
|
||||
int price();
|
||||
|
||||
void put_in(item payload);
|
||||
|
||||
unsigned int weight();
|
||||
unsigned int volume();
|
||||
unsigned char volume_contained();
|
||||
|
||||
int weapon_value(int skills[num_skill_types]);
|
||||
bool is_two_handed(player *u);
|
||||
bool made_of(material mat);
|
||||
bool conductive();
|
||||
bool is_food(player *u);// Some non-food items are food to certain players
|
||||
bool is_food_container(player *u); // Ditto
|
||||
bool is_food(); // Ignoring the ability to eat batteries, etc.
|
||||
bool is_food_container(); // Ignoring the ability to eat batteries, etc.
|
||||
bool is_drink();
|
||||
bool is_weap();
|
||||
bool is_bashing_weapon();
|
||||
bool is_cutting_weapon();
|
||||
bool is_gun();
|
||||
bool is_gunmod();;
|
||||
bool is_ammo();
|
||||
bool is_armor();
|
||||
bool is_book();
|
||||
bool is_container();
|
||||
bool is_tool();
|
||||
|
||||
itype* type;
|
||||
mtype* corpse;
|
||||
it_ammo* curammo;
|
||||
|
||||
std::vector<item> contents;
|
||||
|
||||
std::string name;
|
||||
char invlet;
|
||||
int charges;
|
||||
bool active; // If true, it has active effects to be processed
|
||||
signed char damage; // How much damage it's sustained; generally, max is 5
|
||||
unsigned int bday; // The turn on which it was created
|
||||
bool owned; // If true, NPCs will shout at you for picking it up
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,542 +0,0 @@
|
||||
#ifndef _ITYPE_H_
|
||||
#define _ITYPE_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "color.h"
|
||||
#include "enums.h"
|
||||
#include "iuse.h"
|
||||
#include "pldata.h"
|
||||
#include "bodypart.h"
|
||||
#include "skill.h"
|
||||
#include "bionics.h"
|
||||
|
||||
// mfb(n) converts a flag to its appropriate position in covers's bitfield
|
||||
#ifndef mfb
|
||||
#define mfb(n) int(pow(2,(int)n))
|
||||
#endif
|
||||
|
||||
enum itype_id {
|
||||
itm_null = 0,
|
||||
itm_corpse,
|
||||
// Drinks
|
||||
itm_water, itm_water_dirty, itm_salt_water, itm_oj, itm_energy_drink, itm_cola,
|
||||
itm_rootbeer, itm_milk, itm_V8, itm_whiskey, itm_vodka, itm_rum, itm_tequila,
|
||||
itm_bleach, itm_ammonia, itm_mutagen, itm_purifier,
|
||||
// Monster Meats
|
||||
itm_meat, itm_veggy, itm_meat_tainted, itm_veggy_tainted, itm_meat_cooked,
|
||||
itm_veggy_cooked,
|
||||
// Food
|
||||
itm_apple, itm_orange, itm_lemon, itm_chips, itm_pretzels, itm_chocolate,
|
||||
itm_jerky, itm_sandwich_t, itm_candy, itm_mushroom, itm_mushroom_poison,
|
||||
itm_mushroom_magic, itm_blueberries, itm_strawberries, itm_tomato,
|
||||
itm_broccoli, itm_zucchini, itm_frozen_dinner, itm_spaghetti_raw,
|
||||
itm_spaghetti_cooked, itm_macaroni_raw, itm_macaroni_cooked, itm_ravioli,
|
||||
itm_sauce_red, itm_sauce_pesto, itm_can_beans, itm_can_corn, itm_can_spam,
|
||||
itm_can_pineapple, itm_can_coconut, itm_can_sardine, itm_can_tuna,
|
||||
itm_can_catfood, itm_honeycomb, itm_royal_jelly, itm_fetus, itm_arm, itm_leg,
|
||||
itm_ant_egg,
|
||||
// Medication
|
||||
itm_bandages, itm_1st_aid, itm_vitamins, itm_aspirin, itm_caffeine,
|
||||
itm_pills_sleep, itm_dayquil, itm_nyquil, itm_inhaler, itm_codeine,
|
||||
itm_oxycodone, itm_tramadol, itm_xanax, itm_adderall, itm_thorazine,
|
||||
itm_prozac, itm_cig, itm_weed, itm_coke, itm_meth, itm_heroin,
|
||||
// Do-nothing / Melee weapons
|
||||
itm_wrapper, itm_syringe, itm_rag, itm_fur, itm_leather, itm_superglue,
|
||||
itm_card_id, itm_electrohack, itm_string_6, itm_string_36, itm_rope_6,
|
||||
itm_rope_30, itm_chain, itm_processor, itm_RAM, itm_power_supply,
|
||||
itm_amplifier, itm_transponder, itm_receiver, itm_antenna, itm_steel_chunk,
|
||||
itm_motor, itm_hose, itm_glass_sheet, itm_manhole_cover, itm_rock, itm_stick,
|
||||
itm_broom, itm_mop, itm_screwdriver, itm_wrench, itm_saw, itm_hacksaw,
|
||||
itm_hammer_sledge, itm_hatchet, itm_ax, itm_nailboard, itm_xacto, itm_pot,
|
||||
itm_pan, itm_knife_butter, itm_knife_steak, itm_knife_butcher,
|
||||
itm_knife_combat, itm_2x4, itm_muffler, itm_pipe, itm_bat, itm_machete,
|
||||
itm_katana, itm_spear_wood, itm_baton, itm_bee_sting, itm_chitin_piece,
|
||||
itm_canister_empty,
|
||||
// Footwear
|
||||
itm_sneakers, itm_boots, itm_boots_steel, itm_boots_winter, itm_mocassins,
|
||||
itm_flip_flops, itm_dress_shoes, itm_heels,
|
||||
// Legwear
|
||||
itm_jeans, itm_pants, itm_pants_leather, itm_pants_cargo, itm_pants_army,
|
||||
itm_skirt,
|
||||
// Full-body clothing
|
||||
itm_jumpsuit, itm_dress, itm_armor_chitin,
|
||||
// Torso clothing
|
||||
itm_tshirt, itm_polo_shirt, itm_dress_shirt, itm_tank_top, itm_sweatshirt,
|
||||
itm_sweater, itm_hoodie, itm_jacket_light, itm_jacket_jean, itm_blazer,
|
||||
itm_jacket_leather, itm_kevlar, itm_coat_rain, itm_poncho, itm_trenchcoat,
|
||||
itm_coat_winter, itm_coat_fur, itm_peacoat, itm_vest, itm_coat_lab,
|
||||
// Gloves
|
||||
itm_gloves_light, itm_mittens, itm_gloves_wool, itm_gloves_winter,
|
||||
itm_gloves_leather, itm_gloves_fingerless, itm_gloves_rubber,
|
||||
itm_gloves_medical, itm_fire_gauntlets,
|
||||
// Masks
|
||||
itm_mask_dust, itm_bandana, itm_scarf, itm_mask_filter, itm_mask_gas,
|
||||
// Eyewear
|
||||
itm_glasses_eye, itm_glasses_reading, itm_glasses_safety, itm_goggles_swim,
|
||||
itm_goggles_ski, itm_goggles_welding, itm_goggles_nv,
|
||||
// Headwear
|
||||
itm_hat_ball, itm_hat_boonie, itm_hat_cotton, itm_hat_knit, itm_hat_hunting,
|
||||
itm_hat_fur, itm_hat_hard, itm_helmet_bike, itm_helmet_skid, itm_helmet_ball,
|
||||
itm_helmet_army, itm_helmet_riot, itm_helmet_motor, itm_helmet_chitin,
|
||||
// High-storage
|
||||
itm_backpack, itm_purse, itm_mbag, itm_fanny, itm_holster, itm_bootstrap,
|
||||
// Ammunition
|
||||
itm_battery, itm_plut_cell, itm_nail, itm_bb, itm_bolt_wood, itm_bolt_steel,
|
||||
itm_shot_bird, itm_shot_00, itm_shot_slug, itm_22_lr, itm_22_cb, itm_9mm,
|
||||
itm_9mmP, itm_9mmP2, itm_38_special, itm_38_super, itm_10mm, itm_40sw,
|
||||
itm_44magnum, itm_45_acp, itm_45_jhp, itm_45_super, itm_57mm, itm_46mm,
|
||||
itm_762_m43, itm_762_m87, itm_223, itm_556, itm_270, itm_3006, itm_308,
|
||||
itm_762_51, itm_laser_pack, itm_gasoline,
|
||||
// Guns
|
||||
itm_bbgun, itm_crossbow, itm_rifle_22, itm_rifle_9mm, itm_smg_9mm, itm_smg_45,
|
||||
itm_sig_mosquito, itm_sw_22, itm_glock_19, itm_usp_9mm, itm_sw_619,
|
||||
itm_taurus_38, itm_sig_40, itm_sw_610, itm_ruger_redhawk, itm_deagle_44,
|
||||
itm_usp_45, itm_m1911, itm_fn57, itm_hk_ucp, itm_shotgun_sawn, itm_shotgun_s,
|
||||
itm_shotgun_d, itm_remington_870, itm_mossberg_500, itm_saiga_12, itm_uzi,
|
||||
itm_tec9, itm_calico, itm_hk_mp5, itm_mac_10, itm_hk_ump45, itm_TDI,
|
||||
itm_fn_p90, itm_hk_mp7, itm_marlin_9a, itm_ruger_1022, itm_browning_blr,
|
||||
itm_remington_700, itm_sks, itm_ruger_mini, itm_savage_111f, itm_hk_g3,
|
||||
itm_hk_g36, itm_ak47, itm_fn_fal, itm_acr, itm_ar15, itm_m4a1, itm_scar_l,
|
||||
itm_scar_h, itm_m249, itm_v29, itm_ftk93,
|
||||
// Gun modifications
|
||||
itm_silencer, itm_grip, itm_barrel_big, itm_barrel_small, itm_barrel_rifled,
|
||||
itm_clip, itm_clip2, itm_stablizer, itm_blowback, itm_autofire, itm_retool_45,
|
||||
itm_retool_9mm, itm_retool_22, itm_retool_57, itm_retool_46, itm_retool_308,
|
||||
itm_retool_223, itm_conversion_battle, itm_conversion_sniper,
|
||||
// Books
|
||||
itm_mag_porn, itm_mag_tv, itm_mag_news, itm_mag_cars, itm_mag_cooking,
|
||||
itm_mag_guns, itm_novel_romance, itm_novel_spy, itm_novel_scifi,
|
||||
itm_novel_drama, itm_manual_brawl, itm_manual_knives, itm_manual_mechanics,
|
||||
itm_manual_speech, itm_manual_business, itm_manual_first_aid,
|
||||
itm_manual_computers, itm_cookbook, itm_manual_electronics,
|
||||
itm_manual_tailor, itm_textbook_computers, itm_textbook_electronics,
|
||||
itm_textbook_business, itm_textbook_chemistry, itm_SICP, itm_textbook_robots,
|
||||
// Containers
|
||||
itm_bag_plastic, itm_bottle_plastic, itm_bottle_glass,
|
||||
itm_can_drink, itm_can_food, itm_box_small,
|
||||
// Tools
|
||||
itm_lighter, itm_sewing_kit, itm_scissors, itm_hammer, itm_extinguisher,
|
||||
itm_flashlight, itm_flashlight_on, itm_hotplate, itm_soldering_iron,
|
||||
itm_water_purifier, itm_two_way_radio, itm_radio, itm_radio_on, itm_crowbar,
|
||||
itm_hoe, itm_shovel, itm_chainsaw_off, itm_chainsaw_on, itm_jackhammer,
|
||||
itm_bubblewrap, itm_beartrap, itm_board_trap, itm_tripwire, itm_crossbow_trap,
|
||||
itm_shotgun_trap, itm_blade_trap, itm_landmine, itm_geiger, itm_teleporter,
|
||||
itm_canister_goo, itm_grenade, itm_grenade_act, itm_gasbomb, itm_gasbomb_act,
|
||||
itm_smokebomb, itm_smokebomb_act, itm_molotov, itm_molotov_lit, itm_dynamite,
|
||||
itm_dynamite_act, itm_mininuke, itm_mininuke_act, itm_pheromone, itm_portal,
|
||||
// Bionics containers
|
||||
itm_bionics_battery, itm_bionics_power, itm_bionics_tools, itm_bionics_neuro,
|
||||
itm_bionics_sensory, itm_bionics_aquatic, itm_bionics_combat_aug,
|
||||
itm_bionics_hazmat, itm_bionics_nutritional, itm_bionics_desert,
|
||||
itm_bionics_melee, itm_bionics_armor, itm_bionics_espionage,
|
||||
itm_bionics_defense, itm_bionics_medical, itm_bionics_construction,
|
||||
itm_bionics_super, itm_bionics_ranged,
|
||||
// Static (non-random) artifacts
|
||||
num_items,
|
||||
// These shouldn't be counted among "normal" items, thus, they are outside the
|
||||
// bounds of num_items
|
||||
itm_bio_claws, itm_bio_fusion, itm_bio_blaster,
|
||||
num_all_items
|
||||
};
|
||||
|
||||
enum iclass {
|
||||
IC_NULL,
|
||||
IC_COMEST, IC_MED, IC_WEAP, IC_AMMO, IC_GUN, IC_TOOL, IC_BOOK,
|
||||
IC_MISC
|
||||
};
|
||||
|
||||
// IMPORTANT: If adding a new AT_*** ammotype, add it to the ammo_name function
|
||||
// at the end of itypedef.cpp
|
||||
enum ammotype {
|
||||
AT_NULL,
|
||||
AT_BATT, AT_PLUT,
|
||||
AT_NAIL, AT_BB, AT_BOLT,
|
||||
AT_SHOT,
|
||||
AT_22, AT_9MM, AT_38, AT_40, AT_44, AT_45,
|
||||
AT_57, AT_46,
|
||||
AT_762, AT_223, AT_3006, AT_308,
|
||||
AT_GAS,
|
||||
AT_FUSION,
|
||||
NUM_AMMO_TYPES
|
||||
};
|
||||
|
||||
// Returns the name of a category of ammo (e.g. "shot")
|
||||
std::string ammo_name(ammotype t);
|
||||
// Returns the default ammo for a category of ammo (e.g. "itm_00_shot")
|
||||
itype_id default_ammo(ammotype guntype);
|
||||
|
||||
struct itype
|
||||
{
|
||||
unsigned int id; // ID # that matches its place in master itype list
|
||||
// Used for save files; aligns to itype_id above.
|
||||
unsigned char rarity; // How often it's found
|
||||
unsigned int price; // Its value
|
||||
|
||||
std::string name; // Proper name
|
||||
std::string description;// Flavor text
|
||||
|
||||
char sym; // Symbol on the map
|
||||
nc_color color; // Color on the map (color.h)
|
||||
|
||||
material m1; // Main material
|
||||
material m2; // Secondary material -- MNULL if made of just 1 thing
|
||||
|
||||
unsigned char volume; // Space taken up by this item
|
||||
unsigned char weight; // Weight in quarter-pounds; is 64 lbs max ok?
|
||||
// Also assumes positive weight. No helium, guys!
|
||||
|
||||
signed char melee_dam; // Bonus for melee damage; may be a penalty
|
||||
signed char melee_cut; // Cutting damage in melee
|
||||
signed char m_to_hit; // To-hit bonus for melee combat; -5 to 5 is reasonable
|
||||
|
||||
virtual bool is_food() { return false; }
|
||||
virtual bool is_ammo() { return false; }
|
||||
virtual bool is_gun() { return false; }
|
||||
virtual bool is_gunmod() { return false; }
|
||||
virtual bool is_armor() { return false; }
|
||||
virtual bool is_book() { return false; }
|
||||
virtual bool is_tool() { return false; }
|
||||
virtual bool is_container() { return false; }
|
||||
virtual bool is_artifact() { return false; }
|
||||
|
||||
itype() {
|
||||
id = 0;
|
||||
rarity = 0;
|
||||
name = "none";
|
||||
sym = '#';
|
||||
color = c_white;
|
||||
m1 = MNULL;
|
||||
m2 = MNULL;
|
||||
volume = 0;
|
||||
weight = 0;
|
||||
melee_dam = 0;
|
||||
m_to_hit = 0;
|
||||
}
|
||||
|
||||
itype(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit) {
|
||||
id = pid;
|
||||
rarity = prarity;
|
||||
price = pprice;
|
||||
name = pname;
|
||||
description = pdes;
|
||||
sym = psym;
|
||||
color = pcolor;
|
||||
m1 = pm1;
|
||||
m2 = pm2;
|
||||
volume = pvolume;
|
||||
weight = pweight;
|
||||
melee_dam = pmelee_dam;
|
||||
melee_cut = pmelee_cut;
|
||||
m_to_hit = pm_to_hit;
|
||||
}
|
||||
};
|
||||
|
||||
// Includes food drink and drugs
|
||||
struct it_comest : public itype
|
||||
{
|
||||
signed char quench; // Many things make you thirstier!
|
||||
unsigned char nutr; // Nutrition imparted
|
||||
signed char spoils; // How long it takes to spoil (hours / 600 turns)
|
||||
unsigned char addict; // Addictiveness potential
|
||||
unsigned char charges; // Defaults # of charges (drugs, loaf of bread? etc)
|
||||
signed char stim;
|
||||
signed char healthy;
|
||||
|
||||
signed char fun; // How fun its use is
|
||||
|
||||
itype_id container; // The container it comes in
|
||||
itype_id tool; // Tool needed to consume (e.g. lighter for cigarettes)
|
||||
|
||||
virtual bool is_food() { return true; }
|
||||
|
||||
void (iuse::*use)(game *, item *, bool); // Special effects of use
|
||||
add_type add; // Effects of addiction
|
||||
|
||||
it_comest(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut,
|
||||
signed char pm_to_hit,
|
||||
|
||||
signed char pquench, unsigned char pnutr, signed char pspoils,
|
||||
signed char pstim, signed char phealthy, unsigned char paddict,
|
||||
unsigned char pcharges, signed char pfun, itype_id pcontainer,
|
||||
itype_id ptool, void (iuse::*puse)(game *, item *, bool),
|
||||
add_type padd)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, MNULL,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
quench = pquench;
|
||||
nutr = pnutr;
|
||||
spoils = pspoils;
|
||||
stim = pstim;
|
||||
healthy = phealthy;
|
||||
addict = paddict;
|
||||
charges = pcharges;
|
||||
fun = pfun;
|
||||
container = pcontainer;
|
||||
tool = ptool;
|
||||
use = puse;
|
||||
add = padd;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_ammo : public itype
|
||||
{
|
||||
ammotype type;
|
||||
unsigned char damage;
|
||||
unsigned char pierce;
|
||||
unsigned char range;
|
||||
signed char accuracy;
|
||||
unsigned char recoil;
|
||||
unsigned char count;
|
||||
|
||||
virtual bool is_ammo() { return true; }
|
||||
it_ammo(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
|
||||
|
||||
ammotype ptype, unsigned char pdamage, unsigned char ppierce,
|
||||
signed char paccuracy, unsigned char precoil, unsigned char prange,
|
||||
unsigned char pcount)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, MNULL,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
type = ptype;
|
||||
damage = pdamage;
|
||||
pierce = ppierce;
|
||||
range = prange;
|
||||
accuracy = paccuracy;
|
||||
recoil = precoil;
|
||||
count = pcount;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_gun : public itype
|
||||
{
|
||||
ammotype ammo;
|
||||
skill skill_used;
|
||||
signed char dmg_bonus;
|
||||
signed char accuracy;
|
||||
signed char recoil;
|
||||
signed char durability;
|
||||
unsigned char burst;
|
||||
unsigned char clip;
|
||||
|
||||
virtual bool is_gun() { return true; }
|
||||
|
||||
it_gun(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
|
||||
|
||||
skill pskill_used, ammotype pammo, signed char pdmg_bonus,
|
||||
signed char paccuracy, signed char precoil, unsigned char pdurability,
|
||||
unsigned char pburst, unsigned char pclip)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
skill_used = pskill_used;
|
||||
ammo = pammo;
|
||||
dmg_bonus = pdmg_bonus;
|
||||
accuracy = paccuracy;
|
||||
recoil = precoil;
|
||||
durability = pdurability;
|
||||
burst = pburst;
|
||||
clip = pclip;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_gunmod : public itype
|
||||
{
|
||||
signed char accuracy, damage, loudness, clip, recoil, burst;
|
||||
ammotype newtype;
|
||||
unsigned acceptible_ammo_types : NUM_AMMO_TYPES;
|
||||
bool used_on_pistol;
|
||||
bool used_on_shotgun;
|
||||
bool used_on_smg;
|
||||
bool used_on_rifle;
|
||||
|
||||
virtual bool is_gunmod() { return true; }
|
||||
|
||||
it_gunmod(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut,
|
||||
signed char pm_to_hit,
|
||||
|
||||
signed char paccuracy, signed char pdamage, signed char ploudness,
|
||||
signed char pclip, signed char precoil, signed char pburst,
|
||||
ammotype pnewtype, long a_a_t, bool pistol,
|
||||
bool shotgun, bool smg, bool rifle)
|
||||
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
accuracy = paccuracy;
|
||||
damage = pdamage;
|
||||
loudness = ploudness;
|
||||
clip = pclip;
|
||||
recoil = precoil;
|
||||
burst = pburst;
|
||||
newtype = pnewtype;
|
||||
acceptible_ammo_types = a_a_t;
|
||||
used_on_pistol = pistol;
|
||||
used_on_shotgun = shotgun;
|
||||
used_on_smg = smg;
|
||||
used_on_rifle = rifle;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
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 env_resist; // Resistance to environmental effects
|
||||
signed char warmth;
|
||||
unsigned char storage;
|
||||
virtual bool is_armor() { return true; }
|
||||
it_armor(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
|
||||
|
||||
unsigned char pcovers, signed char pencumber,
|
||||
unsigned char pdmg_resist, unsigned char pcut_resist,
|
||||
unsigned char penv_resist, signed char pwarmth,
|
||||
unsigned char pstorage)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
covers = pcovers;
|
||||
encumber = pencumber;
|
||||
dmg_resist = pdmg_resist;
|
||||
cut_resist = pcut_resist;
|
||||
env_resist = penv_resist;
|
||||
warmth = pwarmth;
|
||||
storage = pstorage;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_book : public itype
|
||||
{
|
||||
skill type; // Which skill it upgrades
|
||||
unsigned char level; // The value it takes the skill to
|
||||
unsigned char req; // The skill level required to understand it
|
||||
signed char fun; // How fun reading this is
|
||||
unsigned char intel; // Intelligence required to read, at all
|
||||
unsigned char time; // How long, in 10-turns (aka minutes), it takes to read
|
||||
// "To read" means getting 1 skill point, not all of em
|
||||
virtual bool is_book() { return true; }
|
||||
it_book(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
|
||||
|
||||
skill ptype, unsigned char plevel, unsigned char preq,
|
||||
signed char pfun, unsigned char pintel, unsigned char ptime)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
type = ptype;
|
||||
level = plevel;
|
||||
req = preq;
|
||||
fun = pfun;
|
||||
intel = pintel;
|
||||
time = ptime;
|
||||
}
|
||||
};
|
||||
|
||||
enum container_flags {
|
||||
con_rigid,
|
||||
con_wtight,
|
||||
con_seals,
|
||||
num_con_flags
|
||||
};
|
||||
|
||||
struct it_container : public itype
|
||||
{
|
||||
unsigned char contains; // Internal volume
|
||||
unsigned flags : num_con_flags;
|
||||
virtual bool is_container() { return true; }
|
||||
it_container(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut,
|
||||
signed char pm_to_hit,
|
||||
|
||||
unsigned char pcontains, unsigned pflags)
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
contains = pcontains;
|
||||
flags = pflags;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_tool : public itype
|
||||
{
|
||||
ammotype ammo;
|
||||
unsigned int max_charges;
|
||||
unsigned int def_charges;
|
||||
unsigned char charges_per_use;
|
||||
unsigned char charges_per_sec;
|
||||
itype_id revert_to;
|
||||
void (iuse::*use)(game *, item *, bool);
|
||||
virtual bool is_tool() { return true; }
|
||||
it_tool(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut, signed char pm_to_hit,
|
||||
|
||||
unsigned int pmax_charges, unsigned int pdef_charges,
|
||||
unsigned char pcharges_per_use, unsigned char pcharges_per_sec,
|
||||
ammotype pammo, itype_id prevert_to,
|
||||
void (iuse::*puse)(game *, item *, bool))
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
max_charges = pmax_charges;
|
||||
def_charges = pdef_charges;
|
||||
ammo = pammo;
|
||||
charges_per_use = pcharges_per_use;
|
||||
charges_per_sec = pcharges_per_sec;
|
||||
revert_to = prevert_to;
|
||||
use = puse;
|
||||
}
|
||||
};
|
||||
|
||||
struct it_bionic : public itype
|
||||
{
|
||||
std::vector<bionic_id> options;
|
||||
int difficulty;
|
||||
it_bionic(unsigned short pid, unsigned char prarity, unsigned int pprice,
|
||||
std::string pname, std::string pdes,
|
||||
char psym, nc_color pcolor, material pm1, material pm2,
|
||||
unsigned char pvolume, unsigned char pweight,
|
||||
signed char pmelee_dam, signed char pmelee_cut,signed char pm_to_hit,
|
||||
|
||||
int pdifficulty, ...)
|
||||
|
||||
:itype(pid, prarity, pprice, pname, pdes, psym, pcolor, pm1, pm2,
|
||||
pvolume, pweight, pmelee_dam, pmelee_cut, pm_to_hit) {
|
||||
difficulty = pdifficulty;
|
||||
va_list ap;
|
||||
va_start(ap, pdifficulty);
|
||||
bionic_id tmp;
|
||||
while (tmp = (bionic_id)va_arg(ap, int))
|
||||
options.push_back(tmp);
|
||||
va_end(ap);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
-2465
File diff suppressed because it is too large
Load Diff
@@ -1,76 +0,0 @@
|
||||
#ifndef _IUSE_H_
|
||||
#define _IUSE_H_
|
||||
|
||||
class game;
|
||||
class item;
|
||||
|
||||
class iuse
|
||||
{
|
||||
public:
|
||||
void none (game *g, item *it, bool t) { };
|
||||
// FOOD AND DRUGS (ADMINISTRATION)
|
||||
void royal_jelly (game *g, item *it, bool t);
|
||||
void bandage (game *g, item *it, bool t);
|
||||
void firstaid (game *g, item *it, bool t);
|
||||
void caff (game *g, item *it, bool t);
|
||||
void alcohol (game *g, item *it, bool t);
|
||||
void pkill_1 (game *g, item *it, bool t);
|
||||
void pkill_2 (game *g, item *it, bool t);
|
||||
void pkill_3 (game *g, item *it, bool t);
|
||||
void pkill_4 (game *g, item *it, bool t);
|
||||
void pkill_l (game *g, item *it, bool t);
|
||||
void xanax (game *g, item *it, bool t);
|
||||
void cig (game *g, item *it, bool t);
|
||||
void weed (game *g, item *it, bool t);
|
||||
void coke (game *g, item *it, bool t);
|
||||
void meth (game *g, item *it, bool t);
|
||||
void poison (game *g, item *it, bool t);
|
||||
void hallu (game *g, item *it, bool t);
|
||||
void thorazine (game *g, item *it, bool t);
|
||||
void prozac (game *g, item *it, bool t);
|
||||
void sleep (game *g, item *it, bool t);
|
||||
void flumed (game *g, item *it, bool t);
|
||||
void flusleep (game *g, item *it, bool t);
|
||||
void inhaler (game *g, item *it, bool t);
|
||||
void blech (game *g, item *it, bool t);
|
||||
void mutagen (game *g, item *it, bool t);
|
||||
void purifier (game *g, item *it, bool t);
|
||||
// TOOLS
|
||||
void lighter (game *g, item *it, bool t);
|
||||
void sew (game *g, item *it, bool t);
|
||||
void scissors (game *g, item *it, bool t);
|
||||
void extinguisher (game *g, item *it, bool t);
|
||||
void hammer (game *g, item *it, bool t);
|
||||
void light_off (game *g, item *it, bool t);
|
||||
void light_on (game *g, item *it, bool t);
|
||||
void water_purifier (game *g, item *it, bool t);
|
||||
void two_way_radio (game *g, item *it, bool t);
|
||||
void radio_off (game *g, item *it, bool t);
|
||||
void radio_on (game *g, item *it, bool t);
|
||||
void crowbar (game *g, item *it, bool t);
|
||||
void makemound (game *g, item *it, bool t);
|
||||
void dig (game *g, item *it, bool t);
|
||||
void chainsaw_off (game *g, item *it, bool t);
|
||||
void chainsaw_on (game *g, item *it, bool t);
|
||||
void jackhammer (game *g, item *it, bool t);
|
||||
void set_trap (game *g, item *it, bool t);
|
||||
void geiger (game *g, item *it, bool t);
|
||||
void teleport (game *g, item *it, bool t);
|
||||
void can_goo (game *g, item *it, bool t);
|
||||
void grenade (game *g, item *it, bool t);
|
||||
void grenade_act (game *g, item *it, bool t);
|
||||
void gasbomb (game *g, item *it, bool t);
|
||||
void gasbomb_act (game *g, item *it, bool t);
|
||||
void smokebomb (game *g, item *it, bool t);
|
||||
void smokebomb_act (game *g, item *it, bool t);
|
||||
void molotov (game *g, item *it, bool t);
|
||||
void molotov_lit (game *g, item *it, bool t);
|
||||
void dynamite (game *g, item *it, bool t);
|
||||
void dynamite_act (game *g, item *it, bool t);
|
||||
void mininuke (game *g, item *it, bool t);
|
||||
void mininuke_act (game *g, item *it, bool t);
|
||||
void pheromone (game *g, item *it, bool t);
|
||||
void portal (game *g, item *it, bool t);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,61 +0,0 @@
|
||||
#include "keypress.h"
|
||||
|
||||
long input()
|
||||
{
|
||||
long ch = getch();
|
||||
switch (ch) {
|
||||
case '7': return 'y';
|
||||
case KEY_UP:
|
||||
case '8': return 'k';
|
||||
case '9': return 'u';
|
||||
case KEY_LEFT:
|
||||
case '4': return 'h';
|
||||
case '5': return '.';
|
||||
case KEY_RIGHT:
|
||||
case '6': return 'l';
|
||||
case '1': return 'b';
|
||||
case KEY_DOWN:
|
||||
case '2': return 'j';
|
||||
case '3': return 'n';
|
||||
default: return ch;
|
||||
}
|
||||
}
|
||||
|
||||
void get_direction(int &x, int &y, char ch)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
switch (ch) {
|
||||
case 'y':
|
||||
x = -1;
|
||||
y = -1;
|
||||
return;
|
||||
case 'u':
|
||||
x = 1;
|
||||
y = -1;
|
||||
return;
|
||||
case 'h':
|
||||
x = -1;
|
||||
return;
|
||||
case 'j':
|
||||
y = 1;
|
||||
return;
|
||||
case 'k':
|
||||
y = -1;
|
||||
return;
|
||||
case 'l':
|
||||
x = 1;
|
||||
return;
|
||||
case 'b':
|
||||
x = -1;
|
||||
y = 1;
|
||||
return;
|
||||
case 'n':
|
||||
x = 1;
|
||||
y = 1;
|
||||
return;
|
||||
default:
|
||||
x = -2;
|
||||
y = -2;
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
#ifndef _KEYPRESS_H_
|
||||
#define _KEYPRESS_H_
|
||||
#include <ncurses.h>
|
||||
// Simple text input--translates numpad to vikeys
|
||||
long input();
|
||||
// If ch is vikey, x & y are set to corresponding direction; ch=='y'->x=-1,y=-1
|
||||
void get_direction(int &x, int &y, char ch);
|
||||
|
||||
#define CTRL(n) (n - 'A' + 1 < 1 ? n - 'a' + 1 : n - 'A' + 1)
|
||||
#define KEY_ESCAPE 27
|
||||
#endif
|
||||
@@ -1,94 +0,0 @@
|
||||
#include "line.h"
|
||||
#include "map.h"
|
||||
|
||||
#define SGN(a) (((a)<0) ? -1 : 1)
|
||||
|
||||
std::vector <point> line_to(int x1, int y1, int x2, int y2, int t) {
|
||||
std::vector<point> ret;
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
int ax = abs(dx)<<1;
|
||||
int ay = abs(dy)<<1;
|
||||
int sx = SGN(dx);
|
||||
int sy = SGN(dy);
|
||||
if (dy == 0) sy = 0;
|
||||
if (dx == 0) sx = 0;
|
||||
point cur;
|
||||
cur.x = x1;
|
||||
cur.y = y1;
|
||||
|
||||
if (ax > ay) {
|
||||
do {
|
||||
if (t > 0) {
|
||||
cur.y += sy;
|
||||
t -= ax;
|
||||
}
|
||||
cur.x += sx;
|
||||
t += ay;
|
||||
ret.push_back(cur);
|
||||
} while ((cur.x != x2 || cur.y != y2) &&
|
||||
(cur.x >= 0 - SEEX * 3 && cur.x <= SEEX * 6 &&
|
||||
cur.y >= 0 - SEEY * 3 && cur.y <= SEEY * 6 ));
|
||||
} else {
|
||||
do {
|
||||
if (t > 0) {
|
||||
cur.x += sx;
|
||||
t -= ay;
|
||||
}
|
||||
cur.y += sy;
|
||||
t += ax;
|
||||
ret.push_back(cur);
|
||||
} while ((cur.x != x2 || cur.y != y2) &&
|
||||
(cur.x >= 0 - SEEX * 3 && cur.x <= SEEX * 6 &&
|
||||
cur.y >= 0 - SEEY * 3 && cur.y <= SEEY * 6 ));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int trig_dist(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
return int(sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2)));
|
||||
}
|
||||
|
||||
int rl_dist(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int dx = abs(x1 - x2), dy = abs(y1 - y2);
|
||||
if (dx > dy)
|
||||
return dx;
|
||||
return dy;
|
||||
}
|
||||
|
||||
std::string direction_from(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int dx = x2 - x1;
|
||||
int dy = y2 - y1;
|
||||
if (dx < 0) {
|
||||
if (abs(dx) >> 1 > abs(dy) || dy == 0) {
|
||||
return "the west";
|
||||
} else if (abs(dy) >> 1 > abs(dx)) {
|
||||
if (dy < 0)
|
||||
return "the north";
|
||||
else
|
||||
return "the south";
|
||||
} else {
|
||||
if (dy < 0)
|
||||
return "the northwest";
|
||||
else
|
||||
return "the southwest";
|
||||
}
|
||||
} else {
|
||||
if (dx >> 1 > abs(dy) || dy == 0) {
|
||||
return "the east";
|
||||
} else if (abs(dy) >> 1 > dx || dx == 0) {
|
||||
if (dy < 0)
|
||||
return "the north";
|
||||
else
|
||||
return "the south";
|
||||
} else {
|
||||
if (dy < 0)
|
||||
return "the northeast";
|
||||
else
|
||||
return "the southeast";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef _LINE_H_
|
||||
#define _LINE_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "enums.h"
|
||||
|
||||
// The "t" value decides WHICH Bresenham line is used.
|
||||
std::vector <point> line_to(int x1, int y1, int x2, int y2, int t);
|
||||
int trig_dist(int x1, int y1, int x2, int y2);
|
||||
int rl_dist(int x1, int y1, int x2, int y2);
|
||||
std::string direction_from(int x1, int y1, int x2, int y2);
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
/* Main Loop for cataclysm
|
||||
* Linux only I guess
|
||||
* But maybe not
|
||||
* Who knows
|
||||
*/
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <ctime>
|
||||
#include "game.h"
|
||||
|
||||
// FUNCTIONS
|
||||
void do_colors();
|
||||
//void load_items();
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
srand(time(NULL));
|
||||
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
keypad(stdscr, true);
|
||||
do_colors();
|
||||
curs_set(0);
|
||||
|
||||
rand();
|
||||
game g;
|
||||
while (!g.do_turn());
|
||||
erase();
|
||||
endwin();
|
||||
system("clear");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define HILIGHT COLOR_BLUE
|
||||
void do_colors()
|
||||
{
|
||||
start_color();
|
||||
|
||||
init_pair( 1, COLOR_WHITE, COLOR_BLACK );
|
||||
init_pair( 2, COLOR_RED, COLOR_BLACK );
|
||||
init_pair( 3, COLOR_GREEN, COLOR_BLACK );
|
||||
init_pair( 4, COLOR_BLUE, COLOR_BLACK );
|
||||
init_pair( 5, COLOR_CYAN, COLOR_BLACK );
|
||||
init_pair( 6, COLOR_MAGENTA, COLOR_BLACK );
|
||||
init_pair( 7, COLOR_YELLOW, COLOR_BLACK );
|
||||
|
||||
// Inverted Colors
|
||||
init_pair( 8, COLOR_BLACK, COLOR_WHITE );
|
||||
init_pair( 9, COLOR_BLACK, COLOR_RED );
|
||||
init_pair(10, COLOR_BLACK, COLOR_GREEN );
|
||||
init_pair(11, COLOR_BLACK, COLOR_BLUE );
|
||||
init_pair(12, COLOR_BLACK, COLOR_CYAN );
|
||||
init_pair(13, COLOR_BLACK, COLOR_MAGENTA);
|
||||
init_pair(14, COLOR_BLACK, COLOR_YELLOW );
|
||||
|
||||
// Highlighted - blue background
|
||||
init_pair(15, COLOR_WHITE, HILIGHT);
|
||||
init_pair(16, COLOR_RED, HILIGHT);
|
||||
init_pair(17, COLOR_GREEN, HILIGHT);
|
||||
init_pair(18, COLOR_BLUE, HILIGHT);
|
||||
init_pair(19, COLOR_CYAN, HILIGHT);
|
||||
init_pair(20, COLOR_BLACK, HILIGHT);
|
||||
init_pair(21, COLOR_MAGENTA, HILIGHT);
|
||||
init_pair(22, COLOR_YELLOW, HILIGHT);
|
||||
|
||||
init_pair(23, COLOR_BLACK, COLOR_BLACK );
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
#ifndef _MAP_H_
|
||||
#define _MAP_H_
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <stdlib.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "mapdata.h"
|
||||
#include "mapitems.h"
|
||||
#include "overmap.h"
|
||||
#include "item.h"
|
||||
#include "monster.h"
|
||||
#include "npc.h"
|
||||
|
||||
class player;
|
||||
class item;
|
||||
struct itype;
|
||||
|
||||
class map
|
||||
{
|
||||
public:
|
||||
// Constructors & Initialization
|
||||
map();
|
||||
map(std::vector<itype*> *itptr, std::vector<itype_id> (*miptr)[num_itloc],
|
||||
std::vector<trap*> *trptr);
|
||||
~map();
|
||||
void init(game *g, int x, int y);
|
||||
void generate(game *g, overmap *om, int x, int y, int turn);
|
||||
|
||||
// Visual Output
|
||||
void draw(game *g, WINDOW* w);
|
||||
void debug();
|
||||
void drawsq(WINDOW* w, player &u, int x, int y, bool invert, bool show_items);
|
||||
|
||||
// File I/O
|
||||
void save(overmap *om, unsigned int turn, int x, int y);
|
||||
void load(game *g, int wx, int wy);
|
||||
void shift(game *g, int wx, int wy, int x, int y);
|
||||
void spawn_monsters(game *g);
|
||||
|
||||
// Movement and LOS
|
||||
int move_cost(int x, int y); // Cost to move through; 0 = impassible
|
||||
bool trans(int x, int y); // Transparent?
|
||||
// (Fx, Fy) sees (Tx, Ty), within a range of (range)?
|
||||
// tc indicates the Bresenham line used to connect the two points, and may
|
||||
// subsequently be used to form a path between them
|
||||
bool sees(int Fx, int Fy, int Tx, int Ty, int range, int &tc);
|
||||
//std::vector<point> route(int Fx, int Fy, int Tx, int Ty); // Best route
|
||||
|
||||
// Terrain
|
||||
ter_id& ter(int x, int y); // Terrain at coord (x, y); {x|y}=(0, SEE{X|Y}*3]
|
||||
std::string tername(int x, int y); // Name of terrain at (x, y)
|
||||
std::string features(int x, int y); // Words relevant to terrain (sharp, etc)
|
||||
bool has_flag(t_flag flag, int x, int y);
|
||||
bool is_destructable(int x, int y);
|
||||
|
||||
bool close_door(int x, int y);
|
||||
bool open_door(int x, int y, bool inside);
|
||||
bool bash(int x, int y, int str, std::string &sound);
|
||||
void destroy(game *g, int x, int y, bool makesound);
|
||||
void shoot(game *g, int x, int y, int &dam, bool hit_items);
|
||||
|
||||
// Radiation
|
||||
int& radiation(int x, int y); // Amount of radiation at (x, y);
|
||||
|
||||
// Items
|
||||
std::vector<item>& i_at(int x, int y);
|
||||
item water_from(int x, int y);
|
||||
void i_clear(int x, int y);
|
||||
void i_rem(int x, int y, int index);
|
||||
point find_item(item *it);
|
||||
void add_item(int x, int y, itype* type, int birthday);
|
||||
void add_item(int x, int y, item new_item);
|
||||
void process_active_items(game *g);
|
||||
|
||||
// Traps
|
||||
trap_id& tr_at(int x, int y);
|
||||
void add_trap(int x, int y, trap_id t);
|
||||
void disarm_trap( game *g, int x, int y);
|
||||
|
||||
// Fields
|
||||
field& field_at(int x, int y);
|
||||
bool add_field(game *g, int x, int y, field_id t, unsigned char density);
|
||||
bool process_fields(game *g);
|
||||
void step_in_field(int x, int y, game *g);
|
||||
void mon_in_field(int x, int y, game *g, monster *z);
|
||||
// mapgen.h functions
|
||||
void place_items(items_location loc, int chance, int x1, int y1,
|
||||
int x2, int y2, bool ongrass, int turn);
|
||||
void make_all_items_owned();
|
||||
void add_spawn(mon_id type, int count, int x, int y);
|
||||
|
||||
private:
|
||||
void saven(overmap *om, unsigned int turn, int x, int y, int gridx, int gridy);
|
||||
bool loadn(game *g, int x, int y, int gridx, int gridy);
|
||||
void draw_map(oter_id terrain_type, oter_id t_north, oter_id t_east,
|
||||
oter_id t_south, oter_id t_west, oter_id t_above, int turn);
|
||||
void rotate(int turns);// Rotates the current map 90*turns degress clockwise
|
||||
// Useful for houses, shops, etc
|
||||
|
||||
submap grid[9];
|
||||
std::vector<item> nulitems; // Returned when &i_at() is asked for an OOB value
|
||||
ter_id nulter; // Returned when &ter() is asked for an OOB value
|
||||
trap_id nultrap; // Returned when &tr_at() is asked for an OOB value
|
||||
field nulfield; // Returned when &field_at() is asked for an OOB value
|
||||
int nulrad; // OOB &radiation()
|
||||
|
||||
std::vector <itype*> *itypes;
|
||||
std::vector <trap*> *traps;
|
||||
std::vector <itype_id> (*mapitems)[num_itloc];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,343 +0,0 @@
|
||||
#ifndef _MAPDATA_H_
|
||||
#define _MAPDATA_H_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "color.h"
|
||||
#include "item.h"
|
||||
#include "trap.h"
|
||||
#include "monster.h"
|
||||
#include "enums.h"
|
||||
|
||||
class game;
|
||||
class monster;
|
||||
|
||||
#ifndef SEEX // SEEX is how far the player can see in the X direction (at
|
||||
// least, without scrolling). All map segments will need to be at least
|
||||
// this wide. The map therefore needs to be 3 times as wide.
|
||||
#define SEEX 12
|
||||
#endif
|
||||
#ifndef SEEY // Same as SEEX
|
||||
#define SEEY 12 // Requires 2*SEEY+1= 25 vertical squares
|
||||
// Nuts to 80x24 terms. Mostly exists in graphical clients, and
|
||||
// those fatcats can resize.
|
||||
#endif
|
||||
|
||||
// mfb(t_flag) converts a flag to a bit for insertion into a bitfield
|
||||
#ifndef mfb
|
||||
#define mfb(n) int(pow(2,(int)n))
|
||||
#endif
|
||||
|
||||
enum t_flag {
|
||||
transparent, // Player & monsters can see through/past it
|
||||
bashable, // Player & monsters can bash this & make it the next in the list
|
||||
container,// Items on this square are hidden until looted by the player
|
||||
flammable,// May be lit on fire
|
||||
explodes, // Explodes when on fire
|
||||
diggable, // Digging monsters, seeding monsters, digging w/ shovel, etc.
|
||||
swimmable,// You (and monsters) swim here
|
||||
sharp, // May do minor damage to players/monsters passing it
|
||||
rough, // May hurt the player's feet
|
||||
sealed, // Can't 'e' to retrieve items here
|
||||
noitem, // Items "fall off" this space
|
||||
goes_down,// Can '>' to go down a level
|
||||
goes_up, // Can '<' to go up a level
|
||||
computer, // Used as a computer
|
||||
num_t_flags // MUST be last
|
||||
};
|
||||
|
||||
struct ter_t {
|
||||
std::string name;
|
||||
char sym;
|
||||
nc_color color;
|
||||
unsigned char movecost;
|
||||
unsigned flags : num_t_flags;
|
||||
};
|
||||
|
||||
enum ter_id {
|
||||
t_null = 0,
|
||||
// Ground
|
||||
t_dirt, t_dirtmound, t_pit,
|
||||
t_rock_floor, t_rubble,
|
||||
t_grass,
|
||||
t_pavement, t_pavement_y, t_sidewalk,
|
||||
t_floor,
|
||||
t_grate,
|
||||
t_slime,
|
||||
// Walls & doors
|
||||
t_wall_v, t_wall_h,
|
||||
t_wall_glass_v, t_wall_glass_h,
|
||||
t_reinforced_glass_v, t_reinforced_glass_h,
|
||||
t_bars,
|
||||
t_door_c, t_door_b, t_door_o, t_door_locked, t_door_frame, t_door_boarded,
|
||||
t_door_metal_c, t_door_metal_o, t_door_metal_locked,
|
||||
t_bulletin,
|
||||
t_portcullis,
|
||||
t_window, t_window_frame, t_window_boarded,
|
||||
t_rock,
|
||||
// Tree
|
||||
t_tree, t_tree_young, t_underbrush,
|
||||
t_wax, t_floor_wax,
|
||||
t_fence_v, t_fence_h,
|
||||
t_railing_v, t_railing_h,
|
||||
// Water, lava, etc.
|
||||
t_water_sh, t_water_dp, t_sewage,
|
||||
t_lava,
|
||||
// Embellishments
|
||||
t_bed, t_toilet,
|
||||
t_gas_pump, t_gas_pump_smashed,
|
||||
t_counter,
|
||||
t_radio_tower, t_radio_controls,
|
||||
t_computer_broken, t_computer_nether, t_computer_lab,
|
||||
// Containers
|
||||
t_fridge, t_dresser,
|
||||
t_rack, t_bookcase,
|
||||
t_dumpster,
|
||||
t_vat,
|
||||
// Staircases etc.
|
||||
t_stairs_down, t_stairs_up, t_manhole, t_ladder, t_slope_down, t_slope_up,
|
||||
// Special
|
||||
t_card_reader, t_card_reader_broken, t_manhole_cover, t_slot_machine,
|
||||
num_terrain_types
|
||||
};
|
||||
|
||||
const ter_t terlist[num_terrain_types] = { // MUST match enum ter_id above!
|
||||
{"nothing", ' ', c_white, 2,
|
||||
mfb(transparent)},
|
||||
{"dirt", '.', c_brown, 2,
|
||||
mfb(transparent)|mfb(diggable)},
|
||||
{"mound of dirt", '#', c_brown, 3,
|
||||
mfb(transparent)|mfb(diggable)},
|
||||
{"shallow pit", '0', c_brown, 14,
|
||||
mfb(transparent)|mfb(diggable)},
|
||||
{"rock floor", '.', c_ltgray, 2,
|
||||
mfb(transparent)},
|
||||
{"pile of rubble", '#', c_ltgray, 4,
|
||||
mfb(transparent)|mfb(rough)|mfb(diggable)},
|
||||
{"grass", '.', c_green, 2,
|
||||
mfb(transparent)|mfb(diggable)},
|
||||
{"pavement", '.', c_dkgray, 2,
|
||||
mfb(transparent)},
|
||||
{"yellow pavement", '.', c_yellow, 2,
|
||||
mfb(transparent)},
|
||||
{"sidewalk", '.', c_ltgray, 2,
|
||||
mfb(transparent)},
|
||||
{"floor", '.', c_cyan, 2,
|
||||
mfb(transparent)},
|
||||
{"metal grate", '#', c_dkgray, 2,
|
||||
mfb(transparent)},
|
||||
{"slime", '~', c_green, 6,
|
||||
mfb(transparent)|mfb(container)|mfb(flammable)},
|
||||
{"wall", '|', c_ltgray, 0,
|
||||
mfb(flammable)},
|
||||
{"wall", '-', c_ltgray, 0,
|
||||
mfb(flammable)},
|
||||
{"glass wall", '|', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"glass wall", '-', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"reinforced glass", '|', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"reinforced glass", '-', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"metal bars", '"', c_ltgray, 0,
|
||||
mfb(transparent)},
|
||||
{"closed wood door", '+', c_brown, 0,
|
||||
mfb(bashable)|mfb(flammable)},
|
||||
{"damaged wood door",'&', c_brown, 0,
|
||||
mfb(transparent)|mfb(bashable)|mfb(flammable)},
|
||||
{"open wood door", '\'', c_brown, 2,
|
||||
mfb(transparent)},
|
||||
{"closed wood door", '+', c_brown, 0, // Actually locked
|
||||
mfb(bashable)|mfb(flammable)},
|
||||
{"empty door frame", '.', c_brown, 2,
|
||||
mfb(transparent)},
|
||||
{"boarded up door", '#', c_brown, 0,
|
||||
mfb(bashable)|mfb(flammable)},
|
||||
{"closed metal door",'+', c_cyan, 0,
|
||||
0},
|
||||
{"open metal door", '\'', c_cyan, 2,
|
||||
mfb(transparent)},
|
||||
{"closed metal door",'+', c_cyan, 0, // Actually locked
|
||||
0},
|
||||
{"bulletin board", '6', c_blue, 0,
|
||||
0},
|
||||
{"makeshift portcullis", '&', c_cyan, 0,
|
||||
0},
|
||||
{"window", '"', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)|mfb(flammable)},
|
||||
{"window frame", '0', c_ltcyan, 12,
|
||||
mfb(container)|mfb(transparent)|mfb(sharp)|mfb(flammable)|mfb(noitem)},
|
||||
{"boarded up window",'#', c_brown, 0,
|
||||
mfb(bashable)|mfb(flammable)},
|
||||
{"solid rock", '#', c_white, 0,
|
||||
0},
|
||||
{"tree", '7', c_green, 0,
|
||||
mfb(flammable)},
|
||||
{"young tree", '1', c_green, 0,
|
||||
mfb(transparent)|mfb(bashable)|mfb(flammable)},
|
||||
{"underbrush", '#', c_green, 7,
|
||||
mfb(transparent)|mfb(bashable)|mfb(diggable)|mfb(container)|mfb(rough)|
|
||||
mfb(flammable)},
|
||||
{"wax wall", '#', c_yellow, 0,
|
||||
mfb(container)|mfb(flammable)},
|
||||
{"wax floor", '.', c_yellow, 2,
|
||||
mfb(transparent)},
|
||||
{"picket fence", '|', c_brown, 3,
|
||||
mfb(transparent)|mfb(diggable)|mfb(flammable)|mfb(noitem)},
|
||||
{"picket fence", '-', c_brown, 3,
|
||||
mfb(transparent)|mfb(diggable)|mfb(flammable)|mfb(noitem)},
|
||||
{"railing", '|', c_yellow, 3,
|
||||
mfb(transparent)|mfb(noitem)},
|
||||
{"railing", '-', c_yellow, 3,
|
||||
mfb(transparent)|mfb(noitem)},
|
||||
{"shallow water", '~', c_ltblue, 5,
|
||||
mfb(transparent)|mfb(swimmable)},
|
||||
{"deep water", '~', c_blue, 0,
|
||||
mfb(transparent)|mfb(swimmable)},
|
||||
{"sewage", '~', c_ltgreen, 6,
|
||||
mfb(transparent)|mfb(swimmable)},
|
||||
{"lava", '~', c_red, 0,
|
||||
mfb(transparent)},
|
||||
{"bed", '#', c_magenta, 5,
|
||||
mfb(transparent)|mfb(container)|mfb(flammable)},
|
||||
{"toilet", '&', c_white, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"gasoline pump", '&', c_red, 0,
|
||||
mfb(transparent)|mfb(explodes)},
|
||||
{"smashed gas pump", '&', c_ltred, 0,
|
||||
mfb(transparent)},
|
||||
{"counter", '#', c_blue, 4,
|
||||
mfb(transparent)},
|
||||
{"radio tower", '&', c_ltgray, 0,
|
||||
0},
|
||||
{"radio controls", '6', c_green, 0,
|
||||
mfb(transparent)|mfb(bashable)},
|
||||
{"broken computer", '6', c_ltgray, 0,
|
||||
mfb(transparent)|mfb(computer)},
|
||||
{"computer console", '6', c_blue, 0,
|
||||
mfb(transparent)|mfb(computer)},
|
||||
{"computer console", '6', c_blue, 0,
|
||||
mfb(transparent)|mfb(computer)},
|
||||
{"refrigerator", '{', c_ltcyan, 0,
|
||||
mfb(container)},
|
||||
{"dresser", '{', c_brown, 0,
|
||||
mfb(transparent)|mfb(container)|mfb(flammable)},
|
||||
{"display rack", '{', c_ltgray, 0,
|
||||
mfb(transparent)|mfb(container)},
|
||||
{"book case", '{', c_brown, 0,
|
||||
mfb(container)|mfb(flammable)},
|
||||
{"dumpster", '{', c_green, 0,
|
||||
mfb(container)},
|
||||
{"cloning vat", '0', c_ltcyan, 0,
|
||||
mfb(transparent)|mfb(bashable)|mfb(container)|mfb(sealed)},
|
||||
{"stairs down", '>', c_yellow, 2,
|
||||
mfb(transparent)|mfb(goes_down)},
|
||||
{"stairs up", '<', c_yellow, 2,
|
||||
mfb(transparent)|mfb(goes_up)},
|
||||
{"manhole", '>', c_dkgray, 2,
|
||||
mfb(transparent)|mfb(goes_down)},
|
||||
{"ladder", '<', c_dkgray, 2,
|
||||
mfb(transparent)|mfb(goes_up)},
|
||||
{"downward slope", '>', c_brown, 2,
|
||||
mfb(transparent)|mfb(goes_down)},
|
||||
{"upward slope", '<', c_brown, 2,
|
||||
mfb(transparent)|mfb(goes_up)},
|
||||
{"card reader", '6', c_pink, 0,
|
||||
0},
|
||||
{"broken card reader",'6', c_ltgray, 0,
|
||||
0},
|
||||
{"manhole cover", '0', c_dkgray, 2,
|
||||
mfb(transparent)},
|
||||
{"slot machine", '6', c_green, 0,
|
||||
mfb(bashable)}
|
||||
};
|
||||
|
||||
struct field_t {
|
||||
std::string name[3];
|
||||
char sym;
|
||||
nc_color color[3];
|
||||
bool transparent[3];
|
||||
bool dangerous[3];
|
||||
int halflife; // In turns
|
||||
};
|
||||
|
||||
enum field_id {
|
||||
fd_null = 0,
|
||||
fd_blood,
|
||||
fd_bile,
|
||||
fd_slime,
|
||||
fd_acid,
|
||||
fd_fire,
|
||||
fd_smoke,
|
||||
fd_tear_gas,
|
||||
fd_nuke_gas,
|
||||
fd_electricity,
|
||||
num_fields
|
||||
};
|
||||
|
||||
const field_t fieldlist[] = {
|
||||
{{"", "", "",}, '%',
|
||||
{c_white, c_white, c_white}, {true, true, true}, {false, false, false}, 0},
|
||||
{{"blood splatter", "blood stain", "puddle of blood"}, '%',
|
||||
{c_red, c_red, c_red}, {true, true, true}, {false, false, false},2500},
|
||||
{{"bile splatter", "bile stain", "puddle of bile"}, '%',
|
||||
{c_pink, c_pink, c_pink}, {true, true, true}, {false, false, false},2500},
|
||||
{{"slime trail", "slime stain", "puddle of slime"}, '%',
|
||||
{c_ltgreen, c_ltgreen, c_green},{true, true, true},{false, false, false},2500},
|
||||
{{"acid splatter", "acid streak", "pool of acid"}, '5',
|
||||
{c_ltgreen, c_green, c_green}, {true, true, true}, {true, true, true}, 10},
|
||||
{{"small fire", "fire", "raging fire"}, '4',
|
||||
{c_yellow, c_ltred, c_red}, {true, true, true}, {true, true, true}, 2000},
|
||||
{{"thin smoke", "smoke", "thick smoke"}, '8',
|
||||
{c_white, c_ltgray, c_dkgray}, {true, false, false},{false, true, true}, 400},
|
||||
{{"hazy cloud","tear gas","thick tear gas"}, '8',
|
||||
{c_white, c_yellow, c_brown}, {true, false, false},{true, true, true}, 600},
|
||||
{{"hazy cloud","radioactive gas", "thick radioactive gas"}, '8',
|
||||
{c_white, c_ltgreen, c_green}, {true, true, false}, {true, true, true}, 1000},
|
||||
{{"sparks", "electric crackle", "electric cloud"}, '9',
|
||||
{c_white, c_cyan, c_blue}, {true, true, true}, {true, true, true}, 2}
|
||||
};
|
||||
|
||||
struct field {
|
||||
field_id type;
|
||||
signed char density;
|
||||
int age;
|
||||
field() { type = fd_null; density = 1; age = 0; };
|
||||
field(field_id t, unsigned char d, unsigned int a) {
|
||||
type = t;
|
||||
density = d;
|
||||
age = a;
|
||||
}
|
||||
bool is_null() {
|
||||
if (type == fd_null || type == fd_blood || type == fd_bile ||
|
||||
type == fd_slime)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
bool is_dangerous() {
|
||||
return fieldlist[type].dangerous[density - 1];
|
||||
}
|
||||
std::string name() {
|
||||
return fieldlist[type].name[density - 1];
|
||||
}
|
||||
};
|
||||
|
||||
struct spawn_point {
|
||||
int posx, posy;
|
||||
int count;
|
||||
mon_id type;
|
||||
spawn_point(mon_id T = mon_null, int C = 0, int X = -1, int Y = -1) :
|
||||
posx (X), posy (Y), count (C), type (T) {}
|
||||
};
|
||||
|
||||
struct submap {
|
||||
ter_id ter[SEEX][SEEY]; // Terrain on each square
|
||||
std::vector<item> itm[SEEX][SEEY]; // Items on each square
|
||||
trap_id trp[SEEX][SEEY]; // Trap on each square
|
||||
field fld[SEEX][SEEY]; // Field on each square
|
||||
int rad[SEEX][SEEY]; // Irradiation of each square
|
||||
std::vector<spawn_point> spawns;
|
||||
};
|
||||
|
||||
#endif
|
||||
-4269
File diff suppressed because it is too large
Load Diff
-44
@@ -1,44 +0,0 @@
|
||||
#ifndef _MAPITEMS_H_
|
||||
#define _MAPITEMS_H_
|
||||
enum items_location {
|
||||
mi_none,
|
||||
mi_field, mi_forest, mi_hive, mi_hive_center,
|
||||
mi_road,
|
||||
mi_livingroom, mi_kitchen, mi_fridge, mi_bedroom, mi_homeguns, mi_dresser,
|
||||
mi_snacks, mi_fridgesnacks, mi_behindcounter, mi_magazines,
|
||||
mi_softdrugs, mi_harddrugs,
|
||||
mi_cannedfood, mi_pasta, mi_produce,
|
||||
mi_cleaning,
|
||||
mi_hardware, mi_tools, mi_bigtools, mi_mischw,
|
||||
mi_sports, mi_camping, mi_allsporting,
|
||||
mi_alcohol,
|
||||
mi_trash,
|
||||
mi_ammo, mi_pistols, mi_shotguns, mi_rifles, mi_smg, mi_assault, mi_allguns,
|
||||
mi_gunxtras,
|
||||
mi_shoes, mi_pants, mi_shirts, mi_jackets, mi_winter, mi_bags, mi_allclothes,
|
||||
mi_novels, mi_manuals, mi_textbooks,
|
||||
mi_chemistry, mi_teleport, mi_goo, mi_cloning_vat, mi_dissection,
|
||||
mi_hydro, mi_electronics, mi_monparts, mi_bionics,
|
||||
mi_weapons, mi_survival_armor, mi_survival_tools,
|
||||
mi_radio,
|
||||
mi_subway, mi_sewer,
|
||||
mi_cavern,
|
||||
mi_ant_food, mi_ant_egg,
|
||||
// Monster drops
|
||||
mi_ants, mi_bees, mi_robots,
|
||||
// Shopkeeps &c
|
||||
mi_trader_avoid,
|
||||
num_itloc
|
||||
};
|
||||
|
||||
// This is used only for monsters; they get a list of items_locations, and
|
||||
// a chance that each one will be used.
|
||||
struct items_location_and_chance {
|
||||
items_location loc;
|
||||
int chance;
|
||||
items_location_and_chance (items_location l, int c) {
|
||||
loc = l;
|
||||
chance = c;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
-369
@@ -1,369 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "itype.h"
|
||||
#include "omdata.h"
|
||||
#include "setvector.h"
|
||||
#include <cstdarg>
|
||||
|
||||
void game::init_mapitems()
|
||||
{
|
||||
setvector(
|
||||
mapitems[mi_field],
|
||||
itm_rock, itm_strawberries, NULL);
|
||||
setvector(
|
||||
mapitems[mi_forest],
|
||||
itm_rock, itm_stick, itm_mushroom, itm_mushroom_poison,
|
||||
itm_mushroom_magic, itm_blueberries, NULL);
|
||||
setvector(
|
||||
mapitems[mi_hive],
|
||||
itm_honeycomb, NULL);
|
||||
setvector(
|
||||
mapitems[mi_hive_center],
|
||||
itm_honeycomb, itm_royal_jelly, NULL);
|
||||
setvector(
|
||||
mapitems[mi_road],
|
||||
itm_muffler, itm_pipe, itm_motor, NULL);
|
||||
setvector(
|
||||
mapitems[mi_livingroom],
|
||||
itm_rootbeer, itm_cola, itm_cig, itm_weed, itm_coke, itm_meth,
|
||||
itm_sneakers, itm_boots, itm_boots_winter, itm_flip_flops,
|
||||
itm_dress_shoes, itm_heels, itm_coat_rain, itm_poncho, itm_gloves_light,
|
||||
itm_mittens, itm_gloves_light, itm_mittens, itm_gloves_wool,
|
||||
itm_gloves_winter, itm_gloves_leather, itm_gloves_fingerless,
|
||||
itm_bandana, itm_scarf, itm_hat_cotton, itm_hat_knit, itm_hat_fur,
|
||||
itm_helmet_bike, itm_helmet_motor, itm_mag_tv, itm_mag_news,
|
||||
itm_lighter, itm_extinguisher, NULL);
|
||||
setvector(
|
||||
mapitems[mi_kitchen],
|
||||
itm_pot, itm_pan, itm_knife_butter, itm_knife_steak, itm_knife_butcher,
|
||||
itm_cookbook, itm_rag, itm_hotplate, itm_flashlight, itm_extinguisher,
|
||||
itm_whiskey, itm_bleach, itm_ammonia,
|
||||
NULL);
|
||||
setvector(
|
||||
mapitems[mi_fridge],
|
||||
itm_water, itm_oj, itm_cola, itm_rootbeer, itm_milk, itm_V8, itm_apple,
|
||||
itm_sandwich_t, itm_mushroom, itm_blueberries, itm_strawberries,
|
||||
itm_tomato, itm_broccoli, itm_zucchini, itm_frozen_dinner, itm_vodka,
|
||||
NULL);
|
||||
setvector(
|
||||
mapitems[mi_bedroom],
|
||||
itm_inhaler, itm_cig, itm_weed, itm_coke, itm_meth, itm_heroin,
|
||||
itm_sneakers, itm_mocassins, itm_bandana, itm_glasses_eye,
|
||||
itm_glasses_reading, itm_hat_ball, itm_backpack, itm_purse, itm_mbag,
|
||||
itm_fanny, itm_battery, itm_bb, itm_bbgun, itm_mag_porn, itm_mag_tv,
|
||||
itm_mag_news, itm_novel_romance, itm_novel_drama, itm_manual_mechanics,
|
||||
itm_manual_speech, itm_manual_business, itm_manual_computers,
|
||||
itm_lighter, itm_sewing_kit, itm_scissors, itm_soldering_iron,
|
||||
itm_radio, itm_syringe, NULL);
|
||||
setvector(
|
||||
mapitems[mi_homeguns],
|
||||
itm_22_lr, itm_9mm, itm_crossbow, itm_sig_mosquito, itm_sw_22,
|
||||
itm_glock_19, itm_usp_9mm, itm_sw_619, itm_taurus_38, itm_sig_40,
|
||||
itm_sw_610, itm_ruger_redhawk, itm_deagle_44, itm_usp_45, itm_m1911,
|
||||
itm_fn57, itm_mac_10, itm_shotgun_sawn, itm_silencer, itm_grip,
|
||||
itm_clip, itm_grenade, itm_gasbomb, NULL);
|
||||
setvector(
|
||||
mapitems[mi_dresser],
|
||||
itm_jeans, itm_pants, itm_pants_leather, itm_pants_cargo, itm_skirt,
|
||||
itm_dress, itm_tshirt, itm_polo_shirt, itm_dress_shirt, itm_tank_top,
|
||||
itm_sweatshirt, itm_sweater, itm_hoodie, itm_jacket_light,
|
||||
itm_jacket_jean, itm_blazer, itm_jacket_leather, itm_poncho,
|
||||
itm_trenchcoat, itm_peacoat, itm_vest, itm_mag_porn, itm_lighter,
|
||||
itm_sewing_kit, itm_flashlight, NULL);
|
||||
setvector(
|
||||
mapitems[mi_snacks],
|
||||
itm_chips, itm_pretzels, itm_chocolate, itm_jerky, itm_candy, NULL);
|
||||
setvector(
|
||||
mapitems[mi_fridgesnacks],
|
||||
itm_water, itm_oj, itm_energy_drink, itm_cola, itm_rootbeer, itm_milk,
|
||||
itm_V8, itm_sandwich_t, itm_frozen_dinner, NULL);
|
||||
setvector(
|
||||
mapitems[mi_behindcounter],
|
||||
itm_aspirin, itm_caffeine, itm_cig, itm_battery, itm_shotgun_sawn,
|
||||
itm_mag_porn, itm_lighter, itm_flashlight, itm_extinguisher, NULL);
|
||||
setvector(
|
||||
mapitems[mi_magazines],
|
||||
itm_mag_tv, itm_mag_news, itm_mag_cars, itm_mag_cooking,
|
||||
itm_novel_romance, itm_novel_spy, NULL);
|
||||
setvector(
|
||||
mapitems[mi_softdrugs],
|
||||
itm_bandages, itm_1st_aid, itm_vitamins, itm_aspirin, itm_caffeine,
|
||||
itm_pills_sleep, itm_dayquil, itm_nyquil, NULL);
|
||||
setvector(
|
||||
mapitems[mi_harddrugs],
|
||||
itm_inhaler, itm_codeine, itm_oxycodone, itm_tramadol, itm_xanax,
|
||||
itm_adderall, itm_thorazine, itm_prozac, itm_syringe, NULL);
|
||||
setvector(
|
||||
mapitems[mi_cannedfood],
|
||||
itm_can_beans, itm_can_corn, itm_can_spam, itm_can_pineapple,
|
||||
itm_can_coconut, itm_can_sardine, itm_can_tuna, itm_can_catfood, NULL);
|
||||
setvector(
|
||||
mapitems[mi_pasta],
|
||||
itm_spaghetti_raw, itm_macaroni_raw, itm_ravioli, itm_sauce_red,
|
||||
itm_sauce_pesto, NULL);
|
||||
setvector(
|
||||
mapitems[mi_produce],
|
||||
itm_apple, itm_orange, itm_mushroom, itm_blueberries, itm_strawberries,
|
||||
itm_tomato, itm_broccoli, itm_zucchini, NULL);
|
||||
setvector(
|
||||
mapitems[mi_cleaning],
|
||||
itm_salt_water, itm_bleach, itm_ammonia, itm_broom, itm_mop,
|
||||
itm_gloves_rubber, itm_mask_dust, itm_bottle_plastic, itm_sewing_kit,
|
||||
itm_rag, itm_scissors, NULL);
|
||||
setvector(
|
||||
mapitems[mi_hardware],
|
||||
itm_superglue, itm_chain, itm_rope_6, itm_rope_30, itm_glass_sheet,
|
||||
itm_pipe, itm_nail, itm_hose, NULL);
|
||||
setvector(
|
||||
mapitems[mi_tools],
|
||||
itm_screwdriver, itm_hammer, itm_wrench, itm_saw, itm_hacksaw,
|
||||
itm_hammer_sledge, itm_xacto, itm_flashlight, itm_crowbar, NULL);
|
||||
setvector(
|
||||
mapitems[mi_bigtools],
|
||||
itm_broom, itm_mop, itm_hoe, itm_shovel, itm_chainsaw_off,
|
||||
itm_jackhammer, NULL);
|
||||
setvector(
|
||||
mapitems[mi_mischw],
|
||||
itm_2x4, itm_machete, itm_boots_steel, itm_hat_hard, itm_mask_filter,
|
||||
itm_glasses_safety, itm_bb, itm_bbgun, itm_beartrap, itm_two_way_radio,
|
||||
itm_radio, itm_hotplate, itm_extinguisher, NULL);
|
||||
setvector(
|
||||
mapitems[mi_sports],
|
||||
itm_bandages, itm_aspirin, itm_bat, itm_sneakers, itm_tshirt,
|
||||
itm_tank_top, itm_gloves_fingerless, itm_glasses_safety,
|
||||
itm_goggles_swim, itm_goggles_ski, itm_hat_ball, itm_helmet_bike,
|
||||
itm_helmet_ball, itm_manual_brawl, NULL);
|
||||
setvector(
|
||||
mapitems[mi_camping],
|
||||
itm_rope_30, itm_hatchet, itm_pot, itm_pan, itm_hotplate,
|
||||
itm_knife_combat, itm_machete, itm_vest, itm_backpack, itm_bb,
|
||||
itm_bolt_steel, itm_bbgun, itm_crossbow, itm_manual_knives,
|
||||
itm_manual_first_aid, itm_lighter, itm_sewing_kit, itm_hammer,
|
||||
itm_flashlight, itm_water_purifier, itm_radio, itm_beartrap, NULL);
|
||||
setvector(
|
||||
mapitems[mi_allsporting],
|
||||
itm_aspirin, itm_bat, itm_sneakers, itm_tshirt, itm_tank_top,
|
||||
itm_gloves_fingerless, itm_glasses_safety, itm_goggles_swim,
|
||||
itm_goggles_ski, itm_hat_ball, itm_helmet_bike, itm_helmet_ball,
|
||||
itm_manual_brawl, itm_rope_30, itm_hatchet, itm_pot, itm_pan,
|
||||
itm_hotplate, itm_knife_combat, itm_machete, itm_vest, itm_backpack,
|
||||
itm_bb, itm_bolt_steel, itm_bbgun, itm_crossbow, itm_manual_knives,
|
||||
itm_manual_first_aid, itm_lighter, itm_sewing_kit, itm_hammer,
|
||||
itm_flashlight, itm_water_purifier, itm_radio, itm_beartrap,
|
||||
itm_extinguisher, NULL);
|
||||
setvector(
|
||||
mapitems[mi_alcohol],
|
||||
itm_whiskey, itm_vodka, itm_rum, itm_tequila, NULL);
|
||||
setvector(
|
||||
mapitems[mi_trash],
|
||||
itm_meth, itm_heroin, itm_wrapper, itm_string_6, itm_chain,
|
||||
itm_glass_sheet, itm_stick, itm_muffler, itm_pipe, itm_bag_plastic,
|
||||
itm_bottle_plastic, itm_bottle_glass, itm_can_drink, itm_can_food,
|
||||
itm_box_small, itm_bubblewrap, itm_lighter, itm_syringe, itm_rag, NULL);
|
||||
setvector(
|
||||
mapitems[mi_ammo],
|
||||
itm_shot_bird, itm_shot_00, itm_shot_slug, itm_22_lr, itm_22_cb,
|
||||
itm_9mm, itm_9mmP, itm_9mmP2, itm_38_special, itm_38_super, itm_10mm,
|
||||
itm_40sw, itm_44magnum, itm_45_acp, itm_45_jhp, itm_45_super, itm_57mm,
|
||||
itm_46mm, itm_762_m43, itm_762_m87, itm_223, itm_556, itm_270, itm_3006,
|
||||
itm_308, itm_762_51, NULL);
|
||||
setvector(
|
||||
mapitems[mi_pistols],
|
||||
itm_sig_mosquito, itm_sw_22, itm_glock_19, itm_usp_9mm, itm_sw_619,
|
||||
itm_taurus_38, itm_sig_40, itm_sw_610, itm_ruger_redhawk, itm_deagle_44,
|
||||
itm_usp_45, itm_m1911, itm_fn57, itm_hk_ucp, NULL);
|
||||
setvector(
|
||||
mapitems[mi_shotguns],
|
||||
itm_shotgun_s, itm_shotgun_d, itm_remington_870, itm_mossberg_500,
|
||||
itm_saiga_12, NULL);
|
||||
setvector(
|
||||
mapitems[mi_rifles],
|
||||
itm_marlin_9a, itm_ruger_1022, itm_browning_blr, itm_remington_700,
|
||||
itm_sks, itm_ruger_mini, itm_savage_111f, NULL);
|
||||
setvector(
|
||||
mapitems[mi_smg],
|
||||
itm_uzi, itm_tec9, itm_calico, itm_hk_mp5, itm_mac_10, itm_hk_ump45,
|
||||
itm_TDI, itm_fn_p90, itm_hk_mp7, NULL);
|
||||
setvector(
|
||||
mapitems[mi_assault],
|
||||
itm_hk_g3, itm_hk_g36, itm_ak47, itm_fn_fal, itm_acr, itm_ar15,
|
||||
itm_scar_l, itm_scar_h, itm_m249, NULL);
|
||||
setvector(
|
||||
mapitems[mi_allguns],
|
||||
itm_sig_mosquito, itm_sw_22, itm_glock_19, itm_usp_9mm, itm_sw_619,
|
||||
itm_taurus_38, itm_sig_40, itm_sw_610, itm_ruger_redhawk, itm_deagle_44,
|
||||
itm_usp_45, itm_m1911, itm_fn57, itm_hk_ucp, itm_shotgun_s,
|
||||
itm_shotgun_d, itm_remington_870, itm_mossberg_500, itm_saiga_12,
|
||||
itm_uzi, itm_tec9, itm_calico, itm_hk_mp5, itm_mac_10, itm_hk_ump45,
|
||||
itm_TDI, itm_fn_p90, itm_hk_mp7, itm_marlin_9a, itm_ruger_1022,
|
||||
itm_browning_blr, itm_remington_700, itm_sks, itm_ruger_mini,
|
||||
itm_savage_111f, itm_hk_g3, itm_hk_g36, itm_ak47, itm_fn_fal, itm_acr,
|
||||
itm_ar15, itm_scar_l, itm_scar_h, itm_m249, NULL);
|
||||
setvector(
|
||||
mapitems[mi_gunxtras],
|
||||
itm_glasses_safety, itm_holster, itm_bootstrap, itm_mag_guns,
|
||||
itm_flashlight, itm_silencer, itm_grip, itm_barrel_big,
|
||||
itm_barrel_small, itm_barrel_rifled, itm_clip, itm_clip2, itm_stablizer,
|
||||
itm_blowback, itm_autofire, itm_retool_45, itm_retool_9mm,
|
||||
itm_retool_22, itm_retool_57, itm_retool_46, itm_retool_308,
|
||||
itm_retool_223, NULL);
|
||||
setvector(
|
||||
mapitems[mi_shoes],
|
||||
itm_sneakers, itm_boots, itm_flip_flops, itm_dress_shoes, itm_heels,
|
||||
NULL);
|
||||
setvector(
|
||||
mapitems[mi_pants],
|
||||
itm_jeans, itm_pants, itm_pants_leather, itm_pants_cargo, itm_skirt,
|
||||
itm_dress, NULL);
|
||||
setvector(
|
||||
mapitems[mi_shirts],
|
||||
itm_tshirt, itm_polo_shirt, itm_dress_shirt, itm_tank_top,
|
||||
itm_sweatshirt, itm_sweater, itm_hoodie, NULL);
|
||||
setvector(
|
||||
mapitems[mi_jackets],
|
||||
itm_jacket_light, itm_jacket_jean, itm_blazer, itm_jacket_leather,
|
||||
itm_coat_rain, itm_trenchcoat, NULL);
|
||||
setvector(
|
||||
mapitems[mi_winter],
|
||||
itm_coat_winter, itm_peacoat, itm_gloves_light, itm_mittens,
|
||||
itm_gloves_wool, itm_gloves_winter, itm_gloves_leather, itm_scarf,
|
||||
itm_hat_cotton, itm_hat_knit, itm_hat_fur, NULL);
|
||||
setvector(
|
||||
mapitems[mi_bags],
|
||||
itm_backpack, itm_purse, itm_mbag, NULL);
|
||||
setvector(
|
||||
mapitems[mi_allclothes],
|
||||
itm_jeans, itm_pants, itm_pants_leather, itm_pants_cargo, itm_skirt,
|
||||
itm_tshirt, itm_polo_shirt, itm_dress_shirt, itm_tank_top,
|
||||
itm_sweatshirt, itm_sweater, itm_hoodie, itm_jacket_light,
|
||||
itm_jacket_jean, itm_blazer, itm_jacket_leather, itm_coat_winter,
|
||||
itm_peacoat, itm_gloves_light, itm_mittens, itm_gloves_wool,
|
||||
itm_gloves_winter, itm_gloves_leather, itm_scarf, itm_hat_cotton,
|
||||
itm_hat_knit, itm_hat_fur, NULL);
|
||||
setvector(
|
||||
mapitems[mi_novels],
|
||||
itm_novel_romance, itm_novel_spy, itm_novel_scifi, itm_novel_drama,
|
||||
NULL);
|
||||
setvector(
|
||||
mapitems[mi_manuals],
|
||||
itm_manual_brawl, itm_manual_knives, itm_manual_mechanics,
|
||||
itm_manual_speech, itm_manual_business, itm_manual_first_aid,
|
||||
itm_manual_computers, itm_cookbook, itm_manual_electronics,
|
||||
itm_manual_tailor, NULL);
|
||||
setvector(
|
||||
mapitems[mi_textbooks],
|
||||
itm_textbook_computers, itm_textbook_electronics, itm_textbook_business,
|
||||
itm_textbook_chemistry, itm_SICP, itm_textbook_robots, NULL);
|
||||
setvector(
|
||||
mapitems[mi_chemistry],
|
||||
itm_water, itm_salt_water, itm_bleach, itm_ammonia, itm_mutagen,
|
||||
itm_purifier, itm_royal_jelly, itm_superglue, itm_bottle_glass,
|
||||
itm_syringe, itm_rag, itm_extinguisher, itm_hotplate, NULL);
|
||||
setvector(
|
||||
mapitems[mi_teleport],
|
||||
itm_screwdriver, itm_wrench, itm_jumpsuit, itm_mask_dust,
|
||||
itm_glasses_safety, itm_goggles_welding, itm_teleporter, NULL);
|
||||
setvector(
|
||||
mapitems[mi_goo],
|
||||
itm_jumpsuit, itm_gloves_rubber, itm_mask_filter, itm_glasses_safety,
|
||||
itm_helmet_riot, itm_lighter, itm_canister_goo, NULL);
|
||||
setvector(
|
||||
mapitems[mi_cloning_vat],
|
||||
itm_fetus, itm_arm, itm_leg, NULL);
|
||||
setvector(
|
||||
mapitems[mi_dissection],
|
||||
itm_bleach, itm_bandages, itm_string_6, itm_hacksaw, itm_xacto,
|
||||
itm_knife_butcher, itm_machete, itm_gloves_rubber, itm_bag_plastic,
|
||||
itm_syringe, itm_rag, itm_scissors, NULL);
|
||||
setvector(
|
||||
mapitems[mi_hydro],
|
||||
itm_blueberries, itm_strawberries, itm_tomato, itm_broccoli,
|
||||
itm_zucchini, NULL);
|
||||
setvector(
|
||||
mapitems[mi_electronics],
|
||||
itm_superglue, itm_electrohack, itm_processor, itm_RAM,
|
||||
itm_power_supply, itm_amplifier, itm_transponder, itm_receiver,
|
||||
itm_antenna, itm_motor, itm_screwdriver, itm_mask_dust,
|
||||
itm_glasses_safety, itm_goggles_welding, itm_battery, itm_plut_cell,
|
||||
itm_manual_electronics, itm_textbook_electronics, itm_soldering_iron,
|
||||
itm_hotplate, NULL);
|
||||
setvector(
|
||||
mapitems[mi_monparts],
|
||||
itm_meat, itm_veggy, itm_meat_tainted, itm_veggy_tainted,
|
||||
itm_royal_jelly, itm_ant_egg, itm_bee_sting, itm_chitin_piece, NULL);
|
||||
setvector(
|
||||
mapitems[mi_bionics],
|
||||
itm_bionics_power, itm_bionics_tools, itm_bionics_neuro,
|
||||
itm_bionics_sensory, itm_bionics_aquatic, itm_bionics_combat_aug,
|
||||
itm_bionics_hazmat, itm_bionics_nutritional, itm_bionics_desert,
|
||||
itm_bionics_melee, itm_bionics_armor, itm_bionics_espionage,
|
||||
itm_bionics_defense, itm_bionics_medical, itm_bionics_construction,
|
||||
itm_bionics_super, itm_bionics_ranged, NULL);
|
||||
setvector(
|
||||
mapitems[mi_weapons],
|
||||
itm_chain, itm_hammer, itm_wrench, itm_hammer_sledge, itm_hatchet,
|
||||
itm_ax, itm_knife_combat, itm_pipe, itm_bat, itm_machete, itm_katana,
|
||||
itm_baton, NULL);
|
||||
setvector(
|
||||
mapitems[mi_survival_armor],
|
||||
itm_boots_steel, itm_pants_cargo, itm_pants_army, itm_jumpsuit,
|
||||
itm_jacket_leather, itm_kevlar, itm_vest, itm_gloves_fingerless,
|
||||
itm_mask_filter, itm_mask_gas, itm_goggles_ski, itm_helmet_skid,
|
||||
itm_helmet_ball, itm_helmet_riot, itm_helmet_motor, itm_holster,
|
||||
itm_bootstrap, NULL);
|
||||
setvector(
|
||||
mapitems[mi_survival_tools],
|
||||
itm_bandages, itm_1st_aid, itm_caffeine, itm_electrohack, itm_string_36,
|
||||
itm_rope_30, itm_chain, itm_bottle_plastic, itm_lighter, itm_sewing_kit,
|
||||
itm_extinguisher, itm_flashlight, itm_crowbar, itm_chainsaw_off,
|
||||
itm_beartrap, itm_grenade, itm_hotplate, NULL);
|
||||
setvector(
|
||||
mapitems[mi_radio],
|
||||
itm_cola, itm_caffeine, itm_cig, itm_weed, itm_amplifier,
|
||||
itm_transponder, itm_receiver, itm_antenna, itm_screwdriver,
|
||||
itm_battery, itm_mag_porn, itm_mag_tv, itm_manual_electronics,
|
||||
itm_lighter, itm_flashlight, itm_two_way_radio, itm_radio, NULL);
|
||||
setvector(
|
||||
mapitems[mi_subway],
|
||||
itm_wrapper, itm_string_6, itm_chain, itm_rock, itm_pipe,
|
||||
itm_mag_porn, itm_bottle_plastic, itm_bottle_glass, itm_can_drink,
|
||||
itm_can_food, itm_lighter, itm_flashlight, itm_rag, itm_crowbar, NULL);
|
||||
setvector(
|
||||
mapitems[mi_sewer],
|
||||
itm_mutagen, itm_fetus, itm_weed, itm_mag_porn, itm_rag, NULL);
|
||||
setvector(
|
||||
mapitems[mi_cavern],
|
||||
itm_rock, itm_jackhammer, NULL);
|
||||
setvector(
|
||||
mapitems[mi_ant_food],
|
||||
itm_apple, itm_orange, itm_mushroom, itm_blueberries, itm_strawberries,
|
||||
itm_tomato, itm_broccoli, itm_zucchini, itm_honeycomb, itm_royal_jelly,
|
||||
itm_arm, itm_leg, itm_rock, itm_stick, NULL);
|
||||
setvector(
|
||||
mapitems[mi_ant_egg],
|
||||
itm_ant_egg, NULL); //TODO: More items here?
|
||||
|
||||
setvector(
|
||||
mapitems[mi_ants],
|
||||
itm_chitin_piece, NULL);
|
||||
|
||||
setvector(
|
||||
mapitems[mi_bees],
|
||||
itm_bee_sting, itm_chitin_piece, NULL);
|
||||
|
||||
setvector(
|
||||
mapitems[mi_robots],
|
||||
itm_processor, itm_RAM, itm_power_supply, itm_amplifier,
|
||||
itm_transponder, itm_receiver, itm_antenna, itm_steel_chunk, itm_motor,
|
||||
itm_battery, itm_plut_cell, NULL);
|
||||
|
||||
// This one kind of an inverted list; what a traveling salesman will NOT carry
|
||||
setvector(
|
||||
mapitems[mi_trader_avoid],
|
||||
itm_water_dirty, itm_meat, itm_veggy, itm_meat_tainted,
|
||||
itm_veggy_tainted, itm_meat_cooked, itm_veggy_cooked,
|
||||
itm_mushroom_poison, itm_spaghetti_cooked, itm_macaroni_cooked,
|
||||
itm_fetus, itm_arm, itm_leg, itm_wrapper, itm_manhole_cover, itm_rock,
|
||||
itm_stick, itm_bag_plastic, itm_flashlight_on, itm_radio_on,
|
||||
itm_chainsaw_on, itm_grenade_act, itm_gasbomb_act, itm_molotov_lit,
|
||||
itm_dynamite_act, itm_mininuke_act, NULL);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
enum mission_category {
|
||||
MISS_NULL = 0,
|
||||
MISS_GO_TO, // GOTO considered harmful.
|
||||
MISS_FIND_ITEM, MISS_FIND_PERSON,
|
||||
MISS_ASSASSINATE,
|
||||
NUM_MISS_TYPES
|
||||
};
|
||||
|
||||
struct mission {
|
||||
mission_category type;
|
||||
itype_id item_id;
|
||||
int count;
|
||||
int npc_id;
|
||||
};
|
||||
-490
@@ -1,490 +0,0 @@
|
||||
#include "mondeath.h"
|
||||
#include "monster.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
#include "line.h"
|
||||
#include "bodypart.h"
|
||||
|
||||
void mattack::antqueen(game *g, monster *z)
|
||||
{
|
||||
std::vector<point> egg_points;
|
||||
z->moves = -200; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
for (int x = z->posx - 1; x <= z->posx + 1; x++) {
|
||||
for (int y = z->posy - 1; y <= z->posy + 1; y++) {
|
||||
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
|
||||
if (g->m.i_at(x, y)[i].type->id == itm_ant_egg)
|
||||
egg_points.push_back(point(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (egg_points.size() == 0) {
|
||||
int junk;
|
||||
if (g->u_see(z->posx, z->posy, junk))
|
||||
g->add_msg("The %s lays an egg!", z->name().c_str());
|
||||
g->m.add_item(z->posx, z->posy, g->itypes[itm_ant_egg], g->turn);
|
||||
} else {
|
||||
int junk;
|
||||
if (g->u_see(z->posx, z->posy, junk))
|
||||
g->add_msg("The %s tends nearby eggs, and they hatch!", z->name().c_str());
|
||||
for (int i = 0; i < egg_points.size(); i++) {
|
||||
int x = egg_points[i].x, y = egg_points[i].y;
|
||||
for (int j = 0; j < g->m.i_at(x, y).size(); j++) {
|
||||
if (g->m.i_at(x, y)[j].type->id == itm_ant_egg) {
|
||||
g->m.i_rem(x, y, j);
|
||||
j = g->m.i_at(x, y).size();
|
||||
monster tmp(g->mtypes[mon_ant_larva], x, y);
|
||||
g->z.push_back(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::shriek(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (rl_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 4 ||
|
||||
!g->sees_u(z->posx, z->posy, j))
|
||||
return; // Out of range
|
||||
z->moves = -240; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
g->sound(z->posx, z->posy, 100, "a terrible shriek!");
|
||||
}
|
||||
|
||||
void mattack::acid(game *g, monster *z)
|
||||
{
|
||||
int junk;
|
||||
if (rl_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 12 ||
|
||||
!g->sees_u(z->posx, z->posy, junk))
|
||||
return; // Out of range
|
||||
z->moves = -300; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
g->sound(z->posx, z->posy, 4, "a spitting noise.");
|
||||
int hitx = g->u.posx + rng(-2, 2), hity = g->u.posy + rng(-2, 2);
|
||||
for (int i = -3; i <= 3; i++) {
|
||||
for (int j = -3; j <= 3; j++) {
|
||||
if (g->m.move_cost(hitx + i, hity +j) > 0 &&
|
||||
g->m.sees(hitx + i, hity + j, hitx, hity, 6, junk) &&
|
||||
(one_in(abs(j)) && one_in(abs(i)) || (i == 0 && j == 0))) {
|
||||
if (g->m.field_at(hitx + i, hity + j).type == fd_acid &&
|
||||
g->m.field_at(hitx + i, hity + j).density < 3)
|
||||
g->m.field_at(hitx + i, hity + j).density++;
|
||||
else
|
||||
g->m.add_field(g, hitx + i, hity + j, fd_acid, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::shockstorm(game *g, monster *z)
|
||||
{
|
||||
int t;
|
||||
if (!g->sees_u(z->posx, z->posy, t))
|
||||
return; // Can't see you, no attack
|
||||
z->moves = -50; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
g->add_msg("A bolt of electricity arcs towards you!");
|
||||
int tarx = g->u.posx + rng(-3, 3), tary = g->u.posy + rng(-3, 3);
|
||||
if (!g->m.sees(z->posx, z->posy, tarx, tary, -1, t))
|
||||
t = 0;
|
||||
std::vector<point> bolt = line_to(z->posx, z->posy, tarx, tary, t);
|
||||
for (int i = 0; i < bolt.size(); i++) {
|
||||
if (!one_in(4))
|
||||
g->m.add_field(g, bolt[i].x, bolt[i].y, fd_electricity, rng(1, 3));
|
||||
}
|
||||
for (int i = tarx - 1; i <= tarx + 1; i++) {
|
||||
for (int j = tary - 1; j <= tary + 1; j++) {
|
||||
if (!one_in(6))
|
||||
g->m.add_field(g, i, j, fd_electricity, rng(1, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::boomer(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (abs(g->u.posx - z->posx) > 3 || abs(g->u.posy - z->posy) > 3 ||
|
||||
!g->sees_u(z->posx, z->posy, j))
|
||||
return; // Out of range
|
||||
std::vector<point> line = line_to(z->posx, z->posy, g->u.posx, g->u.posy, j);
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
z->moves = -250; // It takes a while
|
||||
bool u_see = g->u_see(z->posx, z->posy, j);
|
||||
for (int i = 0; i < line.size(); i++) {
|
||||
if (g->m.field_at(line[i].x, line[i].y).type == fd_blood) {
|
||||
g->m.field_at(line[i].x, line[i].y).type = fd_bile;
|
||||
g->m.field_at(line[i].x, line[i].y).density = 1;
|
||||
} else if (g->m.field_at(line[i].x, line[i].y).type == fd_bile &&
|
||||
g->m.field_at(line[i].x, line[i].y).density < 3)
|
||||
g->m.field_at(line[i].x, line[i].y).density++;
|
||||
else
|
||||
g->m.add_field(g, line[i].x, line[i].y, fd_bile, 1);
|
||||
}
|
||||
if (u_see)
|
||||
g->add_msg("The %s spews bile!", z->name().c_str());
|
||||
if (rng(0, 10) > g->u.dodge() || one_in(g->u.dodge()))
|
||||
g->u.infect(DI_BOOMERED, bp_eyes, 3, 12, g);
|
||||
else if (u_see)
|
||||
g->add_msg("You dodge it!");
|
||||
}
|
||||
|
||||
void mattack::resurrect(game *g, monster *z)
|
||||
{
|
||||
std::vector<point> corpses;
|
||||
for (int x = z->posx - 6; x <= z->posx + 6; x++) {
|
||||
for (int y = z->posy - 6; y <= z->posy + 6; y++) {
|
||||
if (g->mon_at(x, y) == -1) {
|
||||
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
|
||||
if (g->m.i_at(x, y)[i].type->id == itm_corpse)
|
||||
corpses.push_back(point(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (corpses.size() == 0) // No nearby corpses
|
||||
return;
|
||||
int junk;
|
||||
bool sees_necromancer = (g->u_see(z, junk));
|
||||
if (sees_necromancer)
|
||||
g->add_msg("The %s throws its arms wide...", z->name().c_str());
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
z->moves = -500; // It takes a while
|
||||
int raised = 0;
|
||||
for (int i = 0; i < corpses.size(); i++) {
|
||||
int x = corpses[i].x, y = corpses[i].y;
|
||||
for (int n = 0; n < g->m.i_at(x, y).size(); n++) {
|
||||
if (g->m.i_at(x, y)[n].type->id == itm_corpse && one_in(2)) {
|
||||
if (g->u_see(x, y, junk))
|
||||
raised++;
|
||||
monster mon(g->m.i_at(x, y)[n].corpse, x, y);
|
||||
mon.speed = int(mon.speed * .8); // Raised corpses are slower
|
||||
g->m.i_rem(x, y, n);
|
||||
n = g->m.i_at(x, y).size();
|
||||
g->z.push_back(mon);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (raised > 0) {
|
||||
if (raised == 1)
|
||||
g->add_msg("A nearby corpse rises from the dead!");
|
||||
else if (raised < 4)
|
||||
g->add_msg("A few corpses rise from the dead!");
|
||||
else
|
||||
g->add_msg("Several corpses rise from the dead!");
|
||||
} else if (sees_necromancer)
|
||||
g->add_msg("...but nothing seems to happen.");
|
||||
}
|
||||
|
||||
void mattack::growplants(game *g, monster *z)
|
||||
{
|
||||
int junk;
|
||||
for (int i = -3; i <= 3; i++) {
|
||||
for (int j = -3; j <= 3; j++) {
|
||||
if ((i != 0 || j != 0) && g->m.has_flag(diggable, z->posx + i, z->posy + j)){
|
||||
if (one_in(4)) {
|
||||
int mondex = g->mon_at(z->posx + i, z->posy + j);
|
||||
if (mondex != -1) {
|
||||
if (g->u_see(z->posx + i, z->posy + j, junk))
|
||||
g->add_msg("A tree bursts forth from the earth and pierces the %s!",
|
||||
g->z[mondex].name().c_str());
|
||||
int rn = rng(10, 30);
|
||||
rn -= g->z[mondex].armor();
|
||||
if (rn < 0)
|
||||
rn = 0;
|
||||
if (g->z[mondex].hurt(rn))
|
||||
g->kill_mon(mondex);
|
||||
} else if (g->u.posx == z->posx + i && g->u.posy == z->posy + j) {
|
||||
body_part hit = bp_legs;
|
||||
int side = rng(1, 2);
|
||||
if (one_in(4))
|
||||
hit = bp_torso;
|
||||
else if (one_in(2))
|
||||
hit = bp_feet;
|
||||
g->add_msg("A tree bursts forth from the earth and pierces your %s!",
|
||||
body_part_name(hit, side).c_str());
|
||||
g->u.hit(g, hit, side, 0, rng(10, 30));
|
||||
} else {
|
||||
int npcdex = g->npc_at(z->posx + i, z->posy + j);
|
||||
if (npcdex != -1) {
|
||||
body_part hit = bp_legs;
|
||||
int side = rng(1, 2);
|
||||
if (one_in(4))
|
||||
hit = bp_torso;
|
||||
else if (one_in(2))
|
||||
hit = bp_feet;
|
||||
if (g->u_see(z->posx + i, z->posy + j, junk))
|
||||
g->add_msg("A tree bursts forth from the earth and pierces %s's %s!",
|
||||
g->active_npc[npcdex].name.c_str(),
|
||||
body_part_name(hit, side).c_str());
|
||||
g->active_npc[npcdex].hit(g, hit, side, 0, rng(10, 30));
|
||||
} else
|
||||
g->m.ter(z->posx + i, z->posy + j) = t_tree_young;
|
||||
}
|
||||
} else if (one_in(3))
|
||||
g->m.ter(z->posx + i, z->posy + j) = t_underbrush;
|
||||
} else if (one_in(3) && g->m.is_destructable(z->posx + i, z->posy + j))
|
||||
g->m.ter(z->posx + i, z->posy + j) = t_dirtmound;
|
||||
}
|
||||
}
|
||||
|
||||
if (one_in(5)) {
|
||||
for (int i = -5; i <= 5; i++) {
|
||||
for (int j = -5; j <= 5; j++) {
|
||||
if (i != 0 || j != 0) {
|
||||
if (g->m.ter(z->posx + i, z->posy + j) == t_tree_young)
|
||||
g->m.ter(z->posx + i, z->posy + j) = t_tree;
|
||||
else if (g->m.ter(z->posx + i, z->posy + j) == t_underbrush) {
|
||||
int mondex = g->mon_at(z->posx + i, z->posy + j);
|
||||
if (mondex != -1) {
|
||||
if (g->u_see(z->posx + i, z->posy + j, junk))
|
||||
g->add_msg("Underbrush forms into a tree, and it pierces the %s!",
|
||||
g->z[mondex].name().c_str());
|
||||
int rn = rng(10, 30);
|
||||
rn -= g->z[mondex].armor();
|
||||
if (rn < 0)
|
||||
rn = 0;
|
||||
if (g->z[mondex].hurt(rn))
|
||||
g->kill_mon(mondex);
|
||||
} else if (g->u.posx == z->posx + i && g->u.posy == z->posy + j) {
|
||||
body_part hit = bp_legs;
|
||||
int side = rng(1, 2);
|
||||
if (one_in(4))
|
||||
hit = bp_torso;
|
||||
else if (one_in(2))
|
||||
hit = bp_feet;
|
||||
g->add_msg("The underbrush beneath your feet grows and pierces your %s!",
|
||||
body_part_name(hit, side).c_str());
|
||||
g->u.hit(g, hit, side, 0, rng(10, 30));
|
||||
} else {
|
||||
int npcdex = g->npc_at(z->posx + i, z->posy + j);
|
||||
if (npcdex != -1) {
|
||||
body_part hit = bp_legs;
|
||||
int side = rng(1, 2);
|
||||
if (one_in(4))
|
||||
hit = bp_torso;
|
||||
else if (one_in(2))
|
||||
hit = bp_feet;
|
||||
if (g->u_see(z->posx + i, z->posy + j, junk))
|
||||
g->add_msg("Underbrush grows into a tree, and it pierces %s's %s!",
|
||||
g->active_npc[npcdex].name.c_str(),
|
||||
body_part_name(hit, side).c_str());
|
||||
g->active_npc[npcdex].hit(g, hit, side, 0, rng(10, 30));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::fungus(game *g, monster *z)
|
||||
{
|
||||
z->moves = -200; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
monster spore(g->mtypes[mon_spore]);
|
||||
int sporex, sporey;
|
||||
int moncount = 0, mondex;
|
||||
int j;
|
||||
g->sound(z->posx, z->posy, 10, "Pouf!");
|
||||
if (g->u_see(z->posx, z->posy, j))
|
||||
g->add_msg("Spores are released from the %s!", z->name().c_str());
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
if (i == 0 && j == 0) j++; // No need to check 0, 0
|
||||
sporex = z->posx + i;
|
||||
sporey = z->posy + j;
|
||||
mondex = g->mon_at(sporex, sporey);
|
||||
if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
|
||||
if (mondex != -1) { // Spores hit a monster
|
||||
if (g->u_see(sporex, sporey, j))
|
||||
g->add_msg("The %s is covered in tiny spores!",
|
||||
g->z[mondex].name().c_str());
|
||||
if (!g->z[mondex].make_fungus(g))
|
||||
g->kill_mon(mondex);
|
||||
} else if (g->u.posx == sporex && g->u.posy == sporey)
|
||||
g->u.infect(DI_SPORES, bp_mouth, 4, 30, g);
|
||||
else {
|
||||
spore.spawn(sporex, sporey);
|
||||
g->z.push_back(spore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (moncount >= 7)
|
||||
z->poly(g->mtypes[mon_fungaloid_dormant]);
|
||||
}
|
||||
|
||||
void mattack::plant(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (g->m.has_flag(diggable, z->posx, z->posy)) {
|
||||
if (g->u_see(z->posx, z->posy, j))
|
||||
g->add_msg("The %s takes seed and becomes a fungaloid!", z->name().c_str());
|
||||
z->poly(g->mtypes[mon_fungaloid]);
|
||||
z->moves = -1000; // It takes a while
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::disappear(game *g, monster *z)
|
||||
{
|
||||
z->hp = 0;
|
||||
}
|
||||
|
||||
void mattack::formblob(game *g, monster *z)
|
||||
{
|
||||
bool didit = false;;
|
||||
int thatmon = -1;
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
thatmon = g->mon_at(z->posx + i, z->posy + j);
|
||||
if (g->u.posx == z->posx + i && g->u.posy == z->posy + i) {
|
||||
didit = true;
|
||||
g->u.add_disease(DI_SLIMED, rng(0, z->hp), g);
|
||||
} else if (thatmon != -1) {
|
||||
didit = true;
|
||||
if (g->z[thatmon].type->id == mon_blob) {
|
||||
if (g->z[thatmon].speed < 85)
|
||||
g->z[thatmon].speed += 5;
|
||||
} else if (g->z[thatmon].type->id == mon_blob_small) {
|
||||
g->z[thatmon].speed += 5;
|
||||
if (g->z[thatmon].speed >= 60)
|
||||
g->z[thatmon].poly(g->mtypes[mon_blob]);
|
||||
} else if ((g->z[thatmon].made_of(FLESH) || g->z[thatmon].made_of(VEGGY)) &&
|
||||
rng(0, z->hp) > rng(0, g->z[thatmon].hp)) {
|
||||
g->z[thatmon].poly(g->mtypes[mon_blob]);
|
||||
g->z[thatmon].speed = z->speed - rng(5, 25);
|
||||
g->z[thatmon].hp = g->z[thatmon].speed;
|
||||
}
|
||||
} else if (z->speed >= 85 && rng(0, 250) < z->speed) {
|
||||
didit = true;
|
||||
z->speed -= 15;
|
||||
monster blob(g->mtypes[mon_blob_small]);
|
||||
blob.spawn(z->posx + i, z->posy + j);
|
||||
blob.speed = z->speed - rng(30, 60);
|
||||
blob.hp = blob.speed;
|
||||
g->z.push_back(blob);
|
||||
}
|
||||
}
|
||||
if (didit) {
|
||||
z->moves = -500;
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::gene_sting(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (abs(g->u.posx - z->posx) > 7 || abs(g->u.posy - z->posy) > 7 ||
|
||||
!g->sees_u(z->posx, z->posy, j))
|
||||
return; // Not within range and/or sight
|
||||
|
||||
z->moves -= 150;
|
||||
z->sp_timeout = z->type->sp_freq;
|
||||
g->add_msg("The %s shoots a dart into you!", z->name().c_str());
|
||||
g->u.mutate(g);
|
||||
}
|
||||
|
||||
void mattack::stare(game *g, monster *z)
|
||||
{
|
||||
z->moves -= 200;
|
||||
z->sp_timeout = z->type->sp_freq;
|
||||
int j;
|
||||
if (g->sees_u(z->posx, z->posy, j)) {
|
||||
g->add_msg("The %s stares at you...", z->name().c_str());
|
||||
g->u.add_disease(DI_TELEGLOW, 800, g);
|
||||
} else {
|
||||
g->add_msg("A piercing beam of light bursts forth!");
|
||||
std::vector<point> sight = line_to(z->posx, z->posy, g->u.posx, g->u.posy, 0);
|
||||
for (int i = 0; i < sight.size(); i++) {
|
||||
if (g->m.ter(sight[i].x, sight[i].y) == t_reinforced_glass_h ||
|
||||
g->m.ter(sight[i].x, sight[i].y) == t_reinforced_glass_v)
|
||||
i = sight.size();
|
||||
else if (g->m.is_destructable(sight[i].x, sight[i].y))
|
||||
g->m.ter(sight[i].x, sight[i].y) = t_rubble;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mattack::tazer(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (abs(g->u.posx - z->posx) > 2 || abs(g->u.posy - z->posy) > 2 ||
|
||||
!g->sees_u(z->posx, z->posy, j))
|
||||
return; // Out of range
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
z->moves = -200; // It takes a while
|
||||
g->add_msg("The %s shocks you!", z->name().c_str());
|
||||
int shock = rng(1, 5);
|
||||
g->u.hurt(g, bp_torso, 0, shock * rng(1, 3));
|
||||
g->u.moves -= shock * 50;
|
||||
}
|
||||
|
||||
void mattack::smg(game *g, monster *z)
|
||||
{
|
||||
int t, j;
|
||||
if (trig_dist(z->posx, z->posy, g->u.posx, g->u.posy) > 12 ||
|
||||
!g->sees_u(z->posx, z->posy, t))
|
||||
return;
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
z->moves = -150; // It takes a while
|
||||
|
||||
if (g->u_see(z->posx, z->posy, j))
|
||||
g->add_msg("The %s fires its smg!", z->name().c_str());
|
||||
player tmp;
|
||||
tmp.name = "The " + z->name();
|
||||
tmp.sklevel[sk_smg] = 2;
|
||||
tmp.sklevel[sk_gun] = 2;
|
||||
tmp.recoil = 0;
|
||||
tmp.posx = z->posx;
|
||||
tmp.posy = z->posy;
|
||||
tmp.str_cur = 16;
|
||||
tmp.dex_cur = 12;
|
||||
tmp.per_cur = 10;
|
||||
tmp.weapon = item(g->itypes[itm_hk_mp7], 0);
|
||||
tmp.weapon.curammo = dynamic_cast<it_ammo*>(g->itypes[itm_46mm]);
|
||||
tmp.weapon.charges = 10;
|
||||
std::vector<point> traj = line_to(z->posx, z->posy, g->u.posx, g->u.posy, t);
|
||||
g->fire(tmp, g->u.posx, g->u.posy, traj, true);
|
||||
}
|
||||
|
||||
void mattack::flamethrower(game *g, monster *z)
|
||||
{
|
||||
int t;
|
||||
if (abs(g->u.posx - z->posx) > 5 || abs(g->u.posy - z->posy) > 5 ||
|
||||
!g->sees_u(z->posx, z->posy, t))
|
||||
return; // Out of range
|
||||
z->sp_timeout = z->type->sp_freq; // Reset timer
|
||||
z->moves = -500; // It takes a while
|
||||
std::vector<point> traj = line_to(z->posx, z->posy, g->u.posx, g->u.posy, t);
|
||||
for (int i = 0; i < traj.size(); i++)
|
||||
g->m.add_field(g, traj[i].x, traj[i].y, fd_fire, 1);
|
||||
g->u.add_disease(DI_ONFIRE, 8, g);
|
||||
}
|
||||
|
||||
void mattack::multi_robot(game *g, monster *z)
|
||||
{
|
||||
int t, mode = 0;
|
||||
if (!g->sees_u(z->posx, z->posy, t))
|
||||
return; // Can't see you!
|
||||
if (abs(g->u.posx - z->posx) <= 2 && abs(g->u.posy - z->posy) <= 2 &&one_in(2))
|
||||
mode = 1;
|
||||
else if (abs(g->u.posx - z->posx) <= 5 && abs(g->u.posy - z->posy) <= 5)
|
||||
mode = 2;
|
||||
else if (abs(g->u.posx - z->posx) <= 12 && abs(g->u.posy - z->posy) <= 12)
|
||||
mode = 3;
|
||||
|
||||
if (mode == 0)
|
||||
return; // No attacks were valid!
|
||||
|
||||
mattack tmp;
|
||||
switch (mode) {
|
||||
case 1: tmp.tazer(g, z); break;
|
||||
case 2: tmp.flamethrower(g, z); break;
|
||||
case 3: tmp.smg(g, z); break;
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
#ifndef _MONATTACK_H_
|
||||
#define _MONATTACK_H_
|
||||
|
||||
//#include "game.h"
|
||||
|
||||
class game;
|
||||
|
||||
class mattack
|
||||
{
|
||||
public:
|
||||
void none (game *g, monster *z) { };
|
||||
void antqueen (game *g, monster *z);
|
||||
void shriek (game *g, monster *z);
|
||||
void acid (game *g, monster *z);
|
||||
void shockstorm (game *g, monster *z);
|
||||
void boomer (game *g, monster *z);
|
||||
void resurrect (game *g, monster *z);
|
||||
void growplants (game *g, monster *z);
|
||||
void fungus (game *g, monster *z);
|
||||
void plant (game *g, monster *z);
|
||||
void disappear (game *g, monster *z);
|
||||
void formblob (game *g, monster *z);
|
||||
void gene_sting (game *g, monster *z);
|
||||
void stare (game *g, monster *z);
|
||||
void photograph (game *g, monster *z) { }; // TODO: needs faction
|
||||
void tazer (game *g, monster *z);
|
||||
void smg (game *g, monster *z);
|
||||
void flamethrower (game *g, monster *z);
|
||||
void multi_robot (game *g, monster *z); // Pick from tazer, smg, flame
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
-181
@@ -1,181 +0,0 @@
|
||||
#include "mondeath.h"
|
||||
#include "monster.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
|
||||
void mdeath::normal(game *g, monster *z)
|
||||
{
|
||||
int junk;
|
||||
if (g->u_see(z, junk))
|
||||
g->add_msg("It dies!");
|
||||
if (z->made_of(FLESH) && z->has_flag(MF_WARM)) {
|
||||
if (g->m.field_at(z->posx, z->posy).type == fd_blood &&
|
||||
g->m.field_at(z->posx, z->posy).density < 3)
|
||||
g->m.field_at(z->posx, z->posy).density++;
|
||||
else
|
||||
g->m.add_field(g, z->posx, z->posy, fd_blood, 1);
|
||||
}
|
||||
// Drop a dang ol' corpse
|
||||
// If their hp is less than -50, we destroyed them so badly no corpse was left
|
||||
if ((z->hp >= -50 || z->hp >= 0 - z->type->hp) &&
|
||||
(z->made_of(FLESH) || z->made_of(VEGGY))) {
|
||||
item tmp;
|
||||
tmp.make_corpse(g->itypes[itm_corpse], z->type, g->turn);
|
||||
g->m.add_item(z->posx, z->posy, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void mdeath::acid(game *g, monster *z)
|
||||
{
|
||||
int tmp;
|
||||
if (g->u_see(z, tmp))
|
||||
g->add_msg("The %s's corpse melts into a pool of acid.", z->name().c_str());
|
||||
g->m.add_field(g, z->posx, z->posy, fd_acid, 3);
|
||||
}
|
||||
|
||||
void mdeath::boomer(game *g, monster *z)
|
||||
{
|
||||
std::string tmp;
|
||||
g->sound(z->posx, z->posy, 24, "a boomer explode!");
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
g->m.bash(z->posx + i, z->posy + j, 14, tmp);
|
||||
if (g->m.field_at(z->posx + i, z->posy + j).type == fd_bile &&
|
||||
g->m.field_at(z->posx + i, z->posy + j).density < 3)
|
||||
g->m.field_at(z->posx + i, z->posy + j).density++;
|
||||
else
|
||||
g->m.add_field(g, z->posx + i, z->posy + j, fd_bile, 1);
|
||||
}
|
||||
}
|
||||
if (abs(z->posx - g->u.posx) <= 1 && abs(z->posy - g->u.posy) <= 1)
|
||||
g->u.infect(DI_BOOMERED, bp_eyes, 2, 24, g);
|
||||
}
|
||||
|
||||
void mdeath::fungus(game *g, monster *z)
|
||||
{
|
||||
monster spore(g->mtypes[mon_spore]);
|
||||
int sporex, sporey;
|
||||
g->sound(z->posx, z->posy, 10, "Pouf!");
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
sporex = z->posx + i;
|
||||
sporey = z->posy + j;
|
||||
if (g->m.move_cost(sporex, sporey) > 0 && one_in(5)) {
|
||||
if (g->mon_at(sporex, sporey) >= 0) { // Spores hit a monster
|
||||
if (g->u_see(sporex, sporey, j))
|
||||
g->add_msg("The %s is covered in tiny spores!",
|
||||
g->z[g->mon_at(sporex, sporey)].name().c_str());
|
||||
if (!g->z[g->mon_at(sporex, sporey)].make_fungus(g))
|
||||
g->kill_mon(g->mon_at(sporex, sporey));
|
||||
} else if (g->u.posx == sporex && g->u.posy == sporey)
|
||||
g->u.infect(DI_SPORES, bp_mouth, 4, 30, g);
|
||||
else {
|
||||
spore.spawn(sporex, sporey);
|
||||
g->z.push_back(spore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mdeath::fungusawake(game *g, monster *z)
|
||||
{
|
||||
monster newfung(g->mtypes[mon_fungaloid]);
|
||||
newfung.spawn(z->posx, z->posy);
|
||||
g->z.push_back(newfung);
|
||||
}
|
||||
|
||||
void mdeath::worm(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (g->u_see(z, j))
|
||||
g->add_msg("The %s splits in two!", z->name().c_str());
|
||||
|
||||
std::vector <point> wormspots;
|
||||
int wormx, wormy;
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
wormx = z->posx + i;
|
||||
wormy = z->posy + i;
|
||||
if (g->m.has_flag(diggable, wormx, wormy) && g->mon_at(wormx, wormy) == -1 &&
|
||||
!(g->u.posx == wormx && g->u.posy == wormy)) {
|
||||
wormspots.push_back(point(wormx, wormy));
|
||||
}
|
||||
}
|
||||
}
|
||||
int rn;
|
||||
monster worm(g->mtypes[mon_halfworm]);
|
||||
for (int worms = 0; worms < 2 && wormspots.size() > 0; worms++) {
|
||||
rn = rng(0, wormspots.size() - 1);
|
||||
worm.spawn(wormspots[rn].x, wormspots[rn].y);
|
||||
g->z.push_back(worm);
|
||||
wormspots.erase(wormspots.begin() + rn);
|
||||
}
|
||||
}
|
||||
|
||||
void mdeath::disappear(game *g, monster *z)
|
||||
{
|
||||
g->add_msg("The %s disappears! Was it in your head?", z->name().c_str());
|
||||
}
|
||||
|
||||
void mdeath::guilt(game *g, monster *z)
|
||||
{
|
||||
if (g->u.has_trait(PF_HEARTLESS))
|
||||
return; // We don't give a shit!
|
||||
g->add_msg("You feel terrible for killing %s!", z->name().c_str());
|
||||
g->u.morale -= 5;
|
||||
}
|
||||
|
||||
void mdeath::blobsplit(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
int speed = z->speed - rng(30, 50);
|
||||
if (speed <= 0) {
|
||||
if (g->u_see(z, j))
|
||||
g->add_msg("The %s splatters into tiny, dead pieces.", z->name().c_str());
|
||||
return;
|
||||
}
|
||||
monster blob(g->mtypes[(speed < 50 ? mon_blob_small : mon_blob)]);
|
||||
blob.speed = speed;
|
||||
if (g->u_see(z, j))
|
||||
g->add_msg("The %s splits!", z->name().c_str());
|
||||
blob.hp = blob.speed;
|
||||
std::vector <point> valid;
|
||||
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
if (g->m.move_cost(z->posx+i, z->posy+j) > 0 &&
|
||||
g->mon_at(z->posx+i, z->posy+j) == -1 &&
|
||||
(g->u.posx != z->posx+i || g->u.posy != z->posy + j))
|
||||
valid.push_back(point(z->posx+i, z->posy+j));
|
||||
}
|
||||
}
|
||||
|
||||
int rn;
|
||||
for (int s = 0; s < 2 && valid.size() > 0; s++) {
|
||||
rn = rng(0, valid.size() - 1);
|
||||
blob.spawn(valid[rn].x, valid[rn].y);
|
||||
g->z.push_back(blob);
|
||||
valid.erase(valid.begin() + rn);
|
||||
}
|
||||
}
|
||||
|
||||
void mdeath::melt(game *g, monster *z)
|
||||
{
|
||||
int j;
|
||||
if (g->u_see(z, j))
|
||||
g->add_msg("The %s melts away!", z->name().c_str());
|
||||
}
|
||||
|
||||
void mdeath::explode(game *g, monster *z)
|
||||
{
|
||||
int size;
|
||||
switch (z->type->size) {
|
||||
case MS_TINY: size = 4; break;
|
||||
case MS_SMALL: size = 8; break;
|
||||
case MS_MEDIUM: size = 14; break;
|
||||
case MS_LARGE: size = 20; break;
|
||||
case MS_HUGE: size = 26; break;
|
||||
}
|
||||
g->explosion(z->posx, z->posy, size, 0, false);
|
||||
}
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
#ifndef _MONDEATH_H_
|
||||
#define _MONDEATH_H_
|
||||
|
||||
class game;
|
||||
class monster;
|
||||
|
||||
class mdeath
|
||||
{
|
||||
public:
|
||||
void normal (game *g, monster *z); // Empty function
|
||||
void acid (game *g, monster *z); // Drops acid around the body
|
||||
void boomer (game *g, monster *z); // Explodes in vomit :3
|
||||
void fungus (game *g, monster *z); // Explodes in spores D:
|
||||
void fungusawake (game *g, monster *z); // Turn into live fungaloid
|
||||
void shriek (game *g, monster *z); // Screams loudly
|
||||
void worm (game *g, monster *z); // Spawns 2 half-worms
|
||||
void disappear (game *g, monster *z); // Hallucination disappears
|
||||
void guilt (game *g, monster *z); // Morale penalty
|
||||
void blobsplit (game *g, monster *z); // Creates more blobs
|
||||
void melt (game *g, monster *z); // Normal death, but melts
|
||||
void explode (game *g, monster *z); // Damaging explosion
|
||||
};
|
||||
|
||||
#endif
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
#ifndef _MONGROUP_H_
|
||||
#define _MONGROUP_H_
|
||||
|
||||
#include "mtype.h"
|
||||
#include <vector>
|
||||
|
||||
enum moncat_id {
|
||||
mcat_null = 0,
|
||||
mcat_forest,
|
||||
mcat_ant,
|
||||
mcat_bee,
|
||||
mcat_worm,
|
||||
mcat_zombie,
|
||||
mcat_plants,
|
||||
mcat_fungi,
|
||||
mcat_goo,
|
||||
mcat_chud,
|
||||
mcat_sewer,
|
||||
mcat_nether,
|
||||
num_moncats
|
||||
};
|
||||
|
||||
struct mongroup {
|
||||
moncat_id type;
|
||||
int posx, posy;
|
||||
unsigned char radius;
|
||||
unsigned int population;
|
||||
mongroup(moncat_id ptype, int pposx, int pposy, unsigned char prad,
|
||||
unsigned int ppop) {
|
||||
type = ptype;
|
||||
posx = pposx;
|
||||
posy = pposy;
|
||||
radius = prad;
|
||||
population = ppop;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "setvector.h"
|
||||
|
||||
void game::init_moncats()
|
||||
{
|
||||
setvector(
|
||||
moncats[mcat_forest],
|
||||
mon_squirrel, mon_rabbit, mon_deer, mon_wolf, mon_bear, NULL);
|
||||
setvector(
|
||||
moncats[mcat_ant],
|
||||
mon_ant_larva, mon_ant, mon_ant_soldier, NULL);
|
||||
setvector(
|
||||
moncats[mcat_bee],
|
||||
mon_bee, NULL);
|
||||
setvector(
|
||||
moncats[mcat_worm],
|
||||
mon_graboid, mon_worm, mon_halfworm, NULL);
|
||||
setvector(
|
||||
moncats[mcat_zombie],
|
||||
mon_zombie, mon_zombie_shrieker, mon_zombie_spitter, mon_zombie_fast,
|
||||
mon_zombie_electric, mon_zombie_brute, mon_zombie_hulk,
|
||||
mon_zombie_necro, mon_boomer, mon_skeleton, NULL);
|
||||
setvector(
|
||||
moncats[mcat_plants],
|
||||
mon_triffid, mon_triffid_young, mon_triffid_queen, NULL);
|
||||
setvector(
|
||||
moncats[mcat_fungi],
|
||||
mon_fungaloid, mon_fungaloid_dormant, mon_ant_fungus, mon_zombie_fungus,
|
||||
mon_boomer_fungus, mon_spore, NULL);
|
||||
setvector(
|
||||
moncats[mcat_goo],
|
||||
mon_blob, NULL);
|
||||
setvector(
|
||||
moncats[mcat_chud],
|
||||
mon_chud, mon_one_eye, mon_crawler, NULL);
|
||||
setvector(
|
||||
moncats[mcat_sewer],
|
||||
mon_sewer_fish, mon_sewer_snake, mon_sewer_rat, NULL);
|
||||
setvector(
|
||||
moncats[mcat_nether],
|
||||
mon_flying_polyp, mon_hunting_horror, mon_mi_go, mon_yugg, mon_gelatin,
|
||||
mon_flaming_eye, mon_kreck, mon_blank, NULL);
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "setvector.h"
|
||||
|
||||
void game::init_monitems()
|
||||
{
|
||||
setvector(monitems[mon_ant],
|
||||
mi_ants, 1, NULL);
|
||||
monitems[mon_ant_soldier] = monitems[mon_ant];
|
||||
monitems[mon_ant_queen] = monitems[mon_ant];
|
||||
|
||||
setvector(monitems[mon_zombie],
|
||||
mi_livingroom, 10,mi_kitchen, 8,mi_bedroom, 20,mi_dresser, 30,
|
||||
mi_softdrugs, 5,mi_harddrugs, 2,mi_tools, 6,mi_trash, 7,
|
||||
mi_ammo, 18,mi_pistols, 3,mi_shotguns, 2,mi_smg, 1,
|
||||
NULL);
|
||||
monitems[mon_zombie_shrieker] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_spitter] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_electric] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_fast] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_brute] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_hulk] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_fungus] = monitems[mon_zombie];
|
||||
monitems[mon_boomer] = monitems[mon_zombie];
|
||||
monitems[mon_boomer_fungus] = monitems[mon_zombie];
|
||||
monitems[mon_zombie_necro] = monitems[mon_zombie];
|
||||
|
||||
setvector(monitems[mon_chud],
|
||||
mi_subway, 40,mi_sewer, 20,mi_trash, 5,mi_bedroom, 1,
|
||||
mi_dresser, 5,mi_ammo, 18, NULL);
|
||||
monitems[mon_one_eye] = monitems[mon_chud];
|
||||
|
||||
setvector(monitems[mon_bee],
|
||||
mi_bees, 1, NULL);
|
||||
|
||||
setvector(monitems[mon_eyebot],
|
||||
mi_robots, 4, mi_ammo, 1,NULL);
|
||||
monitems[mon_manhack] = monitems[mon_eyebot];
|
||||
monitems[mon_skitterbot] = monitems[mon_eyebot];
|
||||
monitems[mon_secubot] = monitems[mon_eyebot];
|
||||
monitems[mon_molebot] = monitems[mon_eyebot];
|
||||
monitems[mon_tripod] = monitems[mon_eyebot];
|
||||
monitems[mon_chickenbot] = monitems[mon_eyebot];
|
||||
monitems[mon_tankbot] = monitems[mon_eyebot];
|
||||
monitems[mon_turret] = monitems[mon_eyebot];
|
||||
}
|
||||
-499
@@ -1,499 +0,0 @@
|
||||
// Monster movement code; essentially, the AI
|
||||
|
||||
#include "monster.h"
|
||||
#include "map.h"
|
||||
#include "game.h"
|
||||
#include "line.h"
|
||||
#include "rng.h"
|
||||
#include "pldata.h"
|
||||
#include <stdlib.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#ifndef SGN
|
||||
#define SGN(a) (((a)<0) ? -1 : 1)
|
||||
#endif
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
bool monster::wander()
|
||||
{
|
||||
if (plans.empty()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool monster::can_move_to(map &m, int x, int y)
|
||||
{
|
||||
if (m.move_cost(x, y) == 0 &&
|
||||
(!has_flag(MF_DESTROYS) || !m.is_destructable(x, y)) &&
|
||||
((!has_flag(MF_AQUATIC) && !has_flag(MF_SWIMS)) ||
|
||||
!m.has_flag(swimmable, x, y)))
|
||||
return false;
|
||||
if (has_flag(MF_DIGS) && !m.has_flag(diggable, x, y))
|
||||
return false;
|
||||
if (has_flag(MF_AQUATIC) && !m.has_flag(swimmable, x, y))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Resets plans (list of squares to visit) and builds it as a straight line
|
||||
// to the destination (x,y). t is used to choose which eligable line to use.
|
||||
// Currently, this assumes we can see (x,y), so shouldn't be used in any other
|
||||
// circumstance (or else the monster will "phase" through solid terrain!)
|
||||
void monster::set_dest(int x, int y, int &t)
|
||||
{
|
||||
plans.clear();
|
||||
// TODO: This causes a segfault, once in a blue moon! Whyyyyy.
|
||||
plans = line_to(posx, posy, x, y, t);
|
||||
}
|
||||
|
||||
// Move towards (x,y) for f more turns--generally if we hear a sound there
|
||||
// "Stupid" movement; "if (wandx < posx) posx--;" etc.
|
||||
void monster::wander_to(int x, int y, int f)
|
||||
{
|
||||
wandx = x;
|
||||
wandy = y;
|
||||
wandf = f;
|
||||
if (has_flag(MF_GOODHEARING))
|
||||
wandf *= 6;
|
||||
}
|
||||
|
||||
void monster::plan(game *g)
|
||||
{
|
||||
int sightrange = g->light_level();
|
||||
int closest = -1;
|
||||
int dist = 1000;
|
||||
int tc, stc;
|
||||
if (friendly != 0) { // Target monsters, not the player!
|
||||
for (int i = 0; i < g->z.size(); i++) {
|
||||
monster *tmp = &(g->z[i]);
|
||||
if (tmp->friendly == 0 && rl_dist(posx, posy, tmp->posx, tmp->posy) < dist &&
|
||||
g->m.sees(posx, posy, tmp->posx, tmp->posy, sightrange, tc)) {
|
||||
closest = i;
|
||||
dist = rl_dist(posx, posy, tmp->posx, tmp->posy);
|
||||
stc = tc;
|
||||
}
|
||||
}
|
||||
if (closest >= 0)
|
||||
set_dest(g->z[closest].posx, g->z[closest].posy, stc);
|
||||
else if (friendly > 0 && one_in(3)) // Grow restless with no targets
|
||||
friendly--;
|
||||
else if (friendly < 0 && g->sees_u(posx, posy, tc)) {
|
||||
if (rl_dist(posx, posy, g->u.posx, g->u.posy) > 2)
|
||||
set_dest(g->u.posx, g->u.posy, tc);
|
||||
else
|
||||
plans.clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (is_fleeing(g->u) && has_flag(MF_SEES) && g->sees_u(posx, posy, tc) &&
|
||||
(!g->u.has_trait(PF_ANIMALEMPATH) || !has_flag(MF_ANIMAL))) {
|
||||
wandx = posx * 2 - g->u.posx;
|
||||
wandy = posy * 2 - g->u.posy;
|
||||
wandf = 40;
|
||||
}
|
||||
// If we can see, and we can see a character, start moving towards them
|
||||
if (!is_fleeing(g->u) && has_flag(MF_SEES)) {
|
||||
if (g->sees_u(posx, posy, tc)) {
|
||||
dist = rl_dist(posx, posy, g->u.posx, g->u.posy);
|
||||
closest = -2;
|
||||
stc = tc;
|
||||
}
|
||||
for (int i = 0; i < g->active_npc.size(); i++) {
|
||||
npc *me = &(g->active_npc[i]);
|
||||
if (rl_dist(posx, posy, me->posx, me->posy) < dist &&
|
||||
g->m.sees(posx, posy, me->posx, me->posy, sightrange, tc)) {
|
||||
dist = rl_dist(posx, posy, me->posx, me->posy);
|
||||
closest = i;
|
||||
stc = tc;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < g->z.size(); i++) {
|
||||
monster *mon = &(g->z[i]);
|
||||
if (mon->friendly != 0 && rl_dist(posx, posy, mon->posx, mon->posy) < dist &&
|
||||
g->m.sees(posx, posy, mon->posx, mon->posy, sightrange, tc)) {
|
||||
dist = rl_dist(posx, posy, mon->posx, mon->posy);
|
||||
closest = -3 - i;
|
||||
stc = tc;
|
||||
}
|
||||
}
|
||||
if (closest == -2)
|
||||
set_dest(g->u.posx, g->u.posy, stc);
|
||||
else if (closest <= -3)
|
||||
set_dest(g->z[-3 - closest].posx, g->z[-3 - closest].posy, stc);
|
||||
else if (closest >= 0)
|
||||
set_dest(g->active_npc[closest].posx, g->active_npc[closest].posy, stc);
|
||||
}
|
||||
}
|
||||
|
||||
// General movement.
|
||||
// Currently, priority goes:
|
||||
// 1) Special Attack
|
||||
// 2) Sight-based tracking
|
||||
// 3) Scent-based tracking
|
||||
// 4) Sound-based tracking
|
||||
void monster::move(game *g)
|
||||
{
|
||||
// We decrement wandf no matter what. We'll save our wander_to plans until
|
||||
// after we finish out set_dest plans, UNLESS they time out first.
|
||||
if (wandf > 0)
|
||||
wandf--;
|
||||
|
||||
// First, use the special attack, if we can!
|
||||
if (sp_timeout > 0)
|
||||
sp_timeout--;
|
||||
if (sp_timeout == 0 && friendly == 0) {
|
||||
mattack ma;
|
||||
(ma.*type->sp_attack)(g, this);
|
||||
}
|
||||
if (moves < 0)
|
||||
return;
|
||||
if (has_flag(MF_IMMOBILE)) {
|
||||
moves = 0;
|
||||
return;
|
||||
}
|
||||
if (friendly != 0) {
|
||||
if (friendly > 0)
|
||||
friendly--;
|
||||
friendly_move(g);
|
||||
return;
|
||||
}
|
||||
if (!is_fleeing(g->u) && has_flag(MF_ANIMAL)) {
|
||||
stumble(g, false);
|
||||
moves = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
moves -= 100;
|
||||
int rn=0, hmove=0;
|
||||
bool moved=false, xbest=false;
|
||||
point next;
|
||||
int x, x2, x3, y, y2, y3, junk;
|
||||
rn = rng(0, 50);
|
||||
hmove = rng(0, 5);
|
||||
int mondex = (plans.size() > 0 ? g->mon_at(plans[0].x, plans[0].y) : -1);
|
||||
|
||||
if (plans.size() > 0 &&
|
||||
(mondex == -1 || g->z[mondex].friendly != 0 || has_flag(MF_ATTACKMON)) &&
|
||||
(can_move_to(g->m, plans[0].x, plans[0].y) ||
|
||||
(plans[0].x == g->u.posx && plans[0].y == g->u.posy) ||
|
||||
(g->m.has_flag(bashable, plans[0].x, plans[0].y) && has_flag(MF_BASHES)))){
|
||||
// CONCRETE PLANS - Most likely based on sight
|
||||
next = plans[0];
|
||||
moved = true;
|
||||
} else if (has_flag(MF_SMELLS)) {
|
||||
// No sight... or our plans are invalid (e.g. moving through a transparent, but
|
||||
// solid, square of terrain). Fall back to smell if we have it.
|
||||
point tmp = scent_move(g);
|
||||
if (tmp.x != -1) {
|
||||
next = tmp;
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
if (wandf > 0 && !moved) { // No LOS, no scent, so as a fall-back follow sound
|
||||
point tmp = sound_move(g);
|
||||
if (tmp.x != posx || tmp.y != posy) {
|
||||
next = tmp;
|
||||
moved = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Finished logic section. By this point, we should have chosen a square to
|
||||
// move to (moved = true).
|
||||
if (moved) { // Actual effects of moving to the square we've chosen
|
||||
mondex = g->mon_at(next.x, next.y);
|
||||
int npcdex = g->npc_at(next.x, next.y);
|
||||
if (next.x == g->u.posx && next.y == g->u.posy && type->melee_dice > 0)
|
||||
hit_player(g, g->u);
|
||||
else if (mondex != -1 && type->melee_dice > 0 &&
|
||||
(g->z[mondex].friendly != 0 || has_flag(MF_ATTACKMON)))
|
||||
hit_monster(g, mondex);
|
||||
else if (npcdex != -1 && type->melee_dice > 0)
|
||||
hit_player(g, g->active_npc[npcdex]);
|
||||
else if ((!can_move_to(g->m, next.x, next.y) || one_in(3)) &&
|
||||
g->m.has_flag(bashable, next.x, next.y) && has_flag(MF_BASHES)) {
|
||||
std::string bashsound = "NOBASH"; // If we hear "NOBASH" it's time to debug!
|
||||
int bashskill = int(type->melee_dice * type->melee_sides);
|
||||
g->m.bash(next.x, next.y, bashskill, bashsound);
|
||||
g->sound(next.x, next.y, 18, bashsound);
|
||||
} else if (g->m.move_cost(next.x, next.y) == 0 && has_flag(MF_DESTROYS)) {
|
||||
g->m.destroy(g, next.x, next.y, true);
|
||||
moves -= 250;
|
||||
} else if (can_move_to(g->m, next.x, next.y))
|
||||
move_to(g, next.x, next.y);
|
||||
}
|
||||
|
||||
// If we're close to our target, we get focused and don't stumble
|
||||
if ((has_flag(MF_STUMBLES) && (plans.size() > 3 || plans.size() == 0)) ||
|
||||
!moved)
|
||||
stumble(g, moved);
|
||||
}
|
||||
|
||||
void monster::friendly_move(game *g)
|
||||
{
|
||||
point next;
|
||||
bool moved = false;
|
||||
moves -= 100;
|
||||
if (plans.size() > 0 && (plans[0].x != g->u.posx || plans[0].y != g->u.posy) &&
|
||||
(can_move_to(g->m, plans[0].x, plans[0].y) ||
|
||||
(g->m.has_flag(bashable, plans[0].x, plans[0].y) && has_flag(MF_BASHES)))){
|
||||
next = plans[0];
|
||||
plans.erase(plans.begin());
|
||||
moved = true;
|
||||
} else
|
||||
stumble(g, moved);
|
||||
if (moved) {
|
||||
int mondex = g->mon_at(next.x, next.y);
|
||||
int npcdex = g->npc_at(next.x, next.y);
|
||||
if (mondex != -1 && type->melee_dice > 0)
|
||||
hit_monster(g, mondex);
|
||||
else if (npcdex != -1 && type->melee_dice > 0)
|
||||
hit_player(g, g->active_npc[g->npc_at(next.x, next.y)]);
|
||||
else if (mondex == -1 && npcdex == -1 && can_move_to(g->m, next.x, next.y))
|
||||
move_to(g, next.x, next.y);
|
||||
else if ((!can_move_to(g->m, next.x, next.y) || one_in(3)) &&
|
||||
g->m.has_flag(bashable, next.x, next.y) && has_flag(MF_BASHES)) {
|
||||
std::string bashsound = "NOBASH"; // If we hear "NOBASH" it's time to debug!
|
||||
int bashskill = int(type->melee_dice * type->melee_sides);
|
||||
g->m.bash(next.x, next.y, bashskill, bashsound);
|
||||
g->sound(next.x, next.y, 18, bashsound);
|
||||
} else if (g->m.move_cost(next.x, next.y) == 0 && has_flag(MF_DESTROYS)) {
|
||||
g->m.destroy(g, next.x, next.y, true);
|
||||
moves -= 250;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
point monster::scent_move(game *g)
|
||||
{
|
||||
plans.clear();
|
||||
std::vector<point> smoves;
|
||||
int maxsmell = 1; // Squares with smell 0 are not eligable targets
|
||||
int minsmell = 9999;
|
||||
point pbuff, next(-1, -1);
|
||||
unsigned int smell;
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
smell = g->scent(posx + x, posy + y);
|
||||
if ((g->mon_at(posx + x, posy + y) == -1 || has_flag(MF_ATTACKMON)) &&
|
||||
(can_move_to(g->m, posx + x, posy + y) ||
|
||||
(posx + x == g->u.posx && posx + y == g->u.posy) ||
|
||||
(g->m.has_flag(bashable, posx + x, posy + y) && has_flag(MF_BASHES)))) {
|
||||
if ((!is_fleeing(g->u) && smell > maxsmell) ||
|
||||
( is_fleeing(g->u) && smell < minsmell) ) {
|
||||
smoves.clear();
|
||||
pbuff.x = posx + x;
|
||||
pbuff.y = posy + y;
|
||||
smoves.push_back(pbuff);
|
||||
maxsmell = smell;
|
||||
minsmell = smell;
|
||||
} else if ((!is_fleeing(g->u) && smell == maxsmell) ||
|
||||
( is_fleeing(g->u) && smell == minsmell) ) {
|
||||
pbuff.x = posx + x;
|
||||
pbuff.y = posy + y;
|
||||
smoves.push_back(pbuff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (smoves.size() > 0) {
|
||||
int nextsq = rng(0, smoves.size() - 1);
|
||||
next = smoves[nextsq];
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
point monster::sound_move(game *g)
|
||||
{
|
||||
plans.clear();
|
||||
point next;
|
||||
bool xbest = true;
|
||||
if (abs(wandy - posy) > abs(wandx - posx))// which is more important
|
||||
xbest = false;
|
||||
next.x = posx;
|
||||
next.y = posy;
|
||||
int x = posx, x2 = posx - 1, x3 = posx + 1;
|
||||
int y = posy, y2 = posy - 1, y3 = posy + 1;
|
||||
if (wandx < posx) { x--; x2++; }
|
||||
if (wandx > posx) { x++; x2++; x3 -= 2; }
|
||||
if (wandy < posy) { y--; y2++; }
|
||||
if (wandy > posy) { y++; y2++; y3 -= 2; }
|
||||
if (xbest) {
|
||||
if (can_move_to(g->m, x, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y))) {
|
||||
next.x = x;
|
||||
next.y = y;
|
||||
} else if (can_move_to(g->m, x, y2) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y2))) {
|
||||
next.x = x;
|
||||
next.y = y2;
|
||||
} else if (can_move_to(g->m, x2, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x2, y))) {
|
||||
next.x = x2;
|
||||
next.y = y;
|
||||
} else if (can_move_to(g->m, x, y3) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y3))) {
|
||||
next.x = x;
|
||||
next.y = y3;
|
||||
} else if (can_move_to(g->m, x3, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x3, y))) {
|
||||
next.x = x3;
|
||||
next.y = y;
|
||||
}
|
||||
} else {
|
||||
if (can_move_to(g->m, x, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y))) {
|
||||
next.x = x;
|
||||
next.y = y;
|
||||
} else if (can_move_to(g->m, x2, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x2, y))) {
|
||||
next.x = x2;
|
||||
next.y = y;
|
||||
} else if (can_move_to(g->m, x, y2) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y2))) {
|
||||
next.x = x;
|
||||
next.y = y2;
|
||||
} else if (can_move_to(g->m, x3, y) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x3, y))) {
|
||||
next.x = x3;
|
||||
next.y = y;
|
||||
} else if (can_move_to(g->m, x, y3) || (x == g->u.posx && y == g->u.posy) ||
|
||||
(has_flag(MF_BASHES) && g->m.has_flag(bashable, x, y3))) {
|
||||
next.x = x;
|
||||
next.y = y3;
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
void monster::hit_player(game *g, player &p)
|
||||
{
|
||||
if (type->melee_dice == 0) // We don't attack, so just return
|
||||
return;
|
||||
bool is_npc = p.is_npc();
|
||||
int junk;
|
||||
bool u_see = (!is_npc || g->u_see(p.posx, p.posy, junk));
|
||||
std::string you = (is_npc ? p.name : "you");
|
||||
std::string your = (is_npc ? p.name + "'s" : "your");
|
||||
std::string Your = (is_npc ? p.name + "'s" : "Your");
|
||||
body_part bphit;
|
||||
int side = rng(0, 1);
|
||||
int dam = hit(p, bphit);
|
||||
if (dam == 0 && u_see)
|
||||
g->add_msg("The %s misses %s.", name().c_str(), you.c_str());
|
||||
else if (dam > 0) {
|
||||
if (u_see)
|
||||
g->add_msg("The %s hits %s %s.", name().c_str(), your.c_str(),
|
||||
body_part_name(bphit, side).c_str());
|
||||
if (!is_npc) {
|
||||
if (g->u.activity.type == ACT_RELOAD)
|
||||
g->add_msg("You stop reloading.");
|
||||
else if (g->u.activity.type == ACT_READ)
|
||||
g->add_msg("You stop reading.");
|
||||
else if (g->u.activity.type == ACT_CRAFT)
|
||||
g->add_msg("You stop crafting.");
|
||||
g->u.activity.type = ACT_NULL;
|
||||
}
|
||||
if (p.has_active_bionic(bio_ods)) {
|
||||
if (u_see)
|
||||
g->add_msg("%s offensive defense system shocks it!", Your.c_str());
|
||||
hurt(rng(10, 40));
|
||||
}
|
||||
if (p.encumb(bphit) == 0 &&
|
||||
(p.has_trait(PF_SPINES) || p.has_trait(PF_QUILLS))) {
|
||||
int spine = rng(1, (p.has_trait(PF_QUILLS) ? 20 : 8));
|
||||
g->add_msg("%s %s puncture it!", Your.c_str(),
|
||||
(g->u.has_trait(PF_QUILLS) ? "quills" : "spines"));
|
||||
hurt(spine);
|
||||
}
|
||||
p.hit(g, bphit, side, dam, type->melee_cut);
|
||||
if (has_flag(MF_VENOM)) {
|
||||
if (!is_npc)
|
||||
g->add_msg("You're poisoned!");
|
||||
p.add_disease(DI_POISON, 30, g);
|
||||
}
|
||||
}
|
||||
if (is_npc) {
|
||||
if (p.hp_cur[hp_head] <= 0 || p.hp_cur[hp_torso] <= 0) {
|
||||
npc* tmp = dynamic_cast<npc*>(&p);
|
||||
tmp->die(g);
|
||||
int index = g->npc_at(p.posx, p.posy);
|
||||
g->active_npc.erase(g->active_npc.begin() + index);
|
||||
plans.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void monster::move_to(game *g, int x, int y)
|
||||
{
|
||||
int mondex = g->mon_at(x, y);
|
||||
if (mondex == -1) { //...assuming there's no monster there
|
||||
if (plans.size() > 0)
|
||||
plans.erase(plans.begin());
|
||||
if (has_flag(MF_SWIMS) && g->m.has_flag(swimmable, x, y))
|
||||
moves += 50;
|
||||
if (!has_flag(MF_DIGS) && !has_flag(MF_FLIES) &&
|
||||
(!has_flag(MF_SWIMS) || !g->m.has_flag(swimmable, x, y)))
|
||||
moves -= (g->m.move_cost(x, y) - 2) * 50;
|
||||
posx = x;
|
||||
posy = y;
|
||||
if (g->m.tr_at(posx, posy) != tr_null) { // Monster stepped on a trap!
|
||||
trap* tr = g->traps[g->m.tr_at(posx, posy)];
|
||||
if (dice(3, sk_dodge + 1) < dice(3, tr->avoidance)) {
|
||||
trapfuncm f;
|
||||
(f.*(tr->actm))(g, this, posx, posy);
|
||||
}
|
||||
}
|
||||
// Diggers turn the dirt into dirtmound
|
||||
if (has_flag(MF_DIGS))
|
||||
g->m.ter(posx, posy) = t_dirtmound;
|
||||
} else if (has_flag(MF_ATTACKMON) || g->z[mondex].friendly != 0)
|
||||
// If there IS a monster there, and we fight monsters, fight it!
|
||||
hit_monster(g, mondex);
|
||||
}
|
||||
|
||||
/* Random walking even when we've moved
|
||||
* To simulate zombie stumbling and ineffective movement
|
||||
* Note that this is sub-optimal; stumbling may INCREASE a zombie's speed.
|
||||
* Most of the time (out in the open) this effect is insignificant compared to
|
||||
* the negative effects, but in a hallway it's perfectly even
|
||||
*/
|
||||
void monster::stumble(game *g, bool moved)
|
||||
{
|
||||
std::vector <point> valid_stumbles;
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
if (can_move_to(g->m, posx + i, posy + j) &&
|
||||
(g->u.posx != posx + i || g->u.posy != posy + j) &&
|
||||
(g->mon_at(posx + i, posy + j) == -1 || (i == 0 && j == 0))) {
|
||||
point tmp(posx + i, posy + j);
|
||||
valid_stumbles.push_back(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (valid_stumbles.size() > 0 && (one_in(8) || (!moved && one_in(3)))) {
|
||||
int choice = rng(0, valid_stumbles.size() - 1);
|
||||
posx = valid_stumbles[choice].x;
|
||||
posy = valid_stumbles[choice].y;
|
||||
if (!has_flag(MF_DIGS) || !has_flag(MF_FLIES))
|
||||
moves -= (g->m.move_cost(posx, posy) - 2) * 50;
|
||||
// Here we have to fix our plans[] list, trying to get back to the last point
|
||||
// Otherwise the stumble will basically have no effect!
|
||||
if (plans.size() > 0) {
|
||||
int tc;
|
||||
if (g->m.sees(posx, posy, plans[0].x, plans[0].y, -1, tc)) {
|
||||
// Copy out old plans...
|
||||
std::vector <point> plans2;
|
||||
for (int i = 0; i < plans.size(); i++)
|
||||
plans2.push_back(plans[i]);
|
||||
// Set plans to a route between where we are now, and where we were
|
||||
set_dest(plans[0].x, plans[0].y, tc);
|
||||
// Append old plans to the new plans
|
||||
for (int index = 0; index < plans2.size(); index++)
|
||||
plans.push_back(plans2[index]);
|
||||
} else
|
||||
plans.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
-433
@@ -1,433 +0,0 @@
|
||||
#include "monster.h"
|
||||
#include "map.h"
|
||||
#include "mondeath.h"
|
||||
#include "output.h"
|
||||
#include "game.h"
|
||||
#include "rng.h"
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <ncurses.h>
|
||||
|
||||
#define SGN(a) (((a)<0) ? -1 : 1)
|
||||
#define SQR(a) (a*a)
|
||||
|
||||
monster::monster()
|
||||
{
|
||||
/*
|
||||
mvprintz(10, 30, c_red, "INVALID MONSTER!");
|
||||
getch();
|
||||
*/
|
||||
posx = 20;
|
||||
posy = 10;
|
||||
wandx = -1;
|
||||
wandy = -1;
|
||||
wandf = 0;
|
||||
hp = 60;
|
||||
moves = 0;
|
||||
sp_timeout = 0;
|
||||
spawnmapx = -1;
|
||||
spawnmapy = -1;
|
||||
spawnposx = -1;
|
||||
spawnposy = -1;
|
||||
friendly = 0;
|
||||
dead = false;
|
||||
}
|
||||
|
||||
monster::monster(mtype *t)
|
||||
{
|
||||
posx = 20;
|
||||
posy = 10;
|
||||
wandx = -1;
|
||||
wandy = -1;
|
||||
wandf = 0;
|
||||
type = t;
|
||||
moves = type->speed;
|
||||
speed = type->speed;
|
||||
hp = type->hp;
|
||||
sp_timeout = rng(0, type->sp_freq);
|
||||
spawnmapx = -1;
|
||||
spawnmapy = -1;
|
||||
spawnposx = -1;
|
||||
spawnposy = -1;
|
||||
friendly = 0;
|
||||
dead = false;
|
||||
}
|
||||
|
||||
monster::monster(mtype *t, int x, int y)
|
||||
{
|
||||
posx = x;
|
||||
posy = y;
|
||||
wandx = -1;
|
||||
wandy = -1;
|
||||
wandf = 0;
|
||||
type = t;
|
||||
moves = type->speed;
|
||||
speed = type->speed;
|
||||
hp = type->hp;
|
||||
sp_timeout = type->sp_freq;
|
||||
spawnmapx = -1;
|
||||
spawnmapy = -1;
|
||||
spawnposx = -1;
|
||||
spawnposy = -1;
|
||||
friendly = 0;
|
||||
dead = false;
|
||||
}
|
||||
|
||||
void monster::poly(mtype *t)
|
||||
{
|
||||
type = t;
|
||||
moves = 0;
|
||||
speed = type->speed;
|
||||
hp = type->hp;
|
||||
sp_timeout = type->sp_freq;
|
||||
}
|
||||
|
||||
void monster::spawn(int x, int y)
|
||||
{
|
||||
posx = x;
|
||||
posy = y;
|
||||
}
|
||||
|
||||
monster::~monster()
|
||||
{
|
||||
}
|
||||
|
||||
std::string monster::name()
|
||||
{
|
||||
return type->name;
|
||||
}
|
||||
|
||||
void monster::print_info(game *g, WINDOW* w)
|
||||
{
|
||||
// First line of w is the border; the next two are terrain info, and after that
|
||||
// is a blank line. w is 13 characters tall, and we can't use the last one
|
||||
// because it's a border as well; so we have lines 4 through 11.
|
||||
// w is also 48 characters wide - 2 characters for border = 46 characters for us
|
||||
mvwprintz(w, 6, 1, type->color, type->name.c_str());
|
||||
if (friendly != 0) {
|
||||
wprintz(w, c_white, " ");
|
||||
wprintz(w, h_white, "Friendly!");
|
||||
}
|
||||
std::string damage_info;
|
||||
nc_color col;
|
||||
if (hp == type->hp) {
|
||||
damage_info = "It is uninjured";
|
||||
col = c_green;
|
||||
} else if (hp >= type->hp * .8) {
|
||||
damage_info = "It is lightly injured";
|
||||
col = c_ltgreen;
|
||||
} else if (hp >= type->hp * .6) {
|
||||
damage_info = "It is moderately injured";
|
||||
col = c_yellow;
|
||||
} else if (hp >= type->hp * .3) {
|
||||
damage_info = "It is heavily injured";
|
||||
col = c_yellow;
|
||||
} else if (hp >= type->hp * .1) {
|
||||
damage_info = "It is severly injured";
|
||||
col = c_ltred;
|
||||
} else {
|
||||
damage_info = "it is nearly dead";
|
||||
col = c_red;
|
||||
}
|
||||
mvwprintz(w, 7, 1, col, damage_info.c_str());
|
||||
if (is_fleeing(g->u))
|
||||
wprintz(w, c_white, ", and it is fleeing.");
|
||||
else
|
||||
wprintz(w, col, ".");
|
||||
|
||||
|
||||
std::string tmp = type->description;
|
||||
std::string out;
|
||||
size_t pos;
|
||||
int line = 8;
|
||||
do {
|
||||
pos = tmp.find_first_of('\n');
|
||||
out = tmp.substr(0, pos);
|
||||
mvwprintz(w, line, 1, c_white, out.c_str());
|
||||
tmp = tmp.substr(pos + 1);
|
||||
line++;
|
||||
} while (pos != std::string::npos && line < 12);
|
||||
}
|
||||
|
||||
char monster::symbol()
|
||||
{
|
||||
return type->sym;
|
||||
}
|
||||
|
||||
void monster::draw(WINDOW *w, int plx, int ply, bool inv)
|
||||
{
|
||||
int x = SEEX + posx - plx;
|
||||
int y = SEEY + posy - ply;
|
||||
nc_color color = type->color;
|
||||
if (friendly != 0 && !inv)
|
||||
color = hilite(color);
|
||||
if (inv)
|
||||
mvwputch_inv(w, y, x, color, type->sym);
|
||||
else
|
||||
mvwputch(w, y, x, color, type->sym);
|
||||
}
|
||||
|
||||
bool monster::has_flag(m_flags f)
|
||||
{
|
||||
return type->flags & mfb(f);
|
||||
}
|
||||
|
||||
bool monster::made_of(material m)
|
||||
{
|
||||
if (type->mat == m)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void monster::load_info(std::string data, std::vector <mtype*> *mtypes)
|
||||
{
|
||||
std::stringstream dump;
|
||||
int idtmp, plansize;
|
||||
dump << data;
|
||||
dump >> idtmp >> posx >> posy >> wandx >> wandy >> wandf >> moves >> speed >>
|
||||
hp >> sp_timeout >> plansize >> friendly >> dead;
|
||||
type = (*mtypes)[idtmp];
|
||||
point ptmp;
|
||||
for (int i = 0; i < plansize; i++) {
|
||||
dump >> ptmp.x >> ptmp.y;
|
||||
plans.push_back(ptmp);
|
||||
}
|
||||
}
|
||||
|
||||
std::string monster::save_info()
|
||||
{
|
||||
std::stringstream pack;
|
||||
pack << int(type->id) << " " << posx << " " << posy << " " << wandx << " " <<
|
||||
wandy << " " << wandf << " " << moves << " " << speed << " " << hp <<
|
||||
" " << sp_timeout << " " << plans.size() << " " << friendly << " " <<
|
||||
dead;
|
||||
for (int i = 0; i < plans.size(); i++) {
|
||||
pack << " " << plans[i].x << " " << plans[i].y;
|
||||
}
|
||||
return pack.str();
|
||||
}
|
||||
|
||||
void monster::debug(player &u)
|
||||
{
|
||||
char buff[2];
|
||||
debugmsg("%s has %d steps planned.", name().c_str(), plans.size());
|
||||
debugmsg("%s Moves %d Speed %d HP %d",name().c_str(), moves, speed, hp);
|
||||
for (int i = 0; i < plans.size(); i++) {
|
||||
sprintf(buff, "%d", i);
|
||||
if (i < 10) mvaddch(plans[i].y - SEEY + u.posy, plans[i].x - SEEX + u.posx,
|
||||
buff[0]);
|
||||
else mvaddch(plans[i].y - SEEY + u.posy, plans[i].x - SEEX + u.posx, buff[1]);
|
||||
}
|
||||
getch();
|
||||
}
|
||||
|
||||
void monster::shift(int sx, int sy)
|
||||
{
|
||||
posx -= sx * SEEX;
|
||||
posy -= sy * SEEY;
|
||||
for (int i = 0; i < plans.size(); i++) {
|
||||
plans[i].x -= sx * SEEX;
|
||||
plans[i].y -= sy * SEEY;
|
||||
}
|
||||
}
|
||||
|
||||
bool monster::is_fleeing(player &u)
|
||||
{
|
||||
// fleefactor is by default the agressiveness of the animal, minus the
|
||||
// percentage of remaining HP times five. So, aggresiveness of 5 has a
|
||||
// fleefactor of 2 AT MINIMUM.
|
||||
if (type->hp == 0)
|
||||
debugmsg("%s has type->hp of 0!", type->name.c_str());
|
||||
|
||||
if (friendly != 0)
|
||||
return false;
|
||||
|
||||
int fleefactor = type->agro - ((4 * (type->hp - hp)) / type->hp);
|
||||
if (u.has_trait(PF_ANIMALEMPATH) && has_flag(MF_ANIMAL)) {
|
||||
if (type->agro > 0) // Agressive animals flee instead
|
||||
fleefactor -= 5;
|
||||
else // Scared animals approach you
|
||||
return false;
|
||||
}
|
||||
if (u.has_trait(PF_TERRIFYING))
|
||||
fleefactor -= 1;
|
||||
if (fleefactor > 0)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
int monster::hit(player &p, body_part &bp_hit)
|
||||
{
|
||||
int numdice = type->melee_skill;
|
||||
if (dice(numdice, 10) <= dice(p.dodge(), 10))
|
||||
return 0; // We missed!
|
||||
int ret = 0;
|
||||
int highest_hit;
|
||||
switch (type->size) {
|
||||
case MS_TINY:
|
||||
highest_hit = 3;
|
||||
break;
|
||||
case MS_SMALL:
|
||||
highest_hit = 12;
|
||||
break;
|
||||
case MS_MEDIUM:
|
||||
highest_hit = 20;
|
||||
break;
|
||||
case MS_LARGE:
|
||||
highest_hit = 28;
|
||||
break;
|
||||
case MS_HUGE:
|
||||
highest_hit = 35;
|
||||
break;
|
||||
}
|
||||
|
||||
if (has_flag(MF_DIGS))
|
||||
highest_hit -= 8;
|
||||
if (has_flag(MF_FLIES))
|
||||
highest_hit += 15;
|
||||
if (highest_hit <= 1)
|
||||
highest_hit = 2;
|
||||
if (highest_hit > 20)
|
||||
highest_hit = 20;
|
||||
|
||||
int bp_rand = rng(0, highest_hit - 1);
|
||||
if (bp_rand <= 2)
|
||||
bp_hit = bp_legs;
|
||||
else if (bp_rand <= 10)
|
||||
bp_hit = bp_torso;
|
||||
else if (bp_rand <= 14)
|
||||
bp_hit = bp_arms;
|
||||
else if (bp_rand <= 16)
|
||||
bp_hit = bp_mouth;
|
||||
else if (bp_rand == 17)
|
||||
bp_hit = bp_eyes;
|
||||
else
|
||||
bp_hit = bp_head;
|
||||
ret += dice(type->melee_dice, type->melee_sides);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void monster::hit_monster(game *g, int i)
|
||||
{
|
||||
int junk;
|
||||
monster* target = &(g->z[i]);
|
||||
|
||||
int numdice = type->melee_skill;
|
||||
int dodgedice = target->type->sk_dodge;
|
||||
switch (target->type->size) {
|
||||
case MS_TINY: dodgedice += 2; break;
|
||||
case MS_SMALL: dodgedice += 1; break;
|
||||
case MS_LARGE: numdice += 1; break;
|
||||
case MS_HUGE: numdice += 3; break;
|
||||
}
|
||||
|
||||
if (dice(numdice, 10) <= dice(dodgedice, 10)) {
|
||||
if (g->u_see(this, junk))
|
||||
g->add_msg("The %s misses the %s!", name().c_str(), target->name().c_str());
|
||||
return;
|
||||
}
|
||||
if (g->u_see(this, junk))
|
||||
g->add_msg("The %s hits the %s!", name().c_str(), target->name().c_str());
|
||||
int damage = dice(type->melee_dice, type->melee_sides);
|
||||
if (target->hurt(damage))
|
||||
g->kill_mon(i);
|
||||
}
|
||||
|
||||
|
||||
bool monster::hurt(int dam)
|
||||
{
|
||||
hp -= dam;
|
||||
if (hp < 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int monster::armor()
|
||||
{
|
||||
// TODO: Add support for worn armor?
|
||||
return int(type->armor);
|
||||
}
|
||||
|
||||
void monster::die(game *g)
|
||||
{
|
||||
// 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 && g->monitems[type->id].size() == 0)
|
||||
debugmsg("Type %s has item_chance %d but no items assigned!",
|
||||
type->name.c_str(), type->item_chance);
|
||||
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.add_item(posx, posy, g->itypes[mapit[selected_item]], 0);
|
||||
if (type->item_chance < 0)
|
||||
animal_done = true; // Only drop ONE item.
|
||||
}
|
||||
|
||||
// Also, perform our death function
|
||||
mdeath md;
|
||||
(md.*type->dies)(g, this);
|
||||
}
|
||||
|
||||
bool monster::make_fungus(game *g)
|
||||
{
|
||||
switch (mon_id(type->id)) {
|
||||
case mon_ant:
|
||||
case mon_ant_soldier:
|
||||
case mon_bee:
|
||||
poly(g->mtypes[mon_ant_fungus]);
|
||||
return true;
|
||||
case mon_zombie:
|
||||
case mon_zombie_shrieker:
|
||||
case mon_zombie_electric:
|
||||
case mon_zombie_spitter:
|
||||
case mon_zombie_fast:
|
||||
case mon_zombie_brute:
|
||||
case mon_zombie_hulk:
|
||||
poly(g->mtypes[mon_zombie_fungus]);
|
||||
return true;
|
||||
case mon_boomer:
|
||||
poly(g->mtypes[mon_boomer_fungus]);
|
||||
return true;
|
||||
case mon_triffid:
|
||||
case mon_triffid_young:
|
||||
case mon_triffid_queen:
|
||||
poly(g->mtypes[mon_fungaloid]);
|
||||
return true;
|
||||
case mon_fungaloid:
|
||||
case mon_spore:
|
||||
case mon_ant_fungus:
|
||||
case mon_zombie_fungus:
|
||||
case mon_boomer_fungus:
|
||||
return true;
|
||||
default:
|
||||
return false; // All others die
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void monster::make_friendly()
|
||||
{
|
||||
plans.clear();
|
||||
friendly = rng(5, 30) + rng(0, 20);
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
#ifndef _MONSTER_H_
|
||||
#define _MONSTER_H_
|
||||
|
||||
#include "player.h"
|
||||
#include "mtype.h"
|
||||
#include "enums.h"
|
||||
#include <vector>
|
||||
|
||||
class map;
|
||||
class player;
|
||||
class game;
|
||||
|
||||
class monster {
|
||||
public:
|
||||
monster();
|
||||
monster(mtype *t);
|
||||
monster(mtype *t, int x, int y);
|
||||
~monster();
|
||||
void poly(mtype *t);
|
||||
void spawn(int x, int y); // All this does is moves the monster to x,y
|
||||
|
||||
// Access
|
||||
std::string name(); // Returns the monster's formal name
|
||||
void print_info(game *g, WINDOW* w); // Prints information to w.
|
||||
char symbol(); // Just our type's symbol; no context
|
||||
void draw(WINDOW* w, int plx, int ply, bool inv);
|
||||
// Inverts color if inv==true
|
||||
bool has_flag(m_flags f); // Returns true if f is set (see mtype.h)
|
||||
bool made_of(material m); // Returns true if it's made of m
|
||||
void load_info(std::string data, std::vector<mtype*> *mtypes);
|
||||
std::string save_info(); // String of all data, for save files
|
||||
void debug(player &u); // Gives debug info
|
||||
|
||||
//Movement
|
||||
void shift(int sx, int sy); // Shifts the monster to the appropriate submap
|
||||
// Updates current pos AND our plans
|
||||
bool wander(); // Returns true if we have no plans
|
||||
bool can_move_to(map &m, int x, int y); // Can we move to (x, y)?
|
||||
|
||||
void set_dest(int x, int y, int &t); // Go in a straight line to (x, y)
|
||||
// t determines WHICH Bresenham line
|
||||
void wander_to(int x, int y, int f); // Try to get to (x, y), we don't know
|
||||
// the route. Give up after f steps.
|
||||
void plan(game *g);
|
||||
void move(game *g); // Actual movement
|
||||
void friendly_move(game *g);
|
||||
|
||||
point scent_move(game *g);
|
||||
point sound_move(game *g);
|
||||
void hit_player(game *g, player &p);
|
||||
void move_to(game *g, int x, int y);
|
||||
void stumble(game *g, bool moved);
|
||||
|
||||
// Combat
|
||||
bool is_fleeing(player &u); // True if we're fleeing
|
||||
int hit(player &p, body_part &bp_hit); // Returns a damage
|
||||
void hit_monster(game *g, int i);
|
||||
bool hurt(int dam); // Deals this dam damage; returns true if we dead
|
||||
int armor(); // Natural armor, plus any worn armor
|
||||
void die(game *g);
|
||||
|
||||
// Other
|
||||
bool make_fungus(game *g); // Makes this monster into a fungus version
|
||||
// Returns false if no such monster exists
|
||||
void make_friendly();
|
||||
int posx, posy;
|
||||
int wandx, wandy; // Wander destination - Just try to move in that direction
|
||||
int wandf; // Urge to wander - Increased by sound, decrements each move
|
||||
|
||||
// If we were spawned by the map, store our origin for later use
|
||||
int spawnmapx, spawnmapy, spawnposx, spawnposy;
|
||||
|
||||
// DEFINING VALUES
|
||||
int moves, speed;
|
||||
int hp;
|
||||
int sp_timeout;
|
||||
int friendly;
|
||||
mtype *type;
|
||||
bool dead;
|
||||
|
||||
private:
|
||||
std::vector <point> plans;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,177 +0,0 @@
|
||||
#ifndef _MTYPE_H_
|
||||
#define _MTYPE_H_
|
||||
// SEE ALSO: monitemsdef.cpp, which defines data on which items any given
|
||||
// monster may carry.
|
||||
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
#include "mondeath.h"
|
||||
#include "monattack.h"
|
||||
#include "enums.h"
|
||||
#include "color.h"
|
||||
|
||||
class mdeath;
|
||||
|
||||
enum mon_id {
|
||||
mon_null = 0,
|
||||
mon_squirrel, mon_rabbit, mon_deer, mon_wolf, mon_bear,
|
||||
mon_dog,
|
||||
mon_ant_larva, mon_ant, mon_ant_soldier, mon_ant_queen, mon_ant_fungus,
|
||||
mon_bee,
|
||||
mon_graboid, mon_worm, mon_halfworm,
|
||||
mon_zombie, mon_zombie_shrieker, mon_zombie_spitter, mon_zombie_electric,
|
||||
mon_zombie_fast, mon_zombie_brute, mon_zombie_hulk, mon_zombie_fungus,
|
||||
mon_boomer, mon_boomer_fungus, mon_skeleton, mon_zombie_necro,
|
||||
mon_triffid, mon_triffid_young, mon_triffid_queen,
|
||||
mon_fungaloid, mon_fungaloid_dormant, mon_spore,
|
||||
mon_blob, mon_blob_small,
|
||||
mon_chud, mon_one_eye, mon_crawler,
|
||||
mon_sewer_fish, mon_sewer_snake, mon_sewer_rat,
|
||||
mon_flying_polyp, mon_hunting_horror, mon_mi_go, mon_yugg, mon_gelatin,
|
||||
mon_flaming_eye, mon_kreck, mon_blank,
|
||||
mon_eyebot, mon_manhack, mon_skitterbot, mon_secubot, mon_molebot, mon_tripod,
|
||||
mon_chickenbot, mon_tankbot, mon_turret,
|
||||
mon_hallu_zom, mon_hallu_bee, mon_hallu_ant, mon_hallu_mom,
|
||||
num_monsters
|
||||
};
|
||||
|
||||
enum m_size {
|
||||
MS_TINY = 0, // Rodent
|
||||
MS_SMALL, // Half human
|
||||
MS_MEDIUM, // Human
|
||||
MS_LARGE, // Cow
|
||||
MS_HUGE // TAAAANK
|
||||
};
|
||||
|
||||
// Feel free to add to m_flags. Order shouldn't matter, just keep it tidy!
|
||||
// There is a maximum number of 32 flags, including MF_MAX, so...
|
||||
// And comment them well. ;)
|
||||
// mfb(n) converts a flag to its appropriate position in mtype's bitfield
|
||||
#ifndef mfb
|
||||
#define mfb(n) int(pow(2,(int)n))
|
||||
#endif
|
||||
enum m_flags {
|
||||
MF_SEES, // It can see you (and will run/follow)
|
||||
MF_HEARS, // It can hear you
|
||||
MF_GOODHEARING, // Pursues sounds more than most monsters
|
||||
MF_SMELLS, // It can smell you
|
||||
MF_STUMBLES, // Stumbles in its movement
|
||||
MF_WARM, // Warm blooded
|
||||
MF_NOHEAD, // Headshots not allowed!
|
||||
MF_HARDTOSHOOT, // Some shots are actually misses
|
||||
MF_BASHES, // Bashes down doors
|
||||
MF_DESTROYS, // Bashes down walls and more
|
||||
MF_POISON, // Poisonous to eat
|
||||
MF_VENOM, // Attack may poison the player
|
||||
MF_DIGS, // Digs through the ground
|
||||
MF_FLIES, // Can fly (over water, etc)
|
||||
MF_AQUATIC, // Confined to water
|
||||
MF_SWIMS, // Treats water as 50 movement point terrain
|
||||
MF_ATTACKMON, // Attacks other monsters
|
||||
MF_ANIMAL, // Is an "animal" for purposes of the Animal Empath trait
|
||||
MF_PLASTIC, // Absorbs physical damage to a great degree
|
||||
MF_SUNDEATH, // Dies in full sunlight
|
||||
MF_ACIDPROOF, // Immune to acid
|
||||
MF_FIREY, // Burns stuff and is immune to fire
|
||||
MF_SHOCK, // Shocks the player if they attack w/out gloves
|
||||
MF_ELECTRONIC, // E.g. a robot; affected by emp blasts, and other stuff
|
||||
MF_FUR, // May produce fur when butchered.
|
||||
MF_LEATHER, // May produce leather when butchered
|
||||
MF_IMMOBILE, // Doesn't move (e.g. turrets)
|
||||
MF_MAX // Sets the length of the flags - obviously MUST be last
|
||||
};
|
||||
|
||||
struct mtype {
|
||||
int id;
|
||||
std::string name;
|
||||
std::string description;
|
||||
char sym; // Symbol on the map
|
||||
nc_color color;// Color of symbol (see color.h)
|
||||
|
||||
m_size size;
|
||||
material mat; // See enums.h for material list. Generally, flesh; veggy?
|
||||
unsigned flags : MF_MAX; // Bitfield of m_flags
|
||||
|
||||
unsigned char frequency; // How often do these show up? 0 (never) to ??
|
||||
int difficulty;// Used all over; 30 min + (diff-3)*30 min = earlist appearance
|
||||
signed char agro; // How likely to attack; -5 to 5
|
||||
|
||||
unsigned int speed; // Speed; human = 100
|
||||
unsigned char melee_skill; // Melee skill; should be 0 to 5
|
||||
unsigned char melee_dice; // Number of dice on melee hit
|
||||
unsigned char melee_sides; // Number of sides those dice have
|
||||
unsigned char melee_cut; // Bonus cutting damage
|
||||
unsigned char sk_dodge; // Dodge skill; should be 0 to 5
|
||||
unsigned char armor; // Natural armor
|
||||
signed char item_chance; // Higher # means higher chance of loot
|
||||
// Negative # means one item gen'd, tops
|
||||
int hp;
|
||||
|
||||
unsigned char sp_freq; // How long sp_attack takes to charge
|
||||
void (mdeath::*dies)(game *, monster *); // What happens when this monster dies
|
||||
void (mattack::*sp_attack)(game *, monster *); // This monster's special attack
|
||||
|
||||
|
||||
// Default constructor
|
||||
mtype () {
|
||||
id = 0;
|
||||
name = "human";
|
||||
description = "";
|
||||
sym = ' ';
|
||||
color = c_white;
|
||||
size = MS_MEDIUM;
|
||||
mat = FLESH;
|
||||
flags = 0;
|
||||
difficulty = 0;
|
||||
frequency = 0;
|
||||
agro = 0;
|
||||
speed = 0;
|
||||
melee_skill = 0;
|
||||
melee_dice = 0;
|
||||
melee_sides = 0;
|
||||
melee_cut = 0;
|
||||
sk_dodge = 0;
|
||||
armor = 0;
|
||||
hp = 0;
|
||||
sp_freq = 0;
|
||||
item_chance = 0;
|
||||
dies = NULL;
|
||||
sp_attack = NULL;
|
||||
}
|
||||
// Non-default (messy)
|
||||
mtype (int pid, std::string pname, char psym, nc_color pcolor, m_size psize,
|
||||
material pmat, unsigned pflags, unsigned char pfreq, unsigned int pdiff,
|
||||
signed char pagro, unsigned int pspeed, unsigned char pml_skill,
|
||||
unsigned char pml_dice, unsigned char pml_sides, unsigned char pml_cut,
|
||||
unsigned char pdodge, unsigned char parmor, unsigned char pitem_chance,
|
||||
int php, unsigned char psp_freq,
|
||||
void (mdeath::*pdies) (game *, monster *),
|
||||
void (mattack::*psp_attack)(game *, monster *),
|
||||
std::string pdescription ) {
|
||||
id = pid;
|
||||
name = pname;
|
||||
sym = psym;
|
||||
color = pcolor;
|
||||
size = psize;
|
||||
mat = pmat;
|
||||
flags = pflags;
|
||||
frequency = pfreq;
|
||||
difficulty = pdiff;
|
||||
agro = pagro;
|
||||
speed = pspeed;
|
||||
melee_skill = pml_skill;
|
||||
melee_dice = pml_dice;
|
||||
melee_sides = pml_sides;
|
||||
melee_cut = pml_cut;
|
||||
sk_dodge = pdodge;
|
||||
armor = parmor;
|
||||
item_chance = pitem_chance;
|
||||
hp = php;
|
||||
sp_freq = psp_freq;
|
||||
dies = pdies;
|
||||
sp_attack = psp_attack;
|
||||
description = pdescription;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
-685
@@ -1,685 +0,0 @@
|
||||
#include "game.h"
|
||||
#include "mondeath.h"
|
||||
#include "monattack.h"
|
||||
#include "itype.h"
|
||||
|
||||
// This function populates the master list of monster types.
|
||||
// If you edit this function, you'll also need to edit:
|
||||
// * mtype.h - enum mon_id MUST match the order of this list!
|
||||
// * monster.cpp - void make_fungus() should be edited, or fungal infection
|
||||
// will simply kill the monster
|
||||
// * mongroupdef.cpp - void init_moncats() should be edited, so the monster
|
||||
// spawns with the proper group
|
||||
void game::init_mtypes ()
|
||||
{
|
||||
int id = 0;
|
||||
// Null monster named "None".
|
||||
mtypes.push_back(new mtype);
|
||||
|
||||
#define mon(name, sym, color, size, mat, \
|
||||
flags, \
|
||||
freq, diff, agro, speed, melee_skill, melee_dice, melee_sides,\
|
||||
melee_cut, dodge, armor, item_chance, HP, sp_freq, death, sp_att,\
|
||||
desc)\
|
||||
id++;\
|
||||
mtypes.push_back(new mtype(id, name, sym, color, size, mat, flags, freq, diff,\
|
||||
agro, speed, melee_skill, melee_dice, melee_sides, melee_cut, dodge, armor,\
|
||||
item_chance, HP, sp_freq, death, sp_att, desc))
|
||||
|
||||
// PLEASE NOTE: The description is AT MAX 4 lines of 46 characters each.
|
||||
|
||||
// FOREST ANIMALS
|
||||
mon("squirrel", 'r', c_ltgray, MS_TINY, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_ANIMAL)|
|
||||
mfb(MF_WARM)|mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
50, 0, -5,140, 0, 1, 1, 0, 4, 0, 0, 1, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A small woodland animal."
|
||||
);
|
||||
|
||||
mon("rabbit", 'r', c_white, MS_TINY, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_ANIMAL)|
|
||||
mfb(MF_WARM)|mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
10, 0, -5, 180, 0, 0, 0, 0, 6, 0, 0, 4, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A cute wiggling nose, cotton tail, and\n\
|
||||
delicious flesh."
|
||||
);
|
||||
|
||||
mon("deer", 'd', c_brown, MS_LARGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_ANIMAL)|
|
||||
mfb(MF_WARM)|mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 1, -2, 300, 4, 3, 3, 0, 3, 0, 0, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A large buck, fast-moving and strong."
|
||||
);
|
||||
|
||||
mon("wolf", 'w', c_dkgray, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_ANIMAL)|mfb(MF_WARM)|
|
||||
mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
4, 7, 3,165, 14, 2, 3, 4, 4, 0, 0, 28, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A vicious and fast pack hunter."
|
||||
);
|
||||
|
||||
mon("bear", 'B', c_dkgray, MS_LARGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_ANIMAL)|mfb(MF_WARM)|
|
||||
mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
2, 10, 4,140, 10, 3, 4, 6, 3, 0, 0, 90, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
Remember, only YOU can prevent forest fires."
|
||||
);
|
||||
|
||||
// DOMESICATED ANIMALS
|
||||
mon("dog", 'd', c_white, MS_SMALL, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_ANIMAL)|mfb(MF_WARM)|
|
||||
mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 5, 1,150, 12, 2, 3, 3, 3, 0, 0, 25, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A medium-sized domesticated dog, gone feral."
|
||||
);
|
||||
|
||||
// INSECTOIDS
|
||||
mon("ant larva", 'a', c_white, MS_SMALL, FLESH,
|
||||
(mfb(MF_SMELLS)|mfb(MF_POISON)|mfb(MF_ANIMAL)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 0, 1, 15, 4, 1, 3, 0, 0, 0, 0, 10, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
The size of a large cat, this pulsating\n\
|
||||
mass of glistening white flesh turns your\n\
|
||||
stomach."
|
||||
);
|
||||
|
||||
mon("giant ant", 'a', c_brown, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SMELLS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
20, 7, 3,100, 9, 1, 6, 4, 2, 8,-40, 40, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A red ant the size of a crocodile. It is\n\
|
||||
covered in chitinous armor, and has a\n\
|
||||
pair of vicious mandibles."
|
||||
);
|
||||
|
||||
mon("soldier ant", 'a', c_blue, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SMELLS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
2, 16, 5,115, 12, 2, 4, 6, 2, 10,-50, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
Darker in color than the other ants, this\n\
|
||||
more aggresive variety has even larger\n\
|
||||
mandibles."
|
||||
);
|
||||
|
||||
mon("queen ant", 'a', c_ltred, MS_LARGE, FLESH,
|
||||
(mfb(MF_SMELLS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 13, 2, 60, 6, 3, 4, 4, 1, 14,-40,180, 5,
|
||||
&mdeath::normal, &mattack::antqueen, "\
|
||||
This ant has a long, bloated thorax, bulging\n\
|
||||
with hundreds of small ant eggs. It moves\n\
|
||||
slowly, tending to nearby eggs and laying\n\
|
||||
still more."
|
||||
);
|
||||
|
||||
mon("fungal ant", 'a', c_ltgray, MS_MEDIUM, VEGGY,
|
||||
(mfb(MF_SMELLS)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 5, 5, 75, 5, 1, 5, 3, 1, 1, 0, 30, 60,
|
||||
&mdeath::normal, &mattack::fungus, "\
|
||||
This insect is pale gray in color, its\n\
|
||||
chitin weakened by the fungus sprouting\n\
|
||||
from every joint on its body."
|
||||
);
|
||||
|
||||
mon("giant bee", 'a', c_yellow, MS_SMALL, FLESH,
|
||||
(mfb(MF_SMELLS)|mfb(MF_VENOM)|mfb(MF_FLIES)|mfb(MF_STUMBLES)|
|
||||
mfb(MF_ANIMAL)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
2, 15, 4,140, 7, 1, 6, 5, 7, 5,-50, 20, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A honey bee the size of a small dog. It\n\
|
||||
buzzes angrily through the air, dagger-\n\
|
||||
sized sting pointed forward."
|
||||
);
|
||||
|
||||
mon("graboid", 'S', c_red, MS_HUGE, FLESH,
|
||||
(mfb(MF_DIGS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_ATTACKMON)|
|
||||
mfb(MF_DESTROYS)|mfb(MF_WARM)|mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 17, 5,180, 11, 3, 8, 4, 0, 5, 0,180, 0,
|
||||
&mdeath::worm, &mattack::none, "\
|
||||
A hideous slithering beast with a tri-\n\
|
||||
sectional mouth that opens to reveal\n\
|
||||
hundreds of writhing tongues. Most of its\n\
|
||||
enormous body is hidden underground."
|
||||
);
|
||||
|
||||
mon("giant worm", 'S', c_pink, MS_LARGE, FLESH,
|
||||
(mfb(MF_DIGS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_ATTACKMON)|
|
||||
mfb(MF_WARM)|mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
30, 10, 3, 85, 9, 4, 5, 2, 0, 0, 0, 50, 0,
|
||||
&mdeath::worm, &mattack::none, "\
|
||||
Half of this monster is emerging from a\n\
|
||||
hole in the ground. It looks like a huge\n\
|
||||
earthworm, but the end has split into a\n\
|
||||
large, fanged mouth."
|
||||
);
|
||||
|
||||
mon("half worm", 's', c_pink, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_DIGS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_WARM)|
|
||||
mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 2, 2, 80, 5, 3, 5, 0, 0, 0, 0, 20, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A portion of a giant worm that is still\n\
|
||||
alive."
|
||||
);
|
||||
|
||||
// ZOMBIES
|
||||
mon("zombie", 'Z', c_ltgreen, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_STUMBLES)|
|
||||
mfb(MF_WARM)|mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
70, 3, 5, 70, 8, 1, 5, 0, 1, 0, 40, 50, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A human body, stumbling slowly forward on\n\
|
||||
uncertain legs, possessed with an\n\
|
||||
unstoppable rage."
|
||||
);
|
||||
|
||||
mon("shrieker zombie", 'Z', c_magenta, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_STUMBLES)|
|
||||
mfb(MF_WARM)|mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
4, 5, 4, 95, 9, 1, 2, 0, 4, 0, 45, 50, 10,
|
||||
&mdeath::normal, &mattack::shriek, "\
|
||||
This zombie's jaw has been torn off, leaving\n\
|
||||
a gaping hole from mid-neck up."
|
||||
);
|
||||
|
||||
mon("spitter zombie", 'Z', c_yellow, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_BASHES)|
|
||||
mfb(MF_POISON)|mfb(MF_ACIDPROOF)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
4, 9, 5, 105, 8, 1, 5, 0, 4, 0, 30, 60, 20,
|
||||
&mdeath::acid, &mattack::acid, "\
|
||||
This zombie's mouth is deformed into a round\n\
|
||||
spitter, and its body throbs with a dense\n\
|
||||
yellow fluid."
|
||||
);
|
||||
|
||||
mon("shocker zombie", 'Z', c_ltcyan, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_BASHES)|
|
||||
mfb(MF_POISON)|mfb(MF_SHOCK)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 10, 5,110, 8, 1, 6, 0, 4, 0, 40, 65, 25,
|
||||
&mdeath::normal, &mattack::shockstorm, "\
|
||||
This zombie's flesh is pale blue, and it\n\
|
||||
occasionally crackles with small bolts of\n\
|
||||
lightning."
|
||||
);
|
||||
|
||||
mon("fast zombie", 'Z', c_ltred, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_STUMBLES)|
|
||||
mfb(MF_WARM)|mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
6, 9, 5,150, 10, 1, 4, 3, 4, 0, 45, 40, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
This deformed, sinewy zombie stays close\n\
|
||||
to the ground, loping forward faster than\n\
|
||||
most humans ever could."
|
||||
);
|
||||
|
||||
mon("zombie brute", 'Z', c_red, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_BASHES)|
|
||||
mfb(MF_POISON)|mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
4, 15, 5,115, 9, 4, 4, 2, 0, 8, 60, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A hideous beast of a zombie, bulging with\n\
|
||||
distended muscles on both arms and legs."
|
||||
);
|
||||
|
||||
mon("zombie hulk", 'Z', c_blue, MS_HUGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_BASHES)|
|
||||
mfb(MF_DESTROYS)|mfb(MF_POISON)|mfb(MF_ATTACKMON)|mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 30, 5,130, 9, 4, 8, 0, 0, 12, 80,260, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A zombie that has somehow grown to the size\n\
|
||||
of 6 men, with arms as wide as a trash can."
|
||||
);
|
||||
|
||||
mon("fungal zombie", 'Z', c_ltgray, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_STUMBLES)|
|
||||
mfb(MF_WARM)|mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 6, 5, 45, 6, 1, 6, 0, 0, 0, 20, 40, 50,
|
||||
&mdeath::normal, &mattack::fungus, "\
|
||||
A disease zombie. Fungus sprouts from its\n\
|
||||
mouth and eyes, and thick gray mold grows\n\
|
||||
all over its translucent flesh."
|
||||
);
|
||||
|
||||
mon("boomer", 'Z', c_pink, MS_LARGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_STUMBLES)|mfb(MF_WARM)|
|
||||
mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
6, 7, 5, 55, 7, 2, 4, 0, 1, 0, 35, 40, 20,
|
||||
&mdeath::boomer, &mattack::boomer, "\
|
||||
A bloated zombie sagging with fat. It emits a\n\
|
||||
horrible odor, and putrid, pink sludge drips\n\
|
||||
from its mouth."
|
||||
);
|
||||
|
||||
mon("fungal boomer", 'B', c_ltgray, MS_LARGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_STUMBLES)|mfb(MF_WARM)|
|
||||
mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 7, 5, 40, 5, 2, 6, 0, 0, 0, 20, 20, 30,
|
||||
&mdeath::fungus, &mattack::fungus, "\
|
||||
A bloated zombie that is coated with slimy\n\
|
||||
gray mold. Its flesh is translucent and gray,\n\
|
||||
and it dribbles a gray sludge from its mouth."
|
||||
);
|
||||
|
||||
mon("skeleton", 'Z', c_white, MS_MEDIUM, STONE,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_HARDTOSHOOT)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
7, 8, 5, 90, 10, 1, 5, 3, 2, 30, 0, 40, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A skeleton picked clean of all but a few\n\
|
||||
rotten scraps of flesh, somehow still in\n\
|
||||
motion."
|
||||
);
|
||||
|
||||
mon("zombie necromancer",'Z', c_dkgray, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_BASHES)|
|
||||
mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 13, 5,100, 4, 2, 3, 0, 4, 0, 50,140, 4,
|
||||
&mdeath::normal, &mattack::resurrect, "\
|
||||
A zombie with jet black skin and glowing\n\
|
||||
red eyes. As you look at it, you're gripped\n\
|
||||
by a feeling of dread and terror."
|
||||
);
|
||||
|
||||
// PLANTS & FUNGI
|
||||
mon("triffid", 'F', c_ltgreen, MS_MEDIUM, VEGGY,
|
||||
(mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_BASHES)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
24, 16, 4, 75, 9, 2, 4, 5, 0, 12, 0, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A plant that grows as high as your head,\n\
|
||||
with one thick, bark-coated stalk\n\
|
||||
supporting a flower-like head with a sharp\n\
|
||||
sting within."
|
||||
);
|
||||
|
||||
mon("young triffid", 'f', c_ltgreen, MS_SMALL, VEGGY,
|
||||
(mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
15, 2, 1, 65, 7, 1, 4, 3, 0, 0, 0, 40, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A small triffid, only a few feet tall. It\n\
|
||||
has not yet developed bark, but its sting\n\
|
||||
is still sharp and deadly."
|
||||
);
|
||||
|
||||
mon("queen triffid", 'F', c_red, MS_LARGE, VEGGY,
|
||||
(mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 22, 5, 85, 14, 2, 7, 8, 0, 14, 0,280, 2,
|
||||
&mdeath::normal, &mattack::growplants, "\
|
||||
A very large triffid, with a particularly\n\
|
||||
vicious sting and thick bark. As it\n\
|
||||
moves, plant matter drops off its body\n\
|
||||
and immediately takes root."
|
||||
);
|
||||
|
||||
mon("fungaloid", 'F', c_ltgray, MS_MEDIUM, VEGGY,
|
||||
(mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_POISON)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
12, 12, 4, 15, 8, 3, 3, 0, 0, 0, 0, 80, 60,
|
||||
&mdeath::fungus, &mattack::fungus, "\
|
||||
A pale white fungus, one meaty gray stalk\n\
|
||||
supporting a bloom at the top. A few\n\
|
||||
tendrils extend from the base, allowing\n\
|
||||
mobility and a weak attack."
|
||||
);
|
||||
|
||||
// This is a "dormant" fungaloid that doesn't waste CPU cycles ;)
|
||||
mon("fungaloid", 'F', c_ltgray, MS_MEDIUM, VEGGY,
|
||||
(mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_POISON)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 0, 4, 0, 8, 3, 5, 0, 0, 0, 0, 1, 0,
|
||||
&mdeath::fungusawake, &mattack::none, "\
|
||||
A pale white fungus, one meaty gray stalk\n\
|
||||
supporting a bloom at the top. A few\n\
|
||||
tendrils extend from the base, allowing\n\
|
||||
mobility and a weak attack."
|
||||
);
|
||||
|
||||
mon("spore", 'o', c_ltgray, MS_TINY, VEGGY,
|
||||
(mfb(MF_STUMBLES)|mfb(MF_POISON)|mfb(MF_NOHEAD)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 1, -5,100, 0, 0, 0, 0, 6, 0, 0, 5, 50,
|
||||
&mdeath::normal, &mattack::plant, "\
|
||||
A wispy spore, about the size of a fist,\n\
|
||||
wafting on the breeze."
|
||||
);
|
||||
|
||||
// BLOBS & SLIMES &c
|
||||
mon("blob", 'O', c_dkgray, MS_MEDIUM, LIQUID,
|
||||
(mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_NOHEAD)|
|
||||
mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
10, 19, 5, 85, 9, 2, 4, 0, 0, 0, 0, 85, 30,
|
||||
&mdeath::blobsplit, &mattack::formblob, "\
|
||||
A black blob of viscous goo that oozes\n\
|
||||
across the ground like a mass of living\n\
|
||||
oil."
|
||||
);
|
||||
|
||||
mon("small blob", 'o', c_dkgray, MS_SMALL, LIQUID,
|
||||
(mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_NOHEAD)|
|
||||
mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 2, 5, 50, 6, 1, 4, 0, 0, 0, 0, 50, 0,
|
||||
&mdeath::blobsplit, &mattack::none, "\
|
||||
A small blob of viscous good that oozes\n\
|
||||
across the ground like a mass of living\n\
|
||||
oil."
|
||||
);
|
||||
|
||||
// CHUDS & SUBWAY DWELLERS
|
||||
mon("C.H.U.D.", 'S', c_ltgray, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_WARM)|mfb(MF_BASHES)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
50, 8, 4,110, 10, 1, 5, 0, 3, 0, 25, 60, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
Cannibalistic Humanoid Underground Dweller.\n\
|
||||
A human, turned pale and mad from years in\n\
|
||||
the subways."
|
||||
);
|
||||
|
||||
mon("one-eyed mutant", 'S', c_ltred, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_WARM)|mfb(MF_BASHES)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
5, 18, 3,130, 20, 2, 4, 0, 5, 0, 40, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A relatively humanoid mutant with purple\n\
|
||||
hair and a grapefruit-sized bloodshot eye."
|
||||
);
|
||||
|
||||
mon("crawler mutant", 'S', c_red, MS_LARGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_WARM)|
|
||||
mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
2, 16, 5, 80, 10, 2, 6, 0, 1, 8, 0,180, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
Two or three humans fused together somehow,\n\
|
||||
slowly dragging their thick-hided, hideous\n\
|
||||
body across the ground."
|
||||
);
|
||||
|
||||
mon("sewer fish", 's', c_ltgreen, MS_SMALL, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_AQUATIC)|
|
||||
mfb(MF_ANIMAL)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
30, 13, 5,120, 17, 1, 3, 3, 6, 0, 0, 20, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A large green fish, it's mouth lined with\n\
|
||||
three rows of razor-sharp teeth."
|
||||
);
|
||||
|
||||
mon("sewer snake", 's', c_yellow, MS_SMALL, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_WARM)|mfb(MF_VENOM)|mfb(MF_SWIMS)|
|
||||
mfb(MF_ANIMAL)|mfb(MF_LEATHER)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
15, 2, 5, 60, 12, 1, 2, 5, 1, 0, 0, 40, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A large snake, turned pale yellow from its\n\
|
||||
underground life."
|
||||
);
|
||||
|
||||
mon("sewer rat", 's', c_dkgray, MS_SMALL, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_WARM)|mfb(MF_SWIMS)|
|
||||
mfb(MF_ANIMAL)|mfb(MF_FUR)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
18, 3, 4,105, 10, 1, 2, 1, 2, 0, 0, 30, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A large, mangey rat with red eyes. It\n\
|
||||
scampers quickly across the ground, squeaking\n\
|
||||
hungrily."
|
||||
);
|
||||
|
||||
// NETHER WORLD INHABITANTS
|
||||
mon("flying polyp", 'H', c_dkgray, MS_HUGE, FLESH,
|
||||
(mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_NOHEAD)|
|
||||
mfb(MF_BASHES)|mfb(MF_FLIES)|mfb(MF_ATTACKMON)|mfb(MF_PLASTIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 42, 5,280, 16, 5, 8, 12, 7, 8, 0,350, 0,
|
||||
&mdeath::melt, &mattack::none, "\
|
||||
An amorphous mass of twisting black flesh\n\
|
||||
that flies through the air swiftly."
|
||||
);
|
||||
mon("hunting horror", 'h', c_dkgray, MS_SMALL, MNULL,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_NOHEAD)|
|
||||
mfb(MF_HARDTOSHOOT)|mfb(MF_FLIES)|mfb(MF_PLASTIC)|mfb(MF_SUNDEATH)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
10, 28, 4,180, 15, 3, 4, 0, 6, 0, 0, 80, 0,
|
||||
&mdeath::melt, &mattack::none, "\
|
||||
A ropy, worm-like creature that flies on\n\
|
||||
bat-like wings. Its form continually\n\
|
||||
shifts and changes, twitching and\n\
|
||||
writhing."
|
||||
);
|
||||
mon("Mi-go", 'H', c_pink, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_WARM)|
|
||||
mfb(MF_BASHES)|mfb(MF_POISON)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
5, 26, 3,120, 14, 5, 3, 10, 7, 12, 0,110, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A pinkish, fungoid crustacean-like\n\
|
||||
creature with numerous pairs of clawed\n\
|
||||
appendages and a head covered with waving\n\
|
||||
antennae."
|
||||
);
|
||||
mon("yugg", 'H', c_white, MS_HUGE, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_BASHES)|
|
||||
mfb(MF_DESTROYS)|mfb(MF_POISON)|mfb(MF_VENOM)|mfb(MF_DIGS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 32, 4, 80, 12, 3, 5, 8, 1, 0, 0,320, 20,
|
||||
&mdeath::normal, &mattack::gene_sting, "\
|
||||
An enormous white flatworm writhing\n\
|
||||
beneath the earth. Poking from the\n\
|
||||
ground is a bulbous head dominated by a\n\
|
||||
pink mouth, lined with rows of fangs."
|
||||
);
|
||||
mon("gelatinous blob", 'O', c_ltgray, MS_LARGE, LIQUID,
|
||||
(mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_PLASTIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
5, 20, 2, 40, 8, 2, 3, 0, 0, 0, 0,200, 4,
|
||||
&mdeath::melt, &mattack::formblob, "\
|
||||
A shapeless blob the size of a cow. It\n\
|
||||
oozes slowly across the ground, small\n\
|
||||
chunks falling off of its sides."
|
||||
);
|
||||
mon("flaming eye", 'E', c_red, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_WARM)|mfb(MF_FLIES)|mfb(MF_FIREY)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
5, 27, 4, 90, 0, 0, 0, 0, 1, 0, 0,300, 12,
|
||||
&mdeath::normal, &mattack::stare, "\
|
||||
An eyeball the size of an easy chair and\n\
|
||||
covered in rolling blue flames. It floats\n\
|
||||
through the air."
|
||||
);
|
||||
mon("kreck", 'h', c_ltred, MS_SMALL, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_WARM)|mfb(MF_BASHES)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
9, 5, 5,135, 6, 2, 3, 4, 5, 5, 0, 35, 0,
|
||||
&mdeath::melt, &mattack::none, "\
|
||||
A small humanoid, the size of a dog, with\n\
|
||||
twisted red flesh and a distended neck. It\n\
|
||||
scampers across the ground, panting and\n\
|
||||
grunting."
|
||||
);
|
||||
mon("blank body", 'h', c_white, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SMELLS)|mfb(MF_HEARS)|mfb(MF_WARM)|mfb(MF_ANIMAL)|
|
||||
mfb(MF_SUNDEATH)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 5, 3, 80, 9, 1, 4, 0, 1, 0, 0,100, 10,
|
||||
&mdeath::normal, &mattack::shriek, "\
|
||||
This looks like a human body, but its\n\
|
||||
flesh is snow-white and its face has no\n\
|
||||
features save for a perfectly round\n\
|
||||
mouth."
|
||||
);
|
||||
|
||||
// ROBOTS
|
||||
mon("eyebot", 'R', c_ltblue, MS_SMALL, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_FLIES)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
20, 2, 2,120, 0, 0, 0, 0, 3, 10, 70, 20, 10,
|
||||
&mdeath::explode, &mattack::photograph, "\
|
||||
A roughly spherical robot that hovers about\n\
|
||||
five feet of the ground. Its front side is\n\
|
||||
dominated by a huge eye and a flash bulb.\n\
|
||||
Frequently used for reconaissance."
|
||||
);
|
||||
|
||||
mon("manhack", 'R', c_green, MS_TINY, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_FLIES)|mfb(MF_NOHEAD)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
18, 7, 5,130, 12, 1, 1, 8, 2, 0, 10, 5, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A fist-sized robot that flies swiftly through\n\
|
||||
the air. It's covered with whirring blades\n\
|
||||
and has one small, glowing red eye."
|
||||
);
|
||||
|
||||
mon("skitterbot", 'R', c_ltred, MS_SMALL, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
10, 13, 4,105, 7, 1, 3, 6, 0, 12, 60, 40, 5,
|
||||
&mdeath::normal, &mattack::tazer, "\
|
||||
A robot with an insectoid design, about\n\
|
||||
the size of a small dog. It skitters\n\
|
||||
quickly across the ground, two electric\n\
|
||||
prods at the ready."
|
||||
);
|
||||
|
||||
mon("secubot", 'R', c_dkgray, MS_SMALL, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_BASHES)|mfb(MF_ATTACKMON)|
|
||||
mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
7, 19, 5, 70, 0, 0, 0, 0, 0, 14, 80, 80, 8,
|
||||
&mdeath::explode, &mattack::smg, "\
|
||||
A boxy robot about four feet high. It moves\n\
|
||||
slowly on a set of treads, and is armed with\n\
|
||||
a large machine gun type weapon. It is\n\
|
||||
heavily armored."
|
||||
);
|
||||
|
||||
mon("molebot", 'R', c_brown, MS_MEDIUM, STEEL,
|
||||
(mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_DIGS)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
2, 17, 5, 40, 13, 1, 4, 10, 0, 14, 82, 80, 0,
|
||||
&mdeath::normal, &mattack::none, "\
|
||||
A snake-shaped robot that tunnels through the\n\
|
||||
ground slowly. When it emerges from the\n\
|
||||
ground it can attack with its large, spike-\n\
|
||||
covered head."
|
||||
);
|
||||
|
||||
mon("tripod robot", 'R', c_white, MS_LARGE, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_BASHES)|
|
||||
mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
5, 26, 5, 90, 15, 2, 4, 7, 0, 8, 82, 80, 10,
|
||||
&mdeath::normal, &mattack::flamethrower, "\
|
||||
A 8-foot-tall robot that walks on three long\n\
|
||||
legs. It has a pair of spiked tentacles, as\n\
|
||||
well as a flamethrower mounted on its head."
|
||||
);
|
||||
|
||||
mon("chicken walker", 'R', c_red, MS_LARGE, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_BASHES)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
3, 32, 5,115, 0, 0, 0, 0, 0, 14, 85, 90, 5,
|
||||
&mdeath::explode, &mattack::smg, "\
|
||||
A 10-foot-tall, heavily-armored robot that\n\
|
||||
walks on a pair of legs with the knees\n\
|
||||
facing backwards. It's armed with a\n\
|
||||
nasty-looking machine gun."
|
||||
);
|
||||
|
||||
mon("tankbot", 'R', c_blue, MS_HUGE, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_GOODHEARING)|mfb(MF_NOHEAD)|
|
||||
mfb(MF_BASHES)|mfb(MF_DESTROYS)|mfb(MF_ATTACKMON)|mfb(MF_ELECTRONIC)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
1, 52, 5,100, 0, 0, 0, 0, 0, 20, 92,240, 4,
|
||||
&mdeath::normal, &mattack::multi_robot, "\
|
||||
This fearsome robot is essentially an\n\
|
||||
autonomous tank. It moves surprisingly fast\n\
|
||||
on its treads, and is armed with a variety of\n\
|
||||
deadly weapons."
|
||||
);
|
||||
|
||||
mon("turret", 't', c_ltgray, MS_SMALL, STEEL,
|
||||
(mfb(MF_SEES)|mfb(MF_NOHEAD)|mfb(MF_ELECTRONIC)|mfb(MF_IMMOBILE)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 14, 5,100, 0, 0, 0, 0, 0, 16, 88, 30, 1,
|
||||
&mdeath::explode, &mattack::smg, "\
|
||||
A small, round turret which extends from\n\
|
||||
the floor. Two SMG barrels swivel 360\n\
|
||||
degrees."
|
||||
);
|
||||
|
||||
// HALLUCINATIONS
|
||||
mon("zombie", 'Z', c_ltgreen, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)|mfb(MF_STUMBLES)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 0, 5, 65, 3, 0, 0, 0, 0, 0, 0, 1, 20,
|
||||
&mdeath::disappear, &mattack::disappear, "\
|
||||
A human body, stumbling slowly forward on\n\
|
||||
uncertain legs, possessed with an\n\
|
||||
unstoppable rage."
|
||||
);
|
||||
|
||||
mon("giant bee", 'a', c_yellow, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SMELLS)|mfb(MF_FLIES)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 0, 5,180, 2, 0, 0, 0, 0, 0, 0, 1, 20,
|
||||
&mdeath::disappear, &mattack::disappear, "\
|
||||
A honey bee the size of a small dog. It\n\
|
||||
buzzes angrily through the air, dagger-\n\
|
||||
sized sting pointed forward."
|
||||
);
|
||||
|
||||
mon("giant ant", 'a', c_brown, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SMELLS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 0, 5,100, 3, 0, 0, 0, 0, 0, 0, 1, 20,
|
||||
&mdeath::disappear, &mattack::disappear, "\
|
||||
A red ant the size of a crocodile. It is\n\
|
||||
covered in chitinous armor, and has a\n\
|
||||
pair of vicious mandibles."
|
||||
);
|
||||
|
||||
mon("your mother", '@', c_white, MS_MEDIUM, FLESH,
|
||||
(mfb(MF_SEES)|mfb(MF_HEARS)|mfb(MF_SMELLS)),
|
||||
// frq dif agr spd msk mdi m## cut dge arm itm HP special freq
|
||||
0, 0, 5,100, 3, 0, 0, 0, 0, 0, 0, 1, 20,
|
||||
&mdeath::guilt, &mattack::disappear, "\
|
||||
Mom?"
|
||||
);
|
||||
}
|
||||
-1274
File diff suppressed because it is too large
Load Diff
@@ -1,217 +0,0 @@
|
||||
#ifndef _NPC_H_
|
||||
#define _NPC_H_
|
||||
|
||||
#include "player.h"
|
||||
#include "monster.h"
|
||||
#include "item.h"
|
||||
#include "overmap.h"
|
||||
#include "faction.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#define NPC_LOW_VALUE 5
|
||||
#define NPC_HI_VALUE 8
|
||||
#define NPC_VERY_HI_VALUE 15
|
||||
|
||||
class item;
|
||||
class overmap;
|
||||
|
||||
/*
|
||||
* Talk: Trust midlow->high, fear low->mid, need doesn't matter
|
||||
* Trade: Trust mid->high, fear low->midlow, need is a bonus
|
||||
* Follow: Trust high, fear mid->high, need low->mid
|
||||
* Defend: Trust mid->high, fear + need high
|
||||
* Kill: Trust low->midlow, fear low->midlow, need low
|
||||
* Flee: Trust low, fear mid->high, need low
|
||||
*/
|
||||
|
||||
enum npc_attitude {
|
||||
NPCATT_NULL = 0, // Don't care/ignoring player
|
||||
NPCATT_TALK, // Move to and talk to player
|
||||
NPCATT_TRADE, // Move to and trade with player
|
||||
NPCATT_FOLLOW, // Follow the player
|
||||
NPCATT_FOLLOW_RUN, // Follow the player, don't shoot monsters
|
||||
NPCATT_WAIT, // Waiting for the player
|
||||
NPCATT_DEFEND, // Kill monsters that threaten the player
|
||||
NPCATT_MUG, // Mug the player
|
||||
NPCATT_KILL, // Kill the player
|
||||
NPCATT_FLEE, // Get away from the player
|
||||
NPCATT_SLAVE, // Following the player under duress
|
||||
NPCATT_HEAL, // Get to the player and heal them
|
||||
NPCATT_MAX
|
||||
};
|
||||
|
||||
enum npc_mission {
|
||||
MISSION_NULL = 0, // Nothing in particular
|
||||
MISSION_RESCUE_U, // Find the player and aid them
|
||||
MISSION_SHOPKEEP, // Stay still unless combat or something and sell stuff
|
||||
NUM_MISSIONS
|
||||
};
|
||||
|
||||
enum npc_class {
|
||||
NC_NONE,
|
||||
NC_SHOPKEEP, // Found in towns. Stays in his shop mostly.
|
||||
NC_DOCTOR, // Found in towns, or roaming. Stays in the clinic.
|
||||
NC_TRADER, // Roaming trader, journeying between towns.
|
||||
NC_NINJA,
|
||||
NC_COWBOY,
|
||||
NC_SCIENTIST,
|
||||
NC_BOUNTY_HUNTER,
|
||||
NC_MAX
|
||||
};
|
||||
|
||||
enum npc_action {
|
||||
npc_pause = 0,
|
||||
npc_reload,
|
||||
npc_pickup,
|
||||
npc_flee_monster, npc_melee_monster, npc_shoot_monster, npc_alt_attack_monster,
|
||||
npc_look_for_player,
|
||||
npc_heal_player, npc_follow_player, npc_talk_to_player,
|
||||
npc_flee_player, npc_mug_player, npc_melee_player, npc_shoot_player,
|
||||
npc_alt_attack_player,
|
||||
npc_goto_destination,
|
||||
num_npc_actions
|
||||
};
|
||||
|
||||
enum npc_need {
|
||||
need_none,
|
||||
need_ammo, need_weapon, need_gun,
|
||||
need_food, need_drink,
|
||||
num_needs
|
||||
};
|
||||
|
||||
enum npc_flag {
|
||||
NF_NULL,
|
||||
// Items desired
|
||||
NF_FOOD_HOARDER,
|
||||
NF_DRUGGIE,
|
||||
NF_TECHNOPHILE,
|
||||
NF_BOOKWORM,
|
||||
NF_MAX
|
||||
};
|
||||
|
||||
struct npc_personality {
|
||||
// All values should be in the -10 to 10 range.
|
||||
signed char aggression;
|
||||
signed char bravery;
|
||||
signed char collector;
|
||||
signed char altruism;
|
||||
npc_personality() {
|
||||
aggression = 0;
|
||||
bravery = 0;
|
||||
collector = 0;
|
||||
altruism = 0;
|
||||
};
|
||||
};
|
||||
|
||||
struct npc_opinion {
|
||||
signed char trust;
|
||||
signed char fear;
|
||||
signed char value;
|
||||
npc_opinion() {
|
||||
trust = 0;
|
||||
fear = 0;
|
||||
value = 0;
|
||||
};
|
||||
};
|
||||
|
||||
class npc : public player {
|
||||
public:
|
||||
npc();
|
||||
~npc();
|
||||
virtual bool is_npc() { return true; }
|
||||
void randomize(game *g, npc_class type = NC_NONE);
|
||||
void randomize_from_fact(game *g, faction *fac);
|
||||
void make_shopkeep(game *g, oter_id type);
|
||||
void set_name();
|
||||
void spawn_at(overmap *o, int posx, int posy);
|
||||
skill best_skill();
|
||||
void starting_weapon(game *g);
|
||||
bool wear_if_wanted(item it);
|
||||
|
||||
void perform_mission(game *g);
|
||||
int minutes_to_u(game *g);
|
||||
bool fac_has_value(faction_value value);
|
||||
bool fac_has_job(faction_job job);
|
||||
|
||||
void form_opinion(player *u);
|
||||
void decide_needs();
|
||||
void talk_to_u(game *g);
|
||||
void say(game *g, std::string line);
|
||||
void init_selling(std::vector<int> &indices, std::vector<int> &prices);
|
||||
void init_buying(std::vector<item> you, std::vector<int> &indices,
|
||||
std::vector<int> &prices);
|
||||
int value(item &it);
|
||||
|
||||
bool is_friend();
|
||||
bool is_following();
|
||||
int danger_assessment(game *g);
|
||||
bool bravery_check(int diff);
|
||||
void told_to_help(game *g);
|
||||
void told_to_wait(game *g);
|
||||
void told_to_leave(game *g);
|
||||
|
||||
// Display
|
||||
void draw(WINDOW* w, int plx, int ply, bool inv);
|
||||
void print_info(WINDOW* w);
|
||||
// Movement and combat
|
||||
void shift(int sx, int sy); // Shifts the npc to the appropriate submap
|
||||
// Updates current pos AND our plans
|
||||
|
||||
// The following are defined in npcmove.cpp
|
||||
void move(game *g); // Actual movement; depends on target and attitude
|
||||
int confident_range(); // Range at which we have 50% chance of a shot hitting
|
||||
bool wont_shoot_friend(game *g);// Confident that we won't shoot a friend
|
||||
monster* choose_monster_target(game *g);// Most often, the closest to us
|
||||
bool want_to_attack_player(game *g);
|
||||
int follow_distance(); // How closely do we follow the player?
|
||||
bool can_reload();
|
||||
bool fetching_item(); // Are we in the process of fetching a particular item?
|
||||
bool saw_player_recently(); // Do we have an idea of where u are?
|
||||
bool has_destination(); // Do we have a long-term destination?
|
||||
bool alt_attack_available(); // Do we have grenades, molotov, etc?
|
||||
npc_action method_of_attacking_player(game *g, std::vector<point> &path);
|
||||
npc_action method_of_attacking_monster(game *g, std::vector<point> &path);
|
||||
npc_action long_term_goal_action(game *g, std::vector<point> &path);
|
||||
void set_destination(game *g); // Pick a place to go
|
||||
void go_to_destination(game *g);
|
||||
|
||||
bool can_move_to (game *g, int x, int y);
|
||||
void move_to (game *g, int x, int y);
|
||||
void move_away_from (game *g, int x, int y);
|
||||
void move_pause ();
|
||||
void melee_monster(game *g, monster *m);
|
||||
void alt_attack(game *g, monster *m, player *p);
|
||||
void find_items(game *g);
|
||||
void pickup_items(game *g);
|
||||
void melee_player(game *g, player &foe);
|
||||
void alt_attack_player(game *g, player &foe);
|
||||
void heal_player(game *g, player &patient);
|
||||
void mug_player(game *g, player &mark);
|
||||
void look_for_player(game *g);
|
||||
// The preceding are in npcmove.cpp
|
||||
|
||||
void die(game *g);
|
||||
|
||||
monster *target; // Current monster we want to kill
|
||||
npc_attitude attitude; // What we want to do to the player
|
||||
int wandx, wandy, wandf; // Location of heard sound, etc.
|
||||
|
||||
// Location:
|
||||
int omx, omy, omz; // Which overmap (e.g., o.0.0.0)
|
||||
int mapx, mapy;// Which square in that overmap (e.g., m.0.0)
|
||||
int plx, ply, plt;// Where we last saw the player, timeout to forgetting
|
||||
int itx, ity; // The square containing an item we want
|
||||
int goalx, goaly;// Which mapx:mapy square we want to get to
|
||||
|
||||
|
||||
// Personality & other defining characteristics
|
||||
faction *my_fac;
|
||||
npc_mission mission;
|
||||
npc_personality personality;
|
||||
npc_opinion op_of_u;
|
||||
std::vector<npc_need> needs;
|
||||
unsigned flags : NF_MAX;
|
||||
};
|
||||
|
||||
#endif
|
||||
-944
@@ -1,944 +0,0 @@
|
||||
#include "npc.h"
|
||||
#include "rng.h"
|
||||
#include "game.h"
|
||||
#include "line.h"
|
||||
|
||||
std::string npc_action_name(npc_action action);
|
||||
|
||||
void npc::move(game *g)
|
||||
{
|
||||
int light = g->light_level();
|
||||
int linet;
|
||||
std::vector<point> path;
|
||||
npc_action action = npc_pause;
|
||||
target = choose_monster_target(g); // Set a target
|
||||
// If we aren't moving towards an item or a monster, find an item
|
||||
if (!fetching_item() && target == NULL)
|
||||
find_items(g);
|
||||
|
||||
if (want_to_attack_player(g))
|
||||
action = method_of_attacking_player(g, path);
|
||||
else if (target != NULL)
|
||||
action = method_of_attacking_monster(g, path);
|
||||
else if (mission == MISSION_SHOPKEEP)
|
||||
action = npc_pause;
|
||||
else if (can_reload())
|
||||
action = npc_reload;
|
||||
else if (attitude == NPCATT_HEAL &&
|
||||
g->m.sees(posx, posy, g->u.posx, g->u.posy, light, linet)) {
|
||||
path = line_to(posx, posy, g->u.posx, g->u.posy, linet);
|
||||
action = npc_heal_player;
|
||||
} else if (attitude == NPCATT_MUG &&
|
||||
g->m.sees(posx, posy, g->u.posx, g->u.posy, light, linet)) {
|
||||
path = line_to(posx, posy, g->u.posx, g->u.posy, linet);
|
||||
action = npc_mug_player;
|
||||
} else if (fetching_item())
|
||||
action = npc_pickup;
|
||||
else
|
||||
action = long_term_goal_action(g, path);
|
||||
|
||||
if (g->debugmon)
|
||||
debugmsg("%s chose action %s. Mission is %d.", name.c_str(),
|
||||
npc_action_name(action).c_str(), mission);
|
||||
|
||||
int oldmoves = moves;
|
||||
|
||||
switch (action) {
|
||||
case npc_pause:
|
||||
move_pause();
|
||||
break;
|
||||
|
||||
case npc_reload:
|
||||
moves -= weapon.reload_time(*this);
|
||||
weapon.reload(*this, false);
|
||||
recoil = 6;
|
||||
if (g->u_see(posx, posy, linet))
|
||||
g->add_msg("%s reloads %s %s.", name.c_str(), (male ? "his" : "her"),
|
||||
weapon.tname().c_str());
|
||||
break;
|
||||
|
||||
case npc_pickup:
|
||||
pickup_items(g);
|
||||
break;
|
||||
|
||||
case npc_flee_monster:
|
||||
if (target == NULL)
|
||||
debugmsg("%s tried to flee a null monster!", name.c_str());
|
||||
move_away_from(g, target->posx, target->posy);
|
||||
break;
|
||||
|
||||
case npc_melee_monster:
|
||||
if (path.size() > 1)
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
else
|
||||
melee_monster(g, target);
|
||||
break;
|
||||
|
||||
case npc_shoot_monster:
|
||||
if (trig_dist(posx, posy, target->posx, target->posy)<=confident_range() /3 &&
|
||||
target->hp >= weapon.curammo->damage * 3)
|
||||
g->fire(*this, target->posx, target->posy, path, true); // Burst fire
|
||||
else
|
||||
g->fire(*this, target->posx, target->posy, path, false);// Normal
|
||||
break;
|
||||
|
||||
case npc_alt_attack_monster:
|
||||
alt_attack(g, target, NULL);
|
||||
break;
|
||||
|
||||
case npc_look_for_player:
|
||||
if (saw_player_recently() && g->m.sees(posx, posy, plx, ply, light, linet)) {
|
||||
// (plx, ply) is the point where we last saw the player
|
||||
path = line_to(posx, posy, plx, ply, linet);
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
} else
|
||||
look_for_player(g);
|
||||
break;
|
||||
|
||||
case npc_flee_player:
|
||||
move_away_from(g, g->u.posx, g->u.posy);
|
||||
break;
|
||||
|
||||
case npc_melee_player:
|
||||
if (path.size() == 1) // We're adjacent to u, and thus can sock u one
|
||||
melee_player(g, g->u);
|
||||
else
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
break;
|
||||
|
||||
case npc_shoot_player:
|
||||
g->add_msg("%s shoots at you with %s %s!", name.c_str(),
|
||||
(male ? "his" : "her"), weapon.tname().c_str());
|
||||
// If we're at 1/3rd of our confident range, burst fire at the player
|
||||
g->fire(*this, g->u.posx, g->u.posy, path,
|
||||
(trig_dist(posx, posy, g->u.posx, g->u.posy) <= confident_range() / 3));
|
||||
break;
|
||||
|
||||
case npc_alt_attack_player:
|
||||
alt_attack(g, NULL, &(g->u));
|
||||
break;
|
||||
|
||||
case npc_heal_player:
|
||||
if (path.size() == 1) // We're adjacent to u, and thus can heal u
|
||||
heal_player(g, g->u);
|
||||
else
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
break;
|
||||
|
||||
case npc_follow_player:
|
||||
if (path.size() <= follow_distance()) // We're close enough to u.
|
||||
move_pause();
|
||||
else
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
break;
|
||||
|
||||
case npc_talk_to_player:
|
||||
talk_to_u(g);
|
||||
break;
|
||||
|
||||
case npc_mug_player:
|
||||
if (path.size() == 1) // We're adjacent to u, and thus can mug u
|
||||
mug_player(g, g->u);
|
||||
else
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
break;
|
||||
|
||||
case npc_goto_destination:
|
||||
go_to_destination(g);
|
||||
break;
|
||||
|
||||
default:
|
||||
debugmsg("Unknown NPC action (%d)", action);
|
||||
}
|
||||
|
||||
if (oldmoves == moves) {
|
||||
debugmsg("NPC didn't use its moves. Turning on debug mode.");
|
||||
g->debugmon = true;
|
||||
}
|
||||
}
|
||||
|
||||
monster* npc::choose_monster_target(game *g)
|
||||
{
|
||||
int closest = 1000, plclosest = 1000, lowHP = 10000, pllowHP = 10000;
|
||||
int index = -1, plindex = -1;
|
||||
int distance;
|
||||
int linet;
|
||||
bool defend_u = g->sees_u(posx, posy, linet) && !want_to_attack_player(g);
|
||||
|
||||
for (int i = 0; i < g->z.size(); i++) {
|
||||
if (!g->z[i].is_fleeing(g->u) && !g->z[i].is_fleeing(*this) &&
|
||||
g->pl_sees(this, &(g->z[i]), linet) && g->z[i].friendly == 0) {
|
||||
if (defend_u) {
|
||||
distance = trig_dist(g->u.posx, g->u.posy, g->z[i].posx, g->z[i].posy);
|
||||
if (distance < plclosest) {
|
||||
plindex = i;
|
||||
plclosest = distance;
|
||||
pllowHP = g->z[i].hp;
|
||||
} else if (distance == plclosest && g->z[i].hp < pllowHP) {
|
||||
plindex = i;
|
||||
pllowHP = g->z[i].hp;
|
||||
}
|
||||
}
|
||||
distance = trig_dist(posx, posy, g->z[i].posx, g->z[i].posy);
|
||||
if (distance < closest) {
|
||||
index = i;
|
||||
closest = distance;
|
||||
lowHP = g->z[i].hp;
|
||||
} else if (distance == closest && g->z[i].hp < lowHP) {
|
||||
index = i;
|
||||
lowHP = g->z[i].hp;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plindex != -1) { // Maybe defend the player.
|
||||
int importance = (g->u.hp_percentage() - hp_percentage()) / 20;
|
||||
importance -= op_of_u.value / 2;
|
||||
if (attitude == NPCATT_DEFEND)
|
||||
importance -= 5;
|
||||
|
||||
if (bravery_check(importance))
|
||||
return &(g->z[plindex]);
|
||||
}
|
||||
if (index != -1)
|
||||
return &(g->z[index]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void npc::find_items(game *g)
|
||||
{
|
||||
int dist = g->light_level();
|
||||
int linet, top_value = 0;
|
||||
int minx = posx - dist, maxx = posx + dist;
|
||||
int miny = posy - dist, maxy = posy + dist;
|
||||
itx = 999;
|
||||
ity = 999;
|
||||
// Make sure the bounds of our search aren't outside the map!
|
||||
if (minx < 0)
|
||||
minx = 0;
|
||||
if (miny < 0)
|
||||
miny = 0;
|
||||
if (maxx > SEEX * 3 - 1)
|
||||
maxx = SEEX * 3 - 1;
|
||||
if (maxy > SEEY * 3 - 1)
|
||||
maxy = SEEY * 3 - 1;
|
||||
|
||||
for (int x = minx; x <= maxx; x++) {
|
||||
for (int y = miny; y <= maxy; y++) {
|
||||
if (g->m.sees(posx, posy, x, y, dist, linet)) {
|
||||
for (int i = 0; i < g->m.i_at(x, y).size(); i++) {
|
||||
item *tmp = &(g->m.i_at(x, y)[i]);
|
||||
// We value it enough to pick it up
|
||||
if (value(*tmp) + personality.collector >= NPC_HI_VALUE &&
|
||||
value(*tmp) > top_value &&
|
||||
volume_carried() + tmp->volume() <= volume_capacity() &&
|
||||
weight_carried() + tmp->weight() <= weight_capacity() ) {
|
||||
top_value = value(g->m.i_at(x, y)[i]);
|
||||
itx = x;
|
||||
ity = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void npc::pickup_items(game *g)
|
||||
{
|
||||
int light = g->light_level(), dist = rl_dist(posx, posy, itx, ity), linet;
|
||||
bool debug = g->debugmon;
|
||||
/*
|
||||
if (abs(posx - itx) > light || abs(posy - ity) > light) {// Old item is too far
|
||||
itx = 999;
|
||||
ity = 999;
|
||||
}
|
||||
*/
|
||||
if (!fetching_item()) {
|
||||
debugmsg("Ran pickup_items(), but there's no item in mind!");
|
||||
return;
|
||||
}
|
||||
if (dist <= 1) { // We can pick it up!
|
||||
if (debug)
|
||||
debugmsg("Distance to item < 1; picking up items.");
|
||||
item *tmp;
|
||||
for (int i = 0; i < g->m.i_at(itx, ity).size(); i++) {
|
||||
tmp = &(g->m.i_at(itx, ity)[i]);
|
||||
if (value(*tmp) >= NPC_HI_VALUE &&
|
||||
volume_carried() + tmp->volume() <= volume_capacity() &&
|
||||
weight_carried() + tmp->weight() <= weight_capacity()) {
|
||||
i_add(*tmp);
|
||||
g->m.i_rem(itx, ity, i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
moves -= 100;
|
||||
itx = 999;
|
||||
ity = 999;
|
||||
} else if (g->m.sees(posx, posy, itx, ity, light, linet)) {
|
||||
if (debug)
|
||||
debugmsg("We see our item(s). NPC @ (%d:%d); items @ (%d:%d) (dist %d",
|
||||
posx, posy, itx, ity, dist);
|
||||
std::vector<point> traj = line_to(posx, posy, itx, ity, linet);
|
||||
if (debug)
|
||||
debugmsg("Moving to (%d:%d), %s.", traj[0].x, traj[0].y,
|
||||
g->m.tername(traj[0].x, traj[0].y).c_str());
|
||||
move_to(g, traj[0].x, traj[0].y);
|
||||
} else { // Can't see that item anymore, so look for a new one
|
||||
if (debug)
|
||||
debugmsg("Can't see our desired item! Gonna pause.");
|
||||
find_items(g);
|
||||
move_pause();
|
||||
}
|
||||
}
|
||||
|
||||
bool npc::want_to_attack_player(game *g)
|
||||
{
|
||||
int j;
|
||||
if ((attitude == NPCATT_KILL || attitude == NPCATT_FLEE) &&
|
||||
g->m.sees(posx, posy, g->u.posx, g->u.posy, g->light_level(), j) &&
|
||||
(target == NULL || rl_dist(posx, posy, g->u.posx, g->u.posy) > 3))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int npc::follow_distance()
|
||||
{
|
||||
int ret = 4;
|
||||
if (weapon.is_gun())
|
||||
ret = 7;
|
||||
ret = (ret * hp_percentage()) / 100;
|
||||
return (ret < 2 ? 2 : ret);
|
||||
}
|
||||
|
||||
npc_action npc::method_of_attacking_player(game *g, std::vector<point> &path)
|
||||
{
|
||||
if (g->debugmon)
|
||||
debugmsg("method_of_attacking_player()");
|
||||
int linet;
|
||||
int dist = trig_dist(posx, posy, g->u.posx, g->u.posy);
|
||||
bool can_see_u = g->sees_u(posx, posy, linet);
|
||||
// Set our path to the player
|
||||
if (can_see_u)
|
||||
path = line_to(posx, posy, g->u.posx, g->u.posy, linet);
|
||||
else if (saw_player_recently() &&
|
||||
g->m.sees(posx, posy, plx, ply, g->light_level(), linet))
|
||||
path = line_to(posx, posy, plx, ply, linet);
|
||||
else { // We can't see u, and we haven't seen u recently
|
||||
path.clear();
|
||||
if (attitude == NPCATT_FLEE)
|
||||
return long_term_goal_action(g, path);// We're probably safe from u...
|
||||
return npc_look_for_player;
|
||||
}
|
||||
|
||||
if (can_see_u) {
|
||||
if (attitude == NPCATT_FLEE)
|
||||
return npc_flee_player;
|
||||
if (weapon.is_gun()) {
|
||||
if (weapon.charges > 0) {
|
||||
if (dist <= confident_range())
|
||||
return npc_shoot_player;
|
||||
else if (can_reload() &&
|
||||
dist - confident_range() >= weapon.reload_time(*this))
|
||||
// It takes less time to reload than to get within confident range
|
||||
return npc_reload;
|
||||
else
|
||||
return npc_melee_player;
|
||||
} else { // We're wielding a gun, but it's not loaded
|
||||
if (path.size() <= 2)
|
||||
return npc_melee_player;
|
||||
else if (can_reload() && !g->u.weapon.is_gun() &&
|
||||
(dist >= weapon.reload_time(*this) || g->u.hp_percentage() <= 25))
|
||||
return npc_reload; // If we have time to reload OR you're almost dead
|
||||
else if (alt_attack_available()) // Grenades, etc.
|
||||
return npc_alt_attack_player;
|
||||
else
|
||||
return npc_flee_player; // Get away, then maybe reload
|
||||
}
|
||||
} else { // Our weapon is not a gun
|
||||
if (path.size() <= 4 || !g->u.weapon.is_gun()) // Safe to attack
|
||||
return npc_melee_player;
|
||||
else if (alt_attack_available()) // Grenades, etc.
|
||||
return npc_alt_attack_player;
|
||||
else
|
||||
return npc_flee_player;
|
||||
}
|
||||
} else { // We can't see you!
|
||||
if (attitude == NPCATT_FLEE)
|
||||
return npc_flee_player;
|
||||
return npc_melee_player; // Follow path to plx, ply
|
||||
}
|
||||
}
|
||||
|
||||
npc_action npc::method_of_attacking_monster(game *g, std::vector<point> &path)
|
||||
{
|
||||
if (target == NULL) {
|
||||
debugmsg("Tried to figure out how to attack a null monster!");
|
||||
return npc_pause;
|
||||
}
|
||||
if (g->debugmon)
|
||||
debugmsg("method_of_attacking_monster(); %s (%d:%d)", target->name().c_str(), target->posx, target->posy);
|
||||
int linet, light = g->light_level();
|
||||
if (g->m.sees(posx, posy, target->posx, target->posy, light, linet))
|
||||
path = line_to(posx, posy, target->posx, target->posy, linet);
|
||||
else {
|
||||
target = choose_monster_target(g);
|
||||
if (g->m.sees(posx, posy, target->posx, target->posy, light, linet))
|
||||
path = line_to(posx, posy, target->posx, target->posy, linet);
|
||||
else
|
||||
return npc_pause;
|
||||
}
|
||||
int dist = trig_dist(posx, posy, target->posx, target->posy);
|
||||
int rldist = rl_dist(posx, posy, target->posx, target->posy);
|
||||
if (weapon.is_gun()) {
|
||||
if (weapon.charges > 0) {
|
||||
if (dist <= confident_range()) {
|
||||
if (wont_shoot_friend(g))
|
||||
return npc_shoot_monster;
|
||||
else { // u or a friendly NPC is in the way
|
||||
std::string saytext = std::string("Move so I can shoot that") +
|
||||
target->name().c_str() + "!";
|
||||
say(g, saytext);
|
||||
if (can_reload())
|
||||
return npc_reload;
|
||||
return npc_flee_monster;
|
||||
}
|
||||
} else { // The monster is outside of our confident range
|
||||
if (can_reload() && rldist * 1.5 <= weapon.reload_time(*this))
|
||||
return npc_reload; // Plenty of time to reload
|
||||
else if (target->speed >= 100)
|
||||
return npc_melee_monster; // They're fast, don't ignore them
|
||||
else
|
||||
return long_term_goal_action(g, path); // Ignore the monster
|
||||
}
|
||||
} else { // Gun isn't loaded
|
||||
if (can_reload() && rldist * 1.5 <= weapon.reload_time(*this))
|
||||
return npc_reload; // Plenty of time to reload
|
||||
else if (target->speed >= 90 && hp_percentage() >= 75)
|
||||
return npc_melee_monster;
|
||||
else
|
||||
return long_term_goal_action(g, path); // Ignore the monster
|
||||
}
|
||||
} else { // Our weapon isn't a gun
|
||||
if ((rldist * 100) / target->speed <= 6) { // Close enough to care
|
||||
if (hp_percentage() + sklevel[sk_melee] * 10 >= 80) // We're confident
|
||||
return npc_melee_monster;
|
||||
else
|
||||
return npc_flee_monster;
|
||||
} else // Too far away or slow, ignore them for now
|
||||
return long_term_goal_action(g, path);
|
||||
}
|
||||
}
|
||||
|
||||
bool npc::can_reload()
|
||||
{
|
||||
if (!weapon.is_gun())
|
||||
return false;
|
||||
it_gun* gun = dynamic_cast<it_gun*> (weapon.type);
|
||||
return (weapon.charges < gun->clip && has_ammo(gun->ammo).size() > 0);
|
||||
}
|
||||
|
||||
bool npc::fetching_item()
|
||||
{
|
||||
return (itx != 999 && ity != 999);
|
||||
}
|
||||
|
||||
bool npc::saw_player_recently()
|
||||
{
|
||||
return (plx != 999 && ply != 999);
|
||||
}
|
||||
|
||||
bool npc::has_destination()
|
||||
{
|
||||
return (goalx != 999 && goaly != 999);
|
||||
}
|
||||
|
||||
bool npc::alt_attack_available()
|
||||
{
|
||||
if (has_amount(itm_grenade, 1) || has_amount(itm_grenade_act, 1) ||
|
||||
has_amount(itm_molotov, 1) || has_amount(itm_molotov_lit, 1) ||
|
||||
has_amount(itm_gasbomb, 1) || has_amount(itm_gasbomb_act, 1) ||
|
||||
has_amount(itm_dynamite, 1) || has_amount(itm_dynamite_act, 1) ||
|
||||
has_amount(itm_mininuke, 1) || has_amount(itm_mininuke_act, 1) )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
npc_action npc::long_term_goal_action(game *g, std::vector<point> &path)
|
||||
{
|
||||
if (g->debugmon)
|
||||
debugmsg("long_term_goal_action()");
|
||||
int linet;
|
||||
int light = g->light_level();
|
||||
path.clear();
|
||||
if (mission == MISSION_SHOPKEEP)
|
||||
return npc_pause; // Shopkeeps just stay put.
|
||||
if (attitude == NPCATT_FOLLOW || attitude == NPCATT_FOLLOW_RUN ||
|
||||
attitude == NPCATT_SLAVE) {
|
||||
if (g->sees_u(posx, posy, linet)) {
|
||||
path = line_to(posx, posy, g->u.posx, g->u.posy, linet);
|
||||
return npc_follow_player;
|
||||
} else if (saw_player_recently() &&
|
||||
g->m.sees(posx, posy, plx, ply, light, linet)) {
|
||||
path = line_to(posx, posy, plx, ply, linet);
|
||||
return npc_follow_player;
|
||||
} else
|
||||
return npc_look_for_player;
|
||||
} else if (attitude == NPCATT_TALK || attitude == NPCATT_TRADE) {
|
||||
if (g->sees_u(posx, posy, linet))
|
||||
path = line_to(posx, posy, g->u.posx, g->u.posy, linet);
|
||||
else if (saw_player_recently() &&
|
||||
g->m.sees(posx, posy, plx, ply, light, linet))
|
||||
path = line_to(posx, posy, plx, ply, linet);
|
||||
if (path.size() <= 6 && path.size() > 0) // Close enough to talk
|
||||
return npc_talk_to_player;
|
||||
else if (path.size() > 0) {
|
||||
return npc_follow_player;
|
||||
if (one_in(20))
|
||||
say(g, "Come here, let's talk!");
|
||||
} else
|
||||
return npc_look_for_player;
|
||||
} else { // Nothing in particular we care to do with the player
|
||||
if (!has_destination())
|
||||
set_destination(g);
|
||||
return npc_goto_destination;
|
||||
}
|
||||
}
|
||||
|
||||
void npc::set_destination(game *g)
|
||||
{
|
||||
decide_needs();
|
||||
if (needs[0] == need_none) { // We don't really need anything in particular
|
||||
/* Hold off on this for now. TODO: This
|
||||
std::vector<faction_value> values;
|
||||
// Maybe find something based on what our faction values
|
||||
if (fac_has_value(FACVAL_EXPLORATION))
|
||||
values.push_back(FACVAL_EXPLORATION);
|
||||
if (fac_has_value(FACVAL_SHADOW))
|
||||
values.push_back(FACVAL_SHADOW);
|
||||
if (fac_has_value(FACVAL_DRUGS))
|
||||
values.push_back(FACVAL_DRUGS);
|
||||
if (fac_has_value(FACVAL_BIONICS))
|
||||
values.push_back(FACVAL_BIONICS);
|
||||
if (fac_has_value(FACVAL_DOCTORS))
|
||||
values.push_back(FACVAL_DOCTORS);
|
||||
if (fac_has_value(FACVAL_BOOKS))
|
||||
values.push_back(FACVAL_BOOKS);
|
||||
if (fac_has_value(FACVAL_ROBOTS))
|
||||
values.push_back(FACVAL_ROBOTS);
|
||||
|
||||
if (values.size() == 0) {// Our faction doesn't collect anything in particular
|
||||
*/
|
||||
goalx = mapx + rng(-2, 2);
|
||||
goaly = mapy + rng(-2, 2);
|
||||
/*
|
||||
} else { // Our faction DOES collect stuff!
|
||||
oter_id dest_type = ot_null; // Type of terrain we're looking for
|
||||
switch (values[rng(0, values.size() - 1)]) { // Pick one at random
|
||||
case FACVAL_SHADOW: dest_type = ot_sub_station_north; break;
|
||||
case FACVAL_DRUGS:
|
||||
case FACVAL_DOCTORS: dest_type = ot_s_pharm_north; break;
|
||||
case FACVAL_BIONICS:
|
||||
case FACVAL_ROBOTS: dest_type = ot_s_hardware_north; break;
|
||||
case FACVAL_BOOKS: dest_type = ot_s_library_north; break;
|
||||
}
|
||||
int dist = 0;
|
||||
point p = g->cur_om.find_closest(point(mapx, mapy),dest_type,4, dist, false);
|
||||
goalx = p.x;
|
||||
goaly = p.y;
|
||||
}
|
||||
*/
|
||||
} else { // We do have at least one pressing need
|
||||
oter_id dest_type = ot_null; // Type of terrain we're looking for
|
||||
switch (needs[0]) {
|
||||
case need_ammo:
|
||||
case need_gun: dest_type = ot_s_gun_north; break;
|
||||
case need_weapon: dest_type = ot_s_hardware_north; break;
|
||||
case need_food: dest_type = ot_s_grocery_north; break;
|
||||
case need_drink: dest_type = ot_s_liquor_north; break;
|
||||
}
|
||||
int dist = 0;
|
||||
point p = g->cur_om.find_closest(point(mapx, mapy),dest_type,4, dist, false);
|
||||
goalx = p.x;
|
||||
goaly = p.y;
|
||||
}
|
||||
}
|
||||
|
||||
void npc::go_to_destination(game *g)
|
||||
{
|
||||
int sx = (goalx > mapx ? 1 : -1), sy = (goaly > mapy ? 1 : -1);
|
||||
if (goalx == mapx && goaly == mapy)
|
||||
move_pause();
|
||||
else {
|
||||
if (goalx == mapx)
|
||||
sx = 0;
|
||||
if (goaly == mapy)
|
||||
sy = 0;
|
||||
int x = posx + 8 * sx, y = posy + 8 * sy, linet, light = g->light_level();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for (int dx = 0 - i; dx <= i; dx++) {
|
||||
for (int dy = 0 - i; dy <= i; dy++) {
|
||||
if (g->m.sees(posx, posy, x + dx, y + dy, light, linet)) {
|
||||
std::vector<point> path = line_to(posx, posy, x + dx, y + dy, linet);
|
||||
if (can_move_to(g, path[0].x, path[0].y)) {
|
||||
move_to(g, path[0].x, path[0].y);
|
||||
return;
|
||||
} else {
|
||||
move_pause();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool npc::can_move_to(game *g, int x, int y)
|
||||
{
|
||||
if (g->m.move_cost(x, y) > 0 || g->m.has_flag(bashable, x, y) &&
|
||||
rl_dist(posx, posy, x, y) <= 1)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void npc::move_to(game *g, int x, int y)
|
||||
{
|
||||
if (recoil > 0) { // Start by dropping recoil a little
|
||||
if (int(str_cur / 2) + sklevel[sk_gun] >= recoil)
|
||||
recoil = 0;
|
||||
else {
|
||||
recoil -= int(str_cur / 2) + sklevel[sk_gun];
|
||||
recoil = int(recoil / 2);
|
||||
}
|
||||
}
|
||||
if (abs(x - posx) > 1 || abs(y - posy) > 1) {
|
||||
debugmsg("Tried to move_to more than one space! (%d, %d) to (%d, %d)",
|
||||
posx, posy, x, y);
|
||||
return;
|
||||
}
|
||||
if (x == posx && y == posy) // We're just pausing!
|
||||
moves -= 100;
|
||||
else if (g->mon_at(x, y) != -1) { // Shouldn't happen, but it might.
|
||||
monster *m = &(g->z[g->mon_at(x, y)]);
|
||||
melee_monster(g, m);
|
||||
} else if (g->u.posx == x && g->u.posy == y) {
|
||||
say(g, "Excuse me, let me pass.");
|
||||
moves -= 100;
|
||||
} else if (g->npc_at(x, y) != -1)
|
||||
// TODO: Determine if it's an enemy NPC (hit them), or a friendly in the way
|
||||
moves -= 100;
|
||||
else if (g->m.move_cost(x, y) > 0) {
|
||||
posx = x;
|
||||
posy = y;
|
||||
moves -= g->m.move_cost(x, y) * 50;
|
||||
} else if (g->m.open_door(x, y, (g->m.ter(posx, posy) == t_floor)))
|
||||
moves -= 100;
|
||||
else if (g->m.has_flag(bashable, x, y)) {
|
||||
moves -= 110;
|
||||
std::string bashsound;
|
||||
int smashskill = int(str_cur / 2 + weapon.type->melee_dam);
|
||||
g->m.bash(x, y, smashskill, bashsound);
|
||||
g->sound(x, y, 18, bashsound);
|
||||
}
|
||||
}
|
||||
|
||||
void npc::move_away_from(game *g, int x, int y)
|
||||
{
|
||||
int sx = (x > posx ? -1 : 1), sy = (y > posy ? -1 : 1);
|
||||
int dx = abs(posx - x), dy = abs(posy - y);
|
||||
if (can_move_to(g, posx + sx, posy + sy))
|
||||
move_to(g, posx + sx, posy + sy);
|
||||
else {
|
||||
if (dx >= dy) { // More important to flee via x
|
||||
if (can_move_to(g, posx + sx, posy))
|
||||
move_to(g, posx + sx, posy);
|
||||
else if (dx >= dy * 2 && can_move_to(g, posx + sx, posy - sy))
|
||||
move_to(g, posx + sx, posy - sy);
|
||||
else if (can_move_to(g, posx, posy + sy))
|
||||
move_to(g, posx, posy + sy);
|
||||
else if (dx > 3 && can_move_to(g, posx - sx, posy + sy))
|
||||
move_to(g, posx - sx, posy + sy);
|
||||
else
|
||||
move_pause();
|
||||
} else {
|
||||
if (can_move_to(g, posx, posy + sy))
|
||||
move_to(g, posx, posy + sy);
|
||||
else if (dy >= dx * 2 && can_move_to(g, posx - sx, posy + sy))
|
||||
move_to(g, posx - sx, posy + sy);
|
||||
else if (g, can_move_to(g, posx + sx, posy))
|
||||
move_to(g, posx + sx, posy);
|
||||
else if (dy > 3 && can_move_to(g, posx + sx, posy - sy))
|
||||
move_to(g, posx + sx, posy - sy);
|
||||
else
|
||||
move_pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void npc::move_pause()
|
||||
{
|
||||
moves = 0;
|
||||
recoil = 0;
|
||||
}
|
||||
|
||||
void npc::melee_monster(game *g, monster *m)
|
||||
{
|
||||
int dam = hit_mon(g, target);
|
||||
if (target->hurt(dam)) {
|
||||
g->kill_mon(g->mon_at(target->posx, target->posy));
|
||||
target = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void npc::alt_attack(game *g, monster *m, player *p)
|
||||
{
|
||||
// In order of importance
|
||||
itype_id options[8] = {itm_mininuke_act, itm_dynamite_act, itm_grenade_act,
|
||||
itm_gasbomb_act, itm_mininuke, itm_dynamite, itm_grenade,
|
||||
itm_gasbomb};
|
||||
item used;
|
||||
bool throwing = false;
|
||||
int i, tx, ty, linet;
|
||||
if (m == NULL && p == NULL) {
|
||||
debugmsg("alt_attack() with m and p null!");
|
||||
return;
|
||||
} else if (m != NULL) {
|
||||
tx = m->posx;
|
||||
ty = m->posy;
|
||||
} else {
|
||||
tx = p->posx;
|
||||
ty = p->posy;
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (has_amount(options[i], 1)) {
|
||||
if (i <= 4)
|
||||
throwing = true;
|
||||
if (throwing)
|
||||
used = i_rem(options[i]);
|
||||
else
|
||||
used = i_of_type(options[i]);
|
||||
i = 9;
|
||||
}
|
||||
}
|
||||
if (i == 8) { // We didn't encounter anything we can use!
|
||||
debugmsg("alt_attack_monster() didn't find anything usable");
|
||||
return;
|
||||
}
|
||||
if (throwing) {
|
||||
int light = g->light_level();
|
||||
std::vector<point> trajectory;
|
||||
if (g->m.sees(posx, posy, tx, ty, light, linet))
|
||||
trajectory = line_to(posx, posy, tx, ty, linet);
|
||||
else
|
||||
trajectory = line_to(posx, posy, tx, ty, 0);
|
||||
moves -= 125;
|
||||
if (g->u_see(posx, posy, linet))
|
||||
g->add_msg("%s throws a %s.", name.c_str(), used.tname().c_str());
|
||||
g->throw_item(*this, tx, ty, used, trajectory);
|
||||
} else {
|
||||
bool seen = g->u_see(posx, posy, linet);
|
||||
item *activated = &(i_of_type(itype_id(used.type->id)));
|
||||
switch (used.type->id) {
|
||||
case itm_mininuke:
|
||||
activated->make(g->itypes[itm_mininuke_act]);
|
||||
activated->charges = 5;
|
||||
activated->active = true;
|
||||
if (seen)
|
||||
g->add_msg("%s activates %s mininuke.", name.c_str(), (male ? "his":"her"));
|
||||
break;
|
||||
case itm_dynamite:
|
||||
activated->make(g->itypes[itm_dynamite_act]);
|
||||
activated->charges = 20;
|
||||
activated->active = true;
|
||||
if (seen)
|
||||
g->add_msg("%s lights %s dynamite.", name.c_str(), (male ? "his":"her"));
|
||||
break;
|
||||
case itm_gasbomb:
|
||||
activated->make(g->itypes[itm_gasbomb_act]);
|
||||
activated->charges = 20;
|
||||
activated->active = true;
|
||||
if (seen)
|
||||
g->add_msg("%s pulls the pin on %s gas canister.", name.c_str(),
|
||||
(male ? "his":"her"));
|
||||
break;
|
||||
case itm_grenade:
|
||||
activated->make(g->itypes[itm_gasbomb_act]);
|
||||
activated->charges = 5;
|
||||
activated->active = true;
|
||||
if (seen)
|
||||
g->add_msg("%s pulls the pin on %s grenade.", name.c_str(),
|
||||
(male ? "his":"her"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void npc::melee_player(game *g, player &foe)
|
||||
{
|
||||
moves -= 80 + weapon.volume() * 2 + weapon.weight() + encumb(bp_torso);
|
||||
body_part bphit;
|
||||
int hit_dam = 0, hit_cut = 0, side = rng(0, 1);
|
||||
bool hitit = hit_player(g->u, bphit, hit_dam, hit_cut);
|
||||
if (hitit) {
|
||||
g->add_msg("%s hits your %s with %s %s.", name.c_str(),
|
||||
body_part_name(bphit, side).c_str(), (male ? "his" : "her"),
|
||||
weapname(false).c_str());
|
||||
g->u.hit(g, bphit, side, hit_dam, hit_cut);
|
||||
} else
|
||||
g->add_msg("%s swings %s %s at you, but misses.", name.c_str(),
|
||||
(male ? "his" : "her"), weapname(false).c_str());
|
||||
}
|
||||
|
||||
|
||||
void npc::heal_player(game *g, player &patient)
|
||||
{
|
||||
int low_health = 400;
|
||||
hp_part worst;
|
||||
// Chose the worst-hurting body part
|
||||
for (int i = 0; i < num_hp_parts; i++) {
|
||||
int hp = patient.hp_cur[i];
|
||||
// The head and torso are weighted more heavily than other body parts
|
||||
if (i == hp_head)
|
||||
hp = patient.hp_max[i] - 3 * (patient.hp_max[i] - hp);
|
||||
else if (i == hp_torso)
|
||||
hp = patient.hp_max[i] - 2 * (patient.hp_max[i] - hp);
|
||||
if (hp < low_health) {
|
||||
low_health = hp;
|
||||
worst = hp_part(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (patient.is_npc())
|
||||
g->add_msg("%s heals %s.", name.c_str(), patient.name.c_str());
|
||||
else
|
||||
g->add_msg("%s heals you.", name.c_str());
|
||||
|
||||
int amount_healed;
|
||||
if (has_amount(itm_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];
|
||||
}
|
||||
use_up(itm_1st_aid, 1);
|
||||
} else if (has_amount(itm_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];
|
||||
}
|
||||
use_up(itm_bandages, 1);
|
||||
}
|
||||
patient.hp_cur[worst] += amount_healed;
|
||||
if (patient.hp_cur[worst] > patient.hp_max[worst])
|
||||
patient.hp_cur[worst] = patient.hp_max[worst];
|
||||
|
||||
if (!patient.is_npc()) {
|
||||
// Test if we want to heal the player further
|
||||
if (op_of_u.value * 4 + op_of_u.trust + personality.altruism * 3 +
|
||||
(fac_has_value(FACVAL_CHARITABLE) ? 5 : 0) +
|
||||
(fac_has_job (FACJOB_DOCTORS) ? 15 : 0) - op_of_u.fear * 3 < 25) {
|
||||
attitude = NPCATT_FOLLOW;
|
||||
say(g, "That's all the healing I can do.");
|
||||
} else
|
||||
say(g, "Hold still, I can heal you more.");
|
||||
}
|
||||
}
|
||||
|
||||
void npc::mug_player(game *g, player &mark)
|
||||
{
|
||||
int linet;
|
||||
if (mark.cash > 0) {
|
||||
moves -= 100;
|
||||
if (mark.is_npc() && g->u_see(posx, posy, linet))
|
||||
g->add_msg("%d takes %d's money.", name.c_str(), mark.name.c_str());
|
||||
else if (!mark.is_npc())
|
||||
g->add_msg("%d takes all of your money.", name.c_str());
|
||||
cash += mark.cash;
|
||||
mark.cash = 0;
|
||||
} else if (mark.weapon.type->id != 0 && mark.weapon.type->id < num_items) {
|
||||
if (mark.is_npc() && g->u_see(posx, posy, linet))
|
||||
g->add_msg("%d takes %d's %d.", name.c_str(), mark.name.c_str(),
|
||||
mark.weapon.tname().c_str());
|
||||
else if (!mark.is_npc())
|
||||
g->add_msg("%d takes your %d.", name.c_str(), mark.weapon.tname().c_str());
|
||||
if (volume_carried() + mark.weapon.volume() <= volume_capacity() &&
|
||||
weight_carried() + mark.weapon.weight() <= weight_capacity() )
|
||||
i_add(mark.weapon);
|
||||
else {
|
||||
if (g->u_see(posx, posy, linet))
|
||||
g->add_msg("%d drops it.", (male ? "He" : "She"));
|
||||
g->m.add_item(posx, posy, mark.weapon);
|
||||
}
|
||||
mark.remove_weapon();
|
||||
} else { // We already took your weapon; start on inventory
|
||||
int best_value = 0, index = -1;
|
||||
for (int i = 0; i < mark.inv.size(); i++) {
|
||||
int itvalue = value(mark.inv[i]);
|
||||
if (itvalue >= NPC_LOW_VALUE &&
|
||||
volume_carried() + mark.inv[i].volume() <= volume_capacity() &&
|
||||
weight_carried() + mark.inv[i].weight() <= weight_capacity() &&
|
||||
(itvalue > best_value || (itvalue == best_value &&
|
||||
mark.inv[i].volume() < mark.inv[index].volume()))) {
|
||||
best_value = itvalue;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index == -1) { // Nothing left to steal!
|
||||
attitude = NPCATT_FLEE;
|
||||
move_away_from(g, mark.posx, mark.posy);
|
||||
} else {
|
||||
moves -= 100;
|
||||
if (mark.is_npc() && g->u_see(posx, posy, linet))
|
||||
g->add_msg("%s takes %s's %s.", name.c_str(), mark.name.c_str(),
|
||||
mark.inv[index].tname().c_str());
|
||||
else if (!mark.is_npc())
|
||||
g->add_msg("%s takes your %s.", name.c_str(),
|
||||
mark.inv[index].tname().c_str());
|
||||
i_add(mark.inv[index]);
|
||||
mark.i_remn(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void npc::look_for_player(game *g)
|
||||
{
|
||||
if (g->turn % 6 == 0 && one_in(2)) {
|
||||
// Call out to the player
|
||||
switch (rng(0, 4)) {
|
||||
case 0: say(g, "Where are you?"); break;
|
||||
case 1: say(g, "Hey, where are you?"); break;
|
||||
case 2: say(g, "We need to stick together, come back!"); break;
|
||||
case 3: say(g, "Wait up!"); break;
|
||||
case 4: say(g, "Don't leave me!"); break;
|
||||
}
|
||||
}
|
||||
|
||||
goalx = mapx + rng(-1, 1);
|
||||
goaly = mapy + rng(-1, 1);
|
||||
go_to_destination(g);
|
||||
}
|
||||
|
||||
std::string npc_action_name(npc_action action)
|
||||
{
|
||||
switch (action) {
|
||||
case npc_pause: return "pause";
|
||||
case npc_reload: return "reload";
|
||||
case npc_pickup: return "pickup";
|
||||
case npc_flee_monster: return "flee monster";
|
||||
case npc_melee_monster: return "melee monster";
|
||||
case npc_shoot_monster: return "shoot monster";
|
||||
case npc_alt_attack_monster: return "alt attack monster";
|
||||
case npc_look_for_player: return "look for player";
|
||||
case npc_heal_player: return "heal player";
|
||||
case npc_follow_player: return "follow player";
|
||||
case npc_talk_to_player: return "talk to player";
|
||||
case npc_flee_player: return "flee player";
|
||||
case npc_mug_player: return "mug player";
|
||||
case npc_melee_player: return "melee player";
|
||||
case npc_shoot_player: return "shoot player";
|
||||
case npc_alt_attack_player: return "alt attack player";
|
||||
case npc_goto_destination: return "goto destination";
|
||||
default: return "unknown";
|
||||
}
|
||||
};
|
||||
|
||||
-830
@@ -1,830 +0,0 @@
|
||||
#include "npc.h"
|
||||
#include "output.h"
|
||||
#include "game.h"
|
||||
#include "dialogue.h"
|
||||
#include "rng.h"
|
||||
#include "line.h"
|
||||
#include "keypress.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
void say_hello (game *g, dialogue &d);
|
||||
void say_ask_for (game *g, dialogue &d, npc_need need);
|
||||
void say_put_em_up (game *g, dialogue &d);
|
||||
void say_listen (game *g, dialogue &d);
|
||||
void say_listen_need (game *g, dialogue &d);
|
||||
void say_listen_about (game *g, dialogue &d);
|
||||
void say_why_join (game *g, dialogue &d);
|
||||
|
||||
bool trade(game *g, dialogue &d, int cost, std::string deal);
|
||||
|
||||
void npc::talk_to_u(game *g)
|
||||
{
|
||||
moves -= 100;
|
||||
dialogue d;
|
||||
d.alpha = &g->u;
|
||||
d.beta = this;
|
||||
d.done = false;
|
||||
d.win = newwin(25, 80, 0, 0);
|
||||
wborder(d.win, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
for (int i = 1; i < 24; i++)
|
||||
mvwputch(d.win, i, 41, c_ltgray, LINE_XOXO);
|
||||
mvwputch(d.win, 0, 41, c_ltgray, LINE_OXXX);
|
||||
mvwputch(d.win, 24, 41, c_ltgray, LINE_XXOX);
|
||||
mvwprintz(d.win, 1, 1, c_white, "Dialogue with %s", name.c_str());
|
||||
mvwprintz(d.win, 1, 43, c_white, "Your response:");
|
||||
decide_needs();
|
||||
|
||||
// Decide on opening line
|
||||
do {
|
||||
if (op_of_u.fear < personality.bravery &&
|
||||
op_of_u.value < personality.aggression * 2)
|
||||
say_put_em_up(g, d);
|
||||
else if (attitude == NPCATT_TALK && needs.size() > 0 && needs[0] != need_none)
|
||||
say_ask_for(g, d, needs[0]);
|
||||
/*
|
||||
else if (attitude == NPCATT_TALK)
|
||||
say_hello(g, d);
|
||||
*/
|
||||
else
|
||||
say_listen(g, d);
|
||||
} while (!d.done);
|
||||
delwin(d.win);
|
||||
g->refresh_all();
|
||||
}
|
||||
|
||||
void say_hello(game *g, dialogue &d)
|
||||
{
|
||||
//int opt = d.opt(talk_greeting_gen[rng(0, 9)],
|
||||
int opt = d.opt("Hello.", "\"Let's travel together.\"", "\"Leave me alone.\"",
|
||||
"Ignore them", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
say_why_join(g, d);
|
||||
break;
|
||||
case 2:
|
||||
d.done = true;
|
||||
d.beta->attitude = NPCATT_NULL;
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
if (d.beta->op_of_u.fear <= 0 && d.beta->op_of_u.value > 5)
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
else
|
||||
d.beta->attitude = NPCATT_NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// need is what we have determined to be our dearest need at the moment.
|
||||
// This is determined in npc::decide_needs(), found in npc.cpp
|
||||
// See dialogue.h for the strings talk_needs
|
||||
void say_ask_for(game *g, dialogue &d, npc_need need)
|
||||
{
|
||||
int opt = d.opt(talk_needs[need][rng(0, 4)],
|
||||
"\"Okay, let's trade.\"",
|
||||
"&\"Follow me, we'll search together.\"",
|
||||
"\"I don't have any, but...\"", "Ignore them", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
trade(g, d, 0, "");
|
||||
wrefresh(d.win);
|
||||
break;
|
||||
case 2:
|
||||
d.done = true;
|
||||
// TODO: Maybe not follow
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
break;
|
||||
case 3:
|
||||
say_listen(g, d);
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
if (d.beta->op_of_u.fear <= 0 && d.beta->op_of_u.value > 5)
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
else
|
||||
d.beta->attitude = NPCATT_NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void say_put_em_up(game *g, dialogue &d)
|
||||
{
|
||||
int opt;
|
||||
if (d.alpha->weapon.type->id == 0) {
|
||||
opt = d.opt(talk_hands_up[rng(0, 9)],
|
||||
"*Put hands up", "!Exit dialogue", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
d.beta->attitude = NPCATT_MUG;
|
||||
d.done = true;
|
||||
break;
|
||||
case 0:
|
||||
d.beta->attitude = NPCATT_KILL;
|
||||
d.beta->op_of_u.trust -= 8;
|
||||
d.done = true;
|
||||
}
|
||||
} else {
|
||||
opt = d.opt(talk_drop_weap[rng(0, 9)],
|
||||
"Drop weapon", "!Exit dialogue", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
g->m.add_item(d.alpha->posx, d.alpha->posy, d.alpha->remove_weapon());
|
||||
say_put_em_up(g, d);
|
||||
break;
|
||||
case 0:
|
||||
d.beta->attitude = NPCATT_KILL;
|
||||
d.beta->op_of_u.trust -= 10;
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void say_listen(game *g, dialogue &d)
|
||||
{
|
||||
if (d.beta->is_following()) {
|
||||
int opt = d.opt("Yes?", "\"I need...",
|
||||
"\"Tell me about...",
|
||||
"\"Let's do some trading.\"",
|
||||
"\"We need to get out of here!\"",
|
||||
(d.beta->attitude == NPCATT_DEFEND ?
|
||||
"\"I'm okay, just watch your own ass.\"" :
|
||||
"\"Help me!\""),
|
||||
(d.beta->attitude == NPCATT_WAIT ?
|
||||
"\"Okay, let's go.\"" :
|
||||
"\"Wait here.\""),
|
||||
"\"Stop following me.\"",
|
||||
"\"Nothing, let's go.\"", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
say_listen_need(g, d);
|
||||
break;
|
||||
case 2:
|
||||
say_listen_about(g, d);
|
||||
break;
|
||||
case 3:
|
||||
if (trade(g, d, 0, ""))
|
||||
d.done = true;
|
||||
wrefresh(d.win);
|
||||
break;
|
||||
case 4:
|
||||
d.beta->attitude = NPCATT_FOLLOW_RUN;
|
||||
d.done = true;
|
||||
break;
|
||||
case 5:
|
||||
if (d.beta->attitude == NPCATT_DEFEND)
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
else
|
||||
d.beta->told_to_help(g);
|
||||
d.done = true;
|
||||
break;
|
||||
case 6:
|
||||
if (d.beta->attitude == NPCATT_WAIT)
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
else
|
||||
d.beta->told_to_wait(g);
|
||||
d.done = true;
|
||||
break;
|
||||
case 7:
|
||||
d.beta->told_to_leave(g);
|
||||
d.done = true;
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
int opt = d.opt("Yes?", "\"I need...\"",
|
||||
"\"Want to travel together?\"",
|
||||
"\"Want to trade?\"",
|
||||
"\"Nothing, bye.\"", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
say_listen_need(g, d);
|
||||
break;
|
||||
case 2:
|
||||
say_why_join(g, d);
|
||||
break;
|
||||
case 3:
|
||||
if (trade(g, d, 0, ""))
|
||||
d.done = true;
|
||||
wrefresh(d.win);
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void say_listen_need(game *g, dialogue &d)
|
||||
{
|
||||
std::string response;
|
||||
point lookp;
|
||||
npc_opinion opinion = d.beta->op_of_u;
|
||||
int opt2;
|
||||
int opt = d.opt("What do you need, <name_g>?",
|
||||
"\"Healing.\"",
|
||||
"\"Directions to...\"",
|
||||
"\"Never mind.\"",
|
||||
"\"Bye.\"", NULL);
|
||||
switch (opt) {
|
||||
case 1:
|
||||
opinion.value--;
|
||||
if (opinion.fear > 0)
|
||||
opinion.fear--;
|
||||
if (opinion.value * 4 + opinion.trust + d.beta->personality.altruism * 3 +
|
||||
(d.beta->fac_has_value(FACVAL_CHARITABLE) ? 5 : 0) +
|
||||
(d.beta->fac_has_job(FACJOB_DOCTORS) ? 15 : 0) -
|
||||
opinion.fear * 3 >= 25) {
|
||||
if (d.beta->has_amount(itm_bandages,1) || d.beta->has_amount(itm_1st_aid,1)){
|
||||
d.beta->attitude = NPCATT_HEAL;
|
||||
d.done = true;
|
||||
d.beta->say(g, "Okay, hold still and I'll heal you.");
|
||||
} else
|
||||
d.beta->say(g, "I would if I had some medical supplies...");
|
||||
} else {
|
||||
d.done = true;
|
||||
d.beta->say(g, "Sorry... I can't help you.");
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
do {
|
||||
opt2 = d.opt("Directions to what?",
|
||||
"\"A gun store.\"",
|
||||
"\"A pharmacy.\"",
|
||||
"\"A grocery store.\"",
|
||||
"\"A liquor store.\"",
|
||||
"\"A hardware store.\"",
|
||||
"\"Bye.\"", NULL);
|
||||
oter_id look;
|
||||
switch (opt2) {
|
||||
case 1: look = ot_s_gun_north; break;
|
||||
case 2: look = ot_s_pharm_north; break;
|
||||
case 3: look = ot_s_grocery_north; break;
|
||||
case 4: look = ot_s_liquor_north; break;
|
||||
case 5: look = ot_s_hardware_north; break;
|
||||
case 0: d.done = true; break;
|
||||
}
|
||||
if (opt2 != 0) {
|
||||
int dist = 50;
|
||||
lookp = g->cur_om.find_closest(point(g->levx / 2, g->levy / 2), look, 4,
|
||||
dist, false);
|
||||
if (lookp.x != -1) {
|
||||
lookp.x = lookp.x * 2 - 1;
|
||||
lookp.y = lookp.y * 2 - 1;
|
||||
if (lookp.x == g->levx && lookp.y == g->levy)
|
||||
response = "We're standing in one!";
|
||||
else {
|
||||
std::stringstream msg;
|
||||
std::string unit = "feet";
|
||||
dist *= 36;
|
||||
msg << "There's one to the " <<
|
||||
direction_from(g->levx, g->levy, lookp.x, lookp.y);
|
||||
if (dist >= 50000)
|
||||
msg << ", many miles away.";
|
||||
else if (dist >= 15000)
|
||||
msg << ", a few miles away.";
|
||||
else if (dist >= 9000)
|
||||
msg << ", a couple miles away.";
|
||||
else if (dist >= 5000)
|
||||
msg << ", about a mile away.";
|
||||
else if (dist >= 2500)
|
||||
msg << ", about half a mile away.";
|
||||
else {
|
||||
dist = int(dist / 100) * 100;
|
||||
msg << ", about " << dist << "feet away.";
|
||||
}
|
||||
response = msg.str();
|
||||
}
|
||||
} else
|
||||
response = "I honestly have no idea.";
|
||||
opt2 = d.opt(response,
|
||||
"\"Thanks. I need more directions.\"",
|
||||
"\"Thanks. Something else...\"",
|
||||
"\"Thanks, that's all.\"", NULL);
|
||||
}
|
||||
} while (opt2 == 1);
|
||||
if (opt2 == 2)
|
||||
say_listen(g, d);
|
||||
if (opt2 == 0)
|
||||
d.done = true;
|
||||
break;
|
||||
case 3:
|
||||
say_listen(g, d);
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void say_listen_about(game *g, dialogue &d)
|
||||
{
|
||||
int opt = d.opt("About what?",
|
||||
"\"About you.\"",
|
||||
"\"About your faction.\"",
|
||||
"\"About other factions.\"",
|
||||
"\"Never mind.\"",
|
||||
"\"Never mind, bye.\"", NULL);
|
||||
std::string describe;
|
||||
switch (opt) {
|
||||
case 1:
|
||||
//describe = d.beta->describe_self();
|
||||
describe = "Not coded yet.";
|
||||
break;
|
||||
case 2:
|
||||
if (d.beta->my_fac == NULL)
|
||||
describe = talk_no_faction[rng(0, 9)];
|
||||
else
|
||||
describe = d.beta->my_fac->describe();
|
||||
break;
|
||||
case 3:
|
||||
debugmsg("Not coded yet.");
|
||||
d.done = true;
|
||||
case 4:
|
||||
say_listen(g, d);
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
if (opt == 1 || opt == 2) {
|
||||
switch(d.opt(describe,
|
||||
"\"Okay, another question...\"",
|
||||
"\"Thanks, that's it.\"", NULL)) {
|
||||
case 1: say_listen_about(g, d); break;
|
||||
case 0: d.done = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void say_why_join(game *g, dialogue &d)
|
||||
{
|
||||
int opt = d.opt("Why should I travel with you?",
|
||||
"\"We'll be safer together.\"",
|
||||
"\"I'll pay you.\"",
|
||||
"!\"I'll kill you if you don't.\"",
|
||||
"\"Never mind. Bye.\"", NULL);
|
||||
bool will_travel = false;
|
||||
switch (opt) {
|
||||
case 1:
|
||||
d.alpha->practice(sk_speech, 4);
|
||||
if (d.beta->op_of_u.value * 4 - d.beta->personality.bravery * 3 +
|
||||
d.beta->personality.altruism * 2 + d.alpha->int_cur / 4 +
|
||||
d.alpha->sklevel[sk_speech] > 8) {
|
||||
debugmsg("value (%d) * 4, - bravery (%d) * 3, + altruism (%d) * 2, + int",
|
||||
d.beta->op_of_u.value, d.beta->personality.bravery,
|
||||
d.beta->personality.altruism);
|
||||
d.beta->op_of_u.value++;
|
||||
d.beta->op_of_u.trust++;
|
||||
d.beta->say(g, "Alright, let's do it!");
|
||||
will_travel = true;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// if (trade(g, d, d.beta->price_to_follow())) {
|
||||
if (trade(g, d, -1000, "Hire: Travel together")) {
|
||||
d.beta->op_of_u.value--;
|
||||
d.beta->op_of_u.trust += 2;
|
||||
d.beta->op_of_u.fear--;
|
||||
will_travel = true;
|
||||
d.beta->say(g, "You've got yourself a deal!");
|
||||
}
|
||||
wrefresh(d.win);
|
||||
break;
|
||||
case 3:
|
||||
d.beta->op_of_u.trust -= 8;
|
||||
d.beta->op_of_u.value -= 3;
|
||||
d.beta->op_of_u.fear++;
|
||||
if (d.beta->op_of_u.fear - d.beta->personality.bravery -
|
||||
d.beta->personality.aggression < 0) {
|
||||
d.beta->op_of_u.value++;
|
||||
d.beta->say(g, "Fine, you monster!");
|
||||
will_travel = true;
|
||||
} else if (d.beta->op_of_u.fear - 2 * d.beta->personality.aggression -
|
||||
d.beta->personality.bravery < -4) {
|
||||
d.beta->say(g, "Never!");
|
||||
d.beta->attitude = NPCATT_KILL;
|
||||
d.done = true;
|
||||
} else {
|
||||
d.beta->attitude = NPCATT_FLEE;
|
||||
d.done = true;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
d.done = true;
|
||||
break;
|
||||
}
|
||||
if (will_travel) {
|
||||
if (opt == 3)
|
||||
d.beta->attitude = NPCATT_SLAVE;
|
||||
else
|
||||
d.beta->attitude = NPCATT_FOLLOW;
|
||||
d.done = true;
|
||||
} else if (d.done == false) {
|
||||
opt = d.opt("Eh. No thanks.", "\"Oh. But what if...\"",
|
||||
"\"That's fine. How about...\"",
|
||||
"\"Alright. Bye.\"", NULL);
|
||||
switch (opt) {
|
||||
case 1: say_why_join(g, d); break;
|
||||
case 2: say_listen(g, d); break;
|
||||
case 0: d.done = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int dialogue::opt(std::string challenge, ...)
|
||||
{
|
||||
// Parse any tags in challenge
|
||||
size_t fa, fb;
|
||||
std::string tag;
|
||||
do {
|
||||
fa = challenge.find("<");
|
||||
fb = challenge.find(">");
|
||||
if (fa != std::string::npos && fb != std::string::npos)
|
||||
tag = challenge.substr(fa, fb - fa + 1);
|
||||
else
|
||||
tag = "";
|
||||
if (tag == "<name_b>")
|
||||
challenge.replace(fa, 8, talk_bad_names[rng(0, 9)]);
|
||||
else if (tag == "<okay>")
|
||||
challenge.replace(fa, 6, talk_okay[rng(0, 9)]);
|
||||
else if (tag == "<name_g>")
|
||||
challenge.replace(fa, 8, talk_good_names[rng(0, 9)]);
|
||||
else if (tag == "<ill_die>")
|
||||
challenge.replace(fa, 9, ill_die[rng(0, 9)]);
|
||||
else if (tag == "<yrwp>")
|
||||
challenge.replace(fa, 6, alpha->weapon.tname());
|
||||
else if (tag == "<mywp>") {
|
||||
if (beta->weapon.type->id == 0)
|
||||
challenge.replace(fa, 6, "fists");
|
||||
else
|
||||
challenge.replace(fa, 6, beta->weapon.tname());
|
||||
} else if (tag == "<ammo>") {
|
||||
if (!beta->weapon.is_gun())
|
||||
challenge.replace(fa, 6, "BADAMMO");
|
||||
else {
|
||||
it_gun* gun = dynamic_cast<it_gun*>(beta->weapon.type);
|
||||
challenge.replace(fa, 6, ammo_name(gun->ammo));
|
||||
}
|
||||
} else if (tag == "<punc>") {
|
||||
switch (rng(0, 2)) {
|
||||
case 0: challenge.replace(fa, 6, "."); break;
|
||||
case 1: challenge.replace(fa, 6, "..."); break;
|
||||
case 2: challenge.replace(fa, 6, "!"); break;
|
||||
}
|
||||
} else if (tag != "") {
|
||||
debugmsg("Bad tag. %s (%d - %d)", tag.c_str(), fa, fb);
|
||||
challenge.replace(fa, fb - fa + 1, "????");
|
||||
}
|
||||
} while (fa != std::string::npos && fb != std::string::npos);
|
||||
if (challenge[0] >= 'a' && challenge[0] <= 'z')
|
||||
challenge[0] += 'A' - 'a';
|
||||
// Prepend "My Name: "
|
||||
challenge = beta->name + ": " + challenge;
|
||||
history.push_back(""); // Empty line between lines of dialogue
|
||||
|
||||
// Number of lines to highlight
|
||||
int hilight_lines = 1;
|
||||
size_t split;
|
||||
while (challenge.length() > 40) {
|
||||
hilight_lines++;
|
||||
split = challenge.find_last_of(' ', 40);
|
||||
history.push_back(challenge.substr(0, split));
|
||||
challenge = challenge.substr(split);
|
||||
}
|
||||
history.push_back(challenge);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, challenge);
|
||||
std::vector<std::string> options;
|
||||
char* tmp;
|
||||
while (tmp = va_arg(ap, char*))
|
||||
options.push_back(tmp);
|
||||
va_end(ap);
|
||||
nc_color cols[options.size()];
|
||||
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
if (options[i][0] == '!') {
|
||||
cols[i] = c_red;
|
||||
options[i] = options[i].substr(1);
|
||||
} else if (options[i][0] == '*') {
|
||||
cols[i] = c_ltred;
|
||||
options[i] = options[i].substr(1);
|
||||
} else if (options[i][0] == '&') {
|
||||
cols[i] = c_green;
|
||||
options[i] = options[i].substr(1);
|
||||
} else {
|
||||
cols[i] = c_white;
|
||||
}
|
||||
std::stringstream msg;
|
||||
if (i < options.size() - 1)
|
||||
msg << i + 1 << ": " << options[i];
|
||||
else
|
||||
msg << "0: " << options[i];
|
||||
options[i] = msg.str();
|
||||
}
|
||||
|
||||
for (int i = 2; i < 24; i++) {
|
||||
for (int j = 1; j < 79; j++) {
|
||||
if (j != 41)
|
||||
mvwputch(win, i, j, c_black, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
int curline = 23, curhist = 1;
|
||||
nc_color col;
|
||||
while (curhist <= history.size() && curline > 0) {
|
||||
if (curhist <= hilight_lines)
|
||||
col = c_red;
|
||||
else
|
||||
col = c_dkgray;
|
||||
mvwprintz(win, curline, 1, col, history[history.size() - curhist].c_str());
|
||||
curline--;
|
||||
curhist++;
|
||||
}
|
||||
|
||||
curline = 3;
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
while (options[i].size() > 36) {
|
||||
split = options[i].find_last_of(' ', 36);
|
||||
mvwprintz(win, curline, 42, cols[i], options[i].substr(0, split).c_str());
|
||||
options[i] = " " + options[i].substr(split);
|
||||
curline++;
|
||||
}
|
||||
mvwprintz(win, curline, 42, cols[i], options[i].c_str());
|
||||
curline++;
|
||||
}
|
||||
|
||||
wrefresh(win);
|
||||
|
||||
int ch, r;
|
||||
bool okay;
|
||||
do {
|
||||
do {
|
||||
ch = getch() - '0';
|
||||
r = ch - 1;
|
||||
if (r < 0)
|
||||
r += options.size();
|
||||
} while (ch < 0 || ch >= options.size());
|
||||
okay = false;
|
||||
if (cols[r] == c_white || cols[r] == c_green)
|
||||
okay = true;
|
||||
if (cols[r] == c_red && query_yn("You may be attacked! Proceed?"))
|
||||
okay = true;
|
||||
if (cols[r] == c_ltred && query_yn("You'll be helpless! Proceed?"))
|
||||
okay = true;
|
||||
} while (!okay);
|
||||
history.push_back("");
|
||||
if (ch == 0)
|
||||
history.push_back("You: " + options[options.size() - 1].substr(3));
|
||||
else
|
||||
history.push_back("You: " + options[ch - 1].substr(3));
|
||||
return ch;
|
||||
}
|
||||
|
||||
bool trade(game *g, dialogue &d, int cost, std::string deal)
|
||||
{
|
||||
WINDOW* w_head = newwin( 4, 80, 0, 0);
|
||||
WINDOW* w_them = newwin(21, 40, 4, 0);
|
||||
WINDOW* w_you = newwin(21, 40, 4, 40);
|
||||
WINDOW* w_tmp;
|
||||
mvwprintz(w_head, 0, 0, c_white, "\
|
||||
Trading with %s\n\
|
||||
Tab key to switch lists, letters to pick items, Enter to finalize, Esc to quit\n\
|
||||
? to get information on an item", d.beta->name.c_str());
|
||||
|
||||
// Set up line drawings
|
||||
for (int i = 0; i < 80; i++)
|
||||
mvwputch(w_head, 3, i, c_white, LINE_OXOX);
|
||||
wrefresh(w_head);
|
||||
|
||||
|
||||
// End of line drawings
|
||||
|
||||
// Populate the list of what the NPC is willing to buy, and the prices they pay
|
||||
// Note that the NPC's barter skill is factored into these prices.
|
||||
std::vector<int> theirs, their_price, yours, your_price;
|
||||
d.beta->init_selling(theirs, their_price);
|
||||
d.beta->init_buying(d.alpha->inv, yours, your_price);
|
||||
bool getting_theirs[theirs.size()], getting_yours[yours.size()];
|
||||
|
||||
// Adjust the prices based on your barter skill.
|
||||
for (int i = 0; i < their_price.size(); i++) {
|
||||
their_price[i] *= (price_adjustment(d.alpha->sklevel[sk_barter]) +
|
||||
(d.beta->int_cur - d.alpha->int_cur) / 15);
|
||||
getting_theirs[i] = false;
|
||||
}
|
||||
for (int i = 0; i < your_price.size(); i++) {
|
||||
your_price[i] /= (price_adjustment(d.alpha->sklevel[sk_barter]) +
|
||||
(d.beta->int_cur - d.alpha->int_cur) / 15);
|
||||
getting_yours[i] = false;
|
||||
}
|
||||
|
||||
int cash = cost;// How much cash you get in the deal (negative = losing money)
|
||||
bool focus_them = true; // Is the focus on them?
|
||||
bool update = true; // Re-draw the screen?
|
||||
int them_off = 0, you_off = 0; // Offset from the start of the list
|
||||
char ch, help;
|
||||
|
||||
do {
|
||||
if (update) { // Time to re-draw
|
||||
update = false;
|
||||
// Draw borders, one of which is highlighted
|
||||
werase(w_them);
|
||||
werase(w_you);
|
||||
for (int i = 1; i < 80; i++)
|
||||
mvwputch(w_head, 3, i, c_white, LINE_OXOX);
|
||||
mvwprintz(w_head, 3, 30, ((cash < 0 && d.alpha->cash >= cash * -1) ||
|
||||
(cash >= 0 && d.beta->cash >= cash) ?
|
||||
c_green : c_red),
|
||||
"%s $%d", (cash >= 0 ? "Profit" : "Cost"), abs(cash));
|
||||
if (deal != "")
|
||||
mvwprintz(w_head, 3, 45, (cost < 0 ? c_ltred : c_ltgreen), deal.c_str());
|
||||
if (focus_them)
|
||||
wattron(w_them, c_yellow);
|
||||
else
|
||||
wattron(w_you, c_yellow);
|
||||
wborder(w_them, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
wborder(w_you, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
wattroff(w_them, c_yellow);
|
||||
wattroff(w_you, c_yellow);
|
||||
mvwprintz(w_them, 0, 1, (cash < 0 || d.beta->cash >= cash ? c_green : c_red),
|
||||
"%s: $%d", d.beta->name.c_str(), d.beta->cash);
|
||||
mvwprintz(w_you, 0, 2, (cash > 0 || d.alpha->cash>=cash*-1 ? c_green:c_red),
|
||||
"You: $%d", d.alpha->cash);
|
||||
// Draw their list of items, starting from them_off
|
||||
for (int i = them_off; i < theirs.size() && i < 17; i++)
|
||||
mvwprintz(w_them, i - them_off + 1, 1,
|
||||
(getting_theirs[i] ? c_white : c_ltgray), "%c %c %s - $%d",
|
||||
char(i + 'a'), (getting_theirs[i] ? '+' : '-'),
|
||||
d.beta->inv[theirs[i + them_off]].tname().substr( 0,25).c_str(),
|
||||
their_price[i + them_off]);
|
||||
if (them_off > 0)
|
||||
mvwprintw(w_them, 19, 1, "< Back");
|
||||
if (them_off + 17 < theirs.size())
|
||||
mvwprintw(w_them, 19, 9, "More >");
|
||||
// Draw your list of items, starting from you_off
|
||||
for (int i = you_off; i < yours.size() && i < 17; i++)
|
||||
mvwprintz(w_you, i - you_off + 1, 1,
|
||||
(getting_yours[i] ? c_white : c_ltgray), "%c %c %s - $%d",
|
||||
char(i + 'a'), (getting_yours[i] ? '+' : '-'),
|
||||
d.alpha->inv[yours[i + you_off]].tname().substr( 0,25).c_str(),
|
||||
your_price[i + you_off]);
|
||||
if (you_off > 0)
|
||||
mvwprintw(w_you, 19, 1, "< Back");
|
||||
if (you_off + 17 < yours.size())
|
||||
mvwprintw(w_you, 19, 9, "More >");
|
||||
wrefresh(w_head);
|
||||
wrefresh(w_them);
|
||||
wrefresh(w_you);
|
||||
} // Done updating the screen
|
||||
ch = getch();
|
||||
switch (ch) {
|
||||
case '\t':
|
||||
focus_them = !focus_them;
|
||||
update = true;
|
||||
break;
|
||||
case '<':
|
||||
if (focus_them) {
|
||||
if (them_off > 0) {
|
||||
them_off -= 17;
|
||||
update = true;
|
||||
}
|
||||
} else {
|
||||
if (you_off > 0) {
|
||||
you_off -= 17;
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '>':
|
||||
if (focus_them) {
|
||||
if (them_off + 17 < theirs.size()) {
|
||||
them_off += 17;
|
||||
update = true;
|
||||
}
|
||||
} else {
|
||||
if (you_off + 17 < yours.size()) {
|
||||
you_off += 17;
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '?':
|
||||
update = true;
|
||||
w_tmp = newwin(3, 21, 1, 30);
|
||||
mvwprintz(w_tmp, 1, 1, c_red, "Examine which item?");
|
||||
wborder(w_tmp, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
wrefresh(w_tmp);
|
||||
help = getch();
|
||||
help -= 'a';
|
||||
werase(w_tmp);
|
||||
delwin(w_tmp);
|
||||
wrefresh(w_head);
|
||||
if (focus_them) {
|
||||
if (help >= 0 && help < theirs.size())
|
||||
popup(d.beta->inv[theirs[help]].info().c_str());
|
||||
} else {
|
||||
if (help >= 0 && help < yours.size())
|
||||
popup(d.alpha->inv[theirs[help]].info().c_str());
|
||||
}
|
||||
break;
|
||||
case '\n': // Check if we have enough cash...
|
||||
if (cash < 0 && d.alpha->cash < cash * -1) {
|
||||
popup("Not enough cash! You have $%d, price is $%d.", d.alpha->cash, cash);
|
||||
update = true;
|
||||
ch = ' ';
|
||||
} else if (cash > 0 && d.beta->cash < cash) {
|
||||
popup("They don't have enough cash!");
|
||||
update = true;
|
||||
ch = ' ';
|
||||
}
|
||||
break;
|
||||
default: // Letters & such
|
||||
if (ch >= 'a' && ch <= 'z') {
|
||||
ch -= 'a';
|
||||
if (focus_them) {
|
||||
if (ch < theirs.size()) {
|
||||
getting_theirs[ch] = !getting_theirs[ch];
|
||||
if (getting_theirs[ch])
|
||||
cash -= their_price[ch];
|
||||
else
|
||||
cash += their_price[ch];
|
||||
update = true;
|
||||
}
|
||||
} else { // Focus is on the player's inventory
|
||||
if (ch < yours.size()) {
|
||||
getting_yours[ch] = !getting_yours[ch];
|
||||
if (getting_yours[ch])
|
||||
cash += your_price[ch];
|
||||
else
|
||||
cash -= your_price[ch];
|
||||
update = true;
|
||||
}
|
||||
}
|
||||
ch = 0;
|
||||
}
|
||||
}
|
||||
} while (ch != KEY_ESCAPE && ch != '\n');
|
||||
|
||||
if (ch == '\n') {
|
||||
int practice = 0;
|
||||
std::vector<char> removing;
|
||||
debugmsg("Old size: %d", d.beta->inv.size());
|
||||
for (int i = 0; i < yours.size(); i++) {
|
||||
if (getting_yours[i]) {
|
||||
d.beta->inv.push_back(d.alpha->inv[yours[i]]);
|
||||
practice++;
|
||||
debugmsg("Gave a %s", d.alpha->inv[yours[i]].tname().c_str());
|
||||
removing.push_back(d.alpha->inv[yours[i]].invlet);
|
||||
}
|
||||
}
|
||||
debugmsg("New size: %d", d.beta->inv.size());
|
||||
// Do it in two passes, so removing items doesn't corrupt yours[]
|
||||
for (int i = 0; i < removing.size(); i++)
|
||||
d.alpha->i_rem(removing[i]);
|
||||
|
||||
std::vector<item> newinv;
|
||||
for (int i = 0; i < theirs.size(); i++) {
|
||||
item tmp = d.beta->inv[theirs[i]];
|
||||
if (getting_theirs[i]) {
|
||||
practice += 2;
|
||||
tmp.invlet = 'a';
|
||||
while (d.alpha->has_item(tmp.invlet)) {
|
||||
if (tmp.invlet == 'z')
|
||||
tmp.invlet = 'A';
|
||||
else if (tmp.invlet == 'Z')
|
||||
return false; // TODO: Do something else with these.
|
||||
else
|
||||
tmp.invlet++;
|
||||
}
|
||||
d.alpha->inv.push_back(tmp);
|
||||
} else
|
||||
newinv.push_back(tmp);
|
||||
}
|
||||
d.alpha->practice(sk_barter, practice / 2);
|
||||
d.beta->inv = newinv;
|
||||
d.alpha->cash += cash;
|
||||
d.beta->cash -= cash;
|
||||
}
|
||||
werase(w_head);
|
||||
werase(w_you);
|
||||
werase(w_them);
|
||||
wrefresh(w_head);
|
||||
wrefresh(w_you);
|
||||
wrefresh(w_them);
|
||||
delwin(w_head);
|
||||
delwin(w_you);
|
||||
delwin(w_them);
|
||||
if (ch == '\n')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -1,257 +0,0 @@
|
||||
#ifndef _OMDATA_H_
|
||||
#define _OMDATA_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <bitset>
|
||||
#include "mtype.h"
|
||||
#include "itype.h"
|
||||
#include "output.h"
|
||||
|
||||
#define OMAPX 180
|
||||
#define OMAPY 180
|
||||
|
||||
#define NORTH 1
|
||||
#define EAST 2
|
||||
#define SOUTH 4
|
||||
#define WEST 8
|
||||
|
||||
#define TUTORIAL_Z 10
|
||||
#define NETHER_Z 20
|
||||
|
||||
// oter_t defines almost all data needed to describe a location... however,
|
||||
// the list of eligible items is too long to store in this struct! That data
|
||||
// is now a part of the game class, and a pointer to said data is passed to new
|
||||
// maps; please see mapitemsdef.cpp.
|
||||
struct oter_t {
|
||||
std::string name;
|
||||
long sym; // This is type long so we can support curses linedrawing
|
||||
nc_color color;
|
||||
unsigned char see_cost; // Affects how far the player can see in the overmap
|
||||
};
|
||||
|
||||
enum oter_id {
|
||||
ot_null = 0,
|
||||
ot_field, ot_forest, ot_forest_thick, ot_forest_water, ot_hive, ot_hive_center,
|
||||
ot_hiway_ns, ot_hiway_ew,
|
||||
ot_road_null,
|
||||
ot_road_ns, ot_road_ew,
|
||||
ot_road_ne, ot_road_es, ot_road_sw, ot_road_wn,
|
||||
ot_road_nes, ot_road_new, ot_road_nsw, ot_road_esw, ot_road_nesw,
|
||||
ot_road_nesw_manhole,
|
||||
ot_bridge_ns, ot_bridge_ew,
|
||||
ot_river_center,
|
||||
ot_river_c_not_ne, ot_river_c_not_nw, ot_river_c_not_se, ot_river_c_not_sw,
|
||||
ot_river_north, ot_river_east, ot_river_south, ot_river_west,
|
||||
ot_river_ne, ot_river_se, ot_river_sw, ot_river_nw,
|
||||
ot_house_north, ot_house_east, ot_house_south, ot_house_west,
|
||||
ot_house_base_north, ot_house_base_east, ot_house_base_south,
|
||||
ot_house_base_west,
|
||||
ot_s_lot,
|
||||
ot_s_gas_north, ot_s_gas_east, ot_s_gas_south, ot_s_gas_west,
|
||||
ot_s_pharm_north, ot_s_pharm_east, ot_s_pharm_south, ot_s_pharm_west,
|
||||
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,
|
||||
ot_s_sports_north, ot_s_sports_east, ot_s_sports_south, ot_s_sports_west,
|
||||
ot_s_liquor_north, ot_s_liquor_east, ot_s_liquor_south, ot_s_liquor_west,
|
||||
ot_s_gun_north, ot_s_gun_east, ot_s_gun_south, ot_s_gun_west,
|
||||
ot_s_clothes_north, ot_s_clothes_east, ot_s_clothes_south, ot_s_clothes_west,
|
||||
ot_s_library_north, ot_s_library_east, ot_s_library_south, ot_s_library_west,
|
||||
ot_sub_station_north, ot_sub_station_east, ot_sub_station_south,
|
||||
ot_sub_station_west,
|
||||
ot_lab, ot_lab_stairs, ot_lab_core, ot_lab_finale,
|
||||
ot_nuke_plant_entrance, ot_nuke_plant,
|
||||
// <Settlement>
|
||||
ot_set_center,
|
||||
ot_set_house, ot_set_food, ot_set_weapons, ot_set_guns, ot_set_clinic,
|
||||
ot_set_clothing, ot_set_general, ot_set_casino, ot_set_library, ot_set_lab,
|
||||
ot_set_bionics,
|
||||
ot_radio_tower,
|
||||
ot_gate, ot_wall,
|
||||
// </Settlement>
|
||||
ot_anthill,
|
||||
// Underground terrain
|
||||
ot_rock, ot_rift, ot_hellmouth,
|
||||
ot_slimepit, ot_slimepit_down,
|
||||
ot_basement,
|
||||
ot_subway_station,
|
||||
ot_subway_ns, ot_subway_ew,
|
||||
ot_subway_ne, ot_subway_es, ot_subway_sw, ot_subway_wn,
|
||||
ot_subway_nes, ot_subway_new, ot_subway_nsw, ot_subway_esw, ot_subway_nesw,
|
||||
ot_sewer_ns, ot_sewer_ew,
|
||||
ot_sewer_ne, ot_sewer_es, ot_sewer_sw, ot_sewer_wn,
|
||||
ot_sewer_nes, ot_sewer_new, ot_sewer_nsw, ot_sewer_esw, ot_sewer_nesw,
|
||||
ot_ants_ns, ot_ants_ew,
|
||||
ot_ants_ne, ot_ants_es, ot_ants_sw, ot_ants_wn,
|
||||
ot_ants_nes, ot_ants_new, ot_ants_nsw, ot_ants_esw, ot_ants_nesw,
|
||||
ot_ants_food, ot_ants_larvae, ot_ants_queen,
|
||||
ot_cavern,
|
||||
|
||||
ot_tutorial,
|
||||
num_ter_types
|
||||
};
|
||||
|
||||
// LINE_**** corresponds to the ACS_**** macros in ncurses, and are patterned
|
||||
// the same way; LINE_NESW, where X indicates a line and O indicates no line
|
||||
// (thus, LINE_OXXX looks like 'T'). LINE_ is defined in output.h. The ACS_
|
||||
// macros can't be used here, since ncurses hasn't been initialized yet.
|
||||
|
||||
// Order MUST match enum oter_id above!
|
||||
|
||||
const oter_t oterlist[num_ter_types] = {
|
||||
{"nothing", '%', c_white, 0},
|
||||
{"field", '.', c_brown, 2},
|
||||
{"forest", 'F', c_green, 3},
|
||||
{"forest", 'F', c_green, 4},
|
||||
{"swamp", 'F', c_cyan, 4},
|
||||
{"bee hive", '8', c_yellow, 3},
|
||||
{"bee hive", '8', c_yellow, 3},
|
||||
{"highway", 'H', c_dkgray, 2},
|
||||
{"highway", '=', c_dkgray, 2},
|
||||
{"BUG", '%', c_magenta, 0},
|
||||
{"road", LINE_XOXO, c_dkgray, 2},
|
||||
{"road", LINE_OXOX, c_dkgray, 2},
|
||||
{"road", LINE_XXOO, c_dkgray, 2},
|
||||
{"road", LINE_OXXO, c_dkgray, 2},
|
||||
{"road", LINE_OOXX, c_dkgray, 2},
|
||||
{"road", LINE_XOOX, c_dkgray, 2},
|
||||
{"road", LINE_XXXO, c_dkgray, 2},
|
||||
{"road", LINE_XXOX, c_dkgray, 2},
|
||||
{"road", LINE_XOXX, c_dkgray, 2},
|
||||
{"road", LINE_OXXX, c_dkgray, 2},
|
||||
{"road", LINE_XXXX, c_dkgray, 2},
|
||||
{"road w/ manhole",LINE_XXXX, c_yellow, 2},
|
||||
{"bridge", '|', c_dkgray, 2},
|
||||
{"bridge", '-', c_dkgray, 2},
|
||||
{"river", 'R', c_blue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"river bank", 'R', c_ltblue, 1},
|
||||
{"house", '^', c_ltgreen, 5},
|
||||
{"house", '>', c_ltgreen, 5},
|
||||
{"house", 'v', c_ltgreen, 5},
|
||||
{"house", '<', c_ltgreen, 5},
|
||||
{"house", '^', c_ltgreen, 5},
|
||||
{"house", '>', c_ltgreen, 5},
|
||||
{"house", 'v', c_ltgreen, 5},
|
||||
{"house", '<', c_ltgreen, 5},
|
||||
{"parking lot", 'O', c_dkgray, 1},
|
||||
{"gas station", '^', c_ltblue, 5},
|
||||
{"gas station", '>', c_ltblue, 5},
|
||||
{"gas station", 'v', c_ltblue, 5},
|
||||
{"gas station", '<', c_ltblue, 5},
|
||||
{"pharmacy", '^', c_ltred, 5},
|
||||
{"pharmacy", '>', c_ltred, 5},
|
||||
{"pharmacy", 'v', c_ltred, 5},
|
||||
{"pharmacy", '<', c_ltred, 5},
|
||||
{"grocery store", '^', c_green, 5},
|
||||
{"grocery store", '>', c_green, 5},
|
||||
{"grocery store", 'v', c_green, 5},
|
||||
{"grocery store", '<', c_green, 5},
|
||||
{"hardware store", '^', c_cyan, 5},
|
||||
{"hardware store", '>', c_cyan, 5},
|
||||
{"hardware store", 'v', c_cyan, 5},
|
||||
{"hardware store", '<', c_cyan, 5},
|
||||
{"sporting goods store",'^', c_ltcyan, 5},
|
||||
{"sporting goods store",'>', c_ltcyan, 5},
|
||||
{"sporting goods store",'v', c_ltcyan, 5},
|
||||
{"sporting goods store",'<', c_ltcyan, 5},
|
||||
{"liquor store", '^', c_magenta, 5},
|
||||
{"liquor store", '>', c_magenta, 5},
|
||||
{"liquor store", 'v', c_magenta, 5},
|
||||
{"liquor store", '<', c_magenta, 5},
|
||||
{"gun store", '^', c_red, 5},
|
||||
{"gun store", '>', c_red, 5},
|
||||
{"gun store", 'v', c_red, 5},
|
||||
{"gun store", '<', c_red, 5},
|
||||
{"clothing store", '^', c_blue, 5},
|
||||
{"clothing store", '>', c_blue, 5},
|
||||
{"clothing store", 'v', c_blue, 5},
|
||||
{"clothing store", '<', c_blue, 5},
|
||||
{"library", '^', c_brown, 5},
|
||||
{"library", '>', c_brown, 5},
|
||||
{"library", 'v', c_brown, 5},
|
||||
{"library", '<', c_brown, 5},
|
||||
{"subway station", '^', c_yellow, 5},
|
||||
{"subway station", '>', c_yellow, 5},
|
||||
{"subway station", 'v', c_yellow, 5},
|
||||
{"subway station", '<', c_yellow, 5},
|
||||
{"science lab", 'L', c_ltblue, 5},
|
||||
{"science lab", 'L', c_blue, 5},
|
||||
{"science lab", 'L', c_ltblue, 5},
|
||||
{"science lab", 'L', c_cyan, 5},
|
||||
{"nuclear plant", 'P', c_ltgreen, 5},
|
||||
{"nuclear plant", 'P', c_ltgreen, 5},
|
||||
{"town center", 'O', c_white, 2},
|
||||
{"living quarters", '*', c_ltgreen, 2},
|
||||
{"food market", '*', c_green, 2},
|
||||
{"weapon shop", '*', c_cyan, 2},
|
||||
{"gun shop", '*', c_red, 2},
|
||||
{"clinic", '*', c_ltred, 2},
|
||||
{"clothing store", '*', c_blue, 2},
|
||||
{"general store", '*', c_ltblue, 2},
|
||||
{"casino", '*', c_yellow, 2},
|
||||
{"library", '*', c_brown, 2},
|
||||
{"small laboratory", '*', c_magenta, 2},
|
||||
{"bionics shop", '*', c_ltgray, 2},
|
||||
{"radio tower", 'X', c_ltgray, 2},
|
||||
{"city gate", 'o', c_ltred, 5},
|
||||
{"wall", 'x', c_ltgray, 5},
|
||||
{"anthill", '%', c_brown, 2},
|
||||
{"solid rock", '%', c_dkgray, 5},
|
||||
{"rift", '^', c_red, 2},
|
||||
{"hellmouth", '^', c_ltred, 2},
|
||||
{"slime pit", '~', c_ltgreen, 2},
|
||||
{"slime pit", '~', c_ltgreen, 2},
|
||||
{"basement", 'O', c_dkgray, 5},
|
||||
{"subway station", 'S', c_yellow, 5},
|
||||
{"subway", LINE_XOXO, c_dkgray, 5},
|
||||
{"subway", LINE_OXOX, c_dkgray, 5},
|
||||
{"subway", LINE_XXOO, c_dkgray, 5},
|
||||
{"subway", LINE_OXXO, c_dkgray, 5},
|
||||
{"subway", LINE_OOXX, c_dkgray, 5},
|
||||
{"subway", LINE_XOOX, c_dkgray, 5},
|
||||
{"subway", LINE_XXXO, c_dkgray, 5},
|
||||
{"subway", LINE_XXOX, c_dkgray, 5},
|
||||
{"subway", LINE_XOXX, c_dkgray, 5},
|
||||
{"subway", LINE_OXXX, c_dkgray, 5},
|
||||
{"subway", LINE_XXXX, c_dkgray, 5},
|
||||
{"sewer", LINE_XOXO, c_green, 5},
|
||||
{"sewer", LINE_OXOX, c_green, 5},
|
||||
{"sewer", LINE_XXOO, c_green, 5},
|
||||
{"sewer", LINE_OXXO, c_green, 5},
|
||||
{"sewer", LINE_OOXX, c_green, 5},
|
||||
{"sewer", LINE_XOOX, c_green, 5},
|
||||
{"sewer", LINE_XXXO, c_green, 5},
|
||||
{"sewer", LINE_XXOX, c_green, 5},
|
||||
{"sewer", LINE_XOXX, c_green, 5},
|
||||
{"sewer", LINE_OXXX, c_green, 5},
|
||||
{"sewer", LINE_XXXX, c_green, 5},
|
||||
{"ant tunnel", LINE_XOXO, c_brown, 5},
|
||||
{"ant tunnel", LINE_OXOX, c_brown, 5},
|
||||
{"ant tunnel", LINE_XXOO, c_brown, 5},
|
||||
{"ant tunnel", LINE_OXXO, c_brown, 5},
|
||||
{"ant tunnel", LINE_OOXX, c_brown, 5},
|
||||
{"ant tunnel", LINE_XOOX, c_brown, 5},
|
||||
{"ant tunnel", LINE_XXXO, c_brown, 5},
|
||||
{"ant tunnel", LINE_XXOX, c_brown, 5},
|
||||
{"ant tunnel", LINE_XOXX, c_brown, 5},
|
||||
{"ant tunnel", LINE_OXXX, c_brown, 5},
|
||||
{"ant tunnel", LINE_XXXX, c_brown, 5},
|
||||
{"ant food storage", 'O', c_green, 5},
|
||||
{"ant larva chamber", 'O', c_white, 5},
|
||||
{"ant queen chamber", 'O', c_red, 5},
|
||||
{"cavern", '0', c_ltgray, 5},
|
||||
{"tutorial room", 'O', c_cyan, 5}
|
||||
};
|
||||
#endif
|
||||
-678
@@ -1,678 +0,0 @@
|
||||
#ifndef _OUTPUT_H_
|
||||
#define _OUTPUT_H_
|
||||
|
||||
#include <ncurses.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdarg>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include "color.h"
|
||||
#include "output.h"
|
||||
#include "rng.h"
|
||||
#include "keypress.h"
|
||||
|
||||
#define LINE_XOXO 4194424
|
||||
#define LINE_OXOX 4194417
|
||||
#define LINE_XXOO 4194413
|
||||
#define LINE_OXXO 4194412
|
||||
#define LINE_OOXX 4194411
|
||||
#define LINE_XOOX 4194410
|
||||
#define LINE_XXXO 4194420
|
||||
#define LINE_XXOX 4194422
|
||||
#define LINE_XOXX 4194421
|
||||
#define LINE_OXXX 4194423
|
||||
#define LINE_XXXX 4194414
|
||||
|
||||
/*
|
||||
window::window(int x0, int y0, int Width, int Height)
|
||||
{
|
||||
w = newwin(Width, Height, x0, y0);
|
||||
width = Width;
|
||||
height = Height;
|
||||
}
|
||||
|
||||
window::~window()
|
||||
{
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
}
|
||||
|
||||
window::outline(nc_color FG = c_white)
|
||||
{
|
||||
wattron(FG);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
wattroff(FG);
|
||||
}
|
||||
|
||||
window::mvputch(win_attribute attr = WA_NULL,
|
||||
int x, int y, nc_color FG, char ch)
|
||||
{
|
||||
set(FG, attr);
|
||||
wattron(w, FG);
|
||||
mvwaddch(w, y, x, ch);
|
||||
wattroff(w, FG);
|
||||
}
|
||||
|
||||
window::mvprint(win_attribute attr = WA_NULL,
|
||||
int x, int y, nc_color FG = c_ltgray, std::string text)
|
||||
{
|
||||
set(FG, attr);
|
||||
wattron(w, FG);
|
||||
}
|
||||
*/
|
||||
|
||||
void mvputch(int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
attron(FG);
|
||||
mvaddch(y, x, ch);
|
||||
attroff(FG);
|
||||
}
|
||||
|
||||
void wputch(WINDOW* w, nc_color FG, long ch)
|
||||
{
|
||||
wattron(w, FG);
|
||||
waddch(w, ch);
|
||||
wattroff(w, FG);
|
||||
}
|
||||
|
||||
void mvwputch(WINDOW *w, int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
wattron(w, FG);
|
||||
mvwaddch(w, y, x, ch);
|
||||
wattroff(w, FG);
|
||||
}
|
||||
|
||||
void mvputch_inv(int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
nc_color HC;
|
||||
switch (FG) {
|
||||
case c_white:
|
||||
HC = i_white;
|
||||
break;
|
||||
case c_ltgray:
|
||||
HC = i_ltgray;
|
||||
break;
|
||||
case c_dkgray:
|
||||
HC = i_dkgray;
|
||||
break;
|
||||
case c_red:
|
||||
HC = i_red;
|
||||
break;
|
||||
case c_green:
|
||||
HC = i_green;
|
||||
break;
|
||||
case c_blue:
|
||||
HC = i_blue;
|
||||
break;
|
||||
case c_cyan:
|
||||
HC = i_cyan;
|
||||
break;
|
||||
case c_magenta:
|
||||
HC = i_magenta;
|
||||
break;
|
||||
case c_brown:
|
||||
HC = i_brown;
|
||||
break;
|
||||
case c_yellow:
|
||||
HC = i_yellow;
|
||||
break;
|
||||
case c_ltred:
|
||||
HC = i_ltred;
|
||||
break;
|
||||
case c_ltgreen:
|
||||
HC = i_ltgreen;
|
||||
break;
|
||||
case c_ltblue:
|
||||
HC = i_ltblue;
|
||||
break;
|
||||
case c_ltcyan:
|
||||
HC = i_ltcyan;
|
||||
break;
|
||||
case c_pink:
|
||||
HC = i_pink;
|
||||
break;
|
||||
}
|
||||
attron(HC);
|
||||
mvaddch(y, x, ch);
|
||||
attroff(HC);
|
||||
}
|
||||
|
||||
void mvwputch_inv(WINDOW* w, int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
nc_color HC;
|
||||
switch (FG) {
|
||||
case c_white:
|
||||
HC = i_white;
|
||||
break;
|
||||
case c_ltgray:
|
||||
HC = i_ltgray;
|
||||
break;
|
||||
case c_dkgray:
|
||||
HC = i_dkgray;
|
||||
break;
|
||||
case c_red:
|
||||
HC = i_red;
|
||||
break;
|
||||
case c_green:
|
||||
HC = i_green;
|
||||
break;
|
||||
case c_blue:
|
||||
HC = i_blue;
|
||||
break;
|
||||
case c_cyan:
|
||||
HC = i_cyan;
|
||||
break;
|
||||
case c_magenta:
|
||||
HC = i_magenta;
|
||||
break;
|
||||
case c_brown:
|
||||
HC = i_brown;
|
||||
break;
|
||||
case c_yellow:
|
||||
HC = i_yellow;
|
||||
break;
|
||||
case c_ltred:
|
||||
HC = i_ltred;
|
||||
break;
|
||||
case c_ltgreen:
|
||||
HC = i_ltgreen;
|
||||
break;
|
||||
case c_ltblue:
|
||||
HC = i_ltblue;
|
||||
break;
|
||||
case c_ltcyan:
|
||||
HC = i_ltcyan;
|
||||
break;
|
||||
case c_pink:
|
||||
HC = i_pink;
|
||||
break;
|
||||
}
|
||||
wattron(w, HC);
|
||||
mvwaddch(w, y, x, ch);
|
||||
wattroff(w, HC);
|
||||
}
|
||||
|
||||
void mvputch_hi(int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
nc_color HC;
|
||||
switch (FG) {
|
||||
case c_white:
|
||||
HC = h_white;
|
||||
break;
|
||||
case c_ltgray:
|
||||
HC = h_ltgray;
|
||||
break;
|
||||
case c_dkgray:
|
||||
HC = h_dkgray;
|
||||
break;
|
||||
case c_red:
|
||||
HC = h_red;
|
||||
break;
|
||||
case c_green:
|
||||
HC = h_green;
|
||||
break;
|
||||
case c_blue:
|
||||
HC = h_blue;
|
||||
break;
|
||||
case c_cyan:
|
||||
HC = h_cyan;
|
||||
break;
|
||||
case c_magenta:
|
||||
HC = h_magenta;
|
||||
break;
|
||||
case c_brown:
|
||||
HC = h_brown;
|
||||
break;
|
||||
case c_yellow:
|
||||
HC = h_yellow;
|
||||
break;
|
||||
case c_ltred:
|
||||
HC = h_ltred;
|
||||
break;
|
||||
case c_ltgreen:
|
||||
HC = h_ltgreen;
|
||||
break;
|
||||
case c_ltblue:
|
||||
HC = h_ltblue;
|
||||
break;
|
||||
case c_ltcyan:
|
||||
HC = h_ltcyan;
|
||||
break;
|
||||
case c_pink:
|
||||
HC = h_pink;
|
||||
break;
|
||||
}
|
||||
attron(HC);
|
||||
mvaddch(y, x, ch);
|
||||
attroff(HC);
|
||||
}
|
||||
|
||||
void mvwputch_hi(WINDOW* w, int y, int x, nc_color FG, long ch)
|
||||
{
|
||||
nc_color HC;
|
||||
switch (FG) {
|
||||
case c_white:
|
||||
HC = h_white;
|
||||
break;
|
||||
case c_ltgray:
|
||||
HC = h_ltgray;
|
||||
break;
|
||||
case c_dkgray:
|
||||
HC = h_dkgray;
|
||||
break;
|
||||
case c_red:
|
||||
HC = h_red;
|
||||
break;
|
||||
case c_green:
|
||||
HC = h_green;
|
||||
break;
|
||||
case c_blue:
|
||||
HC = h_blue;
|
||||
break;
|
||||
case c_cyan:
|
||||
HC = h_cyan;
|
||||
break;
|
||||
case c_magenta:
|
||||
HC = h_magenta;
|
||||
break;
|
||||
case c_brown:
|
||||
HC = h_brown;
|
||||
break;
|
||||
case c_yellow:
|
||||
HC = h_yellow;
|
||||
break;
|
||||
case c_ltred:
|
||||
HC = h_ltred;
|
||||
break;
|
||||
case c_ltgreen:
|
||||
HC = h_ltgreen;
|
||||
break;
|
||||
case c_ltblue:
|
||||
HC = h_ltblue;
|
||||
break;
|
||||
case c_ltcyan:
|
||||
HC = h_ltcyan;
|
||||
break;
|
||||
case c_pink:
|
||||
HC = h_pink;
|
||||
break;
|
||||
}
|
||||
wattron(w, HC);
|
||||
mvwaddch(w, y, x, ch);
|
||||
wattroff(w, HC);
|
||||
}
|
||||
|
||||
void mvprintz(int y, int x, nc_color FG, const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[6000];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
attron(FG);
|
||||
mvprintw(y, x, buff);
|
||||
attroff(FG);
|
||||
}
|
||||
|
||||
void mvwprintz(WINDOW* w, int y, int x, nc_color FG, const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
// char buff[4096];
|
||||
// vsprintf(buff, mes, ap);
|
||||
char buff[6000];
|
||||
vsprintf(buff, mes, ap);
|
||||
wattron(w, FG);
|
||||
// wmove(w, y, x);
|
||||
mvwprintw(w, y, x, buff);
|
||||
wattroff(w, FG);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void printz(nc_color FG, const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,mes);
|
||||
char buff[6000];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
attron(FG);
|
||||
printw(buff);
|
||||
attroff(FG);
|
||||
}
|
||||
|
||||
void wprintz(WINDOW *w, nc_color FG, const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,mes);
|
||||
char buff[6000];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
wattron(w, FG);
|
||||
wprintw(w, buff);
|
||||
wattroff(w, FG);
|
||||
}
|
||||
|
||||
void debugmsg(const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[1024];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
attron(c_red);
|
||||
mvprintw(0, 0, "DEBUG: %s \n Press spacebar...", buff);
|
||||
while(getch() != ' ');
|
||||
attroff(c_red);
|
||||
}
|
||||
|
||||
bool query_yn(const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[1024];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
int win_width = strlen(buff) + 10;
|
||||
WINDOW* w = newwin(3, win_width, 11, 0);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
mvwprintz(w, 1, 1, c_ltred, "%s (Y/N)", buff);
|
||||
wrefresh(w);
|
||||
char ch;
|
||||
do
|
||||
ch = getch();
|
||||
while (ch != 'Y' && ch != 'N');
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
if (ch == 'Y')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string string_input_popup(const char *mes, ...)
|
||||
{
|
||||
std::string ret;
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[1024];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
int startx = strlen(buff) + 2;
|
||||
WINDOW* w = newwin(3, 80, 11, 0);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
mvwprintz(w, 1, 1, c_ltred, "%s", buff);
|
||||
for (int i = startx + 1; i < 79; i++)
|
||||
mvwputch(w, 1, i, c_ltgray, '_');
|
||||
int posx = startx;
|
||||
mvwputch(w, 1, posx, h_ltgray, '_');
|
||||
do {
|
||||
wrefresh(w);
|
||||
long ch = getch();
|
||||
if (ch == 27) { // Escape
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
return "";
|
||||
} else if (ch == '\n') {
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
return ret;
|
||||
} else if (ch == KEY_BACKSPACE && posx > startx) {
|
||||
ret = ret.substr(0, ret.size() - 1);
|
||||
mvwputch(w, 1, posx, c_ltgray, '_');
|
||||
posx--;
|
||||
mvwputch(w, 1, posx, h_ltgray, '_');
|
||||
} else {
|
||||
ret += ch;
|
||||
mvwputch(w, 1, posx, c_magenta, ch);
|
||||
posx++;
|
||||
mvwputch(w, 1, posx, h_ltgray, '_');
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
int menu_vec(const char *mes, std::vector<std::string> options)
|
||||
{
|
||||
if (options.size() == 0) {
|
||||
debugmsg("0-length menu (\"%s\")", mes);
|
||||
return -1;
|
||||
}
|
||||
std::string title = mes;
|
||||
int height = 3 + options.size(), width = title.length() + 2;
|
||||
for (int i = 0; i < options.size(); i++) {
|
||||
if (options[i].length() + 6 > width)
|
||||
width = options[i].length() + 6;
|
||||
}
|
||||
WINDOW* w = newwin(height, width, 6, 10);
|
||||
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, "%d: %s", i + 1, options[i].c_str());
|
||||
long ch;
|
||||
wrefresh(w);
|
||||
do
|
||||
ch = getch();
|
||||
while (ch < '1' || ch >= '1' + options.size());
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
return (ch - '1' + 1);
|
||||
}
|
||||
|
||||
int menu(const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char* tmp;
|
||||
std::vector<std::string> options;
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
tmp = va_arg(ap, char*);
|
||||
if (tmp != NULL) {
|
||||
std::string strtmp = tmp;
|
||||
options.push_back(strtmp);
|
||||
} else
|
||||
done = true;
|
||||
}
|
||||
return (menu_vec(mes, options));
|
||||
}
|
||||
|
||||
void popup_top(const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[1024];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
std::string tmp = buff;
|
||||
int width = 0;
|
||||
int height = 2;
|
||||
size_t pos = tmp.find_first_of('\n');
|
||||
while (pos != std::string::npos) {
|
||||
height++;
|
||||
if (pos > width)
|
||||
width = pos;
|
||||
tmp = tmp.substr(pos + 1);
|
||||
pos = tmp.find_first_of('\n');
|
||||
}
|
||||
if (width == 0 || tmp.length() > width)
|
||||
width = tmp.length();
|
||||
width += 2;
|
||||
WINDOW* w = newwin(height + 1, width, 0, int((80 - width) / 2));
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
tmp = buff;
|
||||
pos = tmp.find_first_of('\n');
|
||||
int line_num = 0;
|
||||
while (pos != std::string::npos) {
|
||||
std::string line = tmp.substr(0, pos);
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, line.c_str());
|
||||
tmp = tmp.substr(pos + 1);
|
||||
pos = tmp.find_first_of('\n');
|
||||
}
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, tmp.c_str());
|
||||
|
||||
wrefresh(w);
|
||||
char ch;
|
||||
do
|
||||
ch = getch();
|
||||
while(ch != ' ' && ch != '\n' && ch != KEY_ESCAPE);
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
}
|
||||
|
||||
void popup(const char *mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[8192];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
std::string tmp = buff;
|
||||
int width = 0;
|
||||
int height = 2;
|
||||
size_t pos = tmp.find_first_of('\n');
|
||||
while (pos != std::string::npos) {
|
||||
height++;
|
||||
if (pos > width)
|
||||
width = pos;
|
||||
tmp = tmp.substr(pos + 1);
|
||||
pos = tmp.find_first_of('\n');
|
||||
}
|
||||
if (width == 0 || tmp.length() > width)
|
||||
width = tmp.length();
|
||||
width += 2;
|
||||
if (height > 25)
|
||||
height = 25;
|
||||
WINDOW* w = newwin(height + 1, width, int((25 - height) / 2),
|
||||
int((80 - width) / 2));
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
tmp = buff;
|
||||
pos = tmp.find_first_of('\n');
|
||||
int line_num = 0;
|
||||
while (pos != std::string::npos) {
|
||||
std::string line = tmp.substr(0, pos);
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, line.c_str());
|
||||
tmp = tmp.substr(pos + 1);
|
||||
pos = tmp.find_first_of('\n');
|
||||
}
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, tmp.c_str());
|
||||
|
||||
wrefresh(w);
|
||||
char ch;
|
||||
do
|
||||
ch = getch();
|
||||
while(ch != ' ' && ch != '\n' && ch != KEY_ESCAPE);
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
}
|
||||
|
||||
void full_screen_popup(const char* mes, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, mes);
|
||||
char buff[8192];
|
||||
vsprintf(buff, mes, ap);
|
||||
va_end(ap);
|
||||
std::string tmp = buff;
|
||||
WINDOW* w = newwin(25, 80, 0, 0);
|
||||
wborder(w, LINE_XOXO, LINE_XOXO, LINE_OXOX, LINE_OXOX,
|
||||
LINE_OXXO, LINE_OOXX, LINE_XXOO, LINE_XOOX );
|
||||
size_t pos = tmp.find_first_of('\n');
|
||||
int line_num = 0;
|
||||
while (pos != std::string::npos) {
|
||||
std::string line = tmp.substr(0, pos);
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, line.c_str());
|
||||
tmp = tmp.substr(pos + 1);
|
||||
pos = tmp.find_first_of('\n');
|
||||
}
|
||||
line_num++;
|
||||
mvwprintz(w, line_num, 1, c_white, tmp.c_str());
|
||||
wrefresh(w);
|
||||
char ch;
|
||||
do
|
||||
ch = getch();
|
||||
while(ch != ' ' && ch != '\n' && ch != KEY_ESCAPE);
|
||||
werase(w);
|
||||
wrefresh(w);
|
||||
delwin(w);
|
||||
refresh();
|
||||
}
|
||||
|
||||
nc_color hilite(nc_color c)
|
||||
{
|
||||
switch (c) {
|
||||
case c_white: return h_white;
|
||||
case c_ltgray: return h_ltgray;
|
||||
case c_dkgray: return h_dkgray;
|
||||
case c_red: return h_red;
|
||||
case c_green: return h_green;
|
||||
case c_blue: return h_blue;
|
||||
case c_cyan: return h_cyan;
|
||||
case c_magenta: return h_magenta;
|
||||
case c_brown: return h_brown;
|
||||
case c_ltred: return h_ltred;
|
||||
case c_ltgreen: return h_ltgreen;
|
||||
case c_ltblue: return h_ltblue;
|
||||
case c_ltcyan: return h_ltcyan;
|
||||
case c_pink: return h_pink;
|
||||
case c_yellow: return h_yellow;
|
||||
}
|
||||
return h_white;
|
||||
}
|
||||
|
||||
nc_color rand_color()
|
||||
{
|
||||
switch (rng(0, 9)) {
|
||||
case 0: return c_white;
|
||||
case 1: return c_ltgray;
|
||||
case 2: return c_green;
|
||||
case 3: return c_red;
|
||||
case 4: return c_yellow;
|
||||
case 5: return c_blue;
|
||||
case 6: return c_ltblue;
|
||||
case 7: return c_pink;
|
||||
case 8: return c_magenta;
|
||||
case 9: return c_brown;
|
||||
}
|
||||
return c_dkgray;
|
||||
}
|
||||
|
||||
char rand_char()
|
||||
{
|
||||
switch (rng(0, 9)) {
|
||||
case 0: return '|';
|
||||
case 1: return '-';
|
||||
case 2: return '#';
|
||||
case 3: return '?';
|
||||
case 4: return '&';
|
||||
case 5: return '.';
|
||||
case 6: return '%';
|
||||
case 7: return '{';
|
||||
case 8: return '*';
|
||||
case 9: return '^';
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
#ifndef _OUTPUT_H_
|
||||
#define _OUTPUT_H_
|
||||
|
||||
#include "color.h"
|
||||
#include <cstdarg>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// LINE_NESW - X for on, O for off
|
||||
#define LINE_XOXO 4194424
|
||||
#define LINE_OXOX 4194417
|
||||
#define LINE_XXOO 4194413
|
||||
#define LINE_OXXO 4194412
|
||||
#define LINE_OOXX 4194411
|
||||
#define LINE_XOOX 4194410
|
||||
#define LINE_XXXO 4194420
|
||||
#define LINE_XXOX 4194422
|
||||
#define LINE_XOXX 4194421
|
||||
#define LINE_OXXX 4194423
|
||||
#define LINE_XXXX 4194414
|
||||
|
||||
/*
|
||||
struct window
|
||||
{
|
||||
WINDOW* w;
|
||||
window(int x0 = 0, int y0 = 0, int Width, int Height);
|
||||
outline(nc_color FG = c_white);
|
||||
mvputch(win_attribute attr = WA_NULL,
|
||||
int x, int y, nc_color FG, char ch);
|
||||
mvprint(win_attribute attr = WA_NULL,
|
||||
int x, int y, nc_color FG = c_ltgray, std::string text);
|
||||
print(win_attribute attr = WA_NULL,
|
||||
int x, int y, nc_color FG = c_ltgray, std::string text);
|
||||
|
||||
int width, height;
|
||||
};
|
||||
*/
|
||||
|
||||
void mvputch(int y, int x, nc_color FG, long ch);
|
||||
void wputch(WINDOW* w, nc_color FG, long ch);
|
||||
void mvwputch(WINDOW* w, int y, int x, nc_color FG, long ch);
|
||||
void mvputch_inv(int y, int x, nc_color FG, long ch);
|
||||
void mvwputch_inv(WINDOW *w, int y, int x, nc_color FG, long ch);
|
||||
void mvputch_hi(int y, int x, nc_color FG, long ch);
|
||||
void mvwputch_hi(WINDOW *w, int y, int x, nc_color FG, long ch);
|
||||
void mvprintz(int y, int x, nc_color FG, const char *mes, ...);
|
||||
void mvwprintz(WINDOW *w, int y, int x, nc_color FG, const char *mes, ...);
|
||||
void printz(nc_color FG, const char *mes, ...);
|
||||
void wprintz(WINDOW *w, nc_color FG, const char *mes, ...);
|
||||
|
||||
void debugmsg(const char *mes, ...);
|
||||
bool query_yn(const char *mes, ...);
|
||||
std::string string_input_popup(const char *mes, ...);
|
||||
int menu_vec(const char *mes, std::vector<std::string> options);
|
||||
int menu(const char *mes, ...);
|
||||
void popup_top(const char *mes, ...); // Displayed at the top of the screen
|
||||
void popup(const char *mes, ...);
|
||||
void full_screen_popup(const char *mes, ...);
|
||||
|
||||
nc_color hilite(nc_color c);
|
||||
nc_color rand_color();
|
||||
char rand_char();
|
||||
|
||||
#endif
|
||||
-1758
File diff suppressed because it is too large
Load Diff
@@ -1,108 +0,0 @@
|
||||
#ifndef _OVERMAP_H_
|
||||
#define _OVERMAP_H_
|
||||
#include "enums.h"
|
||||
#include "string.h"
|
||||
#include "omdata.h"
|
||||
#include "mongroup.h"
|
||||
#include "settlement.h"
|
||||
#include "npc.h"
|
||||
#include <vector>
|
||||
#include <ncurses.h>
|
||||
|
||||
struct settlement;
|
||||
|
||||
struct city {
|
||||
int x;
|
||||
int y;
|
||||
int s;
|
||||
city(int X = -1, int Y = -1, int S = -1) : x (X), y (Y), s (S) {}
|
||||
};
|
||||
|
||||
struct om_note {
|
||||
int x;
|
||||
int y;
|
||||
int num;
|
||||
std::string text;
|
||||
om_note(int X = -1, int Y = -1, int N = -1, std::string T = "") :
|
||||
x (X), y (Y), num (N), text (T) {}
|
||||
};
|
||||
|
||||
struct radio_tower {
|
||||
int x;
|
||||
int y;
|
||||
int strength;
|
||||
std::string message;
|
||||
radio_tower(int X = -1, int Y = -1, int S = -1, std::string M = "") :
|
||||
x (X), y (Y), strength (S), message (M) {}
|
||||
};
|
||||
|
||||
class overmap
|
||||
{
|
||||
public:
|
||||
overmap();
|
||||
overmap(game *g, int x, int y, int z);
|
||||
~overmap();
|
||||
void save();
|
||||
void save(int x, int y, int z);
|
||||
void open(game *g, int x, int y, int z);
|
||||
void generate(game *g, overmap* north, overmap* east, overmap* south,
|
||||
overmap* west);
|
||||
void generate_sub(overmap* above);
|
||||
void make_tutorial();
|
||||
|
||||
point find_closest(point origin, oter_id type, int type_range,
|
||||
int &dist, bool must_be_seen);
|
||||
void first_house(int &x, int &y);
|
||||
|
||||
oter_id& ter(int x, int y);
|
||||
bool& seen(int x, int y);
|
||||
|
||||
bool has_note(int x, int y);
|
||||
std::string note(int x, int y);
|
||||
void add_note(int x, int y, std::string message);
|
||||
|
||||
std::vector<city> cities;
|
||||
std::vector<city> roads_out;
|
||||
std::vector<settlement> towns;
|
||||
std::vector<mongroup> zg;
|
||||
std::vector<radio_tower> radios;
|
||||
int posx, posy, posz;
|
||||
std::vector<npc> npcs;
|
||||
private:
|
||||
oter_id t[OMAPX][OMAPY];
|
||||
oter_id nullret;
|
||||
bool s[OMAPX][OMAPY];
|
||||
bool nullbool;
|
||||
std::vector<om_note> notes;
|
||||
// Overall terrain
|
||||
void place_river(point pa, point pb);
|
||||
void place_forest();
|
||||
void place_settlements(game *g);
|
||||
void settlement_building(settlement &set, int x, int y);
|
||||
// City Building
|
||||
void place_cities(std::vector<city> &cities, int min);
|
||||
void put_buildings(int x, int y, int dir, city town);
|
||||
void make_road(int cx, int cy, int cs, int dir, city town);
|
||||
void build_lab(int x, int y, int s);
|
||||
void build_anthill(int x, int y, int s);
|
||||
void build_tunnel(int x, int y, int s, int dir);
|
||||
void build_slimepit(int x, int y, int s);
|
||||
void place_rifts();
|
||||
// Connection highways
|
||||
void place_hiways(std::vector<city> cities, oter_id base);
|
||||
void place_subways(std::vector<point> stations);
|
||||
void make_hiway(int x1, int y1, int x2, int y2, oter_id base);
|
||||
void building_on_hiway(int x, int y, int dir);
|
||||
// Polishing
|
||||
bool is_road(oter_id base, int x, int y); // Dependant on road type
|
||||
bool is_road(int x, int y);
|
||||
void polish(oter_id min = ot_null, oter_id max = ot_tutorial);
|
||||
void good_road(oter_id base, int x, int y);
|
||||
void good_river(int x, int y);
|
||||
// Monsters, radios, etc.
|
||||
void place_mongroups();
|
||||
void place_radios();
|
||||
void place_NPCs(game *g);
|
||||
// File I/O
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,84 @@
|
||||
---
|
||||
layout: page
|
||||
title: ""
|
||||
---
|
||||
|
||||
## Example Workflow
|
||||
|
||||
#### Setup your environment
|
||||
|
||||
*(This only needs to be done once.)*
|
||||
|
||||
1. Fork this repository here on GitHub.
|
||||
|
||||
2. Clone your fork locally.
|
||||
|
||||
$ git clone https://github.com/YOUR_USERNAME/Cataclysm-DDA.git
|
||||
# Clones your fork of the repository into the current directory in terminal
|
||||
|
||||
3. Add this repository as a remote.
|
||||
|
||||
$ cd Cataclysm-DDA
|
||||
# Changes the active directory in the prompt to the newly cloned "Cataclysm-DDA" directory
|
||||
$ git remote add -f upstream https://github.com/CleverRaven/Cataclysm-DDA.git
|
||||
# Assigns the original repository to a remote called "upstream"
|
||||
|
||||
#### Update your `master` branch
|
||||
|
||||
1. Make sure you have your `master` branch checked out.
|
||||
|
||||
$ git checkout master
|
||||
|
||||
2. Pull the changes from the `upstream/master` branch.
|
||||
|
||||
$ git pull --ff-only upstream master
|
||||
# gets changes from "master" branch on the "upstream" remote
|
||||
|
||||
* Note: If this gives you an error, it means you have committed directly to your local `master` branch. [Click here for instructions on how to fix this issue](#why-does-git-pull---ff-only-result-in-an-error).
|
||||
|
||||
#### Make your changes
|
||||
|
||||
0. Update your `master` branch, if you haven't already.
|
||||
|
||||
1. For each new feature or bug fix, create a new branch.
|
||||
|
||||
$ git branch new_feature
|
||||
# Creates a new branch called "new_feature"
|
||||
$ git checkout new_feature
|
||||
# Makes "new_feature" the active branch
|
||||
|
||||
2. Once you've committed some changes locally, you need to push them to your fork here on GitHub.
|
||||
|
||||
$ git push origin new_feature
|
||||
# origin was automatically set to point to your fork when you cloned it
|
||||
|
||||
|
||||
3. Once you're finished working on your branch and have committed and pushed all your changes, submit a pull request from your `new_feature` branch to this repository's `master` branch.
|
||||
|
||||
* Note: any new commits to the `new_feature` branch on GitHub will automatically be included in the pull request, so make sure to only commit related changes to the same branch.
|
||||
|
||||
## Pull Request Notes
|
||||
* Mark pull requests that are still being worked on by adding [WIP] before the title
|
||||
* When a pull request is ready to be reviewed remove the [WIP]
|
||||
* Mark pull requests that need commenting/testing by others with [CR] before the title
|
||||
* [WIP] has higher precedence than [CR]. Feel free to remove [CR] when you feel you got enough information
|
||||
* If the pull request fixes a issue listed on github, include "fixes #???" into the text, where ??? is the number of the issue. This automatically closes the issue when the PR is pulled in, and allows mergers to work slightly faster. For further details see issue #2419.
|
||||
|
||||
#### PR Tags
|
||||
If you file a PR but you're still working on it, please add a [WIP] before the title text. This will tell the reviewers that you still intend to add more to the PR and we don't need to review it yet. When it's ready to be reviewed by a merger just edit the title text to remove the [WIP].
|
||||
|
||||
If you are also looking for suggestions then mark it with [CR] - "comments requested". You can use both [WIP] and [CR] to indicated that you need opinion/code review/suggestions to continue working (e.g. "[WIP] [CR] Super awesome big feature"). Feel free to remove [CR] when you feel you got enough information to proceed.
|
||||
|
||||
This can help speed up our review process by allowing us to only review the things that are ready for it and will prevent anything that isn't completely ready from being merged in.
|
||||
|
||||
One more thing: when marking your PR as closing, fixing, or resolving issues, please include "XXXX #???" somewhere in the description, where XXX is on this list:
|
||||
close
|
||||
closes
|
||||
closed
|
||||
fix
|
||||
fixes
|
||||
fixed
|
||||
resolve
|
||||
resolves
|
||||
resolved
|
||||
The "???" is the issue number. This automatically closes the issue when the PR is pulled in, and allows merges to work slightly faster. To close multiple issues format it as "XXXX #???, XXXX#???".
|
||||
@@ -0,0 +1,159 @@
|
||||
---
|
||||
layout: page
|
||||
title: ""
|
||||
---
|
||||
|
||||
## Code Style
|
||||
|
||||
Both c++ and JSON files within the repository have their style validated as part of the build process.
|
||||
See doc/CODE_STYLE.txt and doc/JSON_STYLE.md for details
|
||||
|
||||
## Translations
|
||||
|
||||
The game uses [gettext](https://www.gnu.org/software/gettext/) to display translated texts.
|
||||
|
||||
This requires two actions:
|
||||
- Marking strings that should be translated in the source.
|
||||
- Calling translation functions at run time.
|
||||
|
||||
The first action allows automatically extracting those strings, which are given to the translator team. They return a file that maps the original string (usually in English) as it appears in the code to the translated string. This is used at run time by the translation functions (the second action).
|
||||
|
||||
Note that only extracted strings can get translated. The original string is used to request the translation, in other words: the original string is the identifier used for a specific translation. If the function doesn't know the translation, it returns the original string.
|
||||
|
||||
The empty string is always translated into some debug information, not into an empty string. In most situations, the string can be expected to be non-empty, so you can always translate it. If the string *could* be empty (and it needs to remain empty after the translation), you'll have to check for this and only translate if non-empty.
|
||||
|
||||
Error messages (which indicate a bug in the program) and debug messages should not be translated. If they appear, the player is expected to report them *exactly* as they were printed by the game.
|
||||
|
||||
In practice, you should use one of the following three functions in the source code to get a translation.
|
||||
|
||||
String *literals* that are used in any of these functions are automatically extracted. Non-literal strings are translated at run time, but they won't get extracted.
|
||||
```C++
|
||||
const char *translated = _("text"); // marked for extraction
|
||||
const char *untranslated = "text"; // same string as the original above.
|
||||
// This translates because the input string "text" has been marked
|
||||
// and a translation for it will be available
|
||||
const char *translated_again = _(untranslated);
|
||||
untranslated = "other text";
|
||||
// This does not translate, the string "other text" was never marked for translation
|
||||
// and the translation system therefor doesn't know how to translate it.
|
||||
translated_again = _(untranslated);
|
||||
```
|
||||
|
||||
Strings from the JSON data files are extracted via the `lang/extract_json_strings.py` script. They can be translated at run time using `_()`.
|
||||
|
||||
### Using `_()`
|
||||
|
||||
For simple C-strings:
|
||||
```c++
|
||||
const char *translated = _( "original text" );
|
||||
// also works directly:
|
||||
add_msg( _( "You drop the %s." ), the_item_name );
|
||||
```
|
||||
|
||||
### Using `pgettext()`
|
||||
|
||||
If the original string is short or its meaning in isolation is ambiguous (e.g. "blue" can be a color or an emotion), one can add a context to the string. The context is provided to the translators, but is not part of the translated string itself. This is done by calling `pgettext`. This function's first parameter is the context, the second is the string to be translated.
|
||||
```c++
|
||||
const char *translated = pgettext("The direction: East", "E");
|
||||
```
|
||||
|
||||
### Using `ngettext()`
|
||||
|
||||
Many languages have plural forms. Some have complex rules for how to form these. To translate the plural form correctly, use `ngettext`. Its first parameter is the untranslated string in singular, the second parameter is the untranslated string in plural form and the third is used to determine the required plural form.
|
||||
```c++
|
||||
const char *translated = ngettext( "one zombie.", "many zombies", num_zombies );
|
||||
```
|
||||
Some classes (like `itype` and `mtype`) provide a wrapper for these functions, named `nname`.
|
||||
|
||||
## Doxygen Comments
|
||||
|
||||
Extensive documentation of classes and class members will make the code more readable to new contributors. New doxygen comments for existing classes are a welcomed contribution.
|
||||
|
||||
Use the following template for commenting classes:
|
||||
```c++
|
||||
/**
|
||||
* Brief description
|
||||
*
|
||||
* Lengthy description with many words. (optional)
|
||||
*/
|
||||
class foo {
|
||||
```
|
||||
|
||||
Use the following template for commenting functions:
|
||||
```c++
|
||||
/**
|
||||
* Brief description
|
||||
*
|
||||
* Lengthy description with many words. (optional)
|
||||
* @param param1 Description of param1 (optional)
|
||||
* @return Description of return (optional)
|
||||
*/
|
||||
int foo(int param1);
|
||||
```
|
||||
|
||||
Use the following template for commenting member variables:
|
||||
```c++
|
||||
/** Brief description **/
|
||||
int foo;
|
||||
```
|
||||
|
||||
Helpful pages:
|
||||
https://www.stack.nl/~dimitri/doxygen/manual/commands.html
|
||||
https://www.stack.nl/~dimitri/doxygen/manual/markdown.html#markdown_std
|
||||
https://www.stack.nl/~dimitri/doxygen/manual/faq.html
|
||||
|
||||
### Guidelines for adding documentation
|
||||
* Doxygen comments should describe behavior towards the outside, not implementation, but since many classes in Cataclysm are intertwined, it's often necessary to describe implementation.
|
||||
* Describe things that aren't obvious to newcomers just from the name.
|
||||
* Don't describe redundantly: `/** Map **/; map* map;` is not a helpful comment.
|
||||
* When documenting X, describe how X interacts with other components, not just what X itself does.
|
||||
|
||||
### Building the documentation for viewing it locally
|
||||
* Install doxygen
|
||||
* `doxygen doxygen_doc/doxygen_conf.txt `
|
||||
* `firefox doxygen_doc/html/index.html` (replace firefox with your browser of choice)
|
||||
|
||||
## Advanced Techniques
|
||||
|
||||
These guidelines aren't essential, but they can make keeping things in order much easier.
|
||||
|
||||
#### Using remote tracking branches
|
||||
|
||||
Remote tracking branches allow you to easily stay in touch with this repository's `master` branch, as they automatically know which remote branch to get changes from.
|
||||
|
||||
$ git branch -vv
|
||||
* master xxxx [origin/master] ....
|
||||
new_feature xxxx ....
|
||||
|
||||
Here you can see we have two branches: `master`, which is tracking `origin/master`, and `new_feature`, which isn't tracking any branch. In practice, what this means is that git won't know where to get changes from.
|
||||
|
||||
$ git checkout new_feature
|
||||
Switched to branch 'new_feature'
|
||||
$ git pull
|
||||
There is no tracking information for the current branch.
|
||||
Please specify which branch you want to merge with.
|
||||
|
||||
In order to easily pull changes from `upstream/master` into the `new_feature` branch, we can tell git which branch it should track. (You can even do this for your local master branch.)
|
||||
|
||||
$ git branch -u upstream/master new_feature
|
||||
Branch new_feature set up to track remote branch master from upstream.
|
||||
$ git pull
|
||||
Updating xxxx..xxxx
|
||||
....
|
||||
|
||||
You can also set the tracking information at the same time as creating the branch.
|
||||
|
||||
$ git branch new_feature_2 --track upstream/master
|
||||
Branch new_feature_2 set up to track remote branch master from upstream.
|
||||
|
||||
* Note: Although this makes it easier to pull from `upstream/master`, it doesn't change anything with regards to pushing. `git push` fails because you don't have permission to push to `upstream/master`.
|
||||
|
||||
$ git push
|
||||
error: The requested URL returned error: 403 while accessing https://github.com/CleverRaven/Cataclysm-DDA.git
|
||||
fatal: HTTP request failed
|
||||
$ git push origin
|
||||
....
|
||||
To https://github.com/YOUR_USERNAME/Cataclysm-DDA.git
|
||||
xxxx..xxxx new_feature -> new_feature
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
layout: page
|
||||
title: ""
|
||||
---
|
||||
|
||||
## In-game testing, test environment and the debug menu
|
||||
|
||||
Whether you are implementing a new feature or whether you are fixing a bug, it is always a good practice to test your changes in-game. It can be a hard task to create the exact conditions by playing a normal game to be able to test your changes, which is why there is a debug menu. There is no default key to bring up the menu so you will need to assign one first.
|
||||
|
||||
Bring up the keybindings menu (press `Escape` then `1`), scroll down almost to the bottom and press `+` to add a new key binding. Press the letter that corresponds to the *Debug menu* item, then press the key you want to use to bring up the debug menu. To test your changes, create a new world with a new character. Once you are in that world, press the key you just assigned for the debug menu and you should see something like this:
|
||||
|
||||
```
|
||||
┌────────────────────────────────────────────┐
|
||||
│ Debug Functions - Using these is CHEATING! │
|
||||
├────────────────────────────────────────────┤
|
||||
│ 1 Wish for an item │
|
||||
│ 2 Teleport - Short Range │
|
||||
│ 3 Teleport - Long Range │
|
||||
│ 4 Reveal map │
|
||||
│ 5 Spawn NPC │
|
||||
│ 6 Spawn Monster │
|
||||
│ 7 Check game state... │
|
||||
│ 8 Kill NPCs │
|
||||
│ 9 Mutate │
|
||||
│ 0 Spawn a vehicle │
|
||||
│ a Change all skills │
|
||||
│ b Learn all melee styles │
|
||||
│ c Unlock all recipes │
|
||||
│ d Edit player/NPC │
|
||||
│ e Spawn Artifact │
|
||||
│ f Spawn Clairvoyance Artifact │
|
||||
│ g Map editor │
|
||||
│ h Change weather │
|
||||
│ i Remove all monsters │
|
||||
│ j Display hordes │
|
||||
│ k Test Item Group │
|
||||
│ l Damage Self │
|
||||
│ m Show Sound Clustering │
|
||||
│ n Lua Command │
|
||||
│ o Display weather │
|
||||
│ p Change time │
|
||||
│ q Set automove route │
|
||||
│ r Show mutation category levels │
|
||||
│ s Cancel │
|
||||
└────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
With these commands, you should be able to recreate the proper conditions to test your changes. You can find some more information about the debug menu on [the official wiki](http://www.wiki.cataclysmdda.com/index.php?title=Cheating#The_Debug_Menu).
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
layout: page
|
||||
title: Experimental Builds
|
||||
permalink: /experimental/
|
||||
---
|
||||
|
||||
# Latest Stable
|
||||
The most recent stable release is {{ site.github.latest_release.tag_name }} {{ site.github.latest_release.name }}. We recommend stable for the most bug-free experience possible. You can download it from the [Releases Page]({{ site.baseurl }}{% link releases.md %}).
|
||||
|
||||
# Latest Experimental
|
||||
Cataclysm: DDA is under constant development. As such, stable can lag behind with features. If you would like access to the bleeding edge of features and any bugs that may come along with them, you can download the latest experimental builds from github at the [Experimental Releases](https://github.com/CleverRaven/Cataclysm-DDA/releases?q=prerelease%3Atrue&expanded=true) page.
|
||||
|
||||
Note: We used to populate this page with the most recent 10 experimental releases, but we exceeded the number of releases that the GitHub API this used was allowed to supply so it broke the page.
|
||||
@@ -0,0 +1,8 @@
|
||||
window.storyFormat({
|
||||
"name": "cdda_twison",
|
||||
"version": "0.0.2",
|
||||
"author": "SittingDucken",
|
||||
"description": "Export your Twine 2 story as a JSON document for CDDA NPC talk topics",
|
||||
"proofing": false,
|
||||
"source": "<html>\r\n <head>\r\n <title>{{STORY_NAME}}</title>\r\n <script type=\"text/javascript\">\r\n /**\r\n * CDDA Twison - Twine 2 JSON talk-topic formated Export Story Format\r\n *\r\n * Copyright (c) 2025 Sitting Ducken\r\n * https://github.com/SittingDucken/sittingducken.github.io\r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and\r\n * associated documentation files (the \"Software\"), to deal in the Software without restriction,\r\n * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\r\n * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\r\n * subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all copies or substantial\r\n * portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT\r\n * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\r\n * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r\n * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\r\n * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n */\r\n var Twison={extractLinksFromText:function(t){var e=t.match(/\\[\\[.+?\\]\\]/g);const n=/\\{\\{((\\s|\\S)+?)\\}\\}((\\s|\\S)+?)\\{\\{\\/\\1\\}\\}/gm;if(!e)return null;var r=t.split(\"\\n\"),a=[];return r.forEach(function(t){var e=t.match(/\\[\\[.+?\\]\\]/g);e&&e.forEach(function(e){var r={},s=e.substring(2,e.length-2),o=t.replace(e,\"\").replace(n,\"\").trim(),i=Twison.extractPropsFromText(t);r.topic=s,r.text=o,i&&Object.assign(r,i),a.push(r)})}),a},extractPropsFromText:function(t){var e,n={},r=!1;const a=/\\{\\{((\\s|\\S)+?)\\}\\}((\\s|\\S)+?)\\{\\{\\/\\1\\}\\}/gm;for(;null!==(e=a.exec(t));){const s=e[1],o=e[3].replace(/(\\r\\n|\\n|\\r)/gm,\"\"),i=this.extractPropsFromText(o);n[s]=null!==i?i:o,r=!0}return r?n:null},convertPassage:function(t){var e={text:t.innerHTML};if(e.topic=\"talk_topic\",[\"name\",\"tags\"].forEach(function(n){var r=t.attributes[n].value;r&&(e[n]=r)}),e.name&&(e.id=e.name,delete e.name),e.text){for(var n=e.text.split(\"\\n\"),r=[],a=0;a<n.length;a++){var s=n[a].trim();if(s.match(/\\[\\[.+?\\]\\]/))break;r.push(s)}e.dynamic_line=r.join(\"\\n\").trim();const o=/\\{\\{((\\s|\\S)+?)\\}\\}((\\s|\\S)+?)\\{\\{\\/\\1\\}\\}/gm;var i=Twison.extractPropsFromText(e.dynamic_line);e.dynamic_line=i||e.dynamic_line.replace(o,\"\").trim()}var c=Twison.extractLinksFromText(e.text);return c&&(e.responses=c),e.tags&&(e.tags=e.tags.split(\" \")),e},convertStory:function(t){var e=t.getElementsByTagName(\"tw-passagedata\"),n=Array.prototype.slice.call(e).map(Twison.convertPassage).filter(function(t){return t&&\"TALK_DONE\"!==t.id&&\"TALK_NONE\"!==t.id}),r={passages:n};return r.passages.forEach(function(t){t.text&&delete t.text}),r.passages},convert:function(){var t=document.getElementsByTagName(\"tw-storydata\")[0],e=JSON.stringify(Twison.convertStory(t),null,2);document.getElementById(\"output\").innerHTML=e}};window.Twison=Twison;\r\n </script>\r\n </head>\r\n <body>\r\n <pre id=\"output\"></pre>\r\n <div id=\"storyData\" style=\"display: none;\">\r\n {{STORY_DATA}}\r\n </div>\r\n <script>\r\n Twison.convert();\r\n </script>\r\n </body>\r\n</html>\r\n"
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
layout: page
|
||||
title: ""
|
||||
---
|
||||
|
||||
# Issues
|
||||
|
||||
## How to create new issues properly
|
||||
|
||||
GitHub issues are used for everything from bug reporting to long-term ideas. As such, you can make everything much smoother by following some simple rules.
|
||||
|
||||
### Rule zero
|
||||
|
||||
Always try to give your issue a meaningful title as this is the first thing anyone will see.
|
||||
|
||||
Note: `[CR]` and `[WIP]` "tags" are meaningful only for PRs. All open issues by definition are request for comments and work in progress.
|
||||
|
||||
### Bug reports
|
||||
|
||||
Before you submit a bug, always search the issues to see if it hasn't been reported already.
|
||||
|
||||
Your bug report should include:
|
||||
|
||||
- What OS did you experience the problem on (Windows, Linux, OS X etc.)
|
||||
- What version were you playing:
|
||||
- Tiles or Curses (text-based)
|
||||
- Version string (preferably full version e.g. "0.C-4547-g3f1c109")
|
||||
- A description of the problem you've found written in a way that enables anyone to try to recreate it.
|
||||
- The behavior you expected from the game.
|
||||
|
||||
Your bug report may include:
|
||||
|
||||
- Screenshot(s) as some things are best explained visually
|
||||
- A save file (e.g. link to a dropbox upload)
|
||||
|
||||
Bonus points for:
|
||||
|
||||
- Checking if the bug exists under the latest experimental build.
|
||||
- Checking if it is OS specific.
|
||||
|
||||
The OS and CDDA version are very important - with the pace of changes here it is possible the bug you have encountered has already been fixed. After that reproducibility is the key, so write your report with all the necessary details.
|
||||
|
||||
### Enhancements and addition ideas
|
||||
|
||||
We have hundreds of issues open - most of them are ideas and suggestions. If you have a general idea or anything that can't be easily described in terms of *current* code changes you'd be better off suggesting it in appropriate section of the forum. You'll also get much broader exposure for your idea there. And getting a polished idea from the forum to GitHub issue should be a smooth move.
|
||||
|
||||
Otherwise please search first if maybe something like what you have on mind has been already proposed. If so feel free to join the discussion! If you think your idea is related but sufficiently different - open a new issue and perhaps refer to the older discussion (use GitHub's `#issue_number` reference system).
|
||||
|
||||
Remember to take part in the discussion of your suggestions.
|
||||
|
||||
### Questions
|
||||
|
||||
You should direct your question to the forum or ask on IRC. You should also checkout the included documentation and additional text files, e.g. `COMPILING.md` if you have problems building.
|
||||
|
||||
## Issue Triage
|
||||
|
||||
We have a fairly overwhelming number of open issues, 900+ as of this page's creation, we need to bring this under control, otherwise important issues can go unnoticed. In order to make this happen, we need to step up issue triage, closing stale issues.
|
||||
|
||||
Ideally, issues will be found to be either invalid and closed quickly or found to be valid and addressed quickly. Unfortunately there are some valid issues that cannot be addressed as quickly as we'd like, and they tend to accumulate.
|
||||
|
||||
### Reasons to close Issues
|
||||
- Issue is invalid. There are a number of reasons an issue might be invalid:
|
||||
- Bug report that can't be reproduced. Regardless of the severity of a bug, if it can't be reproduced there's no value to keeping it around. This doesn't mean we should close issues after just a few attempts to reproduce the issue, but if people have tried and failed to reproduce the issue, and there are no further instructions for reproduction, we can consider the report stale and close it. These can be reopened if people find a reliable way to reproduce the issue.
|
||||
- Suggestion incompatible with direction of game development. There are some suggestions that just don't fit in the game, and keeping them around adds no value. Some examples of this kind of issue can be found [on the forums](https://discourse.cataclysmdda.org/t/fms-frequently-made-suggestions/), and it will be useful to tag such issues to create more examples.
|
||||
- Trivial suggestion. Some issues are just to trivial to bother with tracking, for example requests to add a particular item, profession, building, etc, especially if the suggestion lacks detail can be closed, ideally with a polite message suggesting that Pull Requests are welcome (assuming it's a good idea).
|
||||
- Issue is stale. Valid, reproducable bugs should stick around forever, but some feature requests and discussions lose their value if no one is championing them.
|
||||
- Issues tagged "Suggestion" that are idle for a week or more can be closed, discussion issues should be short-lived and spawn more concrete issues. If you are closing a suggestion, consider writing up recommendations made in the issue in a new Issue and closing the original.
|
||||
- Overly-specific outlines of features that are obviously an individual developer's notes to themselves about something they want to implement. These can be valuable in the short term, but if it's been months since the last activity on the issue, we can consider closing the issue.
|
||||
|
||||
## Bounties
|
||||
|
||||
We keep the development and direction of the game community-driven so placing a bounty *does not* necessarily mean that change will be incorporated into the main game. But it may be incorporated as a mod (or not). As such feel free to post bounties on what you like, but remember we don't do "bounty-driven" development. A good way of thinking about bounties is as encouragement for contributors to work on a particular issue and certainly not as "paying for features".
|
||||
|
||||
## Issue resolution
|
||||
|
||||
We do not assign people to issues. If you plan to work on a bug fix or a validated idea feel free to just comment about that. Actual PRs are of much greater value than any assignments. In general the first correct PR about something will be the PR that will get merged, but remember: we are using Git - you can collaborate with someone else easily by sending them patches or PRs against their PR branch.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
layout: page
|
||||
title: Packaging Status
|
||||
permalink: /packaging/
|
||||
---
|
||||
<a href="https://repology.org/project/cataclysm-dda/versions">
|
||||
<img src="https://repology.org/badge/vertical-allrepos/cataclysm-dda.svg" alt="Packaging status" align="right">
|
||||
</a>
|
||||
|
||||
Catalcysm: Dark Days Ahead is availible to download from many package repositories, as well as directly from the [Releases Page]({{ site.baseurl }}{% link releases.md %}) on this site.
|
||||
|
||||
### Arch Linux
|
||||
|
||||
Ncurses and tiles versions are available in the [Community repo](https://www.archlinux.org/packages/?q=cataclysm-dda)
|
||||
|
||||
`sudo pacman -S cataclysm-dda`
|
||||
|
||||
`sudo pacman -S cataclysm-dda-tiles`
|
||||
|
||||
### Debian / Ubuntu
|
||||
|
||||
Ncurses and tiles versions are available in the [official repos](https://tracker.debian.org/pkg/cataclysm-dda)
|
||||
|
||||
`sudo apt install cataclysm-dda-curses`
|
||||
|
||||
`sudo apt install cataclysm-dda-sdl`
|
||||
|
||||
### Fedora
|
||||
|
||||
Ncurses and tiles versions are available in the [official repos](https://src.fedoraproject.org/rpms/cataclysm-dda)
|
||||
|
||||
`sudo dnf install cataclysm-dda`
|
||||
|
||||
### Flatpak
|
||||
|
||||
Download from [Flathub](https://flathub.org/apps/org.cataclysmdda.CataclysmDDA).
|
||||
@@ -0,0 +1,83 @@
|
||||
[
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [ "INTRO" ],
|
||||
"id": "Intro",
|
||||
"dynamic_line": "Hey there, stranger! I'm Nautilus, leader of this little caravan we have here. We've got quite a few supplies to deliver, and it looks like you could use some help. Why don't you join us?",
|
||||
"responses": [
|
||||
{ "topic": "ResponsePrompTest", "text": "What's it going to cost me?" },
|
||||
{ "topic": "DynamicLineTest", "text": "What's your story?" },
|
||||
{ "topic": "TrialTest", "text": "Trial talk example" },
|
||||
{ "topic": "ListResponseTest", "text": "List some responses" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [ "LANDING", "EXIT" ],
|
||||
"id": "Landing",
|
||||
"dynamic_line": "Have some more questions? Ask away, and I'll do my best to shed some light.",
|
||||
"responses": [
|
||||
{ "topic": "ResponsePrompTest", "text": "What's it going to cost me?" },
|
||||
{ "topic": "DynamicLineTest", "text": "What's your backstory?" },
|
||||
{ "topic": "TALK_DONE", "text": "Let's go" },
|
||||
{ "topic": "Intro", "text": "Take me back" }
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "ResponsePrompTest",
|
||||
"dynamic_line": "Welp, joining the caravan isn't exactly cheap, but I promise it'll be worth every single coin. We've got a lot of mouths to feed and supplies to buy, so we need people who are willing to chip in and help us out.\n\nBut don't worry, I won't ask for everything you have right away.",
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Here's some cash.",
|
||||
"effect": { "u_add_var": "dialogue_survivor_cop_talked_to_survivor_cop", "value": "yes" },
|
||||
"condition": "something"
|
||||
},
|
||||
{ "topic": "Landing", "text": "Okay, that sounds good.", "condition": { "u_has_item": "money_twenty" } }
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "DynamicLineTest",
|
||||
"dynamic_line": {
|
||||
"u_is_wearing": "foodperson_mask",
|
||||
"gendered_line": "I was just a regular person. Until some American <name_b>s ruined my business!",
|
||||
"relevant_genders": "[ npc ]"
|
||||
},
|
||||
"responses": [ { "topic": "Landing", "text": "Very interesting, thanks." } ]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "TrialTest",
|
||||
"dynamic_line": {
|
||||
"compare_string": "yes",
|
||||
"yes": "It's nice to see you again <u_name>. What can I do for you?",
|
||||
"no": {
|
||||
"gendered_line": "It's nice to see a new face around here. I'm <npc_name>, it's a pleasure meeting you.",
|
||||
"relevant_genders": "[\"npc\"]"
|
||||
}
|
||||
},
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Nice to meet you too, I'm <u_name>",
|
||||
"condition": { "not": { "compare_string": "yes" } }
|
||||
},
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Hands up! Hand over everything you've got, and nobody gets hurt!",
|
||||
"condition": { "not": "yes" },
|
||||
"trial": { "type": "Intimidate", "difficulty": "30" },
|
||||
"success": "change_topic_logic",
|
||||
"failure": "change_topic_logic"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "ListResponseTest",
|
||||
"dynamic_line": "[Can I define an empty object name and still get an object?, If so, that makes it simple, Here's some random text, Can't define that way, I think it may be best to match the string and then save as array]",
|
||||
"responses": [ { "topic": "Landing", "text": "Cool" } ]
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,75 @@
|
||||
:: StoryTitle
|
||||
Nautilus_Intro
|
||||
|
||||
|
||||
:: StoryData
|
||||
{
|
||||
"ifid": "4422091B-426E-4C3F-B426-C8138CFCB5CB",
|
||||
"format": "cdda_twison",
|
||||
"format-version": "0.0.2",
|
||||
"start": "Intro",
|
||||
"zoom": 1
|
||||
}
|
||||
|
||||
|
||||
:: DynamicLineTest {"position":"900,575","size":"100,100"}
|
||||
{{u_is_wearing}}foodperson_mask{{/u_is_wearing}}
|
||||
{{gendered_line}}I was just a regular person. Until some American <name_b>s ruined my business!{{/gendered_line}}
|
||||
{{relevant_genders}}[ npc ]{{/relevant_genders}}
|
||||
|
||||
Very interesting, thanks. [[Landing]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:: Intro [INTRO] {"position":"725,400","size":"100,100"}
|
||||
Hey there, stranger! I'm Nautilus, leader of this little caravan we have here. We've got quite a few supplies to deliver, and it looks like you could use some help. Why don't you join us?
|
||||
|
||||
What's it going to cost me? [[ResponsePrompTest]]
|
||||
What's your story? [[DynamicLineTest]]
|
||||
Trial talk example [[TrialTest]]
|
||||
List some responses [[ListResponseTest]]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:: Landing [LANDING EXIT] {"position":"1025,425","size":"100,100"}
|
||||
Have some more questions? Ask away, and I'll do my best to shed some light.
|
||||
|
||||
What's it going to cost me? [[ResponsePrompTest]]
|
||||
What's your backstory? [[DynamicLineTest]]
|
||||
Let's go [[TALK_DONE]]
|
||||
Take me back [[Intro]]
|
||||
|
||||
|
||||
:: ListResponseTest {"position":"900,125","size":"100,100"}
|
||||
[Can I define an empty object name and still get an object?, If so, that makes it simple, Here's some random text, Can't define that way, I think it may be best to match the string and then save as array]
|
||||
|
||||
Cool [[Landing]]
|
||||
|
||||
|
||||
:: ResponsePrompTest {"position":"900,250","size":"100,100"}
|
||||
Welp, joining the caravan isn't exactly cheap, but I promise it'll be worth every single coin. We've got a lot of mouths to feed and supplies to buy, so we need people who are willing to chip in and help us out.
|
||||
|
||||
But don't worry, I won't ask for everything you have right away.
|
||||
|
||||
Here's some cash. {{effect}}{{u_add_var}}dialogue_survivor_cop_talked_to_survivor_cop{{/u_add_var}} {{value}}yes{{/value}} } {{/effect}} {{condition}}something{{/condition}} [[Landing]]
|
||||
|
||||
Okay, that sounds good. [[Landing]] {{condition}}{{u_has_item}}money_twenty{{/u_has_item}}{{/condition}}
|
||||
|
||||
|
||||
:: TALK_DONE {"position":"1275,425","size":"100,100"}
|
||||
|
||||
|
||||
|
||||
:: TrialTest {"position":"900,425","size":"100,100"}
|
||||
{{compare_string}}yes{{/compare_string}}
|
||||
{{yes}}It's nice to see you again <u_name>. What can I do for you?{{/yes}}
|
||||
{{no}}{{gendered_line}}It's nice to see a new face around here. I'm <npc_name>, it's a pleasure meeting you.{{/gendered_line}}{{relevant_genders}}["npc"]{{/relevant_genders}}{{/no}}
|
||||
|
||||
Nice to meet you too, I'm <u_name> [[Landing]] {{condition}}{{not}}{{compare_string}}yes{{/compare_string}}{{/not}}{{/condition}}
|
||||
|
||||
Hands up! Hand over everything you've got, and nobody gets hurt! [[Landing]] {{condition}}{{not}}yes{{/not}}{{/condition}}{{trial}}{{type}}Intimidate{{/type}}{{difficulty}}30{{/difficulty}}{{/trial}}{{success}}change_topic_logic{{/success}}{{failure}}change_topic_logic{{/failure}}
|
||||
@@ -0,0 +1,205 @@
|
||||
# CDDA_Twison
|
||||
|
||||

|
||||
|
||||
CDDA_Twison is a format for for [Twine 2](http://twinery.org/2) that exports JSON formatted for CDDA NPC talk-topics.
|
||||
|
||||
Twison is a story format for [Twine 2](http://twinery.org/2) that simply exports to JSON.
|
||||
|
||||
It is inspired by [Entweedle](http://www.maximumverbosity.net/twine/Entweedle/) as a model for how Twine 2 story formats work.
|
||||
|
||||
## Installation
|
||||
|
||||
From the Twine 2 story select screen, add a story format, and point it to the url `https://sittingducken.github.io/dist/format.js`.
|
||||
|
||||
From within your story, set the story format to CDDA_Twison. Choosing "Play" will now give you a JSON file.
|
||||
|
||||
## Output
|
||||
|
||||
Here's an example of its output:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [
|
||||
"INTRO"
|
||||
],
|
||||
"id": "Intro",
|
||||
"dynamic_line": "Hey there, stranger! I'm Nautilus, leader of this little caravan we have here. We've got quite a few supplies to deliver, and it looks like you could use some help. Why don't you join us?",
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Cost",
|
||||
"text": "What's it going to cost me?"
|
||||
},
|
||||
{
|
||||
"topic": "Backstory",
|
||||
"text": "What's your story?"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [
|
||||
"LANDING",
|
||||
"EXIT"[
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [
|
||||
"INTRO"
|
||||
],
|
||||
"id": "Intro",
|
||||
"dynamic_line": "Hey there, stranger! I'm Nautilus, leader of this little caravan we have here. We've got quite a few supplies to deliver, and it looks like you could use some help. Why don't you join us?",
|
||||
"responses": [
|
||||
{
|
||||
"text": "What's it going to cost me?",
|
||||
"topic": "Cost"
|
||||
},
|
||||
{
|
||||
"text": "What's your story?",
|
||||
"topic": "Backstory"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"tags": [
|
||||
"LANDING",
|
||||
"EXIT"
|
||||
],
|
||||
"id": "Landing",
|
||||
"dynamic_line": "Have some more questions? Ask away, and I'll do my best to shed some light.",
|
||||
"responses": [
|
||||
{
|
||||
"text": "What's it going to cost me?",
|
||||
"topic": "Cost"
|
||||
},
|
||||
{
|
||||
"text": "What's your backstory?",
|
||||
"topic": "Backstory"
|
||||
},
|
||||
{
|
||||
"text": "Let's go",
|
||||
"topic": "TALK_DONE"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "Cost",
|
||||
"dynamic_line": "Welp, joining the caravan isn't exactly cheap, but I promise it'll be worth every single coin. We've got a lot of mouths to feed and supplies to buy, so we need people who are willing to chip in and help us out.\n\nBut don't worry, I won't ask for everything you have right away.",
|
||||
"responses": [
|
||||
{
|
||||
"text": "Okay, that sounds good.",
|
||||
"topic": "Landing"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "Backstory",
|
||||
"dynamic_line": "Leading a caravan makes more sense than going solo because it's all about teamwork and cooperation, which are crucial for survival in a post-apocalyptic world. By being part of a group, we can protect each other from various threats like roving gangs, portal storms, or the hordes. And who knows? Maybe one day we'll find fellow survivors to join our journey and make it through this tough world together.",
|
||||
"responses": [
|
||||
{
|
||||
"text": "Very interesting, thanks.",
|
||||
"topic": "Landing"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"id": "Landing",
|
||||
"dynamic_line": "Have some more questions? Ask away, and I'll do my best to shed some light.",
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Cost",
|
||||
"text": "What's it going to cost me?"
|
||||
},
|
||||
{
|
||||
"topic": "Backstory",
|
||||
"text": "What's your backstory?"
|
||||
},
|
||||
{
|
||||
"topic": "TALK_DONE",
|
||||
"text": "Let's go"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "Cost",
|
||||
"dynamic_line": "Welp, joining the caravan isn't exactly cheap, but I promise it'll be worth every single coin. We've got a lot of mouths to feed and supplies to buy, so we need people who are willing to chip in and help us out.\n\nBut don't worry, I won't ask for everything you have right away.",
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Here's some cash.",
|
||||
"effect": {
|
||||
"u_add_var": "dialogue_survivor_cop_talked_to_survivor_cop",
|
||||
"value": "yes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Okay, that sounds good.",
|
||||
"condition": {
|
||||
"u_has_item": "money_twenty"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"topic": "talk_topic",
|
||||
"id": "Backstory",
|
||||
"dynamic_line": "Leading a caravan makes more sense than going solo because it's all about teamwork and cooperation, which are crucial for survival in a post-apocalyptic world. By being part of a group, we can protect each other from various threats like roving gangs, portal storms, or the hordes. And who knows? Maybe one day we'll find fellow survivors to join our journey and make it through this tough world together.",
|
||||
"responses": [
|
||||
{
|
||||
"topic": "Landing",
|
||||
"text": "Very interesting, thanks."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Capabilities
|
||||
|
||||
Additional features have been baked in:
|
||||
|
||||
1. Links
|
||||
|
||||
- [Links are available via the standard way of linking in Twine 2.](https://twinery.org/wiki/twine2:how_to_create_links) Formatting expects Links to be on a new line along with the text for the response. The line containing the link will then be transformed into a response.
|
||||
```
|
||||
Hey there, stranger! I'm Nautilus, leader of this little caravan we have here. We've got quite a few supplies to deliver, and it looks like you could use some help.
|
||||
Why don't you join us?
|
||||
|
||||
What's it going to cost me? [[Cost]]
|
||||
What's your story? [[Backstory]]
|
||||
```
|
||||
|
||||
2. Props
|
||||
|
||||
- Props are available by adding them as so to the passage text: "{{foo}}bar{{/foo}}". Props are only supported in a single instance. eg {{condition}}{{u_has_var}}dancing{{/u_has_var}}{{/condition}} works but {{condition}}(same stuff){{/condition}}{{effect}}(new_stuff){{/effect}} doesn't work.
|
||||
|
||||
1. Tags
|
||||
- Tags are included for your benefit as reminders. They currently serve no functionallity and need to be deleted before ingesting into CDDA.
|
||||
|
||||
## Development
|
||||
|
||||
If you want to hack on CDDA_Twison itself:
|
||||
|
||||
1. Clone this repo and run `npm install` to install dependencies.
|
||||
2. Make your changes to the unminified code in the `src` folder
|
||||
3. Run `npm run build` to compile your source into a `format.js` file that Twine 2 can understand. It'll be placed in the `dist` folder. Alternatively, you can run `npm run watch` to watch the `src` directory for changes and auto-recompile every time you save.
|
||||
|
||||
### Testing your changes locally
|
||||
|
||||
Running `npm start` will start the `watch.js` auto-compile behavior, and also start a local web server that serves the compiled `format.js` file. By default, this will be available at `http://localhost:3000/format.js`. Add that URL as a story format to your copy of Twine 2; every time you save a source file and then re-generate the "Play" view of your story in Twine, it should use the latest version of your code.
|
||||
|
||||
This is easier to do with the browser-based version of Twine 2 than with the downloadable copy, as you can just refresh your output page and it'll use the latest version of CDDA_Twison.
|
||||
|
||||
All contributions are welcome! If making code changes, please be sure to run the test suite (`npm test`) before opening a pull request.
|
||||
|
||||
## License
|
||||
|
||||
CDDA_Twison is licensed under the MIT license. See the LICENSE file for more information.
|
||||
tag
|
||||
-4056
File diff suppressed because it is too large
Load Diff
@@ -1,186 +0,0 @@
|
||||
#ifndef _PLAYER_H_
|
||||
#define _PLAYER_H_
|
||||
|
||||
#include "item.h"
|
||||
#include "monster.h"
|
||||
#include "pldata.h"
|
||||
#include "skill.h"
|
||||
#include "bionics.h"
|
||||
#include "trap.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class monster;
|
||||
class game;
|
||||
class trap;
|
||||
|
||||
class player {
|
||||
public:
|
||||
player();
|
||||
~player();
|
||||
bool create(game *g, character_type type);
|
||||
int random_good_trait(character_type type);
|
||||
int random_bad_trait (character_type type);
|
||||
void normalize(game *g); // Starting set up of HP and inventory
|
||||
|
||||
virtual bool is_npc() { return false; }
|
||||
nc_color color(); // What color to draw us as
|
||||
|
||||
void load_info(std::string data); // Load from file matching name
|
||||
std::string save_info(); // Save to file matching name
|
||||
void disp_info(game *g); // '@' key; extending character info
|
||||
void disp_status(WINDOW* w); // The constant data in the lower right
|
||||
|
||||
void reset(); // Resets movement points, stats, and applies pain, effects, etc
|
||||
int current_speed(); // Returns the number of movement points we get each turn
|
||||
int swim_speed(); // Our speed when swimming
|
||||
|
||||
bool has_trait(int flag);
|
||||
void toggle_trait(int flag);
|
||||
|
||||
bool has_bionic(bionic_id b);
|
||||
bool has_active_bionic(bionic_id b);
|
||||
void add_bionic(bionic_id b);
|
||||
void charge_power(int amount);
|
||||
void power_bionics(game *g);
|
||||
void activate_bionic(int b, game *g);
|
||||
|
||||
void mutate(game *g);
|
||||
|
||||
int sight_range(int light_level);
|
||||
bool is_in_sunlight(game *g);
|
||||
bool has_two_arms();
|
||||
bool can_wear_boots();
|
||||
bool is_armed(); // Whether we're wielding something; true for bionics
|
||||
bool avoid_trap(trap * tr);
|
||||
|
||||
void pause(); // '.' command; pauses & reduces recoil
|
||||
int hit_mon(game *g, monster *z); // Handles hitting a monster up to its death
|
||||
// hit_player returns false on a miss, and modifies bp, hitdam, and hitcut
|
||||
bool hit_player(player &p, body_part &bp, int &hitdam, int &hitcut);
|
||||
int dodge(); //Returns the players's dodge, modded by clothing etc
|
||||
int throw_range(char ch); // Range of throwing item; -1:DNE 0:Can't throw
|
||||
|
||||
// Converts bphurt to a hp_part (if side == 0, the left), then does/heals dam
|
||||
// hit() processes damage through armor
|
||||
void hit (game *g, body_part bphurt, int side, int dam, int cut);
|
||||
// absorb() reduces dam and cut by your armor (and bionics, traits, etc)
|
||||
void absorb(game *g, body_part bp, int &dam, int &cut);
|
||||
// hurt() doesn't--effects of disease, what have you
|
||||
void hurt (game *g, body_part bphurt, int side, int dam);
|
||||
|
||||
void heal(body_part bpheal, int side, int dam);
|
||||
void healall(int dam);
|
||||
void hurtall(int dam);
|
||||
|
||||
int hp_percentage(); // % of HP remaining, overall
|
||||
|
||||
void get_sick(game *g); // Process diseases
|
||||
// infect() gives us a chance to save (mostly from armor)
|
||||
void infect(dis_type type, body_part vector, int strength, int duration,
|
||||
game *g);
|
||||
// add_disease() does NOT give us a chance to save
|
||||
void add_disease(dis_type type, int duration, game *g);
|
||||
void rem_disease(dis_type type);
|
||||
bool has_disease(dis_type type);
|
||||
int disease_level(dis_type type);
|
||||
|
||||
void add_addiction(add_type type, int strength);
|
||||
bool has_addiction(add_type type);
|
||||
void rem_addiction(add_type type);
|
||||
int addiction_level(add_type type);
|
||||
|
||||
void suffer(game *g);
|
||||
void vomit(game *g);
|
||||
|
||||
bool eat(game *g, char let); // Eat item; returns false on fail
|
||||
bool wield(game *g, char let); // Wield item; returns false on fail
|
||||
bool wear(game *g, char let); // Wear item; returns false on fail
|
||||
bool takeoff(game *g, char let);// Take off item; returns false on fail
|
||||
void use(game *g, char let); // Use a tool
|
||||
void read(game *g, char let); // Read a book
|
||||
void try_to_sleep(game *g); // '$' command; adds DIS_LYING_DOWN
|
||||
bool can_sleep(game *g); // Checked each turn during DIS_LYING_DOWN
|
||||
|
||||
int warmth(body_part bp); // Warmth provided by armor &c
|
||||
int encumb(body_part bp); // Encumberance from armor &c
|
||||
int armor_bash(body_part bp); // Bashing resistance
|
||||
int armor_cut(body_part bp); // Cutting resistance
|
||||
int resist(body_part bp); // Infection &c resistance
|
||||
bool wearing_something_on(body_part bp); // True if wearing something on bp
|
||||
|
||||
void practice(skill s, int amount); // Practice a skill
|
||||
|
||||
int weight_carried();
|
||||
int volume_carried();
|
||||
int weight_capacity();
|
||||
int volume_capacity();
|
||||
int morale_level(); // Modified by traits, &c
|
||||
|
||||
void sort_inv(); // Sort inventory by type
|
||||
std::string weapname(bool charges = true);
|
||||
|
||||
void i_add(item it);
|
||||
bool has_active_item(itype_id id);
|
||||
void process_active_items(game *g);
|
||||
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();
|
||||
item i_remn(int index);// Remove item from inventory; returns ret_null on fail
|
||||
item &i_at(char let); // Returns the item with inventory letter let
|
||||
item &i_of_type(itype_id type); // Returns the first item with this type
|
||||
std::vector<item> inv_dump(); // Dumps full item list (e.g. at death)
|
||||
void use_up(itype_id it, int quantity);// Uses up items OR charges if a tool
|
||||
void use_amount(itype_id it, int quantity);// Uses up items
|
||||
void use_charges(itype_id it, int quantity);// Uses up charges
|
||||
int butcher_factor(); // Automatically picks our best butchering tool
|
||||
|
||||
bool is_wearing(itype_id it); // Are we wearing a specific itype?
|
||||
// has_amount works for quantity, OR charges if it is a tool.
|
||||
bool has_amount(itype_id it, int quantity);
|
||||
// has_number works ONLY for quantity.
|
||||
bool has_number(itype_id it, int quantity);
|
||||
// has_charges works ONLY for charges.
|
||||
bool has_charges(itype_id it, int quantity);
|
||||
bool has_item(char let); // Has an item with invlet let
|
||||
bool has_item(item *it); // Has a specific item
|
||||
std::vector<int> has_ammo(ammotype at);// Returns a list of indices of the ammo
|
||||
|
||||
// ---------------VALUES-----------------
|
||||
int posx, posy;
|
||||
player_activity activity;
|
||||
|
||||
std::string name;
|
||||
bool male;
|
||||
bool my_traits[PF_MAX2];
|
||||
std::vector<bionic> my_bionics;
|
||||
// Current--i.e. modified by disease, pain, etc.
|
||||
int str_cur, dex_cur, int_cur, per_cur;
|
||||
// Normal--i.e. unmodified by disease
|
||||
int str_max, dex_max, int_max, per_max;
|
||||
int power_level, max_power_level;
|
||||
int hunger, thirst, fatigue, health, morale;
|
||||
bool underwater;
|
||||
bool can_dodge;
|
||||
int oxygen;
|
||||
unsigned int recoil;
|
||||
unsigned int scent;
|
||||
int stim, pain, pkill, radiation;
|
||||
int cash;
|
||||
int moves;
|
||||
int hp_cur[num_hp_parts], hp_max[num_hp_parts];
|
||||
|
||||
int sklevel[num_skill_types];
|
||||
int skexercise[num_skill_types];
|
||||
|
||||
bool inv_sorted;
|
||||
std::vector <item> inv;
|
||||
std::vector <item> worn;
|
||||
item weapon;
|
||||
item ret_null; // Null item, sometimes returns by weapon() etc
|
||||
|
||||
std::vector <disease> illness;
|
||||
std::vector <addiction> addictions;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,468 +0,0 @@
|
||||
#ifndef _PLDATA_H_
|
||||
#define _PLDATA_H_
|
||||
|
||||
enum character_type {
|
||||
PLTYPE_CUSTOM,
|
||||
PLTYPE_RANDOM,
|
||||
PLTYPE_STUDENT,
|
||||
PLTYPE_FARMER,
|
||||
PLTYPE_MECHANIC,
|
||||
PLTYPE_CLERK,
|
||||
PLTYPE_COP,
|
||||
PLTYPE_SURVIVALIST,
|
||||
PLTYPE_PROGRAMMER,
|
||||
PLTYPE_DOCTOR,
|
||||
PLTYPE_MAX
|
||||
};
|
||||
|
||||
const std::string pltype_name[PLTYPE_MAX] = {
|
||||
"Custom Character", "Random Character", "Student", "Farmer", "Mechanic",
|
||||
"Clerk", "Police Officer", "Survivalist", "Programmer", "Doctor" };
|
||||
|
||||
const std::string pltype_desc[PLTYPE_MAX] = { "\
|
||||
A custom character you design yourself. A pool of points is used for\n\
|
||||
statistics, traits, and skills.",
|
||||
"\
|
||||
A character with stats, traits, and skills chosen randomly.",
|
||||
"\
|
||||
Before the influx of monsters, you were a college student. You start with\n\
|
||||
high intelligence, average strength, perception, and dexterity, and a\n\
|
||||
smattering of varied skills.",
|
||||
"\
|
||||
As a farmer, you have a naturally robust strength, while your other stats may\n\
|
||||
vary. You are slightly skilled in cutting weapons, as many farm tools are.",
|
||||
"\
|
||||
Reparing cars has given you a keen skill in mechanics and a decent dexterity.\n\
|
||||
You are also slightly skilled in bashing weapons, like wrenches and hammers.",
|
||||
"\
|
||||
Spending your time behind a checkout counter has honed your skills of speech\n\
|
||||
and barter, but you're not particularly good at much else.",
|
||||
"\
|
||||
Police training demands a good strength, dexterity and perception, with less\n\
|
||||
emphasis on intelligence. You're also trained in the use of pistols, and\n\
|
||||
possibly other firearms.",
|
||||
"\
|
||||
You love living off the land and firing your guns--the apocalypse is a dream\n\
|
||||
come true! You start off skilled in traps, rifles, and first aid.",
|
||||
"\
|
||||
Hours at a computer have caused your strength and perception to decline, but\n\
|
||||
your mind couldn't be better honed. You're highly skilled with computers and\n\
|
||||
possibly one or two other technical areas.",
|
||||
"\
|
||||
Possessed of a mind and stamina capable of carrying you through law school,\n\
|
||||
you're highly skilled both with first aid and more serious medical procedure,\n\
|
||||
but less so with fighting."
|
||||
};
|
||||
|
||||
enum dis_type {
|
||||
DI_NULL,
|
||||
// Temperature
|
||||
DI_HEATSTROKE, DI_FBFACE, DI_FBHANDS, DI_FBFEET,
|
||||
DI_SMOKE, DI_ONFIRE, DI_TEARGAS,
|
||||
// Monsters
|
||||
DI_BOOMERED, DI_SPORES, DI_FUNGUS, DI_SLIMED,
|
||||
DI_BLIND,
|
||||
DI_LYING_DOWN, DI_SLEEP,
|
||||
DI_POISON, DI_FOODPOISON, DI_SHAKES,
|
||||
// Food & Drugs
|
||||
DI_PKILL1, DI_PKILL2, DI_PKILL3, DI_PKILL_L, DI_DRUNK, DI_CIG, DI_HIGH,
|
||||
DI_HALLU, DI_VISUALS, DI_TOOK_XANAX, DI_TOOK_PROZAC, DI_TOOK_FLUMED,
|
||||
DI_ADRENALINE, DI_ASTHMA, DI_METH,
|
||||
// Traps
|
||||
DI_BEARTRAP, DI_IN_PIT,
|
||||
// Other
|
||||
DI_TELEGLOW
|
||||
};
|
||||
|
||||
enum add_type {
|
||||
ADD_NULL,
|
||||
ADD_CAFFEINE, ADD_ALCOHOL, ADD_SLEEP, ADD_PKILLER, ADD_SPEED, ADD_CIG,
|
||||
ADD_COKE
|
||||
};
|
||||
|
||||
struct disease
|
||||
{
|
||||
dis_type type;
|
||||
int duration;
|
||||
disease() { type = DI_NULL; duration = 0; }
|
||||
disease(dis_type t, int d) { type = t; duration = d;}
|
||||
};
|
||||
|
||||
struct addiction
|
||||
{
|
||||
add_type type;
|
||||
int intensity;
|
||||
int sated;
|
||||
addiction() { type = ADD_NULL; intensity = 0; sated = 600; }
|
||||
addiction(add_type t) { type = t; intensity = 1; sated = 600; }
|
||||
addiction(add_type t, int i) { type = t; intensity = i; sated = 600; }
|
||||
};
|
||||
|
||||
enum activity_type {
|
||||
ACT_NULL = 0,
|
||||
ACT_RELOAD, ACT_READ, ACT_WAIT, ACT_CRAFT,
|
||||
NUM_ACTIVITIES
|
||||
};
|
||||
|
||||
struct player_activity
|
||||
{
|
||||
activity_type type;
|
||||
int moves_left;
|
||||
int index;
|
||||
player_activity() { type = ACT_NULL; moves_left = 0; index = -1; }
|
||||
player_activity(activity_type t, int turns, int Index)
|
||||
{
|
||||
type = t;
|
||||
moves_left = turns;
|
||||
index = Index;
|
||||
}
|
||||
};
|
||||
|
||||
enum pl_flag {
|
||||
PF_FLEET = 0, // -10%% terrain movement cost
|
||||
PF_PARKOUR, // Terrain movement cost of 3 or 4 are both 2
|
||||
PF_QUICK, // +5%% movement points
|
||||
PF_OPTIMISTIC, // Morale boost
|
||||
PF_FASTHEALER, // Heals faster
|
||||
PF_LIGHTEATER, // Less hungry
|
||||
PF_PAINRESIST, // Effects of pain are reduced
|
||||
PF_NIGHTVISION,// Increased sight during the night
|
||||
PF_POISRESIST, // Resists poison, etc
|
||||
PF_FASTREADER, // Reads books faster
|
||||
PF_TOUGH, // Bonus to HP
|
||||
PF_THICKSKIN, // Built-in armor of 1
|
||||
PF_PACKMULE, // Bonus to carried volume
|
||||
PF_FASTLEARNER,// Better chance of skills leveling up
|
||||
PF_DEFT, // Less movement penalty for melee miss
|
||||
PF_DRUNKEN, // Having a drunk status improves melee combat
|
||||
PF_GOURMAND, // Faster eating, higher level of max satiated
|
||||
PF_SUPERTASTER,// ALWAYS warned for rotten food
|
||||
PF_ANIMALEMPATH,// Animals run away more
|
||||
PF_TERRIFYING, // All creatures run away more
|
||||
PF_DISRESISTANT,// Less likely to succumb to low health; TODO: Implement this
|
||||
PF_ADRENALINE, // Big bonuses when low on HP
|
||||
PF_INCONSPICUOUS,// Less spawns due to timeouts
|
||||
PF_MASOCHIST, // Morale boost from pain
|
||||
PF_LIGHTSTEP, // Less noise from movement
|
||||
PF_HEARTLESS, // No morale penalty for murder &c
|
||||
PF_ANDROID, // Start with two bionics (occasionally one)
|
||||
PF_ROBUST, // Mutations tend to be good (usually they tend to be bad)
|
||||
|
||||
PF_SPLIT, // Null trait, splits between bad & good
|
||||
|
||||
PF_MYOPIC, // Smaller sight radius UNLESS wearing glasses
|
||||
PF_HEAVYSLEEPER, // Sleeps in, won't wake up to sounds as easily
|
||||
PF_ASTHMA, // Occasionally needs medicine or suffers effects
|
||||
PF_BADBACK, // Carries and moves less
|
||||
PF_ILLITERATE, // Can not read books
|
||||
PF_BADHEARING, // Max distance for heard sounds is halved
|
||||
PF_INSOMNIA, // Sleep may not happen
|
||||
PF_VEGETARIAN, // Morale penalty for eating meat
|
||||
PF_GLASSJAW, // Head HP is 15%% lower
|
||||
PF_FORGETFUL, // Skills decrement faster
|
||||
PF_LIGHTWEIGHT,// Longer DI_DRUNK and DI_HIGH
|
||||
PF_ADDICTIVE, // Better chance of addiction / longer addictive effects
|
||||
PF_TRIGGERHAPPY,// Possible chance of unintentional burst fire
|
||||
PF_SMELLY, // Default scent is higher
|
||||
PF_CHEMIMBALANCE,// Random tweaks to some values
|
||||
PF_SCHIZOPHRENIC,// Random bad effects, variety
|
||||
PF_JITTERY, // Get DI_SHAKES under some circumstances
|
||||
PF_HOARDER, // Morale penalty when volume is less than max
|
||||
PF_SAVANT, // All skills except our best are trained more slowly
|
||||
PF_MOODSWINGS, // Big random shifts in morale
|
||||
PF_WEAKSTOMACH,// More likely to throw up in all circumstances
|
||||
PF_WOOLALLERGY,// Can't wear wool
|
||||
PF_HPIGNORANT, // Don't get to see exact HP numbers, just colors & symbols
|
||||
|
||||
PF_MAX,
|
||||
// Below this point is mutations and other mid-game perks.
|
||||
// They are NOT available during character creation.
|
||||
PF_NIGHTVISION2,
|
||||
PF_INFRARED,
|
||||
PF_REGEN,
|
||||
PF_FANGS,
|
||||
PF_MEMBRANE,
|
||||
PF_GILLS,
|
||||
PF_SCALES,
|
||||
PF_FUR, // TODO: Warmth effects
|
||||
PF_CHITIN,
|
||||
PF_SPINES,
|
||||
PF_QUILLS,
|
||||
PF_TALONS,
|
||||
PF_RADIOGENIC,
|
||||
|
||||
PF_DEFORMED,
|
||||
PF_DEFORMED2,
|
||||
PF_VOMITOUS,
|
||||
PF_HUNGER,
|
||||
PF_THIRST,
|
||||
PF_ROT,
|
||||
PF_ALBINO,
|
||||
PF_SORES,
|
||||
PF_TROGLO,
|
||||
PF_WEBBED,
|
||||
PF_BEAK,
|
||||
PF_UNSTABLE,
|
||||
PF_RADIOACTIVE,
|
||||
PF_SLIMY,
|
||||
PF_HERBIVORE,
|
||||
PF_CARNIVORE,
|
||||
|
||||
PF_MAX2
|
||||
};
|
||||
|
||||
struct trait {
|
||||
std::string name;
|
||||
int points; // How many points it costs in character creation
|
||||
bool curable; // Can it be cured by stem cell purifier?
|
||||
std::string description;
|
||||
};
|
||||
|
||||
const trait traits[] = {
|
||||
{"Fleet-Footed", 3, false, "\
|
||||
You can run more quickly than most, resulting in a 15%% speed bonus on sure\n\
|
||||
footing."},
|
||||
{"Parkour Expert", 1, false, "\
|
||||
You're skilled at clearing obstacles; terrain like railings or counters are\n\
|
||||
as easy for you to move on as solid ground."},
|
||||
{"Quick", 3, false, "\
|
||||
You're just generally quick! You get a 10%% bonus to action points."},
|
||||
{"Optimist", 2, false, "\
|
||||
Nothing gets you down! Your morale will generally be higher than average."},
|
||||
{"Fast Healer", 2, false, "\
|
||||
You heal a little faster than most; sleeping will heal more lost HP."},
|
||||
{"Light Eater", 3, false, "\
|
||||
Your metabolism is a little slower, and you require less food than most."},
|
||||
{"Pain Resistant", 4, false, "\
|
||||
You have a high tolerance for pain."},
|
||||
{"Night Vision", 1, false, "\
|
||||
You possess natural night vision, and can see two squares instead of one in\n\
|
||||
pitch blackness."},
|
||||
{"Poison Resistant", 1, false, "\
|
||||
Your system is rather tolerant of poisons and toxins, and most will affect\n\
|
||||
you less."},
|
||||
{"Fast Reader", 1, false, "\
|
||||
You're a quick reader, and can get through books a lot faster than most."},
|
||||
{"Tough", 5, false, "\
|
||||
It takes a lot to bring you down! You get a 20%% bonus to all hit points."},
|
||||
{"Thick-Skinned", 2, true, "\
|
||||
Your skin is tough. Cutting damage is slightly reduced for you."},
|
||||
{"Packmule", 3, false, "\
|
||||
You can manage to find space for anything! You can carry 40%% more volume."},
|
||||
{"Fast Learner", 4, false, "\
|
||||
You learn skills at twice the normal rate! Note that this only applies to\n\
|
||||
real-world experience, not to skill gain from other sources like books."},
|
||||
{"Deft", 2, false, "\
|
||||
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."},
|
||||
{"Drunken Master", 2, false, "\
|
||||
The martial art technique of Zui Quan, or Drunken Fist, comes naturally to\n\
|
||||
you. While under the influence of alcohol, your melee skill will rise\n\
|
||||
considerably, especially unarmed combat."},
|
||||
{"Gourmand", 2, false, "\
|
||||
You eat faster, and can eat and drink more, than anyone else! You also enjoy\n\
|
||||
food more; delicious food is better for your morale, and you don't mind some\n\
|
||||
unsavory meals."},
|
||||
{"Supertaster", 1, false, "\
|
||||
You can tell if food is even a little spoiled before eating it."},
|
||||
{"Animal Empathy", 1, false, "\
|
||||
Peaceful animals will not run away from you, and even aggressive animals are\n\
|
||||
less likely to attack. This only applies to natural animals such as woodland\n\
|
||||
creatures."},
|
||||
{"Terrifying", 2, false, "\
|
||||
There's something about you that creatures find frightening, and they are\n\
|
||||
more likely to try to flee."},
|
||||
{"Disease Resistant", 1, false, "\
|
||||
It's very unlikely that you will catch ambient diseases like a cold or the\n\
|
||||
flu."},
|
||||
{"High Adrenaline", 3, false, "\
|
||||
If you are in a very dangerous situation, you may experience a temporary rush\n\
|
||||
which increases your speed and strength significantly."},
|
||||
{"Inconspicuous", 2, false, "\
|
||||
While sleeping or staying still, it is less likely that monsters will wander\n\
|
||||
close to you."},
|
||||
{"Masochist", 2, false, "\
|
||||
Although you still suffer the negative effects of pain, it also brings a\n\
|
||||
unique pleasure to you."},
|
||||
{"Light Step", 1, false, "\
|
||||
You make less noise while walking. You're also less likely to set off traps."},
|
||||
{"Heartless", 2, false, "\
|
||||
You have few qualms, and no capacity for pity. Killing the helpless, the\n\
|
||||
young, and your friends will not affect your morale at all."},
|
||||
{"Android", 4, false, "\
|
||||
At some point in the past you had a bionic upgrade installed in your body.\n\
|
||||
You start the game with a power system, and one random bionic enhancement."},
|
||||
{"Robust Genetics", 2, false, "\
|
||||
You have a very strong genetic base. If you mutate, the odds that the\n\
|
||||
mutation will be beneficial are greatly increased."},
|
||||
|
||||
{"NULL", 0, " -------------------------------------------------- "},
|
||||
|
||||
{"Near-Sighted", -2, true, "\
|
||||
Without your glasses, your seeing radius is severely reduced! However, while\n\
|
||||
wearing glasses this trait has no effect, and you are guaranteed to start\n\
|
||||
with a pair."},
|
||||
{"Heavy Sleeper", -2, false, "\
|
||||
You're quite the heavy sleeper. Noises are unlikely to wake you up."},
|
||||
{"Asthmatic", -4, true, "\
|
||||
You will occasionally need to use an inhaler, or else suffer severe physical\n\
|
||||
limitations. However, you are guaranteed to start with an inhaler."},
|
||||
{"Bad Back", -3, true, "\
|
||||
You simply can not carry as much as people with a similar strength could.\n\
|
||||
Your maximum weight carried is reduced by 35%%."},
|
||||
{"Illiterate", -5, false, "\
|
||||
You never learned to read! Books are totally off-limits to you."},
|
||||
{"Poor Hearing", -2, true, "\
|
||||
Your hearing is poor, and you may not hear quiet or far-off noises."},
|
||||
{"Insomniac", -2, false, "\
|
||||
You have a hard time falling asleep, even under the best circumstances!"},
|
||||
{"Vegetarian", -3, false, "\
|
||||
You have moral objections to eating meat. You may consume it, but doing so\n\
|
||||
will hurt your morale."},
|
||||
{"Glass Jaw", -3, false, "\
|
||||
Your head can't take much abuse. Its maximum HP is 15%% lower than usual."},
|
||||
{"Forgetful", -3, false, "\
|
||||
You have a hard time remembering things. Your skills will erode slightly\n\
|
||||
faster than usual."},
|
||||
{"Lightweight", -1, false, "\
|
||||
Alcohol and drugs go straight to your head. You suffer the negative effects\n\
|
||||
of these for longer."},
|
||||
{"Addictive Personality", -3, false, "\
|
||||
It's easier for you to become addicted to substances, and harder to rid\n\
|
||||
yourself of these addictions."},
|
||||
{"Trigger Happy", -2, false, "\
|
||||
On rare occasion, you will go full-auto when you intended to fire a single\n\
|
||||
shot. This has no effect when firing handguns or other semi-automatic\n\
|
||||
firearms."},
|
||||
{"Smelly", -1, false, "\
|
||||
Your scent is particularly strong. It's not offensive to humans, but animals\n\
|
||||
that track your scent will do so more easily."},
|
||||
{"Chemical Imbalance", -2, true, "\
|
||||
You suffer from a minor chemical imbalance, whether mental or physical. Minor\n\
|
||||
changes to your internal chemistry will manifest themselves on occasion,\n\
|
||||
such as hunger, sleepiness, narcotic effects, etc."},
|
||||
{"Schizophrenic", -5, false, "\
|
||||
You will periodically suffer from delusions, ranging from minor effects to\n\
|
||||
full visual hallucinations. Some of these effects may be controlled through\n\
|
||||
the use of medication."},
|
||||
{"Jittery", -3, false, "\
|
||||
During moments of great stress or under the effects of stimulants, you may\n\
|
||||
find your hands shaking uncontrollably, severely reducing your dexterity."},
|
||||
{"Hoarder", -3, false, "\
|
||||
You don't feel right unless you're carrying as much as you can. You suffer\n\
|
||||
morale penalties for carrying less than maximum volume (weight is ignored).\n\
|
||||
Benzodiazepines can help control this anxiety."},
|
||||
{"Savant", -4, false, "\
|
||||
You tend to specialize in one skill and be poor at all others. You advance\n\
|
||||
at half speed in all skills except your best one. Note that combining this\n\
|
||||
with Fast Learner will come out to a slower rate of learning for all skills."},
|
||||
{"Mood Swings", -1, false, "\
|
||||
Your morale will shift up and down at random, often dramatically."},
|
||||
{"Weak Stomach", -1, false, "\
|
||||
You are more likely to throw up from food poisoning, alcohol, etc."},
|
||||
{"Wool Allergy", -1, false, "\
|
||||
You are badly allergic to wool, and can not wear any clothing made of the\n\
|
||||
substance."},
|
||||
{"HP Ignorant", -2, false, "\
|
||||
You do not get to see your exact amount of HP remaining, but do have a vague\n\
|
||||
idea of whether you're in good condition or not."},
|
||||
|
||||
{"Bug - PF_MAX", 0, false, "\
|
||||
This shouldn't be here! You have the trait PF_MAX toggled. Weird."},
|
||||
|
||||
{"High Night Vision", 3, true, "\
|
||||
You can see incredibly well in the dark!"},
|
||||
{"Infrared Vision", 3, true, "\
|
||||
Your eyes have mutated to pick up radiation in the infrared spectrum."},
|
||||
{"Regeneration", 8, true, "\
|
||||
Your flesh regenerates from wounds incredibly quickly."},
|
||||
{"Fangs", 2, true, "\
|
||||
Your teeth have grown into two-inch-long fangs, allowing you to make an extra\n\
|
||||
attack when conditions favor it."},
|
||||
{"Nictating Membrane", 1, true, "\
|
||||
You have a second set of clear eyelids which lower while underwater, allowing\n\
|
||||
you to see as though you were wearing goggles."},
|
||||
{"Gills", 1, true, "\
|
||||
You've grown a set of gills in your neck, allowing you to breathe underwater."},
|
||||
{"Scales", 4, true, "\
|
||||
A set of flexible green scales have grown to cover your body, acting as a\n\
|
||||
natural armor."},
|
||||
{"Furry", 2, true, "\
|
||||
Thick black fur has grown to cover your entire body, providing a marginal\n\
|
||||
protection against attacks, and considerable protection from cold."},
|
||||
{"Chitinous Armor", 2, true, "\
|
||||
You've grow a chitin exoskeleton, much like that of an insect. It provides\n\
|
||||
considerable physical protection, but reduces your dexterity by 3."},
|
||||
{"Spines", 1, true, "\
|
||||
Your skin is covered with fine spines. Whenever an unarmed opponent strikes\n\
|
||||
a part of your body that is not covered by clothing, they will receive minor\n\
|
||||
damage."},
|
||||
{"Quills", 3, true, "\
|
||||
Your body is covered with large quills. Whenever an unarmed opponent strikes\n\
|
||||
a part of your body that is not covered by clothing, they will receive\n\
|
||||
significant damage."},
|
||||
{"Large Talons", 2, true, "\
|
||||
Your index fingers have grown into huge talons. After a bit of practice, you\n\
|
||||
find that this does not affect your dexterity, but allows for a deadly\n\
|
||||
unarmed attack."},
|
||||
{"Radiogenic", 3, true, "\
|
||||
Your system has adapted to radiation. While irradiated, you will actually\n\
|
||||
heal slowly, converting the radiation into hit points."},
|
||||
|
||||
{"Deformed", -2, true, "\
|
||||
You're minorly deformed. Some people will react badly to your appearance."},
|
||||
{"Badly Deformed", -3, true, "\
|
||||
You're hideously deformed. Some people will have a strong negative reaction\n\
|
||||
to your appearance."},
|
||||
{"Vomitous", -4, true, "\
|
||||
You have a major digestive disorder, which causes you to vomit frequently."},
|
||||
{"Fast Metabolism", -2, true, "\
|
||||
You require more food than most people."},
|
||||
{"High Thirst", -3, true, "\
|
||||
Your body dries out easily; you need to drink a lot more water."},
|
||||
{"Disintegration", -10, true, "\
|
||||
Your body is slowly wasting away!"},
|
||||
{"Albino", -2, true, "\
|
||||
Your skin lacks pigment, and is nearly transparent. You suffer serious burns\n\
|
||||
in direct sunlight."},
|
||||
{"Sores", -2, true, "\
|
||||
Your body is covered in painful sores. The pain is worse when they are\n\
|
||||
covered in clothing."},
|
||||
{"Light Sensitive", -3, true, "\
|
||||
Sunlight makes you extremely uncomfortable, resulting in large penalties to\n\
|
||||
all stats."},
|
||||
{"Webbed Hands", -1, true, "\
|
||||
Your hands and feet are heavily webbed, reducing your dexterity by 1 and\n\
|
||||
preventing you from wearing gloves. However, you can swim much faster."},
|
||||
{"Beak", -1, true, "\
|
||||
You have a beak for a mouth. You can occasionally use it to peck at your\n\
|
||||
enemies, but it is impossible for you to wear mouthgear."},
|
||||
{"Genetically Unstable", -4, true, "\
|
||||
Your DNA has been damaged in a way that causes you to continually develop\n\
|
||||
more mutations."},
|
||||
{"Radioactive", -4, true, "\
|
||||
Your body has become radioactive! You continuously emit low levels of\n\
|
||||
radiation, some of which will be absorbed by you, and some of which will\n\
|
||||
contaminate the world around you."},
|
||||
{"Slimy", -1, true, "\
|
||||
Your body is coated with a fine slime, which oozes off of you, leaving a\n\
|
||||
trail."},
|
||||
{"Herbivore", -3, true, "\
|
||||
Your body's ability to digest meat is severely hampered. Eating meat has a\n\
|
||||
good chance of making you vomit it back up; even if you manage to keep it\n\
|
||||
down, its nutritional value is greatly reduced."},
|
||||
{"Carnivore", -2, true, "\
|
||||
Your body's ability to digest fruits, vegetables and grainss is severely\n\
|
||||
hampered. You cannot eat anything besides meat."}
|
||||
};
|
||||
|
||||
enum hp_part {
|
||||
hp_head = 0,
|
||||
hp_torso,
|
||||
hp_arm_l,
|
||||
hp_arm_r,
|
||||
hp_leg_l,
|
||||
hp_leg_r,
|
||||
num_hp_parts
|
||||
};
|
||||
#endif
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
---
|
||||
layout: page
|
||||
title: "Privacy Policy"
|
||||
permalink: /privacy/
|
||||
---
|
||||
|
||||
# Privacy Policy for Cataclysm: Dark Days Ahead
|
||||
|
||||
**CleverRaven**, the group of internet randoms that make **Cataclysm: Dark Days Ahead**, does not and cannot download or use your data, nor do we want to. You know what kind of person you are so we're sure you understand why not.
|
||||
|
||||
You can see the source code of this game online for yourself to confirm this (_and even become a member of the contributor team if you want_) at https://github.com/CleverRaven/Cataclysm-DDA/.
|
||||
|
||||
If you have questions about this privacy policy (though we can't imagine how that would be possible), please submit them as [a Github issue](https://github.com/CleverRaven/Cataclysm-DDA/issues/new/choose).
|
||||
|
||||
If you're wondering why we have a privacy policy at all in a single player locally-stored game, please direct further inquiries to Google's app store.
|
||||
|
||||
***
|
||||
|
||||
TLDR: **Cataclysm: Dark Days Ahead** and **Cataclysm: Dark Days Ahead (X)** apps do not collect or share any of your data.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: page
|
||||
title: Releases
|
||||
permalink: /releases/
|
||||
---
|
||||
|
||||
# Latest Stable
|
||||
The most recent stable release is {{ site.github.latest_release.tag_name }} {{ site.github.latest_release.name }}. We recommend stable for the most bug-free experience possible. You can download it from the [GitHub releases page](https://github.com/CleverRaven/Cataclysm-DDA/releases?q=prerelease%3Afalse&expanded=true). Note: downloads with 'Curses' in the name include a version that can be played in the console and has purely text-based display. Downloads with 'Tiles' in the name includes a version of the game that has sprite-based graphics. It can also be downloaded from many [package repositories]({{ site.baseurl }}{% link pages/packaging.md %}).
|
||||
|
||||
# Latest Experimental
|
||||
Cataclysm: DDA is under constant development. As such, stable can lag behind with features. If you would like access to the bleeding edge of features and any bugs that may come along with them, you can download the [latest experimental builds]({{ site.baseurl }}{% link pages/experimental.md %}).
|
||||
@@ -1,23 +0,0 @@
|
||||
#include "output.h"
|
||||
#include "rng.h"
|
||||
|
||||
long rng(long low, long high)
|
||||
{
|
||||
return low + long((high - low + 1) * double(rand() / double(RAND_MAX + 1.0)));
|
||||
}
|
||||
|
||||
bool one_in(int chance)
|
||||
{
|
||||
if (chance <= 1 || rng(0, chance - 1) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
int dice(int number, int sides)
|
||||
{
|
||||
int ret = 0;
|
||||
for (int i = 0; i < number; i++) {
|
||||
ret += rng(1, sides);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
#ifndef _RNG_H_
|
||||
#define _RNG_H_
|
||||
#include <stdlib.h>
|
||||
long rng(long low, long high);
|
||||
bool one_in(int chance);
|
||||
int dice(int number, int sides);
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
#include "settlement.h"
|
||||
#include "game.h"
|
||||
#include "output.h"
|
||||
#include "line.h"
|
||||
#include "rng.h"
|
||||
|
||||
settlement::settlement()
|
||||
{
|
||||
fact.randomize();
|
||||
posx = 0;
|
||||
posy = 0;
|
||||
size = 0;
|
||||
pop = 0;
|
||||
for (int i = 0; i < ot_wall - ot_set_house + 1; i++)
|
||||
buildings[i] = 0;
|
||||
}
|
||||
|
||||
settlement::settlement(int mapx, int mapy)
|
||||
{
|
||||
fact.randomize();
|
||||
posx = mapx;
|
||||
posy = mapy;
|
||||
size = 0;
|
||||
pop = 0;
|
||||
for (int i = 0; i < ot_wall - ot_set_house + 1; i++)
|
||||
buildings[i] = 0;
|
||||
}
|
||||
|
||||
void settlement::set_population()
|
||||
{
|
||||
pop = rng(4, 40);
|
||||
pop += rng(0, (fact.power - 20) / 6);
|
||||
if (pop < 4)
|
||||
pop = 4;
|
||||
}
|
||||
|
||||
int settlement::num(oter_id ter)
|
||||
{
|
||||
if (ter < ot_set_house || ter > ot_wall) {
|
||||
debugmsg("settlement::num requested back oter_id (%s)", oterlist[ter].name.c_str());
|
||||
return -1;
|
||||
}
|
||||
return buildings[ter - ot_set_house];
|
||||
}
|
||||
|
||||
void settlement::add_building(oter_id ter)
|
||||
{
|
||||
if (ter < ot_set_house || ter > ot_wall)
|
||||
return;
|
||||
buildings[ter - ot_set_house]++;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef _SETTLEMENT_H_
|
||||
#define _SETTLEMENT_H_
|
||||
|
||||
#include "npc.h"
|
||||
#include "overmap.h"
|
||||
#include "faction.h"
|
||||
|
||||
struct settlement {
|
||||
settlement();
|
||||
settlement(int mapx, int mapy);
|
||||
void pick_faction(game *g, int omx, int omy);
|
||||
void set_population();
|
||||
void populate(game *g) { };
|
||||
|
||||
int num(oter_id ter);
|
||||
void add_building(oter_id ter);
|
||||
|
||||
|
||||
faction fact;
|
||||
int posx;
|
||||
int posy;
|
||||
int pop;
|
||||
int size;
|
||||
int buildings[ot_wall - ot_set_house + 1];
|
||||
};
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user