diff options
author | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-15 22:04:40 -0600 |
---|---|---|
committer | Steve Melenchuk <smelenchuk@gmail.com> | 2014-04-27 17:02:32 -0600 |
commit | dc91ade0243adba03fa5160dc3f0fb8aac84200c (patch) | |
tree | fe962420245e89f3da8942d4e6b7058f811e9086 | |
parent | 3d16f3b060f7ce54bd74de9037d882316715458f (diff) | |
download | crawl-ref-dc91ade0243adba03fa5160dc3f0fb8aac84200c.tar.gz crawl-ref-dc91ade0243adba03fa5160dc3f0fb8aac84200c.zip |
A skeleton ranged_attack class, derived from attack.
TODO: tie this up to the beam code; move shared code between melee and
ranged to plain attack; write ranged-specific code.
-rw-r--r-- | crawl-ref/source/Crawl.xcodeproj/project.pbxproj | 9 | ||||
-rw-r--r-- | crawl-ref/source/MSVC/crawl.vcxproj | 2 | ||||
-rw-r--r-- | crawl-ref/source/MSVC/crawl.vcxproj.filters | 2 | ||||
-rw-r--r-- | crawl-ref/source/Makefile.obj | 1 | ||||
-rw-r--r-- | crawl-ref/source/ranged_attack.cc | 68 | ||||
-rw-r--r-- | crawl-ref/source/ranged_attack.h | 35 |
6 files changed, 117 insertions, 0 deletions
diff --git a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj index 5d92bb6a65..cf9e73b2a4 100644 --- a/crawl-ref/source/Crawl.xcodeproj/project.pbxproj +++ b/crawl-ref/source/Crawl.xcodeproj/project.pbxproj @@ -243,6 +243,7 @@ 7B09F5F11133D6AB004F149D /* player.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406210BD494500A99626 /* player.cc */; }; 7B09F5F21133D6AB004F149D /* quiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406410BD494500A99626 /* quiver.cc */; }; 7B09F5F31133D6AB004F149D /* random.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406710BD494500A99626 /* random.cc */; }; + 7BDE8459116D24E600974D63 /* ranged_attack.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BDE8457116D24E600974D63 /* ranged_attack.cc */; }; 7B09F5F41133D6AB004F149D /* ray.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406910BD494500A99626 /* ray.cc */; }; 7B09F5F51133D6AB004F149D /* religion.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406B10BD494500A99626 /* religion.cc */; }; 7B09F5F61133D6AB004F149D /* rng.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406D10BD494500A99626 /* rng.cc */; }; @@ -597,6 +598,8 @@ E5D6414410BD494500A99626 /* player.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406210BD494500A99626 /* player.cc */; }; E5D6414510BD494500A99626 /* quiver.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406410BD494500A99626 /* quiver.cc */; }; E5D6414610BD494500A99626 /* random.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406710BD494500A99626 /* random.cc */; }; + 7BDE845A116D24E600974D63 /* ranged_attack.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BDE8457116D24E600974D63 /* ranged_attack.cc */; }; + E5D6414710BD494500A99626 /* ray.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406910BD494500A99626 /* ray.cc */; }; E5D6414710BD494500A99626 /* ray.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406910BD494500A99626 /* ray.cc */; }; E5D6414810BD494500A99626 /* religion.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406B10BD494500A99626 /* religion.cc */; }; E5D6414910BD494500A99626 /* rng.cc in Sources */ = {isa = PBXBuildFile; fileRef = E5D6406D10BD494500A99626 /* rng.cc */; }; @@ -1506,6 +1509,8 @@ E5D6406610BD494500A99626 /* random-weight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "random-weight.h"; sourceTree = "<group>"; }; E5D6406710BD494500A99626 /* random.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = random.cc; sourceTree = "<group>"; }; E5D6406810BD494500A99626 /* random.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = random.h; sourceTree = "<group>"; }; + 7BDE8457116D24E600974D63 /* ranged_attack.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ranged_attack.cc; sourceTree = "<group>"; }; + 7BDE8458116D24E600974D63 /* ranged_attack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ranged_attack.h; sourceTree = "<group>"; }; E5D6406910BD494500A99626 /* ray.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ray.cc; sourceTree = "<group>"; }; E5D6406A10BD494500A99626 /* ray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ray.h; sourceTree = "<group>"; }; E5D6406B10BD494500A99626 /* religion.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = religion.cc; sourceTree = "<group>"; }; @@ -2119,6 +2124,8 @@ E5D6406610BD494500A99626 /* random-weight.h */, E5D6406710BD494500A99626 /* random.cc */, E5D6406810BD494500A99626 /* random.h */, + 7BDE8457116D24E600974D63 /* ranged_attack.cc */ + 7BDE8458116D24E600974D63 /* ranged_attack.h */ E5D6406910BD494500A99626 /* ray.cc */, E5D6406A10BD494500A99626 /* ray.h */, 7B5165B911859D82005B23ED /* religion-enum.h */, @@ -3101,6 +3108,7 @@ 7B09F5F21133D6AB004F149D /* quiver.cc in Sources */, 7B5165CC11859D82005B23ED /* random-var.cc in Sources */, 7B09F5F31133D6AB004F149D /* random.cc in Sources */, + 7BDE8459116D24E600974D63 /* ranged_attack.cc in Sources */, 7B09F5F41133D6AB004F149D /* ray.cc in Sources */, 7B09F5F51133D6AB004F149D /* religion.cc in Sources */, 7B09F5F61133D6AB004F149D /* rng.cc in Sources */, @@ -3347,6 +3355,7 @@ E5D6414510BD494500A99626 /* quiver.cc in Sources */, 7B5165C611859D82005B23ED /* random-var.cc in Sources */, E5D6414610BD494500A99626 /* random.cc in Sources */, + 7BDE845A116D24E600974D63 /* ranged_attack.cc in Sources */, E5D6414710BD494500A99626 /* ray.cc in Sources */, E5D6414810BD494500A99626 /* religion.cc in Sources */, E5D6414910BD494500A99626 /* rng.cc in Sources */, diff --git a/crawl-ref/source/MSVC/crawl.vcxproj b/crawl-ref/source/MSVC/crawl.vcxproj index e892721591..06fec9e111 100644 --- a/crawl-ref/source/MSVC/crawl.vcxproj +++ b/crawl-ref/source/MSVC/crawl.vcxproj @@ -444,6 +444,7 @@ perl.exe "util/gen-cflg.pl" compflag.h "<UNKNOWN>" "<UNKNOWN>" <ClCompile Include="..\quiver.cc" />
<ClCompile Include="..\random-var.cc" />
<ClCompile Include="..\random.cc" />
+ <ClCompile Include="..\ranged_attack.cc" /> <ClCompile Include="..\ray.cc" />
<ClCompile Include="..\religion.cc" />
<ClCompile Include="..\rltiles\tiledef-feat.cc" />
@@ -799,6 +800,7 @@ perl.exe "util/gen-cflg.pl" compflag.h "<UNKNOWN>" "<UNKNOWN>" <ClInclude Include="..\random-var.h" />
<ClInclude Include="..\random-weight.h" />
<ClInclude Include="..\random.h" />
+ <ClInclude Include="..\ranged_attack.h" /> <ClInclude Include="..\ray.h" />
<ClInclude Include="..\religion-enum.h" />
<ClInclude Include="..\religion.h" />
diff --git a/crawl-ref/source/MSVC/crawl.vcxproj.filters b/crawl-ref/source/MSVC/crawl.vcxproj.filters index e84b27e33b..07c80c194a 100644 --- a/crawl-ref/source/MSVC/crawl.vcxproj.filters +++ b/crawl-ref/source/MSVC/crawl.vcxproj.filters @@ -185,6 +185,7 @@ <ClCompile Include="..\quiver.cc" />
<ClCompile Include="..\random-var.cc" />
<ClCompile Include="..\random.cc" />
+ <ClCompile Include="..\ranged_attack.cc" /> <ClCompile Include="..\ray.cc" />
<ClCompile Include="..\religion.cc" />
<ClCompile Include="..\rltiles\tiledef-feat.cc" />
@@ -493,6 +494,7 @@ <ClInclude Include="..\random-var.h" />
<ClInclude Include="..\random-weight.h" />
<ClInclude Include="..\random.h" />
+ <ClInclude Include="..\ranged_attack.h" /> <ClInclude Include="..\ray.h" />
<ClInclude Include="..\religion-enum.h" />
<ClInclude Include="..\religion.h" />
diff --git a/crawl-ref/source/Makefile.obj b/crawl-ref/source/Makefile.obj index 6d30983bc4..23957648e1 100644 --- a/crawl-ref/source/Makefile.obj +++ b/crawl-ref/source/Makefile.obj @@ -178,6 +178,7 @@ potion.o \ quiver.o \ random.o \ random-var.o \ +ranged_attack.o \ ray.o \ religion.o \ shopping.o \ diff --git a/crawl-ref/source/ranged_attack.cc b/crawl-ref/source/ranged_attack.cc new file mode 100644 index 0000000000..5b23d27421 --- /dev/null +++ b/crawl-ref/source/ranged_attack.cc @@ -0,0 +1,68 @@ +/** + * @file + * @brief ranged_attack class and associated ranged_attack methods + */ + +#include "AppHdr.h" + +#include "ranged_attack.h" + +ranged_attack::ranged_attack(actor *attk, actor *defn, item_def *proj) : + attack(attk, defn), projectile(proj) +{ +} + +int ranged_attack::calc_to_hit(bool) +{ + return 0; +} + +bool ranged_attack::handle_phase_attempted() +{ + return false; +} + +bool ranged_attack::handle_phase_dodged() +{ + return false; +} + +bool ranged_attack::handle_phase_blocked() +{ + return false; +} + +bool ranged_attack::handle_phase_hit() +{ + return false; +} + +bool ranged_attack::handle_phase_damaged() +{ + return false; +} + +bool ranged_attack::handle_phase_killed() +{ + return false; +} + +bool ranged_attack::handle_phase_end() +{ + return false; +} + +bool ranged_attack::attack_shield_blocked(bool verbose) +{ + return false; +} + +bool ranged_attack::apply_damage_brand() +{ + return false; +} + +bool ranged_attack::check_unrand_effects() +{ + return false; +} diff --git a/crawl-ref/source/ranged_attack.h b/crawl-ref/source/ranged_attack.h new file mode 100644 index 0000000000..a8c94403ee --- /dev/null +++ b/crawl-ref/source/ranged_attack.h @@ -0,0 +1,35 @@ +#ifndef RANGED_ATTACK_H +#define RANGED_ATTACK_H + +#include "attack.h" + +class ranged_attack : public attack +{ +// Public Methods +public: + ranged_attack(actor *attacker, actor *defender, item_def *projectile); + + int calc_to_hit(bool); + +private: + /* Attack Phases */ + bool handle_phase_attempted(); + bool handle_phase_dodged(); + bool handle_phase_blocked(); + bool handle_phase_hit(); + bool handle_phase_damaged(); + bool handle_phase_killed(); + bool handle_phase_end(); + + /* Combat Calculations */ + bool attack_shield_blocked(bool verbose); + bool apply_damage_brand(); + + /* Weapon Effects */ + bool check_unrand_effects(); + +private: + const item_def *projectile; +}; + +#endif |