From bab1ce1992acc67b814e3de9f09ac58d569265b1 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 31 Mar 2006 18:19:10 +0000 Subject: - Fixed skill_require_db loading. - Added a column to specify the amount of ammo required for skills that require ammo. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5831 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/skill.c | 81 ++++++++++++++++++++++++++++++--------------------------- src/map/skill.h | 2 +- 2 files changed, 43 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/map/skill.c b/src/map/skill.c index cbd0d4bd8..d30ae2d26 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -659,6 +659,7 @@ int skill_get_time2( int id ,int lv ){ skill_get (skill_db[id].upkeep_time2[lv-1 int skill_get_castdef( int id ){ skill_get (skill_db[id].cast_def_rate, id, 1); } int skill_get_weapontype( int id ){ skill_get (skill_db[id].weapon, id, 1); } int skill_get_ammotype( int id ){ skill_get (skill_db[id].ammo, id, 1); } +int skill_get_ammo_qty( int id, int lv ){ skill_get (skill_db[id].ammo_qty[lv-1], id, lv); } int skill_get_inf2( int id ){ skill_get (skill_db[id].inf2, id, 1); } int skill_get_castcancel( int id ){ skill_get (skill_db[id].castcancel, id, 1); } int skill_get_maxcount( int id ){ skill_get (skill_db[id].maxcount, id, 1); } @@ -7543,7 +7544,7 @@ static int skill_check_condition_hermod_sub(struct block_list *bl,va_list ap) */ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int type) { - int i,j,hp,sp,hp_rate,sp_rate,zeny,weapon,ammo,state,spiritball,mhp; + int i,j,hp,sp,hp_rate,sp_rate,zeny,weapon,ammo,ammo_qty,state,spiritball,mhp; int index[10],itemid[10],amount[10]; int force_gem_flag = 0; int delitem_flag = 1, checkitem_flag = 1; @@ -7630,6 +7631,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ zeny = skill_db[j].zeny[lv-1]; weapon = skill_db[j].weapon; ammo = skill_db[j].ammo; + ammo_qty = skill_db[j].ammo_qty[lv-1]; state = skill_db[j].state; spiritball = skill_db[j].spiritball[lv-1]; mhp = skill_db[j].mhp[lv-1]; /* ?Á”ïHP */ @@ -7651,8 +7653,12 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ if (!ammo && sd->status.weapon == 11 && skill && skill != HT_PHANTASMIC && skill != GS_MAGICALBULLET && skill_get_type(skill) == BF_WEAPON && !(skill_get_nk(skill)&NK_NO_DAMAGE) - ) //Assume this skill is using the weapon, therefore it requires arrows. + ) + { //Assume this skill is using the weapon, therefore it requires arrows. ammo = 2; //1<<1 <- look 1 (arrows) moved right 1 times. + ammo_qty = skill_get_num(skill, lv); + if (ammo_qty < 0) ammo_qty *= -1; + } switch(skill) { // Check for cost reductions due to skills & SCs case MC_MAMMONITE: @@ -8081,6 +8087,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ if(ammo) { //Skill requires stuff equipped in the arrow slot. if((i=sd->equip_index[10]) < 0 || !sd->inventory_data[i] || + sd->status.inventory[i].amount < ammo_qty || !(ammo&1<inventory_data[i]->look) ) { clif_arrow_fail(sd,0); @@ -8217,7 +8224,7 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ pc_delitem(sd,index[i],amount[i],0); // ƒAƒCƒeƒ€?Á”ï } if (ammo && battle_config.arrow_decrement) - pc_delitem(sd,sd->equip_index[10],1,0); + pc_delitem(sd,sd->equip_index[10],ammo_qty,0); } if(type&2) @@ -10653,8 +10660,8 @@ int skill_readdb(void) char *split[50]; if(line[0]=='/' && line[1]=='/') continue; - j = skill_split_str(line,split,30); - if(j < 30 || split[29]==NULL) + j = skill_split_str(line,split,32); + if(j < 32 || split[31]==NULL) continue; i=atoi(split[0]); @@ -10685,42 +10692,38 @@ int skill_readdb(void) p++; } - if( strcmpi(split[8],"hiding")==0 ) skill_db[i].state=ST_HIDING; - else if( strcmpi(split[8],"cloaking")==0 ) skill_db[i].state=ST_CLOAKING; - else if( strcmpi(split[8],"hidden")==0 ) skill_db[i].state=ST_HIDDEN; - else if( strcmpi(split[8],"riding")==0 ) skill_db[i].state=ST_RIDING; - else if( strcmpi(split[8],"falcon")==0 ) skill_db[i].state=ST_FALCON; - else if( strcmpi(split[8],"cart")==0 ) skill_db[i].state=ST_CART; - else if( strcmpi(split[8],"shield")==0 ) skill_db[i].state=ST_SHIELD; - else if( strcmpi(split[8],"sight")==0 ) skill_db[i].state=ST_SIGHT; - else if( strcmpi(split[8],"explosionspirits")==0 ) skill_db[i].state=ST_EXPLOSIONSPIRITS; - else if( strcmpi(split[8],"cartboost")==0 ) skill_db[i].state=ST_CARTBOOST; - else if( strcmpi(split[8],"recover_weight_rate")==0 ) skill_db[i].state=ST_RECOV_WEIGHT_RATE; - else if( strcmpi(split[8],"move_enable")==0 ) skill_db[i].state=ST_MOVE_ENABLE; - else if( strcmpi(split[8],"water")==0 ) skill_db[i].state=ST_WATER; + p = split[8]; + for(j=0;j<32;j++){ + l = atoi(p); + if (l) + skill_db[i].ammo |= 1<