Brew Code by Kracus version2 Please keep the below credit intact if you use this code You do need to have the stockrom spells of: heal, refresh, sanctuary, pass door, and bless I provided the code for the advanced brew noncastable spells Brewer needs to hold SPIRITVIAL to brew regular spells Brewer needs to hold SPIRITSTONE to brew advanced spells You need to load the SPIRITVIAL AND SPIRITSTONE on a mob or in a shop, or even make a skill or spell to make them. Have Fun -Kracus // Brew Code by Kracus version2 void do_brew ( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_STRING_LENGTH]; OBJ_DATA *obj = NULL; OBJ_DATA *spiritvial; OBJ_DATA *spiritstone; int brewskill; int chance; int extract_spirit; int sn; // Brewed Spells SpiritVial int heal_num, refresh_num, sanctuary_num, passdoor_num, bless_num; // Brewed Spells SpiritStone int arlia_num, karanas_num, devanos_num; one_argument( argument, arg ); heal_num = skill_lookup("heal"); refresh_num = skill_lookup("refresh"); sanctuary_num = skill_lookup("sanctuary"); passdoor_num = skill_lookup("pass door"); bless_num = skill_lookup("bless"); arlia_num = skill_lookup("arlia spirit"); karanas_num = skill_lookup("karanas spirit"); devanos_num = skill_lookup("devanos spirit"); sn = find_spell(ch, arg); if (IS_NPC(ch)) return; if ( ch->position == POS_FIGHTING ) { send_to_char( "You cannot brew while fighting.\n\r", ch ); return; } if ( auction->item != NULL && ((ch == auction->buyer) || (ch == auction->seller)) ) { send_to_char ("You cannot brew while engaged in an auction.\n\r",ch); return; } if (arg[0] == '\0') { send_to_char("What kind of potion do you want to brew?\n\r", ch); return; } if ((brewskill = get_skill(ch, gsn_brew)) < 1) { send_to_char( "You don't know how to brew potions.\n\r", ch ); return; } if (sn < 1 || skill_table[sn].spell_fun == spell_null || (ch->level < skill_table[sn].skill_level[ch->class] || ch->pcdata->learned[sn] == 0)) { send_to_char( "You cannot brew a potion with a spell you do not know.\n\r", ch ); return; } if(((sn != arlia_num) || (sn != karanas_num) || (sn != devanos_num)) && (ch->pcdata->learned[sn] < 75)) { send_to_char( "You cannot brew that potion unless your skill is 90 percent or more.\n\r", ch ); return; } chance = ((brewskill/2) + ((get_curr_stat(ch,STAT_WIS)/2) + (get_curr_stat(ch,STAT_INT)/2))+10); extract_spirit = ((brewskill/2) + ((get_curr_stat(ch,STAT_WIS)/2) + (get_curr_stat(ch,STAT_INT)/2))+23); if (sn == heal_num || sn == refresh_num || sn == sanctuary_num || sn == passdoor_num || sn == bless_num || sn == arlia_num || sn == karanas_num || sn == devanos_num) { if (number_percent() > (100 - chance)) { // DO YOUR CHECKS FOR MANA COST HERE if (sn == heal_num) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial == NULL || (spiritvial->pIndexData->vnum != OBJ_VNUM_SPIRITVIAL)) { send_to_char("You are not holding a Spirit Vial to brew heals.\n\r",ch); return; } obj = create_object(get_obj_index(OBJ_VNUM_HEALPOTION), 0); } else if (sn == refresh_num) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial == NULL || (spiritvial->pIndexData->vnum != OBJ_VNUM_SPIRITVIAL)) { send_to_char("You are not holding a Spirit Vial to brew a refresh potion.\n\r",ch); return; } obj = create_object(get_obj_index(OBJ_VNUM_REFRESHPOTION), 0); } else if (sn == sanctuary_num) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial == NULL || (spiritvial->pIndexData->vnum != OBJ_VNUM_SPIRITVIAL)) { send_to_char("You are not holding a Spirit Vial to brew sanctuary.\n\r",ch); return; } obj = create_object(get_obj_index(OBJ_VNUM_SANCTUARYPOTION), 0); } else if (sn == passdoor_num) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial == NULL || (spiritvial->pIndexData->vnum != OBJ_VNUM_SPIRITVIAL)) { send_to_char("You are not holding a Spirit Vial to brew pass door.\n\r",ch); return; } obj = create_object(get_obj_index(OBJ_VNUM_PASSDOORPOTION), 0); } else if (sn == bless_num) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial == NULL || (spiritvial->pIndexData->vnum != OBJ_VNUM_SPIRITVIAL)) { send_to_char("You are not holding a Spirit Vial to brew blessings.\n\r",ch); return; } obj = create_object(get_obj_index(OBJ_VNUM_BLESSPOTION), 0); } else if (sn == arlia_num) { spiritstone = get_eq_char(ch,WEAR_HOLD); if (spiritstone == NULL || (spiritstone->pIndexData->vnum != OBJ_VNUM_SPIRITSTONE)) { send_to_char("You are not holding a Spirit Stone to brew the Spirit of Arlia.\n\r",ch); return; } check_improve(ch,gsn_arlia_spirit,TRUE,1); obj = create_object(get_obj_index(OBJ_VNUM_ARLIAPOTION), 0); } else if (sn == karanas_num) { spiritstone = get_eq_char(ch,WEAR_HOLD); if (spiritstone == NULL || (spiritstone->pIndexData->vnum != OBJ_VNUM_SPIRITSTONE)) { send_to_char("You are not holding a Spirit Stone to brew the Spirit of Karanas.\n\r",ch); return; } check_improve(ch,gsn_karanas_spirit,TRUE,1); obj = create_object(get_obj_index(OBJ_VNUM_KARANASPOTION), 0); } else if (sn == devanos_num) { spiritstone = get_eq_char(ch,WEAR_HOLD); if (spiritstone == NULL || (spiritstone->pIndexData->vnum != OBJ_VNUM_SPIRITSTONE)) { send_to_char("You are not holding a Spirit Stone to brew the Spirit of Karanas.\n\r",ch); return; } check_improve(ch,gsn_devanos_spirit,TRUE,1); obj = create_object(get_obj_index(OBJ_VNUM_DEVANOSPOTION), 0); } else { obj = create_object(get_obj_index(OBJ_VNUM_BREW), 0); } obj->value[0] = ch->level; obj->value[1] = sn; sprintf( buf, "brewed potion %s", skill_table[obj->value[1]].name ); free_string( obj->name ); obj->name = str_dup( buf ); sprintf( buf, "a potion of %s", skill_table[obj->value[1]].name ); free_string( obj->short_descr ); obj->short_descr = str_dup( buf ); sprintf( buf, "A brewed potion of %s lies here.", skill_table[obj->value[1]].name ); free_string( obj->description ); obj->description = str_dup( buf ); obj_to_char(obj,ch); send_to_char("Through careful manipulation you brew a potion.\n\r",ch); check_improve(ch,gsn_brew,TRUE,1); if (number_percent() < (100 - extract_spirit)) { if ((sn == arlia_num) || (sn == karanas_num) || (sn == devanos_num)) { spiritstone = get_eq_char(ch,WEAR_HOLD); if (spiritstone != NULL && (spiritstone->pIndexData->vnum == OBJ_VNUM_SPIRITSTONE)) { send_to_char("\n\rYour Spirit Stone crumbles and turns into dust!\n\r", ch); extract_obj(spiritstone); } } if ((sn == heal_num) || (sn == refresh_num) || (sn == passdoor_num) || (sn == sanctuary_num) || (sn == bless_num)) { spiritvial = get_eq_char(ch,WEAR_HOLD); if (spiritvial != NULL && (spiritvial->pIndexData->vnum == OBJ_VNUM_SPIRITVIAL)) { send_to_char("\n\rYour Spirit Vial shatters into many small pieces!\n\r", ch); extract_obj(spiritvial); } } } return; } else { // DO YOUR CHECKS FOR MANA COST HERE send_to_char("You failed to create a brewed potion.\n\r", ch); check_improve(ch,gsn_brew,FALSE, 1); return; } } else { send_to_char("You do not know how to brew that spell.\n\r", ch); check_improve(ch,gsn_brew,FALSE, 1); return; } } // Kracus: Add into const.c { "brew", { 52, 100, 52, 52 }, { 0, 6, 0, 0 }, spell_null, TAR_IGNORE, POS_STANDING, &gsn_brew, SLOT( 0), 12, "brew", "!Brew!", "" }, // Kracus: Add into const.c // Cleric Brew Spells // Make or add into spell groups so chars can gain them { "arlia spirit", { 52, 100, 52, 52 }, { 1, 1, 1, 1 }, spell_arlia_spirit, TAR_CHAR_DEFENSIVE, POS_FIGHTING, &gsn_arlia_spirit, SLOT(351), 12, "", "!Arlia Spirit!", "" }, { "karanas spirit", { 52, 100, 52, 52 }, { 1, 1, 1, 1 }, spell_karanas_spirit, TAR_CHAR_DEFENSIVE, POS_FIGHTING, &gsn_karanas_spirit, SLOT(352), 12, "", "!Karanas Spirit!", "" }, { "devanos spirit", { 52, 100, 52, 52 }, { 1, 1, 1, 1 }, spell_devanos_spirit, TAR_CHAR_SELF, POS_STANDING, &gsn_devanos_spirit, SLOT(353), 12, "", "The Spirit of Devanos leaves you.", "" }, // Kracus: Add into magic.h DECLARE_SPELL_FUN( spell_arlia_spirit ); DECLARE_SPELL_FUN( spell_karanas_spirit ); DECLARE_SPELL_FUN( spell_devanos_spirit ); // Kracus: Add do_brew into interp.c // Kracus: Add do_brew into interp.h // Kracus: Add into magic.c in do_cast int arlia_num, karanas_num, devanos_num; arlia_num = skill_lookup("arlia spirit"); karanas_num = skill_lookup("karanas spirit"); devanos_num = skill_lookup("devanos spirit"); if((( sn = find_spell(ch,arg1)) == arlia_num) || (( sn = find_spell(ch,arg1)) == karanas_num) || (( sn = find_spell(ch,arg1)) == devanos_num)) { send_to_char( "That spell is only able to be brewed.\n\r", ch ); return; } // Kracus: Add into magic.c // Cleric Brew System void spell_arlia_spirit( int sn, int level, CHAR_DATA *ch, void *vo,int target ) { CHAR_DATA *victim = (CHAR_DATA *) vo; victim->hit = UMIN( victim->hit + 300, victim->max_hit ); update_pos( victim ); send_to_char( "The Spirit of Arlia heals your body.\n\r", victim ); if ( ch != victim ) send_to_char( "The Spirit of Arlia heals your body.\n\r", ch ); return; } void spell_karanas_spirit( int sn, int level, CHAR_DATA *ch, void *vo,int target ) { CHAR_DATA *victim = (CHAR_DATA *) vo; victim->mana = UMIN( victim->mana + 300, victim->max_hit ); update_pos( victim ); send_to_char( "The Spirit of Karanas envelops your body.\n\r", victim ); if ( ch != victim ) send_to_char( "The Spirit of Karanas envelops your body.\n\r", ch ); return; } void spell_devanos_spirit( int sn, int level, CHAR_DATA *ch, void *vo,int target ) { CHAR_DATA *victim = (CHAR_DATA *) vo; AFFECT_DATA af; if ( is_affected( ch, sn ) ) { if (victim == ch) send_to_char("The Spirit of Devanos is already protecting you.\n\r",ch); else act("$N is already protected by the Spirit of Devanos.",ch,NULL,victim,TO_CHAR); return; } af.where = TO_AFFECTS; af.type = sn; af.level = level; af.duration = 6; af.location = APPLY_AC; af.modifier = -50; af.bitvector = 0; affect_to_char( victim, &af ); af.location = APPLY_SAVES; af.modifier = -10; af.bitvector = 0; affect_to_char( victim, &af ); act( "The Spirit of Devanos protects $n.", victim, NULL, NULL, TO_ROOM ); send_to_char( "You feel protected by the Spirit of Devanos.\n\r", victim ); return; } // DONT FORGET TO ADD into merc.h and db.c the GSNs for // gsn_brew // gsn_arlia_spirit // gsn_karanas_spirit // gsn_devanos_spirit // INCREASE MAXSKILL BY 4 in merc.h // INCREASE MAXGROUP BY how many spellgroups you add in merc.h // Kracus: Add into merc.h #define OBJ_VNUM_BREW 39 #define OBJ_VNUM_HEALPOTION 40 #define OBJ_VNUM_SANCTUARYPOTION 41 #define OBJ_VNUM_BLESSPOTION 42 #define OBJ_VNUM_REFRESHPOTION 43 #define OBJ_VNUM_PASSDOORPOTION 44 #define OBJ_VNUM_ARLIAPOTION 46 #define OBJ_VNUM_KARANASPOTION 47 #define OBJ_VNUM_DEVANOSPOTION 48 #define OBJ_VNUM_SPIRITVIAL 63 #define OBJ_VNUM_SPIRITSTONE 64 // Kracus: Add into limbo.c #39 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #40 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #41 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #42 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #43 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #44 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #45 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #46 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #47 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #48 potion brewed~ a brewed potion~ A potion that has been brewed.~ glass~ potion G AO 20 0 0 0 0 11 10 0 P #63 spiritvial~ an ancient Spirit Vial~ An ancient Spirit Vial lies here on the ground.~ crystal~ treasure a AO 0 0 0 0 0 1 5 10000 P #64 spiritstone~ an ancient Spirit Stone~ An ancient Spirit Stone lies here on the ground.~ stone~ treasure a AO 0 0 0 0 0 100 10 1000 P