Browse Source

- Moved the intimacy penalty of HFLI_SBR44 and HVAN_EXPLOSION to skill_counter_additional_effect
- Simplified skillnotok_hom by using an invocation to skillnotok
- Hopefully fixed BD_ADAPTATION
- Homun won't lose any intimacy on death now.
- Homun will be saved together with the master now (as long as the homun is active)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8564 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 18 years ago
parent
commit
a19cafda61
7 changed files with 32 additions and 51 deletions
  1. 7 0
      Changelog-Trunk.txt
  2. 2 5
      src/map/battle.c
  3. 4 1
      src/map/chrif.c
  4. 1 1
      src/map/map.h
  5. 2 11
      src/map/mercenary.c
  6. 0 5
      src/map/pc.c
  7. 16 28
      src/map/skill.c

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 
 2006/08/31
 2006/08/31
+	* Moved the intimacy penalty of HFLI_SBR44 and HVAN_EXPLOSION to
+	  skill_counter_additional_effect [Skotlex]
+	* Simplified skillnotok_hom by using an invocation to skillnotok [Skotlex]
+	* Hopefully fixed BD_ADAPTATION [Skotlex]
+	* Homun won't lose any intimacy on death now. [Skotlex]
+	* Homun will be saved together with the master now (as long as the homun is
+	  active) [Skotlex]
 	* Modified the error reporting in map_freeblock_unlock so that when there's
 	* Modified the error reporting in map_freeblock_unlock so that when there's
 	  an error, the reported line number is the file's linenumber plus the
 	  an error, the reported line number is the file's linenumber plus the
 	  object's type *10000. This is for debug information to help track down the
 	  object's type *10000. This is for debug information to help track down the

+ 2 - 5
src/map/battle.c

@@ -1204,11 +1204,8 @@ static struct Damage battle_calc_weapon_attack(
 					break;
 					break;
 				}
 				}
 			case HFLI_SBR44:	//[orn]
 			case HFLI_SBR44:	//[orn]
-				if(src->type == BL_HOM){
-					TBL_HOM *hd = (TBL_HOM*)src;
-					wd.damage = hd->master->homunculus.intimacy ;
-					hd->master->homunculus.intimacy = 200;
-					clif_send_homdata(hd->master,0x100,hd->master->homunculus.intimacy/100);
+				if(src->type == BL_HOM && ((TBL_HOM*)src)->master) {
+					wd.damage = ((TBL_HOM*)src)->master->homunculus.intimacy ;
 					break;
 					break;
 				}
 				}
 			default:
 			default:

+ 4 - 1
src/map/chrif.c

@@ -209,7 +209,6 @@ int chrif_save(struct map_session_data *sd, int flag)
 		intif_saveregistry(sd, 2); //Save account regs
 		intif_saveregistry(sd, 2); //Save account regs
 	if (sd->state.reg_dirty&1)
 	if (sd->state.reg_dirty&1)
 		intif_saveregistry(sd, 1); //Save account2 regs
 		intif_saveregistry(sd, 1); //Save account2 regs
-
 #ifndef TXT_ONLY
 #ifndef TXT_ONLY
 	if(charsave_method){ //New 'Local' save
 	if(charsave_method){ //New 'Local' save
 		charsave_savechar(sd->char_id, &sd->status);
 		charsave_savechar(sd->char_id, &sd->status);
@@ -228,6 +227,10 @@ int chrif_save(struct map_session_data *sd, int flag)
 	WFIFOB(char_fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting.
 	WFIFOB(char_fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting.
 	memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status));
 	memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status));
 	WFIFOSET(char_fd, WFIFOW(char_fd,2));
 	WFIFOSET(char_fd, WFIFOW(char_fd,2));
+
+	if (sd->hd && merc_is_hom_active(sd->hd))
+		merc_save(sd->hd);
+
 	if (flag)
 	if (flag)
 		sd->state.finalsave = 1; //Mark the last save as done.
 		sd->state.finalsave = 1; //Mark the last save as done.
 	return 0;
 	return 0;

