Index: /src/map/atcommand.c
===================================================================
--- /src/map/atcommand.c (revision 1)
+++ /src/map/atcommand.c (revision 5)
@@ -1269,4 +1269,10 @@
 			{ "gunner",	24 },
 			{ "ninja",	25 },
+			//Begin custom Job (blackmagic)
+			{ "adept",	30 },//New job classes [Brainstorm]
+			{ "necromancer",	31 },
+			{ "necro",	31 },
+			{ "warlock",	32 },
+			//End Custom Job
 			{ "high novice",	4001 },
 			{ "swordsman high",	4002 },
@@ -7816,5 +7822,19 @@
 	return 0;
 }
-
+//Begin Custom Jobs (black magic)
+//@showsummon [Brainstorm]
+int atcommand_showsummon(const int fd, struct map_session_data* sd, const char* command, const char* message)
+{
+	if (sd->state.showsummon) {
+	sd->state.showsummon = 0;
+	clif_displaymessage(fd, "Summon Stats will not be shown.");
+	return 0;
+	}
+
+	sd->state.showsummon = 1;
+	clif_displaymessage(fd, "Summon Stats is now shown.");
+	return 0;
+}
+//End Custom Jobs
 /*==========================================
  * Barricade Build
@@ -8623,4 +8643,8 @@
 	{ "barricade",         60,     atcommand_barricade },
 	{ "killbarricade",     60,     atcommand_barricade_destroy },
+	//Bwgin Custom Jobs (blackmagic)
+	//Vanaheim Commands
+	{ "showsummon",	 0, atcommand_showsummon}, //Brainstorm
+	//End Custom Jobs
 	{ "god",				60,		atcommand_god },
 	{ "demon",				60,		atcommand_demon },
Index: /src/map/itemdb.c
===================================================================
--- /src/map/itemdb.c (revision 1)
+++ /src/map/itemdb.c (revision 5)
@@ -242,4 +242,12 @@
 	if (jobmask & 1<<JOB_NINJA)
 		bclass[0] |= 1<<MAPID_NINJA;
+	//Begin custom job (blackmagic)
+	if (jobmask & 1<<26) // Adept [Brain]
+	bclass[0] |= 1<<MAPID_ADEPT;
+	if (jobmask & 1<<27) // Necromancer [Brain]
+	bclass[1] |= 1<<MAPID_ADEPT;
+	if (jobmask & 1<<28) // Warlock [Brain]
+	bclass[2] |= 1<<MAPID_ADEPT;
+	//end custom job
 }
 
Index: /src/map/battle.c
===================================================================
--- /src/map/battle.c (revision 1)
+++ /src/map/battle.c (revision 5)
@@ -373,4 +373,31 @@
 		}
 
+		//Begin Custom Jobs (blackmagic)
+			
+	//Display red flashing aura effect of Adept Blood Lust [Brain]
+	if(sc->data[SC_LUST] && damage > 0){
+		clif_specialeffect(bl, 548, AREA);
+		if(rand()%100 < 10) clif_specialeffect(bl, 455, AREA); //Red Lightnings, 1/10 attacks will show to prevent spam
+	};
+	//Display blue flashing aura effect of Warlock Overwhelming Evil [Brain]
+	if(sc->data[SC_OVERWHELMING] && damage > 0)
+		clif_specialeffect(bl, 73, AREA);
+
+	// AT-Field [Brainstorm]
+	if(sc->data[SC_ATFIELD] &&
+		rand()%100 < sc->data[SC_ATFIELD]->val2)
+	{	//Blocks all skills.
+		clif_specialeffect(bl, 438, AREA);
+		//Shouldn't end until Breaker's non-weapon part connects.
+		if (skill_num == ASC_BREAKER ||
+		skill_num == LK_SPIRALPIERCE ||
+		skill_num == CG_ARROWVULCAN ||
+		skill_num == SN_SHARPSHOOTING)
+		if (--sc->data[SC_ATFIELD]->val3 <= 0) //We make it work like Safety Wall
+		status_change_end(bl, SC_ATFIELD, -1);
+		return 0;
+	}
+//End Custom Jobs
+
 		if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU])
 		&& 
@@ -624,4 +651,9 @@
 			damage += sd->status.str;
 	}
+	//Begin Custom Jobs (blackmagic)	
+	//Warlock Touch of Corruption (Mage-Monster Killer passive skill) [Brainstorm]
+	if((skill = pc_checkskill(sd,WL_CORRUPTION)) > 0 && target->type==BL_MOB )
+	damage += (skill * (status->int_/10));
+	//end custom job
 
 	if(type == 0)
@@ -1299,4 +1331,9 @@
 			switch( skill_num )
 			{
+			//Begin Custom Job (blackmagic)
+				case NC_DEATHHAND: // Necro Death Hand [Brain]
+				skillratio += -25+25*skill_lv;
+				break;
+			//End Black Magic Custom Jobs
 				case SM_BASH:
 					skillratio += 30*skill_lv;
@@ -1575,4 +1612,13 @@
 					skillratio += 100 *(skill_lv-1);
 					break;
+					//Begin Custom Jobs (blackmagic)
+					//Mercenary Skills [Brainstorm]
+				case MS_BASH:
+					skillratio += 30*skill_lv;
+					break;
+				case MER_CRASH:
+					skillratio += 10*skill_lv;
+					break;
+					//end custom jobs
 			}
 
@@ -2188,4 +2234,7 @@
 			case AL_HEAL:
 			case PR_BENEDICTIO:
+				//Begin Custom Job (blackmagic)
+			case AD_DARKHEAL: // Adept Dark Heal
+				//end custom job
 				ad.damage = skill_calc_heal(src, target, skill_lv)/2;
 				break;
@@ -2306,5 +2355,32 @@
 						skillratio += 100 +100*skill_lv +100*(skill_lv/2);
 						break;
-				}
+				//Begin Custom Job (blackmagic)
+					case NC_DRAINLIFE: // Necro Drain Life [Brain]
+						skillratio += 25*skill_lv;
+						break;
+					case WL_HELLFIRE: // Warlock Hellfire [Brain]
+						skillratio += 25*skill_lv;
+						break;
+					case WL_SHADOWBURN: // Warlock Shadow Burn [Brain]
+						skillratio += 20*skill_lv;
+						break;
+					case WL_CURSEDOOM: // Warlock Curse of Doom [Brain]
+						skillratio += 400 + 300*skill_lv; //max 20*matk dmg after 60 seconds
+						break;
+					case WL_SEARING: // Warlock Searing Pain [Brain]
+						if(status_get_sc(target)->data[SC_SEARING])
+							skillratio = 10*pc_checkskill(sd,WL_SEARING);//10% * skilllv
+						break; //Else 100% Matk
+					case WL_IMMOLATE: // Warlock Immolate [Brain]
+						if(status_get_sc(target)->data[SC_IMMOLATE])
+							skillratio += 10*pc_checkskill(sd,WL_SEARING);//100% +10 * searing lv
+						else skillratio += -20 + 20*skill_lv;// Else 80% + 20% * skill lv
+						break;
+					case WL_CONFLAGRATE: // Warlock Conflagrate [Brain]
+						skillratio += 100 + 60*skill_lv + //damage bonus from other fire skills
+							10*pc_checkskill(sd,WL_SEARING) + 10*pc_checkskill(sd,WL_IMMOLATE);
+						break;
+	//End Custom Job
+			}
 
 				MATK_RATE(skillratio);
@@ -2376,5 +2452,13 @@
 		if (!(nk&NK_NO_ELEFIX))
 			ad.damage=battle_attr_fix(src, target, ad.damage, s_ele, tstatus->def_ele, tstatus->ele_lv);
-
+	//Begin Custom Job (blackmagic)		
+	if(skill_num == WL_SHADOWBURN) { // Warlock Shadow Burn [Brain]
+		// This is where we calculate the secondary damage
+		if(ad.damage<1) ad.damage=1;
+		struct Damage md = battle_calc_misc_attack(src,target,skill_num,skill_lv, mflag);
+		if(md.damage<1) md.damage=1;
+		ad.damage += md.damage;
+	}
+	//End Custom Job
 		if (sd && !(nk&NK_NO_CARDFIX_ATK)) {
 			short t_class = status_get_class(target);
@@ -2576,4 +2660,9 @@
 	case NPC_EVILLAND:
 		md.damage = (skill_lv>6)?666:skill_lv*100;
+	//Begin Custom Job (blackmagic)
+	case WL_SHADOWBURN: // Warlock ShadowBurn dark element damage [Brain]
+	s_ele = ELE_DARK;
+	md.damage = ((300 + 20*skill_lv)/100)*((sstatus->int_*(rand()%300+500))/100); //Fixed between min and max matk for now
+	//End Custom Job
 		break;
 	}
@@ -2763,4 +2852,20 @@
 	if (sd->sp_vanish_rate && rand()%1000 < sd->sp_vanish_rate)
 		status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->sp_vanish_per, false);
+	//begin custom job (blackmagic	
+	// Adept Blood Pact drains 5% damage per hit [FlavioJS/Brain]
+	if( pc_checkskill(sd, AD_BLOODPACT) > 0 )
+	thp += battle_calc_drain(rdamage,1000,5);
+
+	// Warlock Soul Steal drains 1%*skilllv damage per hit [Brain]
+	if( pc_checkskill(sd, WL_SOULSTEAL) > 0 )
+	tsp += battle_calc_drain(rdamage,1000,pc_checkskill(sd,WL_SOULSTEAL));
+	// Warlock Touch of Corruption burns 1%*skilllv damage as SP per hit [Brain]
+	if( pc_checkskill(sd, WL_CORRUPTION) > 0 ) {
+	int corrupt_sp;
+	corrupt_sp = battle_calc_drain(rdamage,1000,pc_checkskill(sd,WL_CORRUPTION));
+	if(status_damage(NULL, tbl, 0, corrupt_sp, 0, 3))
+		rhp += corrupt_sp;//If SP damage was caused, increase HP damage too
+	}
+	//end custom job
 	if (!thp && !tsp) return;
 
@@ -2986,4 +3091,19 @@
 	return wd.dmg_lv;
 }
+
+//Begin custom Job (blackmagic)
+int battle_check_living(int race,int element)// Living creature check [Brain]
+{
+	if(element == ELE_UNDEAD || race == RC_UNDEAD // Undead element and race check
+	|| race == RC_DEMON		// Demon race check
+	|| race == RC_FORMLESS		// Formless race check
+	|| element == ELE_GHOST){	// Ghost element check
+	return 0;
+	}
+	else {
+	return 1;
+	}
+}
+//end custom job
 
 int battle_check_undead(int race,int element)
@@ -3712,4 +3832,9 @@
 	{ "auction_feeperhour",                 &battle_config.auction_feeperhour,              12000,  0,      INT_MAX,        },
 	{ "auction_maximumprice",               &battle_config.auction_maximumprice,            500000000, 0,   MAX_ZENY,       },
+	//Begin Custom Job (blackmagic)	
+	//Vanaheim battle settings [Brainstorm]
+	{ "necro_retaliation",		  &battle_config.necro_retaliation,		   1,	  0,	  1,		  },
+	{ "disp_summon_stats",		  &battle_config.disp_summon_stats,
+	//End Custom Job
 	{ "gm_viewequip_min_lv",                &battle_config.gm_viewequip_min_lv,             0,      0,      99,             },
 };
Index: /src/map/battle.h
===================================================================
--- /src/map/battle.h (revision 1)
+++ /src/map/battle.h (revision 5)
@@ -88,4 +88,7 @@
 
 int battle_check_undead(int race,int element);
+//Begin Custom Job (blackmagic)
+int battle_check_living(int race,int element);	//Living Creature Check [Brain]
+//End Custom Job (blackmagic)
 int battle_check_target(struct block_list *src, struct block_list *target,int flag);
 bool battle_check_range(struct block_list *src,struct block_list *bl,int range);
@@ -452,4 +455,9 @@
 	int auction_feeperhour;
 	int auction_maximumprice;
+	//Begin custom Job (blackmagic)	
+	//Vanaheim battle settings [Brainstorm]
+	int necro_retaliation; //Battle flag to force monsters to attack adept/necro/warlock summons [Brain]
+	int disp_summon_stats; //Battle Flag to show summoned monster stats [Brain]
+	//end custom job
 	int gm_viewequip_min_lv;
 } battle_config;
Index: /src/map/mob.c
===================================================================
--- /src/map/mob.c (revision 1)
+++ /src/map/mob.c (revision 5)
@@ -245,4 +245,6 @@
  * 1: poring list
  * 2: bloody branch list
+ * 3: mob_pouch list
+ * 4: familiar list // familiar by FlavioJS [Brain]
  * flag:
  * &1: Apply the summon success chance found in the list (otherwise get any monster from the db)
@@ -2011,6 +2013,16 @@
 			break;
 		//Let players decide whether to retaliate versus the master or the mob. [Skotlex]
-		if (md2->master_id && battle_config.retaliate_to_master)
-			md->attacked_id = md2->master_id;
+		/*if (md2->master_id && battle_config.retaliate_to_master)
+			md->attacked_id = md2->master_id;*/
+//UNCOMMENT IF ERROR OCCURS WITH CUSTOM JOBS V
+//if (md2->master_id && battle_config.retaliate_to_master)
+		//BEGIN Custom Jobs (blackmagic)
+			{
+		//necro_retaliation config (same as above, but only works for adept/necro/warlock summons) [Brainstorm]
+		if(!battle_config.necro_retaliation && (md2->class_ >= 3100 && md2->class_ <= 3235))
+		md->attacked_id = src->id;
+		else md->attacked_id = md2->master_id; //All normal summons
+	}
+			//end
 		else
 			md->attacked_id = src->id;
