[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /std/basic/condition.c</h2>
This class keeps track of the condition of a particular object.  It
handles damaging the object when it is hit and the lowest conditon to
which the object has been damaged.  The lowest conditon keeps track of
how hard the object is to fix.  If an object has been reduced to really
shaggy condition at one point, it will be a lot harder to fix from then
on.<p>Written by Pinkfish
<h2>Includes</h2>
This class includes the following files <a href="include.move_failures.h.shtml">/include/move_failures.h</a> and <a href="include.armoury.h.shtml">/include/armoury.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#adjust_cond">adjust_cond</a>(int)<br/>
This method adjust the current condition by the given amount.
<li><a href="#break_me">break_me</a>()<br/>
This method breaks the object.
<li><a href="#cond_string">cond_string</a>()<br/>
This method returns the current condition as a string.
<li><a href="#do_damage">do_damage</a>(string, int)<br/>
This method damages the object.
<li><a href="#query_cond">query_cond</a>()<br/>
This method returns the current conditon.
<li><a href="#query_damage_chance">query_damage_chance</a>()<br/>
This method returns the percentage of the damage which is done to the
object which will be carried through.
<li><a href="#query_hide_cond">query_hide_cond</a>()<br/>
This method returns whether the condition string returns "" or something 
meaning full.
<li><a href="#query_lowest_cond">query_lowest_cond</a>()<br/>
This method returns the current lowest conditon.
<li><a href="#query_max_cond">query_max_cond</a>()<br/>
This method returns the current maximum conditon.
<li><a href="#set_cond">set_cond</a>(int)<br/>
This method sets the current condition of the object.
<li><a href="#set_damage_chance">set_damage_chance</a>(int)<br/>
This method sets the percentage of the damage which is done to the
object which will be carried through.
<li><a href="#set_hide_cond">set_hide_cond</a>(int)<br/>
This sets whether the condition string should be returned or not.
<li><a href="#set_lowest_cond">set_lowest_cond</a>(int)<br/>
This sets the lowest condition for the object.
<li><a href="#set_max_cond">set_max_cond</a>(int)<br/>
This sets up how much damage an object can take before it 
breaks.
<li><a href="#set_percentage">set_percentage</a>(int)<br/>
This method is used to setup the objects condition.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="adjust_cond">
adjust_cond</a><pre>
int adjust_cond(int i)
</pre></br>
This method adjust the current condition by the given amount.  If
resultant condition is less than the lowest condition, then the lowest
condition is set to this value.  If it is greater than the maximum
condition.  Then the condition is set to the maximum condition.  If the
condition is less than or equal to 0, then the object is attempted to
be broken.
<br/><ul>
<li><b>Parameters:</b>
<br/>i - the amount to adjust the condition by
<li><b>Returns:</b>
<br/>the new condition
<li><b>See also:</b>
<br/><a href="#set_cond">set_cond()
</a></dl>

<ul><a name="break_me">
break_me</a><pre>
void break_me()
</pre></br>
This method breaks the object.  This moves it into the recycled
object section of the armoury or dests itself if this is not
possible.


<ul><a name="cond_string">
cond_string</a><pre>
string cond_string()
</pre></br>
This method returns the current condition as a string.
<br/><ul>
<li><b>Returns:</b>
<br/>the string value of the condition

</dl>

<ul><a name="do_damage">
do_damage</a><pre>
void do_damage(string type,
               int amount)
</pre></br>
This method damages the object.  The conditon is reduced by
the amount multiplied by 1 + 2 * random(damage_chance) ewhic
is then divided by 100.  This means it does approximately
the percentage of of the damage done to the object to its condition.
<br/><ul>
<li><b>See also:</b>
<br/><a href="#set_damage_chance">set_damage_chance()
See query_damage_chance()
</a></dl>

<ul><a name="query_cond">
query_cond</a><pre>
int query_cond()
</pre></br>
This method returns the current conditon.
<br/><ul>
<li><b>Returns:</b>
<br/>the current condition

</dl>

<ul><a name="query_damage_chance">
query_damage_chance</a><pre>
int query_damage_chance()
</pre></br>
This method returns the percentage of the damage which is done to the
object which will be carried through.
<br/><ul>
<li><b>Returns:</b>
<br/>the damage chance
<li><b>See also:</b>
<br/><a href="#do_damage">do_damage()
</a></dl>

<ul><a name="query_hide_cond">
query_hide_cond</a><pre>
int query_hide_cond()
</pre></br>
This method returns whether the condition string returns "" or something 
meaning full.
<br/><ul>
<li><b>Returns:</b>
<br/>the current lowest condition

</dl>

<ul><a name="query_lowest_cond">
query_lowest_cond</a><pre>
int query_lowest_cond()
</pre></br>
This method returns the current lowest conditon.
<br/><ul>
<li><b>Returns:</b>
<br/>the current lowest condition

</dl>

<ul><a name="query_max_cond">
query_max_cond</a><pre>
int query_max_cond()
</pre></br>
This method returns the current maximum conditon.
<br/><ul>
<li><b>Returns:</b>
<br/>the current maximum condition

</dl>

<ul><a name="set_cond">
set_cond</a><pre>
void set_cond(int i)
</pre></br>
This method sets the current condition of the object.  If this is lower
than the current lowest conditon, then the lowest condition will be modified
to be this.
<br/><ul>
<li><b>Parameters:</b>
<br/>i - the new condition
<li><b>See also:</b>
<br/>adjust_condition
.c</dl>

<ul><a name="set_damage_chance">
set_damage_chance</a><pre>
void set_damage_chance(int number)
</pre></br>
This method sets the percentage of the damage which is done to the
object which will be carried through.
<p>
Use the following chart to set the damage chance.
<br><br>
o==================o=====================o<br>
|     Material     |    Damage Chance    |<br>
o==================o=====================o<br>
| Cloth            |         20          |<br>
| Hide             |         17          |<br>
| Bone             |         16          |<br>
| Leather          |         15          |<br>
| Wood             |         12          |<br>
| Copper           |         10          |<br>
| Bronze           |          8          |<br>
| Iron             |          6          |<br>
| Steel            |          5          |<br>
| Klatchian Steel  |          3          |<br>
| Stone            |          3          |<br>
| Octiron          |          0          |<br>
o==================o=====================o

<br/><ul>
<li><b>Parameters:</b>
<br/>number - the new damage chance

<li><b>See also:</b>
<br/>new_weapon.c, setup_armour.c, setup_clothing.c, set_weight.c, set_max_cond.c, <a href="#query_damage_chance">query_damage_chance()</a> and <a href="#do_damage">do_damage()</a></dl>

<ul><a name="set_hide_cond">
set_hide_cond</a><pre>
void set_hide_cond(int i)
</pre></br>
This sets whether the condition string should be returned or not.  This
is for objects what indicate their condition with different long
descriptions instead of the default condition string.
<br/><ul>
<li><b>Parameters:</b>
<br/>i - set it to 1 to hide the condition string.

</dl>

<ul><a name="set_lowest_cond">
set_lowest_cond</a><pre>
void set_lowest_cond(int i)
</pre></br>
This sets the lowest condition for the object.  The lowest cond
variable is used for repairing the armour...
See where it was repaired to last time, this determines how difficult
repairs will be...
<br/><ul>
<li><b>Parameters:</b>
<br/>i - the new lowest condition
<li><b>See also:</b>
<br/><a href="#adjust_cond">adjust_cond()</a> and <a href="#set_cond">set_cond()
</a></dl>

<ul><a name="set_max_cond">
set_max_cond</a><pre>
void set_max_cond(int i)
</pre></br>
This sets up how much damage an object can take before it 
breaks.  This should not be used in the actual object files
unless under special circumstances.  In weapon files, use 
new_weapon().  In armour files use setup_armour().  In 
clothing files, use setup_clothing().  Use ::Setup:: in 
clo, arm, imp and wep files.
<p>
The values may seem strange, as cloth can take more damage 
per unit weight than steel.  This is because steel weighs
so much, and cloth weighs so little.
<br><br>
o==================o=====================o<br>
|     Material     |  Maximum Condition  |<br>
|                  |   per unit weight   |<br>
o==================o=====================o<br>
| Cloth            |         90          |<br>
| Hide             |         80          |<br>
| Leather          |         70          |<br>
| Wood             |         60          |<br>
| Bone             |         45          |<br>
o==================o=====================o<br>
| Copper           |         30          |<br>
| Stone            |         40          |<br>
| Bronze           |         40          |<br>
| Iron             |         50          |<br>
| Steel            |         60          |<br>
| Klatchian Steel  |         70          |<br>
| Octiron          |         80          |<br>
o==================o=====================o

<br/><ul>
<li><b>See also:</b>
<br/>new_weapon.c, setup_armour.c, setup_clothing.c, set_weight.c and set_damage_chance
.c</dl>

<ul><a name="set_percentage">
set_percentage</a><pre>
void set_percentage(int i)
</pre></br>
This method is used to setup the objects condition.  Once the maximum
condition has been set, this is used to set the maximum condition to
this percentage of the maximum condition.
It sets the lowest conditon a random value from 70-100% of the
current condition.
<br/><ul>
<li><b>Parameters:</b>
<br/>i - the percentage condiion
<li><b>See also:</b>
<br/><a href="obj.handlers.armoury.c.shtml">/obj/handlers/armoury.c</a>, <a href="#set_cond">set_cond()</a>, <a href="#set_lowest_cond">set_lowest_cond()</a> and <a href="#query_max_cond">query_max_cond()
</a></dl>


[an error occurred while processing this directive]