+ 1 - 1
src/map/map.h

@@ -9,7 +9,7 @@
 #include "../common/mapindex.h"
 #include "../common/mapindex.h"
 #include "../common/db.h"
 #include "../common/db.h"
 
 
-//Uncomment to enable the Cell Stack Limit mod. (EXPERIMENTAL)
+//Uncomment to enable the Cell Stack Limit mod.
 //It's only config is the battle_config cell_stack_limit.
 //It's only config is the battle_config cell_stack_limit.
 //Only chars affected are those defined in BL_CHAR (mobs and players currently)
 //Only chars affected are those defined in BL_CHAR (mobs and players currently)
 //#define CELL_NOSTACK
 //#define CELL_NOSTACK

+ 2 - 11
src/map/mercenary.c

@@ -56,22 +56,13 @@ int merc_hom_dead(struct homun_data *hd, struct block_list *src)
 	clif_emotion(&hd->bl, 16) ;	//wah
 	clif_emotion(&hd->bl, 16) ;	//wah
 	if (!sd) //unit remove map will invoke unit free
 	if (!sd) //unit remove map will invoke unit free
 		return 3;
 		return 3;
+	//There's no intimacy penalties on death (from Tharis)
 
 
 	//Delete timers when dead.
 	//Delete timers when dead.
 	merc_hom_hungry_timer_delete(hd);
 	merc_hom_hungry_timer_delete(hd);
 	sd->homunculus.hp = 0 ;
 	sd->homunculus.hp = 0 ;
 	clif_hominfo(sd,hd,0); // Send dead flag
 	clif_hominfo(sd,hd,0); // Send dead flag
-
-	if(!merc_hom_decrease_intimacy(hd, 100)) // Intimacy was <= 100
-		clif_emotion(&sd->bl, 23) ;	//omg
-	else {
-		clif_emotion(&sd->bl, 28) ;	//sob
-		// Not needed because the status window will be closed until resurect homun and then
-		// Intimacy will be sent
-		//clif_send_homdata(hd->master,SP_INTIMATE,hd->master->homunculus.intimacy / 100);
-	}
-
-	merc_save(hd);
+	clif_emotion(&sd->bl, 28) ;	//sob
 	//Remove from map (if it has no intimacy, it is auto-removed from memory)
 	//Remove from map (if it has no intimacy, it is auto-removed from memory)
 	return 3;
 	return 3;
 }
 }

+ 0 - 5
src/map/pc.c

@@ -344,11 +344,6 @@ int pc_makesavestatus(struct map_session_data *sd)
 		else
 		else
 			memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
 			memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point));
 	}
 	}
-
-	if (sd->hd) { //Update Homun HP info
-		sd->homunculus.hp = sd->hd->battle_status.hp ;
-		sd->homunculus.sp = sd->hd->battle_status.sp ;
-	}
 	return 0;
 	return 0;
 }
 }
 
 

+ 16 - 28
src/map/skill.c

@@ -928,10 +928,6 @@ int skillnotok_hom (int skillid, struct homun_data *hd)
 {	
 {	
 	int i = skillid;
 	int i = skillid;
 	nullpo_retr (1, hd);
 	nullpo_retr (1, hd);
-	//if (sd == 0)
-		//return 0; 
-		//return 1;
-	// I think it was meant to be "no skills allowed when not a valid sd"
 	
 	
 	if (skillid >= GD_SKILLRANGEMIN && skillid <= GD_SKILLRANGEMAX)
 	if (skillid >= GD_SKILLRANGEMIN && skillid <= GD_SKILLRANGEMAX)
 		return 1;
 		return 1;
@@ -947,23 +943,8 @@ int skillnotok_hom (int skillid, struct homun_data *hd)
 	if (hd->blockskill[i] > 0)
 	if (hd->blockskill[i] > 0)
 		return 1;
 		return 1;
 
 
-	// Check skill restrictions [Celest]
-	if(!map_flag_vs(hd->bl.m) && skill_get_nocast (skillid) & 1)
-		return 1;
-	if(map[hd->bl.m].flag.pvp) {
-		if(!battle_config.pk_mode && skill_get_nocast (skillid) & 2)
-			return 1;
-		if(battle_config.pk_mode && skill_get_nocast (skillid) & 16)
-			return 1;
-	}
-	if(map_flag_gvg(hd->bl.m) && skill_get_nocast (skillid) & 4)
-		return 1;
-	if(agit_flag && skill_get_nocast (skillid) & 8)
-		return 1;
-	if(map[hd->bl.m].flag.restricted && map[hd->bl.m].zone && skill_get_nocast (skillid) & (8*map[hd->bl.m].zone))
-		return 1;
-
-	return (map[hd->bl.m].flag.noskill);
+	//Use master's criteria.
+	return skillnotok(skillid, hd->master);
 }
 }
 
 
 struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT];
 struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT];
