Lightning random %?
NEW INFO
I discovered that my Inscription was at 99.8 and because of that I was getting 2% Lightning each time. Now that Im GM in both I get random values between 3% and 50%
END NEW INFO
I've been looking at the programming for lightning (thus all other attack add-ons) and Im trying to figure out exactly why a person with GM Alchemy and GM Inscription would get 2% lightning most of the time? I have enhanced a Double Axe with Dragon Slaying 7 times and always get 2%.
Here is what I have surmised to-date:
Lightning.cs
Code:
int scalar = (int)( (from.Skills[SkillName.Inscribe].Value + from.Skills[SkillName.Alchemy].Value) / 200.0 );
SpellCraft.ApplyAttribute( ((BaseWeapon)target).WeaponAttributes, 20 * scalar, 100 * scalar, AosWeaponAttribute.HitLightning, Minimum, Maximum, 2 );
The above section sets "scalar" to your overall % success chance. (RIGHT?) Then the main spellcraft script is called to add the lightning attribute to the item. This is where it gets a little fuzzy for me to follow.
Spellcraft.cs
Code:
public static int Scale( int min, int max, int low, int high )
{
return low + AOS.Scale( high-low, Utility.RandomMinMax( min, max ) );
}
This above section of the spellcraft.cs determines the amount to add based on two things. First "LOW" is a value passed by Lightning.cs that determines the smallest value possible to add. To "LOW" is added a random number between the High and the lowest amounts.
Lets say for the example a Double Axe adding lightning with both skills at GM that the low is "2" (standard for lightning) and the max based on skill is 50. You should get a random number in the range of 3-50 added to lightning.
As far as I know there are NO EXCEPTIONS to this straight forward script. The problem of course is the fact that no matter how many times I enhance my double axe I get 2%.
Here is the Bitch!
Other people on my shard have been able to add lightning to items without any problems and there ranges have varried from 9% to 39% so far and they have never gotten 2%. This proves that the script is working for some items and not others.
and HERE is the Question!
If the % of lightning depends on what attributes already exist on the item (Dragon Slaying), where is the function called that checks the items existing attributes?