Difference between revisions of "Talk:Enchantment"

From NetHackWiki
Jump to navigation Jump to search
(Created page with "Where is the function that determines if an item can have an enchantment? For some reason I can't find it in the source. It seems certain rings have an oc_charged property (in...")
 
(Answering Bluescreen)
Line 1: Line 1:
 
Where is the function that determines if an item can have an enchantment? For some reason I can't find it in the source. It seems certain rings have an oc_charged property (increase attribute, adornment etc.) while others do not, and probably weapons and armor have it, maybe wands too, but I'd like to allow tools, iron balls and iron chains to have an enchantment value without changing their base object type; where could that function be hidden? There's got to be some kind of function that checks whether an object is of a type that can have an enchantment, so I'd just need to add ball_class and others to that type... --[[User:Bluescreenofdeath|Bluescreenofdeath]] ([[User talk:Bluescreenofdeath|talk]]) 11:35, 19 February 2014 (UTC)
 
Where is the function that determines if an item can have an enchantment? For some reason I can't find it in the source. It seems certain rings have an oc_charged property (increase attribute, adornment etc.) while others do not, and probably weapons and armor have it, maybe wands too, but I'd like to allow tools, iron balls and iron chains to have an enchantment value without changing their base object type; where could that function be hidden? There's got to be some kind of function that checks whether an object is of a type that can have an enchantment, so I'd just need to add ball_class and others to that type... --[[User:Bluescreenofdeath|Bluescreenofdeath]] ([[User talk:Bluescreenofdeath|talk]]) 11:35, 19 February 2014 (UTC)
 +
 +
The variable that holds enchantment level is spe.
 +
 +
There is no dedicated function that checks for whether an item can have an enchantment, the check is included in several places in the code (For enchanting weapons, it checks if the object is a weapon or a tool that can be used as a weapon). Just looking quickly, this is checked in read.c in the SCR_ENCHANT_WEAPON section (where erode-proofing is handled) and in wield.c (where the actual enchanting of weapons is handled). You may also have to amend the code that displays object names (spe is ignored for object classes that can't be enchanted) and the code that handles attacks (again, spe is ignored for invalid types).
 +
 +
---[[User:Chris|Chris]] ([[User talk:Chris|talk]])

Revision as of 17:37, 19 February 2014

Where is the function that determines if an item can have an enchantment? For some reason I can't find it in the source. It seems certain rings have an oc_charged property (increase attribute, adornment etc.) while others do not, and probably weapons and armor have it, maybe wands too, but I'd like to allow tools, iron balls and iron chains to have an enchantment value without changing their base object type; where could that function be hidden? There's got to be some kind of function that checks whether an object is of a type that can have an enchantment, so I'd just need to add ball_class and others to that type... --Bluescreenofdeath (talk) 11:35, 19 February 2014 (UTC)

The variable that holds enchantment level is spe.

There is no dedicated function that checks for whether an item can have an enchantment, the check is included in several places in the code (For enchanting weapons, it checks if the object is a weapon or a tool that can be used as a weapon). Just looking quickly, this is checked in read.c in the SCR_ENCHANT_WEAPON section (where erode-proofing is handled) and in wield.c (where the actual enchanting of weapons is handled). You may also have to amend the code that displays object names (spe is ignored for object classes that can't be enchanted) and the code that handles attacks (again, spe is ignored for invalid types).

---Chris (talk)