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 --- Changelog-Trunk.txt | 10 +++++++ db/Changelog.txt | 2 ++ db/const.txt | 2 +- db/skill_db.txt | 2 +- doc/item_bonus.txt | 2 -- doc/script_commands.txt | 17 +++++++++++- 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 +-- 12 files changed, 116 insertions(+), 45 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c39a10def..202188212 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,16 @@ 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. +2007/09/09 + * 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). + * Added gethominfo (which behaves in the same way as getpetinfo). + * 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. 2007/09/09 * Modified bonus3 bAddEff/bAddEffWhenHit so that the last parameter is now passed directly as "trigger" flag. The possible trigger values are diff --git a/db/Changelog.txt b/db/Changelog.txt index 991510d03..c224513b0 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -28,6 +28,8 @@ ======================== 09/10 + * Corrected Kamaitachi's range to be 9, and the path range to be 4+SkillLv + [Skotlex] * Fixed Garm's and Bacsojin's skills being cancelable [Playtester] * Fixed Asura Strike autocast being self targetted [Playtester] 09/09 diff --git a/db/const.txt b/db/const.txt index 1114f4cea..223966ed5 100644 --- a/db/const.txt +++ b/db/const.txt @@ -395,7 +395,7 @@ bSPDrainValueRace 2029 bExpAddRace 2030 bSPGainRace 2031 bSubRace2 2032 -bAddEffWhenHitShort 2033 + bUnstripableWeapon 2034 bUnstripableArmor 2035 bUnstripableHelm 2036 diff --git a/db/skill_db.txt b/db/skill_db.txt index 31bcc3678..e1e9b8dda 100644 --- a/db/skill_db.txt +++ b/db/skill_db.txt @@ -581,7 +581,7 @@ 539,0,6,4,1,0x2,3,5,1,yes,0,0,0,magic,0 //NJ_HYOUSYOURAKU#NJ_HYOUSYOURAKU# 540,9,8,1,4,0,0,10,1:2:2:3:3:4:4:5:5:6,yes,0,0,0,magic,0 //NJ_HUUJIN#NJ_HUUJIN# 541,9,6,4,4,0x2,2:2:3:3:4,5,1,yes,0,0,0,magic,0 //NJ_RAIGEKISAI#NJ_RAIGEKISAI# -542,5:6:7:8:9,8,1,4,0,3,5,1,yes,0,0,9,magic,0 //NJ_KAMAITACHI#NJ_KAMAITACHI# +542,9,8,1,4,0,3,5,1,yes,0,0,5:6:7:8:9,magic,0 //NJ_KAMAITACHI#NJ_KAMAITACHI# 543,0,6,4,0,0x1,0,5,1,yes,0,0,0,none,0 //NJ_NEN#NJ_NEN# 544,-5,6,1,0,0x40,0,10,1,no,0,0,0,weapon,0 //NJ_ISSEN#NJ_ISSEN# diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index fd6a5becf..d31862254 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -165,8 +165,6 @@ bonus2 bHPRegenRate,n,x; Gain n HP every x milliseconds bonus2 bHPLossRate,n,x; Lose n HP every x milliseconds bonus2 bAddEffWhenHit,n,x; x/100% chance to cause n state to the enemy when being hit by physical damage -bonus2 bAddEffWhenHitShort,n,x; n% chance to cause x state to the enemy when - being hit by physical close range damage bonus2 bSkillAtk,n,x; Increase damage of skill n by x% bonus2 bSkillHeal,n,x; Increase heal amount of skill n by x% bonus2 bAddDamageByClass,n,x; When being hit by monster of class n increase diff --git a/doc/script_commands.txt b/doc/script_commands.txt index f87cba4a0..b589cf481 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -80,6 +80,8 @@ //= Removed the messy 'unitdeadsit' command reference [ultramage] //= 3.05.20070823 //= Fixed typo in 'areamonster' description (missing argument) [ultramage] +//= 3.06 20070909 +//= Added 'gethominfo' description [Skotlex] //===== Description ======================================= //= A reference manual for the eAthena scripting language, //= sorted out depending on their functionality. @@ -2761,7 +2763,7 @@ currently has active. Valid types are: 0 - Unique pet ID number as stored by the char server and distinguishing it from all other pets the characters actually have. This value is currently useless, at most you can use it to tell pets apart reliably. - 1 - Pet ID number as per 'db/pet_db.txt' - will tell you what kind of a pet it + 1 - Pet class number as per 'db/pet_db.txt' - will tell you what kind of a pet it is. 2 - Pet name. Will return "null" if there's no pet. 3 - Pet friendly level (intimacy score). 1000 is full loyalty. @@ -2769,6 +2771,19 @@ currently has active. Valid types are: 5 - Pet rename flag. 0 means this pet has not been named yet. --------------------------------------- +*gethominfo() + +This function works as a direct counterpart of 'getpetinfo': + 0 - Homunculus unique ID + 1 - Homunculus Class + 2 - Name + 3 - Friendly level (intimacy score). 100000 is full loyalty. + 4 - Hungry level. 100 is completely full. + 5 - Rename flag. 0 means this homunculus has not been named yet. + 6 - Homunculus level +--------------------------------------- + + *petstat() Returns current pet status, all are integers except name. 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-70-g09d2