Skip to content
mikejc edited this page Jan 31, 2023 · 8 revisions

The Basics

Auto mana is an optional value that may be set on a spell you've defined in your YAML that will make scripts that cast spells automatically use DISCERN to determine at what mana point a spell may be cast. For standard spells, this is pretty straightforward. A spell may be set in this manner by applying the use_auto_mana property to the spell in your YAML. Below is an example of what this setup might look like.

ags: &ags
  Aggressive Stance: 
    use_auto_mana: true

Once set in this manner, Lich will automatically discern the spell when appropriate and set the mana and cambrinth values based on the maximum mana that you are able to feed into the spell, adjusted by the prep_scaling_factor (default value 0.85).

So, for example, if you have a particular spell that DISCERN reports you may cast at a total of 50 mana, by default, Lich will take 50 * 0.85, or 42.5, always rounded down to 42. The spell will then be cast at 42 mana. You may override the prep_scaling_factor setting in your own YAML.

Symbiosis and Sorcery

Introduction

As mentioned, the handling of regular spells with auto mana is straightforward. Symbiosis and sorcery spells, however, require a bit more complexity to get right. DISCERN doesn't provide the details needed to know exactly how much mana can be fed into a spell, but combat-trainer uses some specific logic to figure it out.

If you aren't familiar with Symbiosis and/or Sorcery, they are more advanced topics that a beginner can ignore. The official wiki has good information on both topics:

Symbiosis

Sorcery

How Do I Use It?

Thankfully, the actual usage of auto mana for symbiosis and sorcery spells isn't any more complicated than with regular spells. Just set the use_auto_mana: true property on the spell and combat-trainer will take care of the rest.

Please note that if you are using a script other than combat-trainer for magic training, auto mana is not currently supported for symbiosis and sorcery spells.

Okay, but How Does it Work?

Each time combat-trainer prepares a standard auto mana spell, common-arcana checks how long it's been since the discern data has been updated and updates if the elapsed time exceeds the update requirement (as determined by check_discern_timer_in_hours). Discern data is stored in each character's discern user variable.

For symbiosis and sorcery auto mana spells, common-arcana short circuits this logic and sets two important values in the discern data: min and more. min reflects the minimum mana required to prepare a given spell. more is initially set to 0 the first time the spell is discerned. Once the min value is present, common-arcana will no longer discern the mana cost of this spell and just utilize the more value to determine the total mana that should be utilized by the spell, both for the initial prep and any cambrinth or harness that should be included.

So what makes more increase from 0? Each time combat-trainer casts a symbiosis or sorcery spell, the script checks how much experience was gained from casting the spell and compares it to the YAML setting symbiosis_learning_threshold (default value is 2). If the experience is equal to or more than the threshold, no changes will be made. If the spell fails to reach the specified threshold, however, then the script will increase more by 1. The next time the spell is prepared, common-arcana will provide new mana and cambrinth values based on the new more value. This will repeat until the threshold is reached or the spell backfires, in which case combat-trainer will reduce more by 1 and stop increasing it for this session.

So I Have to Wait for the Spell to Slowly Increase by 1 Each Time?

Yes, but there's a shortcut. There's a helper script called discern that provides a few functions for navigating auto mana spells.

Let's say you currently have your sorcery spell, Calm, set to 15. By default, if you turned on use_auto_mana, it would start at the minimum prep (1) and increase by 1 until it passed the threshold. But we can fast track this by setting the more value to something closer to our goal.

This is easy to do. Just call the script discern with the arguments set, your spell name or abbreviation, and the total mana you would like to set. Your mana and cambrinth charges will be set accordingly and on the next cast, combat-trainer will continue to automatically adjust from the new value. Remember that the prep_scaling_factor will affect the final calculation.

Using the above Calm example and the default prep_scaling_factor of 0.85, we need to set our discern value for calm to 18 (15 / 0.85). To set the discern values so that combat-trainer will cast Calm at 15 mana, we can use the below command:

;discern set calm 18

combat-trainer will now start casting at 15 total mana and adjust automatically.

Clone this wiki locally