public static void ApplyAttributesTo( BaseWeapon weapon, bool isRunicTool, int luckChance, int attributeCount, int min, int max )
{
m_IsRunicTool = isRunicTool;
m_LuckChance = luckChance;
AosAttributes primary = weapon.Attributes;
AosWeaponAttributes secondary = weapon.WeaponAttributes;
m_Props.SetAll( false );
if ( weapon is BaseRanged )
m_Props.Set( 2, true ); // ranged weapons cannot be ubws or mageweapon
for ( int i = 0; i < attributeCount; ++i )
{
int random = GetUniqueRandom( 25 );
if ( random == -1 )
break;
switch ( random )
{
case 0:
{
switch ( Utility.Random( 5 ) )
{
case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitPhysicalArea,2, 50, 2 ); break;
case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2 ); break;
case 2: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2 ); break;
case 3: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2 ); break;
case 4: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2 ); break;
}
break;
}
case 1:
{
switch ( Utility.Random( 4 ) )
{
case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2 ); break;
case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2 ); break;
case 2: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2 ); break;
case 3: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2 ); break;
}
break;
}
case 2:
{
switch ( Utility.Random( 2 ) )
{
case 0: ApplyAttribute( secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1 ); break;
case 1: ApplyAttribute( secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10 ); break;
}
break;
}
case 3: ApplyAttribute( primary, min, max, AosAttribute.WeaponDamage, 1, 50 ); break;
case 4: ApplyAttribute( primary, min, max, AosAttribute.DefendChance, 1, 15 ); break;
case 5: ApplyAttribute( primary, min, max, AosAttribute.CastSpeed, 1, 1 ); break;
case 6: ApplyAttribute( primary, min, max, AosAttribute.AttackChance, 1, 15 ); break;
case 7: ApplyAttribute( primary, min, max, AosAttribute.Luck, 1, 100 ); break;
case 8: ApplyAttribute( primary, min, max, AosAttribute.WeaponSpeed, 5, 30, 5 ); break;
case 9: ApplyAttribute( primary, min, max, AosAttribute.SpellChanneling, 1, 1 ); break;
case 10: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitDispel, 2, 50, 2 ); break;
case 11: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLeechHits, 2, 50, 2 ); break;
case 12: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLowerAttack, 2, 50, 2 ); break;
case 13: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLowerDefend, 2, 50, 2 ); break;
case 14: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLeechMana, 2, 50, 2 ); break;
case 15: ApplyAttribute( secondary, min, max, AosWeaponAttribute.HitLeechStam, 2, 50, 2 ); break;
case 16: ApplyAttribute( secondary, min, max, AosWeaponAttribute.LowerStatReq, 10, 100, 10 ); break;
case 17: ApplyAttribute( secondary, min, max, AosWeaponAttribute.ResistPhysicalBonus, 1, 15 ); break;
case 18: ApplyAttribute( secondary, min, max, AosWeaponAttribute.ResistFireBonus, 1, 15 ); break;
case 19: ApplyAttribute( secondary, min, max, AosWeaponAttribute.ResistColdBonus, 1, 15 ); break;
case 20: ApplyAttribute( secondary, min, max, AosWeaponAttribute.ResistPoisonBonus, 1, 15 ); break;
case 21: ApplyAttribute( secondary, min, max, AosWeaponAttribute.ResistEnergyBonus, 1, 15 ); break;
case 22: ApplyAttribute( secondary, min, max, AosWeaponAttribute.DurabilityBonus, 10, 100, 10 ); break;
case 23: weapon.Slayer = GetRandomSlayer(); break;
case 24: GetElementalDamages( weapon ); break;
}
}
}