# lib_splconv function library

Dependencies: alter_effect, lib_anon, lib_fn, lib_sugar, lib_tools, resolve_spell

## Description

Tools to convert wizard spells to priest spells and vice versa, or make innate versions of either. This library should have no dependencies.

Conventions:

- wizard spells have CT <=level
- innate spells have CT=1
- wizard version of priest spell SPPRxyz has name DWPWxyz
- priest version of wizard spell SPWIxyz has name DWWPxyz
- innate version of wizard spell SPWIxyz has name DWWIxyz
- innate version of priest spell SPPRxyz has name DWPIxyz

## Public functions

splconv(spell:s, new_type:s, tra_path:s="MOD_FOLDER/sfo/lua/lang", tra:s="sfo_lua", new_resref:s)=(new_resref:s, splconv_array:a) dimorphic

Input a wizard/priest spell 'spell' in the SPWI/SPPR range (either a resref, or an ids name (from normal or extended namespace), or an abbreviated ids name) and a spell type 'new_type' (innate/priest/wizard). Convert the spell, unless old and new types match. Return the resref of the new spell. Delete any headers where min_level>50, to remove scroll-making code & the like.

If 'tra_path' and 'tra' are set ('tra' does not include the .tra extension) then the function attempts to load strings @100-@105 from it and then to update the description to include new casting time, remove reference to spheres, and add a note saying that this is an innate version of a spell normally available to wizards (or whatever). See lua/lang/english/sfo_lua.tra in the sfo-lua template for the format.

'splconv_array' is a 2D array reporting all spells/items that reference SPPR/SPWI spells (other than themselves) via 206/318/321/324. We output it to avoid having to regenerate it each time.

## Internal functions

These should not be called from outside the library itself.

splconv_array_load()=(splconv_array:a) dimorphic

splconv_clone_or_cast(resref:s, new_resref:s)=() patch

splconv_get_name(new_type:s, type:s, resref:s, spell:s)=(new_resref:s) dimorphic

splconv_update_desc(new_ct:i, tra:s, tra_path:s, old_type:s, new_type:s, old_desc:s)=(new_desc:s) patch