From e6d726f486b00d443320269a96a0e6d9a12d8d38 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 10 Sep 2007 17:07:35 +0000 Subject: - Removed bonus bAddEffWhenHitShort as it is unneeded and unused. - Corrected getpetinfo so it actually returns "null" when there's no pet and you request the name (the docs state it so). - Also cleaned up a bit getpetinfo - Added gethominfo (which behaves in the same way as getpetinfo). - The 'maxcount' skill_db field now can store independant values per skill-level, required for Kamaitachi since it uses different range values per level. - Corrected bonus3 bAutoSpell(WhenHit) to select target enemy (rather than self) for skills with inf self and inf2 'don't target self' (aka: auto-select target skills). - Corrected map_foreachinpath to do a wall check for targets beyond the initially selected tile. - Corrected Kamaitachi's range to be 9, and the path range to be 4+SkillLv git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11169 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 10 ++++++-- src/map/map.h | 3 ++- src/map/pc.c | 22 ++++++++--------- src/map/script.c | 73 +++++++++++++++++++++++++++++++++++++++++++------------- src/map/skill.c | 14 +++++------ src/map/skill.h | 4 ++-- 6 files changed, 86 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/map/map.c b/src/map/map.c index b2e0fc376..42a22d120 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1154,7 +1154,10 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y k = (xi-x0)*(x1-x0) + (yi-y0)*(y1-y0); if (k < 0 || k > len_limit) //Since more skills use this, check for ending point as well. continue; - + + if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi)) + continue; //Targets beyond the initial ending point need the wall check. + //All these shifts are to increase the precision of the intersection point and distance considering how it's //int math. k = (k<<4)/magnitude2; //k will be between 1~16 instead of 0~1 @@ -1186,7 +1189,10 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y k = (xi-x0)*(x1-x0) + (yi-y0)*(y1-y0); if (k < 0 || k > len_limit) continue; - + + if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi)) + continue; //Targets beyond the initial ending point need the wall check. + k = (k<<4)/magnitude2; //k will be between 1~16 instead of 0~1 xi<<=4; yi<<=4; diff --git a/src/map/map.h b/src/map/map.h index 8f28c8f9c..5f3672e2a 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1193,12 +1193,13 @@ enum _sp { SP_SKILL_ATK, SP_UNSTRIPABLE, SP_FREE, // 2018-2020 SP_SP_GAIN_VALUE, SP_HP_REGEN_RATE, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 SP_SUBSIZE, SP_HP_DRAIN_VALUE_RACE, SP_ADD_ITEM_HEAL_RATE, SP_SP_DRAIN_VALUE_RACE, SP_EXP_ADDRACE, // 2026-2030 - SP_SP_GAIN_RACE, SP_SUBRACE2, SP_ADDEFF_WHENHIT_SHORT, // 2031-2033 + SP_SP_GAIN_RACE, SP_SUBRACE2, SP_FREE2, // 2031-2033 SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037 SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040 SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041 //Before adding new bonuses, reuse the currently free slots: //2020 (SP_FREE) (previously SP_ADD_DAMAGE_BY_CLASS) + //2033 (SP_FREE2) (previously SP_ADDEFF_WHENHIT_SHORT) }; enum _look { diff --git a/src/map/pc.c b/src/map/pc.c index dc69041eb..2578903a0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2201,14 +2201,6 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) if(sd->state.lr_flag != 2) pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), type2, val, 0, 0); break; - case SP_ADDEFF_WHENHIT_SHORT: - if (type2 > SC_MAX) { - ShowWarning("pc_bonus2 (Add Effect when hit short): %d is not supported.\n", type2); - break; - } - if(sd->state.lr_flag != 2) - pc_bonus_addeff(sd->addeff2, ARRAYLENGTH(sd->addeff2), type2, val, 0, ATF_SHORT); - break; case SP_SKILL_ATK: if(sd->state.lr_flag == 2) break; @@ -2387,15 +2379,21 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) break; case SP_AUTOSPELL: if(sd->state.lr_flag != 2) + { + int target = skill_get_inf(type2); //Support or Self (non-auto-target) skills should pick self. + target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill_get_inf2(type2)&INF2_NO_TARGET_SELF)); pc_bonus_autospell(sd->autospell, ARRAYLENGTH(sd->autospell), - skill_get_inf(type2)&(INF_SELF_SKILL|INF_SUPPORT_SKILL)?-type2:type2, - type3, val, 0, current_equip_card_id); + target?-type2:type2, type3, val, 0, current_equip_card_id); + } break; case SP_AUTOSPELL_WHENHIT: if(sd->state.lr_flag != 2) + { + int target = skill_get_inf(type2); //Support or Self (non-auto-target) skills should pick self. + target = target&INF_SUPPORT_SKILL || (target&INF_SELF_SKILL && !(skill_get_inf2(type2)&INF2_NO_TARGET_SELF)); pc_bonus_autospell(sd->autospell2, ARRAYLENGTH(sd->autospell2), - skill_get_inf(type2)&(INF_SELF_SKILL|INF_SUPPORT_SKILL)?-type2:type2, - type3, val, 0, current_equip_card_id); + target?-type2:type2, type3, val, 0, current_equip_card_id); + } break; case SP_SP_DRAIN_RATE: if(!sd->state.lr_flag) { diff --git a/src/map/script.c b/src/map/script.c index 7e36818e9..a5dc7696b 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -11062,27 +11062,68 @@ BUILDIN_FUNC(recovery) BUILDIN_FUNC(getpetinfo) { TBL_PC *sd=script_rid2sd(st); - struct pet_data *pd; + TBL_PET *pd; int type=script_getnum(st,2); + + if(!sd || !sd->pd) { + if (type == 2) + script_pushconststr(st,"null"); + else + script_pushint(st,0); + return 0; + } + pd = sd->pd; + switch(type){ + case 0: script_pushint(st,pd->pet.pet_id); break; + case 1: script_pushint(st,pd->pet.class_); break; + case 2: script_pushstr(st,aStrdup(pd->pet.name)); break; + case 3: script_pushint(st,pd->pet.intimate); break; + case 4: script_pushint(st,pd->pet.hungry); break; + case 5: script_pushint(st,pd->pet.rename_flag); break; + default: + script_pushint(st,0); + break; + } + return 0; +} - if(sd && sd->status.pet_id && sd->pd){ - pd = sd->pd; - switch(type){ - case 0: script_pushint(st,sd->status.pet_id); break; - case 1: script_pushint(st,pd->pet.class_); break; - case 2: script_pushstr(st,aStrdup(pd->pet.name)); break; - case 3: script_pushint(st,pd->pet.intimate); break; - case 4: script_pushint(st,pd->pet.hungry); break; - case 5: script_pushint(st,pd->pet.rename_flag); break; - default: - script_pushint(st,0); - break; - } - }else{ - script_pushint(st,0); +/*========================================== + * Get your homunculus info: gethominfo(n) + * n -> 0:hom_id 1:class 2:name + * 3:friendly 4:hungry, 5: rename flag. + * 6: level + *------------------------------------------*/ +BUILDIN_FUNC(gethominfo) +{ + TBL_PC *sd=script_rid2sd(st); + TBL_HOM *hd; + int type=script_getnum(st,2); + + hd = sd?sd->hd:NULL; + if(!merc_is_hom_active(hd)) + { + if (type == 2) + script_pushconststr(st,"null"); + else + script_pushint(st,0); + return 0; + } + + switch(type){ + case 0: script_pushint(st,hd->homunculus.hom_id); break; + case 1: script_pushint(st,hd->homunculus.class_); break; + case 2: script_pushstr(st,aStrdup(hd->homunculus.name)); break; + case 3: script_pushint(st,hd->homunculus.intimacy); break; + case 4: script_pushint(st,hd->homunculus.hunger); break; + case 5: script_pushint(st,hd->homunculus.rename_flag); break; + case 6: script_pushint(st,hd->homunculus.level); break; + default: + script_pushint(st,0); + break; } return 0; } + /*========================================== * Shows wether your inventory(and equips) contain selected card or not. diff --git a/src/map/skill.c b/src/map/skill.c index 9c0ac2f46..27701cf40 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -709,7 +709,7 @@ 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); } +int skill_get_maxcount( int id ,int lv ){ skill_get (skill_db[id].maxcount[lv-1], id, lv); } int skill_get_blewcount( int id ,int lv ){ skill_get (skill_db[id].blewcount[lv-1], id, lv); } int skill_get_mhp( int id ,int lv ){ skill_get (skill_db[id].mhp[lv-1], id, lv); } int skill_get_castnodex( int id ,int lv ){ skill_get (skill_db[id].castnodex[lv-1], id, lv); } @@ -2920,7 +2920,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int //line of sight between caster and target. skill_area_temp[1] = bl->id; map_foreachinpath (skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid), BL_CHAR, + skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid,skilllv), BL_CHAR, skill_get_type(skillid),src,src,skillid,skilllv,tick,flag,BCT_ENEMY); break; @@ -2931,7 +2931,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case NPC_THUNDERBREATH: skill_area_temp[1] = bl->id; map_foreachinpath(skill_attack_area,src->m,src->x,src->y,bl->x,bl->y, - skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid), BL_CHAR, + skill_get_splash(skillid, skilllv),skill_get_maxcount(skillid,skilllv), BL_CHAR, skill_get_type(skillid),src,src,skillid,skilllv,tick,flag,BCT_ENEMY); break; @@ -5974,7 +5974,7 @@ int skill_castend_pos (int tid, unsigned int tick, int id, int data) break; if(battle_config.land_skill_limit && src->type&battle_config.land_skill_limit && - (maxcount = skill_get_maxcount(ud->skillid)) > 0 + (maxcount = skill_get_maxcount(ud->skillid, ud->skilllv)) > 0 ) { int i; for(i=0;iskillunit[i] && maxcount;i++) { @@ -6492,7 +6492,7 @@ int skill_castend_map (struct map_session_data *sd, int skill_num, const char *m p[2] = &sd->status.memo_point[1]; p[3] = &sd->status.memo_point[2]; - if((maxcount = skill_get_maxcount(skill_num)) > 0) { + if((maxcount = skill_get_maxcount(skill_num, sd->menuskill_val)) > 0) { for(i=0;iud.skillunit[i] && maxcount;i++) { if(sd->ud.skillunit[i]->skill_id == skill_num) maxcount--; @@ -8388,7 +8388,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t int c=0; int summons[5] = { 1589, 1579, 1575, 1555, 1590 }; //int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; - int maxcount = (skill==AM_CANNIBALIZE)? 6-lv : skill_get_maxcount(skill); + int maxcount = (skill==AM_CANNIBALIZE)? 6-lv : skill_get_maxcount(skill,lv); int mob_class = (skill==AM_CANNIBALIZE)? summons[lv-1] :1142; if(battle_config.land_skill_limit && maxcount>0 && (battle_config.land_skill_limit&BL_PC)) { i = map_foreachinmap(skill_check_condition_mob_master_sub ,sd->bl.m, BL_MOB, sd->bl.id, mob_class, skill, &c); @@ -11355,7 +11355,7 @@ int skill_readdb (void) skill_db[i].castcancel=0; skill_db[i].cast_def_rate=atoi(split[10]); skill_db[i].inf2=(int)strtol(split[11], NULL, 0); - skill_db[i].maxcount=atoi(split[12]); + skill_split_atoi(split[12], skill_db[i].maxcount); if(strcmpi(split[13],"weapon") == 0) skill_db[i].skill_type=BF_WEAPON; else if(strcmpi(split[13],"magic") == 0) diff --git a/src/map/skill.h b/src/map/skill.h index c67d65588..5195c728d 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -66,7 +66,7 @@ struct skill_db { int cast[MAX_SKILL_LEVEL],walkdelay[MAX_SKILL_LEVEL],delay[MAX_SKILL_LEVEL]; int upkeep_time[MAX_SKILL_LEVEL],upkeep_time2[MAX_SKILL_LEVEL]; int castcancel,cast_def_rate; - int inf2,maxcount,skill_type; + int inf2,maxcount[MAX_SKILL_LEVEL],skill_type; int blewcount[MAX_SKILL_LEVEL]; int hp[MAX_SKILL_LEVEL],sp[MAX_SKILL_LEVEL],mhp[MAX_SKILL_LEVEL],hp_rate[MAX_SKILL_LEVEL],sp_rate[MAX_SKILL_LEVEL],zeny[MAX_SKILL_LEVEL]; int weapon,ammo,ammo_qty[MAX_SKILL_LEVEL],state,spiritball[MAX_SKILL_LEVEL]; @@ -179,7 +179,7 @@ int skill_get_nocast( int id ); int skill_get_unit_id(int id,int flag); int skill_get_inf2( int id ); int skill_get_castcancel( int id ); -int skill_get_maxcount( int id ); +int skill_get_maxcount( int id ,int lv ); int skill_get_blewcount( int id ,int lv ); int skill_get_unit_flag( int id ); int skill_get_unit_target( int id ); -- cgit v1.2.3-60-g2f50