summaryrefslogtreecommitdiffstats
path: root/stone_soup/crawl-ref/source/wpn-misc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'stone_soup/crawl-ref/source/wpn-misc.cc')
-rw-r--r--stone_soup/crawl-ref/source/wpn-misc.cc199
1 files changed, 199 insertions, 0 deletions
diff --git a/stone_soup/crawl-ref/source/wpn-misc.cc b/stone_soup/crawl-ref/source/wpn-misc.cc
new file mode 100644
index 0000000000..90b9cb0d37
--- /dev/null
+++ b/stone_soup/crawl-ref/source/wpn-misc.cc
@@ -0,0 +1,199 @@
+/*
+ *********************************************************************
+ * File: wpn-misc.cc *
+ * Summary: temporary home for weapon f(x) until struct'ed *
+ * Written by: don brodale <dbrodale@bigfootinteractive.com> *
+ * *
+ * Changelog(most recent first): *
+ * *
+ * <00> 12jun2000 dlb created after little thought *
+ *********************************************************************
+ */
+
+#include "AppHdr.h"
+#include "wpn-misc.h"
+
+#include "externs.h"
+
+// all of this will be replaced by a struct and data handlers {dlb}:
+
+/*
+ **************************************************
+ * *
+ * BEGIN PUBLIC FUNCTIONS *
+ * *
+ **************************************************
+*/
+
+// FIXME: Remove these eventually
+
+int damage_type(const item_def &item)
+{
+ return (damage_type(item.base_type, item.sub_type));
+}
+
+int damage_type(int wclass, int wtype)
+{
+ int type_damage = DVORP_CRUSHING; // this is the default, btw {dlb}
+
+ if (wclass == OBJ_WEAPONS)
+ {
+ switch (wtype)
+ {
+ case WPN_DAGGER:
+ case WPN_DEMON_BLADE:
+ case WPN_DOUBLE_SWORD:
+ case WPN_GREAT_SWORD:
+ case WPN_KATANA:
+ case WPN_KNIFE:
+ case WPN_LONG_SWORD:
+ case WPN_QUICK_BLADE:
+ case WPN_SABRE:
+ case WPN_FALCHION:
+ case WPN_SCIMITAR:
+ case WPN_SCYTHE:
+ case WPN_SHORT_SWORD:
+ case WPN_TRIPLE_SWORD:
+ case WPN_BLESSED_BLADE:
+ case WPN_LAJATANG:
+ type_damage = DVORP_SLICING;
+ break;
+
+ case WPN_DEMON_TRIDENT:
+ case WPN_EVENINGSTAR:
+ case WPN_GIANT_SPIKED_CLUB:
+ case WPN_MORNINGSTAR:
+ case WPN_SPEAR:
+ case WPN_SPIKED_FLAIL:
+ case WPN_TRIDENT:
+ type_damage = DVORP_PIERCING;
+ break;
+
+ case WPN_WAR_AXE:
+ case WPN_BATTLEAXE:
+ case WPN_BROAD_AXE:
+ case WPN_EXECUTIONERS_AXE:
+ case WPN_GLAIVE:
+ case WPN_HALBERD:
+ case WPN_HAND_AXE:
+ case WPN_LOCHABER_AXE:
+ type_damage = DVORP_CHOPPING;
+ break;
+ }
+ }
+
+ return (type_damage);
+} // end damage_type()
+
+bool can_cut_meat(int wclass, int wtype)
+{
+ int type = damage_type( wclass, wtype );
+
+ if (type == DVORP_CHOPPING || type == DVORP_SLICING)
+ return (true);
+
+ return (false);
+}
+
+int hands_reqd_for_weapon(int wclass, int wtype)
+{
+ int reqd_hands = HANDS_ONE;
+
+ switch (wclass)
+ {
+ case OBJ_WEAPONS:
+ switch (wtype)
+ {
+ case WPN_HALBERD:
+ case WPN_SCYTHE:
+ case WPN_GLAIVE:
+ case WPN_QUARTERSTAFF:
+ case WPN_LAJATANG:
+ case WPN_BATTLEAXE:
+ case WPN_EXECUTIONERS_AXE:
+ case WPN_GREAT_SWORD:
+ case WPN_TRIPLE_SWORD:
+ case WPN_GREAT_MACE:
+ case WPN_DIRE_FLAIL:
+ case WPN_GIANT_CLUB:
+ case WPN_GIANT_SPIKED_CLUB:
+ case WPN_LOCHABER_AXE:
+ case WPN_BOW:
+ case WPN_LONGBOW:
+ case WPN_CROSSBOW:
+ reqd_hands = HANDS_TWO;
+ break;
+
+ case WPN_SPEAR:
+ case WPN_TRIDENT:
+ case WPN_DEMON_TRIDENT:
+ case WPN_WAR_AXE:
+ case WPN_BROAD_AXE:
+ case WPN_KATANA:
+ case WPN_DOUBLE_SWORD:
+ case WPN_HAND_CROSSBOW:
+ case WPN_BLOWGUN:
+ case WPN_SLING:
+ reqd_hands = HANDS_HALF;
+ break;
+ }
+ break;
+
+ case OBJ_STAVES:
+ reqd_hands = HANDS_TWO;
+ break;
+ }
+
+ return (reqd_hands);
+} // end hands_reqd_for_weapon()
+
+bool is_demonic(unsigned char weapon_subtype)
+{
+ switch (weapon_subtype)
+ {
+ case WPN_DEMON_BLADE:
+ case WPN_DEMON_WHIP:
+ case WPN_DEMON_TRIDENT:
+ return true;
+
+ default:
+ return false;
+ }
+} // end is_demonic()
+
+bool launches_things( unsigned char weapon_subtype )
+{
+ switch (weapon_subtype)
+ {
+ case WPN_SLING:
+ case WPN_BOW:
+ case WPN_LONGBOW:
+ case WPN_CROSSBOW:
+ case WPN_HAND_CROSSBOW:
+ case WPN_BLOWGUN:
+ return (true);
+
+ default:
+ return (false);
+ }
+} // end launches_things()
+
+unsigned char launched_by(unsigned char weapon_subtype)
+{
+ switch (weapon_subtype)
+ {
+ case WPN_BLOWGUN:
+ return MI_NEEDLE;
+ case WPN_SLING:
+ return MI_STONE;
+ case WPN_BOW:
+ case WPN_LONGBOW:
+ return MI_ARROW;
+ case WPN_CROSSBOW:
+ return MI_BOLT;
+ case WPN_HAND_CROSSBOW:
+ return MI_DART;
+ default:
+ return MI_NONE; // lame debugging code :P {dlb}
+ }
+} // end launched_by()