Code:
void do_create_potion( CHAR_DATA* ch, const char* argument)
{
OBJ_DATA *ingredient;
OBJ_DATA *potion;
int selection;
int dice;
int check;
dice = number_percent();
check = LEARNED(ch, gsn_create_potion) + (get_curr_int(ch)/2);
ingredient = get_obj_carry(ch, argument);
selection = rand() %3;
if(argument[0] == '\0' || !str_cmp(argument, ""))
{
send_to_char( "Brew what?\r\n", ch );
return;
}
if(str_cmp(argument, "alit hide"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_INTELLIGENCE), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_POISON_RESISTANCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_PICKPOCKET), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_DETECT_INVISIBILITY), 0);}
}
if(str_cmp(argument, "ampoule pod"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_WATER_BREATHING), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_PARALYSIS), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DETECT_INVISIBILITY), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_WILLPOWER), 0);}
}
if(str_cmp(argument, "ash salts"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_AGILITY), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_MAGIC_RESISTANCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DISEASE_IMMUNITY), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_RESTORE_MAGICKA), 0);}
}
if(str_cmp(argument, "ash yam"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_INTELLIGENCE), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_STRENGTH), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DISEASE_RESISTANCE), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_SNEAK), 0);}
}
if(str_cmp(argument, "bittergreen petals"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_RESTORE_INTELLIGENCE), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_INVISIBILITY), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_ENDURANCE), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_MAGICKA), 0);}
}
if(str_cmp(argument, "black anther"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_AGILITY), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FIRE_RESISTANCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_ENDURANCE), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_ALCHEMY), 0);}
}
if(str_cmp(argument, "black lichen"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_STRENGTH), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FROST_RESISTANCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_AGILITY), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_POISON_IMMUNITY), 0);}
}
if(str_cmp(argument, "bloat"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_MAGICKA), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_INTELLIGENCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_WILLPOWER), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_DETECT_INVISIBILITY), 0);}
}
if(str_cmp(argument, "bonemeal"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_RESTORE_AGILITY), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_PICKPOCKET), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_FATIGUE), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_PERSONALITY), 0);}
}
if(str_cmp(argument, "corkbulb root"))
{
if(selection == 0)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_AGILITY), 0);}
if(selection == 1)
{potion = create_object(get_obj_index(OBJ_POTION_FIRE_RESISTANCE), 0);}
if(selection == 2)
{potion = create_object(get_obj_index(OBJ_POTION_DRAIN_ENDURANCE), 0);}
if(selection == 3)
{potion = create_object(get_obj_index(OBJ_POTION_FORTIFY_ALCHEMY), 0);}
}
if(check < dice)
{
if(ingredient != NULL)
{
ch_printf( ch, "You brew a %s.\r\n", potion->name);
obj_to_char(potion, ch);
extract_obj(ingredient);
learn_from_success(ch, gsn_create_potion);
}
else
{
send_to_char( "You don't have this ingredient.\r\n", ch );
}
}
else
{
ch_printf( ch, "You failed brewing.\r\n");
extract_obj(ingredient);
}
}