How can I emulate a CiviDiscount when using Webform CiviCRM?
This is easy to configure with webform civicrm (a Drupal module) - here are the steps:

A. Create a native webform field - call it Discount Code. Let's put it at the top - where we're going to select the Membership Type:



B. Go to your CiviCRM Tab -> then to Memberships -> and hit the checkbox on Membership Fee; this will expose it to the webform;

C. String it together with Conditionals: in your Webform Tab -> hit Conditionals
Here's mine:

D. Let's test the Form: here are the three scenarios:

Select Professional Membership - we don't have a Discount Code:



Select Student Membership - we don't have a Discount Code:



Select Student Membership - and we have a Discount Code: