public EnchantResult Calc(EEnchantType Type, int from, int To, int TryCount) { List <IEnchant> enchantList; EnchantResult result = new EnchantResult(); if (Type == EEnchantType.Armor) { enchantList = ArmorEnchants; } else { enchantList = ArmorEnchants; } result.CostPer = enchantList[0].Cost; for (int t = 0; t < TryCount; t++) { int costAll = 0; for (int i = from; i < To; i++) { do { costAll += enchantList[i].Cost; } while(Random.Next(100) > enchantList[i].Chance); } } return(result); }
public EnchantResult Calc( EEnchantType Type, int from, int To, int TryCount ) { List<IEnchant> enchantList; EnchantResult result = new EnchantResult(); if( Type == EEnchantType.Armor ) enchantList = ArmorEnchants; else enchantList = ArmorEnchants; result.CostPer = enchantList[ 0 ].Cost; for( int t = 0; t < TryCount; t++ ) { int costAll = 0; for( int i = from; i < To; i++ ) { do { costAll += enchantList[ i ].Cost; } while( Random.Next( 100 ) > enchantList[ i ].Chance ); } } return result; }