summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-19 09:45:11 +0000
committertoms <toms@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-08-19 09:45:11 +0000
commitd7f50c4fc9a7e708dbee6d7c3c26880c167c23a5 (patch)
tree5e2064cb85b1e30bf832c0ba213db0d3ad28962b
parent5717abea66c34bd8450f4959168073afcd9f6ff2 (diff)
downloadhercules-d7f50c4fc9a7e708dbee6d7c3c26880c167c23a5.tar.gz
hercules-d7f50c4fc9a7e708dbee6d7c3c26880c167c23a5.tar.bz2
hercules-d7f50c4fc9a7e708dbee6d7c3c26880c167c23a5.tar.xz
hercules-d7f50c4fc9a7e708dbee6d7c3c26880c167c23a5.zip
- Added skill's required item check on homunc skills
- Add Condensed Red Potion as a required item for HLIF_HEAL git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8359 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--db/skill_require_db.txt2
-rw-r--r--src/map/skill.c48
3 files changed, 45 insertions, 8 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 84bafffb1..cb6af50de 100644
--- a/Changelog-Trunk.txt
+++ b/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]
diff --git a/db/skill_require_db.txt b/db/skill_require_db.txt
index b7a14238f..903b9062e 100644
--- a/db/skill_require_db.txt
+++ b/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
diff --git a/src/map/skill.c b/src/map/skill.c
index 24af7a858..23b6a780c 100644
--- a/src/map/skill.c
+++ b/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;