@@ -1526,6 +1507,16 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
 	case GS_FULLBUSTER:
 	case GS_FULLBUSTER:
 		status_change_start(src,SC_BLIND,200*skilllv,skilllv,0,0,0,skill_get_time2(skillid,skilllv),10);
 		status_change_start(src,SC_BLIND,200*skilllv,skilllv,0,0,0,skill_get_time2(skillid,skilllv),10);
 		break;
 		break;
+	case HFLI_SBR44:	//[orn]
+	case HVAN_EXPLOSION:
+		if(src->type == BL_HOM){
+			TBL_HOM *hd = (TBL_HOM*)src;
+			if (hd->master) {
+				hd->master->homunculus.intimacy = 200;
+				clif_send_homdata(hd->master,0x100,hd->master->homunculus.intimacy/100);
+			}
+		}
+		break;
 	}
 	}
 
 
 	if(sd && skillid && attack_type&BF_MAGIC && status_isdead(bl) &&
 	if(sd && skillid && attack_type&BF_MAGIC && status_isdead(bl) &&
@@ -2421,10 +2412,10 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 		}
 		}
 	}
 	}
 
 
+	if (!type) //States are only checked on begin casting.
 	switch(state) {
 	switch(state) {
 	case ST_MOVE_ENABLE:
 	case ST_MOVE_ENABLE:
-		//Check only on begin casting. [Skotlex]
-		if(!type && !unit_can_move(&hd->bl)) {
+		if(!unit_can_move(&hd->bl)) {
 			clif_skill_fail(sd,skill,0,0);
 			clif_skill_fail(sd,skill,0,0);
 			return 0;
 			return 0;
 		}
 		}
@@ -4050,10 +4041,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		break;
 		break;
 
 
 	case HVAN_EXPLOSION:	//[orn]
 	case HVAN_EXPLOSION:	//[orn]
-		if(hd){
-			hd->master->homunculus.intimacy = 200;
-			clif_send_homdata(hd->master,0x100,hd->master->homunculus.intimacy/100);
-		}
 	case NPC_SELFDESTRUCTION:
 	case NPC_SELFDESTRUCTION:
 		//Self Destruction hits everyone in range (allies+enemies)
 		//Self Destruction hits everyone in range (allies+enemies)
 		//Except for Summoned Marine spheres on non-versus maps, where it's just enemy.
 		//Except for Summoned Marine spheres on non-versus maps, where it's just enemy.
@@ -8120,7 +8107,8 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
 			}
 			}
 			group=(struct skill_unit_group*)sc->data[SC_DANCING].val2;
 			group=(struct skill_unit_group*)sc->data[SC_DANCING].val2;
 			time = 1000*(sc->data[SC_DANCING].val3>>16);
 			time = 1000*(sc->data[SC_DANCING].val3>>16);
-			if (!group || (skill_get_time(sc->data[SC_DANCING].val1,group->skill_lv) - time <= skill_get_time2(skill,lv)))
+			if (!group ||
+				(skill_get_time(group->skill_id,group->skill_lv) - time <= skill_get_time2(skill,lv)))
 			{
 			{
 				clif_skill_fail(sd,skill,0,0);
 				clif_skill_fail(sd,skill,0,0);
 				return 0;
 				return 0;