瀏覽代碼

* Added setting for resetting reuse skill delay homunculus, 0x80 (Disabled by default).
* Follow up 22dea1f

PS:
Hmm, as "suggested" by Darkpurple at bugreport:8989, idk it's bug or it should be like that. And, I added the setting option for a whole Homunculus (not for spesific skill/homun id yet), just like "reset reuse skill delay when vaporized" does.

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>

Cydh Ramdh 11 年之前
父節點
當前提交
c0326df96b
共有 8 個文件被更改,包括 43 次插入29 次删除
  1. 8 7
      conf/battle/homunc.conf
  2. 3 3
      src/map/clif.c
  3. 3 3
      src/map/homunculus.c
  4. 19 3
      src/map/homunculus.h
  5. 2 8
      src/map/itemdb.c
  6. 1 1
      src/map/mob.c
  7. 3 0
      src/map/skill.c
  8. 4 4
      src/map/status.c

+ 8 - 7
conf/battle/homunc.conf

@@ -11,13 +11,14 @@
 
 // Homunculus setting (Note 3)
 // Activates various 'quirks' that makes them behave unlike normal characters.
-// 0x001: Can't be targetted by support skills (except for their master)
-// 0x004: Mobs will always go after them instead of players until attacked
-// 0x008: Copy their master's speed on spawn/map-change
-// 0x010: They display luk/3+1 instead of their actual critical in the
-//        stat window (by default they don't crit)
-// 0x020: Their Min-Matk is always the same as their max
-// 0x040: Skill re-use delay is reset when they are vaporized.
+// 0x01: Can't be targetted by support skills (except for their master)
+// 0x04: Mobs will always go after them instead of players until attacked
+// 0x08: Copy their master's speed on spawn/map-change
+// 0x10: They display luk/3+1 instead of their actual critical in the
+//       stat window (by default they don't crit)
+// 0x20: Their Min-Matk is always the same as their max
+// 0x40: Skill re-use delay is reset when they are vaporized.
+// 0x80: Skill re-use delay is reset when they are warped (by skill or item) with player.
 hom_setting: 0x3D
 
 // The rate a homunculus will get friendly by feeding it. (Note 2)

+ 3 - 3
src/map/clif.c

@@ -1414,7 +1414,7 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag)
 	WBUFW(buf,35)=cap_value(status->rhw.atk2+status->batk, 0, INT16_MAX);
 	WBUFW(buf,37)=min(status->matk_max, INT16_MAX); //FIXME capping to INT16 here is too late
 	WBUFW(buf,39)=status->hit;
-	if (battle_config.hom_setting&0x10)
+	if (battle_config.hom_setting&HOMSET_DISPLAY_LUK)
 		WBUFW(buf,41)=status->luk/3 + 1;	//crit is a +1 decimal value! Just display purpose.[Vicious]
 	else
 		WBUFW(buf,41)=status->cri/10;
@@ -9628,9 +9628,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 		clif_hominfo(sd,sd->hd,1);
 		clif_hominfo(sd,sd->hd,0); //for some reason, at least older clients want this sent twice
 		clif_homskillinfoblock(sd);
-		if( battle_config.hom_setting&0x8 )
+		if( battle_config.hom_setting&HOMSET_COPY_SPEED )
 			status_calc_bl(&sd->hd->bl, SCB_SPEED); //Homunc mimic their master's speed on each map change
-		if( !(battle_config.hom_setting&0x2) )
+		if( !(battle_config.hom_setting&HOMSET_NO_INSTANT_LAND_SKILL) )
 			skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
 	}
 

+ 3 - 3
src/map/homunculus.c

@@ -177,7 +177,7 @@ int hom_vaporize(struct map_session_data *sd, int flag)
 	//Delete timers when vaporized.
 	hom_hungry_timer_delete(hd);
 	hd->homunculus.vaporize = flag ? flag : HOM_ST_REST;
-	if(battle_config.hom_setting&0x40)
+	if(battle_config.hom_setting&HOMSET_RESET_REUSESKILL_VAPORIZED)
 		memset(hd->blockskill, 0, sizeof(hd->blockskill));
 	clif_hominfo(sd, sd->hd, 0);
 	hom_save(hd);
@@ -457,7 +457,7 @@ int hom_evolution(struct homun_data *hd)
 	hom->sp = hd->battle_status.sp;
 	status_calc_homunculus(hd, SCO_FIRST);
 