@@ -2812,4 +2824,41 @@
 	return map_foreachinmap(mob_countslave_sub, bl->m, BL_MOB,bl->id);
 }
+
+//Begin Custom Jobs (blackmagic)
+/// Count slaves with a certain master and class. by FlavioJS [Brain]
+static int mob_countslave_class_sub(struct block_list* bl, va_list ap)
+{
+	int id;
+	int count;
+	short* classes;
+	TBL_MOB* md;
+
+	id = va_arg(ap, int);
+	count = va_arg(ap, int);
+	classes = va_arg(ap, short*);
+	md = (TBL_MOB*)bl;
+	
+	if( md->master_id == id )
+	{// has the correct master
+	int i;
+	for( i = 0; i < count; ++i )
+	{
+		if( md->class_ == classes[i] )
+		return 1;
+	}
+	}
+	return 0;
+}
+
+/// Returns the number of slaves of the specified classes. by FlavioJS [Brain]
+/// @param bl Master
+/// @param count Number of classes
+/// @param classes Array of classes
+int mob_countslave_class(struct block_list* bl, int count, short* classes)
+{
+	return map_foreachinmap(mob_countslave_class_sub, bl->m, BL_MOB, bl->id, count, classes);
+}
+
+//End
 
 /*==========================================
@@ -3974,5 +4023,9 @@
 		"mob_poring.txt",
 		"mob_boss.txt",
-		"mob_pouch.txt"};
+		"mob_pouch.txt"
+		//Begin custom Jobs (blackmagic
+		"mob_familiar.txt" // familiar By FlavioJS [Brain]
+	};
+	//end
 
 	memset(&summon, 0, sizeof(summon));
Index: /src/map/map.h
===================================================================
--- /src/map/map.h (revision 1)
+++ /src/map/map.h (revision 5)
@@ -77,4 +77,7 @@
 	MAPID_XMAS,
 	MAPID_SUMMER,
+	//Begin custom Jobs (blackmagic)
+	MAPID_ADEPT = 0x0E,	// Adept [Brain]
+	//end
 //2_1 classes
 	MAPID_SUPER_NOVICE = JOBL_2_1|0x0,
@@ -86,4 +89,7 @@
 	MAPID_ASSASSIN,
 	MAPID_STAR_GLADIATOR,
+	//Begin Custom Jobs (blackmagic)
+	MAPID_NECROMANCER = JOBL_2_1|0x0E,	// Necromancer [Brain]
+	//end
 //2_2 classes
 	MAPID_CRUSADER = JOBL_2_2|0x1,
@@ -94,4 +100,7 @@
 	MAPID_ROGUE,
 	MAPID_SOUL_LINKER,
+	//begin custom job (blackmagic)
+	MAPID_WARLOCK = JOBL_2_2|0x0E, // Warlock [Flavio]
+	//end
 //1-1, advanced
 	MAPID_NOVICE_HIGH = JOBL_UPPER|0x0,
Index: /src/map/mob.h
===================================================================
--- /src/map/mob.h (revision 1)
+++ /src/map/mob.h (revision 5)
@@ -12,5 +12,5 @@
 
 
-#define MAX_RANDOMMONSTER 4
+#define MAX_RANDOMMONSTER 5
 #define MAX_MOB_RACE_DB 6
 
@@ -18,5 +18,5 @@
 // Be sure to note that IDs 4001 to 4048 are reserved for advanced/baby/expanded classes.
 // Notice that the last 1000 entries are used for player clones, so always set this to desired value +1000
-#define MAX_MOB_DB 3000
+#define MAX_MOB_DB 7000
 
 //The number of drops all mobs have and the max drop-slot that the steal skill will attempt to steal from.
@@ -271,4 +271,7 @@
 int mob_convertslave(struct mob_data *md);
 
+//Begin custom Job (blackmagic)
+int mob_countslave_class(struct block_list* bl, int count, short* classes); // By FlavioJS [Brain]
+//end
 int mob_is_clone(int class_);
 
