Digging

From IvanWiki
Jump to navigation Jump to search

Coding: This article contains code which is for experienced users only, and may reveal game secrets


Digging is the act of applying a pick-axe to a wall with the intention of demolishing the wall to form a passage. How long it takes to dig is dependent on both the player's ASTR (for damage to the wall) and DEX (how many action points it takes for 1 turn of digging.)
Digging trains the player's ASTR.

Firstly, the game must check if the player is able to dig out the wall by comparing the pick-axe's primary material against the wall's material:

truth material::CanBeDug(material* ShovelMaterial) const  
{ return ShovelMaterial->GetStrengthValue() > GetStrengthValue(); }

The pick-axe must be made of a material with a greater strength value than the wall's material, otherwise the player will be unable to dig.

Once it has been established that the player is able to dig the wall, the game then begins the digging proper:

int Damage = Actor->GetAttribute(ARM_STRENGTH) * Digger->GetMainMaterial()->GetStrengthValue() / 500; 
Terrain->EditHP(-Max(Damage, 1)); 
Actor->EditExperience(ARM_STRENGTH, 200, 1 << 5); 
Actor->EditAP(-200000 / APBonus(Actor->GetAttribute(DEXTERITY))); 
Actor->EditNP(-500); 

Digging is done in ticks, much like normal play. How long a digging tick takes in relation to the game world is determined by the player's DEX - the larger the DEX the shorter it takes for one tick.
Every tick the player strikes the earth for damage equivalent to his ASTR multiplied by the pick-axe's material strength divided by 500. When the wall runs out of HP, it will break and turn into a tunnel for the player to walk through.
Destroyed walls also have a small chance to drop a valuable stone.

Every tick (regardless of how long it took) the player consumes 500 nutrition points (see Eating) and gains some ASTR experience. This rapid consumption of NP will starve the player very quickly over extended periods of digging, therefore it is recommended that you always dig with the strongest pick-axe available and keep digging to a minimum.