-	if (!(battle_config.hom_setting&0x2))
+	if (!(battle_config.hom_setting&HOMSET_NO_INSTANT_LAND_SKILL))
 		skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
 
 	return 1 ;
@@ -511,7 +511,7 @@ int hom_mutate(struct homun_data *hd, int homun_id)
 	hom->prev_class = prev_class;
 	status_calc_homunculus(hd, SCO_FIRST);
 
-	if (!(battle_config.hom_setting&0x2))
+	if (!(battle_config.hom_setting&HOMSET_NO_INSTANT_LAND_SKILL))
 		skill_unit_move(&sd->hd->bl,gettick(),1); // apply land skills immediately
 
 	return 1;

+ 19 - 3
src/map/homunculus.h

@@ -21,11 +21,11 @@ struct s_homunculus_db {
 	long hungryDelay ;
 	unsigned char element, race, base_size, evo_size;
 };
-
 extern struct s_homunculus_db homunculus_db[MAX_HOMUNCULUS_CLASS];
+
 enum { HOMUNCULUS_CLASS, HOMUNCULUS_FOOD };
 
-enum { MH_MD_FIGHTING=1, MH_MD_GRAPPLING };
+enum { MH_MD_FIGHTING = 1, MH_MD_GRAPPLING };
 
 enum {
 	HOM_ST_ACTIVE	= 0,
@@ -72,7 +72,8 @@ struct homun_skill_tree_entry {
 #define HOM_S 0x200 //512
 #define HOM_REG 0x1000 //4096
 
-enum {
+/// Houmunculus ID
+enum homun_mapid {
 // Normal Homunculus
 	MAPID_LIF = HOM_REG|0x0,
 	MAPID_AMISTR,
@@ -90,6 +91,8 @@ enum {
 	MAPID_DIETER,
 	MAPID_ELANOR,
 };
+
+/// Homunculus type
 enum homun_type {
 	HT_REG		= 0x1,
 	HT_EVO		= 0x2,
@@ -97,6 +100,19 @@ enum homun_type {
 	HT_INVALID	= -1,
 };
 
+/// Homunculus battle_config setting
+enum homun_setting {
+	HOMSET_NO_SUPPORT_SKILL				= 0x01, /// Cannot be targetted by support skills, except for their master
+	HOMSET_NO_INSTANT_LAND_SKILL		= 0x02, /// Unit/land skill doesn't applied immediately
+	HOMSET_FIRST_TARGET					= 0x04, /// Mobs will always go after them instead of players until attacked
+	HOMSET_COPY_SPEED					= 0x08, /// Copy their master's speed on spawn/map-change
+	HOMSET_DISPLAY_LUK					= 0x10, /// They display luk/3+1 instead of their actual critical in the stat window, by default they don't crit
+	HOMSET_SAME_MATK					= 0x20, /// Their Min-Matk is always the same as their max
+	HOMSET_RESET_REUSESKILL_VAPORIZED	= 0x40, /// Skill re-use delay is reset when they are vaporized.
+	HOMSET_RESET_REUSESKILL_TELEPORTED	= 0x80, /// Skill re-use delay is reset when they are warped (by skill or item) with player.
+};
+
+/// Check Homunculus Class ID
 #define homdb_checkid(id) (id >=  HM_CLASS_BASE && id <= HM_CLASS_MAX)
 
 // merc_is_hom_alive(struct homun_data *)

+ 2 - 8
src/map/itemdb.c

@@ -55,9 +55,6 @@ static int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap)
 	dst = va_arg(ap,struct item_data **);
 	dst2 = va_arg(ap,struct item_data **);
 
-	if (item == dummy_item)
-		return 0;
-
 	//Absolute priority to Aegis code name.
 	if (strcmpi(item->name,str) == 0)
 		*dst = item;
@@ -89,8 +86,6 @@ static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap)
 	struct item_data *item = db_data2ptr(&data);
 	char *str = va_arg(ap,char *);
 
-	if (item && dummy_item)
-		return 1;
 	if (stristr(item->jname,str))
 		return 0;
 	if (stristr(item->name,str))
@@ -387,7 +382,6 @@ static void itemdb_create_dummy(void) {
 	safestrncpy(dummy_item->name, "UNKNOWN_ITEM", sizeof(dummy_item->name));
 	safestrncpy(dummy_item->jname, "Unknown Item", sizeof(dummy_item->jname));
 	dummy_item->view_id = UNKNOWN_ITEM_ID;
-	idb_put(itemdb, dummy_item->nameid, dummy_item);
 }
 
 /**
@@ -398,8 +392,8 @@ static struct item_data *itemdb_create_item(unsigned short nameid) {
 	struct item_data *id;
 	CREATE(id, struct item_data, 1);
 	memset(id, 0, sizeof(struct item_data));
-	dummy_item->nameid = nameid;
-	dummy_item->type = IT_ETC; //Etc item
+	id->nameid = nameid;
+	id->type = IT_ETC; //Etc item
 	idb_put(itemdb, nameid, id);
 	return id;
 }

+ 1 - 1
src/map/mob.c

@@ -1081,7 +1081,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
 			!(status_get_mode(&md->bl)&MD_BOSS))
 			return 0; //Gangster paradise protection.
 	default:
-		if (battle_config.hom_setting&0x4 &&
+		if (battle_config.hom_setting&HOMSET_FIRST_TARGET &&
 			(*target) && (*target)->type == BL_HOM && bl->type != BL_HOM)
 			return 0; //For some reason Homun targets are never overriden.
 

+ 3 - 0
src/map/skill.c

@@ -6840,6 +6840,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
 
 			if( sd->state.autocast || ( (sd->skillitem == AL_TELEPORT || battle_config.skip_teleport_lv1_menu) && skill_lv == 1 ) || skill_lv == 3 )
 			{
+				if (sd->hd && battle_config.hom_setting&HOMSET_RESET_REUSESKILL_TELEPORTED)
+					memset(sd->hd->blockskill, 0, sizeof(hd->blockskill));
+
 				if( skill_lv == 1 )
 					pc_randomwarp(sd,CLR_TELEPORT);
 				else

+ 4 - 4
src/map/status.c

@@ -1973,7 +1973,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, uin
 		case BL_HOM:
 		case BL_MER:
 		case BL_ELEM:
-			if( target->type == BL_HOM && skill_id && battle_config.hom_setting&0x1 && skill_get_inf(skill_id)&INF_SUPPORT_SKILL && battle_get_master(target) != src )
+			if( target->type == BL_HOM && skill_id && battle_config.hom_setting&HOMSET_NO_SUPPORT_SKILL && skill_get_inf(skill_id)&INF_SUPPORT_SKILL && battle_get_master(target) != src )
 				return 0; // Can't use support skills on Homunculus (only Master/Self)
 			if( target->type == BL_MER && (skill_id == PR_ASPERSIO || (skill_id >= SA_FLAMELAUNCHER && skill_id <= SA_SEISMICWEAPON)) && battle_get_master(target) != src )
 				return 0; // Can't use Weapon endow skills on Mercenary (only Master)
@@ -3660,7 +3660,7 @@ int status_calc_homunculus_(struct homun_data *hd, enum e_status_calc_opt opt)
 		status->rhw.range = 1 + status->size;
 		status->mode = MD_CANMOVE|MD_CANATTACK;
 		status->speed = DEFAULT_WALK_SPEED;
-		if (battle_config.hom_setting&0x8 && hd->master)
+		if (battle_config.hom_setting&HOMSET_COPY_SPEED && hd->master)
 			status->speed = status_get_speed(&hd->master->bl);
 
 		status->hp = 1;
@@ -4292,7 +4292,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
 		if( bl->type&BL_PC && status->speed < battle_config.max_walk_speed )
 			status->speed = battle_config.max_walk_speed;
 
-		if( bl->type&BL_HOM && battle_config.hom_setting&0x8 && ((TBL_HOM*)bl)->master)
+		if( bl->type&BL_HOM && battle_config.hom_setting&HOMSET_COPY_SPEED && ((TBL_HOM*)bl)->master)
 			status->speed = status_get_speed(&((TBL_HOM*)bl)->master->bl);
 		if( bl->type&BL_MER && ((TBL_MER*)bl)->master)
 			status->speed = status_get_speed(&((TBL_MER*)bl)->master->bl);
@@ -4444,7 +4444,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag)
 
 		status->matk_max = status_calc_matk(bl, sc, status->matk_max);
 
-		if ((bl->type&BL_HOM && battle_config.hom_setting&0x20)  /// Hom Min Matk is always the same as Max Matk
+		if ((bl->type&BL_HOM && battle_config.hom_setting&HOMSET_SAME_MATK)  /// Hom Min Matk is always the same as Max Matk
 				|| (sc && sc->data[SC_RECOGNIZEDSPELL]))
 			status->matk_min = status->matk_max;
 		else