This type of discount is fairly straight forward. If you are already setting the session variable to a percentage then in the discount rule you will specify 'if session variable exists' and enter the name for your variable. Then for the calculation portion you just base it off of the cart subtotal times your percentage, you can just enter the session variable like this:
$_SESSION['<your var name>']
We have more information on discounts, charges and coupons that can be found on the eCart support page under Solution Recipes and How Tos.