3 Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "common_irrlicht.h"
27 #include "itemgroup.h"
31 std::map<int, float> times;
40 bool getTime(int rating, float *time) const
42 std::map<int, float>::const_iterator i = times.find(rating);
52 struct ToolCapabilities
54 float full_punch_interval;
56 std::map<std::string, ToolGroupCap> groupcaps;
59 float full_punch_interval_=1.4,
60 int max_drop_level_=1,
61 std::map<std::string, ToolGroupCap> groupcaps_ =
62 std::map<std::string, ToolGroupCap>()
64 full_punch_interval(full_punch_interval_),
65 max_drop_level(max_drop_level_),
69 void serialize(std::ostream &os) const;
70 void deSerialize(std::istream &is);
76 // Digging time in seconds
81 DigParams(bool a_diggable=false, float a_time=0, u16 a_wear=0):
88 DigParams getDigParams(const ItemGroupList &groups,
89 const ToolCapabilities *tp, float time_from_last_punch);
91 DigParams getDigParams(const ItemGroupList &groups,
92 const ToolCapabilities *tp);
99 HitParams(s16 hp_=0, s16 wear_=0):
105 HitParams getHitParams(const ItemGroupList &groups,
106 const ToolCapabilities *tp, float time_from_last_punch);
108 HitParams getHitParams(const ItemGroupList &groups,
109 const ToolCapabilities *tp);
111 struct PunchDamageResult
126 PunchDamageResult getPunchDamage(
127 const ItemGroupList &armor_groups,
128 const ToolCapabilities *toolcap,
129 const ItemStack *punchitem,
130 float time_from_last_punch