Prechádzať zdrojové kódy

- Added skill's required item check on homunc skills
- Add Condensed Red Potion as a required item for HLIF_HEAL

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

toms 19 rokov pred
rodič
commit
8c79b21151
3 zmenil súbory, kde vykonal 45 pridanie a 8 odobranie
  1. 3 0
      Changelog-Trunk.txt
  2. 1 1
      db/skill_require_db.txt
  3. 41 7
      src/map/skill.c

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/08/19
+	* Added skill's required item check on homunc skills [Toms]
+	* Add Condensed Red Potion as a required item for HLIF_HEAL [Toms]
 2006/08/18
 	* Little code cleanup on last fix [Toms]
 	* Fixed HLIF_HEAL healing the homunc instead of the master [Toms]

+ 1 - 1
db/skill_require_db.txt

@@ -458,7 +458,7 @@
 10012,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//GD_RESTORE##
 10013,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//GD_EMERGENCYCALL##
 
-8001,0,0,13:16:19:22:25,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//HLIF_HEAL
+8001,0,0,13:16:19:22:25,0,0,0,99,0,0,none,0,545,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//HLIF_HEAL
 8002,0,0,20:25:30:35:40,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//HLIF_AVOID
 8004,0,1,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//HLIF_CHANGE
 8005,0,0,10,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0	//HAMI_CASTLE

+ 41 - 7
src/map/skill.c

@@ -2353,9 +2353,13 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 {
 	struct status_data *status;
 	struct status_change *sc;
-	int j,hp,sp,hp_rate,sp_rate,state,mhp ;
-
+	TBL_PC * sd;
+	int i,j,hp,sp,hp_rate,sp_rate,state,mhp ;
+	int index[10],itemid[10],amount[10];
+	int checkitem_flag = 1, delitem_flag = 1;
+	
 	nullpo_retr(0, hd);
+	sd = hd->master;
 
 	if (lv <= 0) return 0;
 
@@ -2374,6 +2378,12 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 	//Code speedup, rather than using skill_get_* over and over again.
 	if (lv < 1 || lv > MAX_SKILL_LEVEL)
 		return 0;
+
+	for(i = 0; i < 10; i++) {
+		itemid[i] = skill_db[j].itemid[i];
+		amount[i] = skill_db[j].amount[i];
+	}
+
 	hp = skill_db[j].hp[lv-1];
 	sp = skill_db[j].sp[lv-1];
 	hp_rate = skill_db[j].hp_rate[lv-1];
@@ -2393,21 +2403,22 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 
 	switch(skill) { // Check for cost reductions due to skills & SCs
 		case HFLI_SBR44:
-			if(hd->master->homunculus.intimacy < 200)
+			if(sd->homunculus.intimacy < 200)
 				return 0;
 			break;
 		case HVAN_EXPLOSION:
-			if(hd->master->homunculus.intimacy < battle_config.hvan_explosion_intimate)
+			if(sd->homunculus.intimacy < battle_config.hvan_explosion_intimate)
 				return 0;
 			break;
 	}
+
 	if(!(type&2)){
 		if( hp>0 && status->hp <= (unsigned int)hp) {
-			clif_skill_fail(hd->master,skill,2,0);
+			clif_skill_fail(sd,skill,2,0);
 			return 0;
 		}
 		if( sp>0 && status->sp < (unsigned int)sp) {
-			clif_skill_fail(hd->master,skill,1,0);
+			clif_skill_fail(sd,skill,1,0);
 			return 0;
 		}
 	}
@@ -2416,15 +2427,38 @@ static int skill_check_condition_hom (struct homun_data *hd, int skill, int lv,
 	case ST_MOVE_ENABLE:
 		//Check only on begin casting. [Skotlex]
 		if(!type && !unit_can_move(&hd->bl)) {
-			clif_skill_fail(hd->master,skill,0,0);
+			clif_skill_fail(sd,skill,0,0);
 			return 0;
 		}
 		break;
 	}
 
+	if (checkitem_flag) {
+		for(i=0;i<10;i++) {
+			int x = lv%11 - 1;
+			index[i] = -1;
+			if(itemid[i] <= 0)
+				continue;
+
+			index[i] = pc_search_inventory(sd,itemid[i]);
+			if(index[i] < 0 || sd->status.inventory[index[i]].amount < amount[i])
+			{
+				clif_skill_fail(sd,skill,0,0);
+				return 0;
+			}
+		}
+	}
+
 	if(!(type&1))
 		return 1;
 
+	if(delitem_flag) {
+		for(i=0;i<10;i++) {
+			if(index[i] >= 0)
+				pc_delitem(sd,index[i],amount[i],0);
+		}
+	}
+
 	if(type&2)
 		return 1;