From 3089bee74700694461fdc50bf9e9aa01fe589730 Mon Sep 17 00:00:00 2001 From: rud0lp20 Date: Wed, 16 May 2012 16:56:43 +0000 Subject: Fixed bugreport:5749 Amplify Magic Power should now work properly on multi-hit magical skills. Fixed bugreport:5748 Masquerade-Groomy now removes Dragon and Warg. Fixed bugreport:5751 Implemented script command in checking/mounting Dragon, Warg and MADO Gear, also made a clean up regarding MADO Gear and Warg conditions. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16114 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 2 +- src/map/battle.c | 4 ++-- src/map/pc.c | 17 +++++++++++++- src/map/pc.h | 5 +++- src/map/script.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++- src/map/skill.c | 27 ++++++++++++---------- src/map/status.c | 9 ++++---- 7 files changed, 108 insertions(+), 22 deletions(-) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a3212d43f..3bfe53522 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4257,7 +4257,7 @@ ACMD_FUNC(mount_peco) return 0; } if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) { - if( !(sd->sc.option&OPTION_MADOGEAR) ) { + if( !pc_ismadogear(sd) ) { clif_displaymessage(sd->fd,"You have mounted your Mado Gear"); pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR); } else { diff --git a/src/map/battle.c b/src/map/battle.c index b38214d52..a010eed4f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -781,7 +781,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16)); } if( sd ) { - if( (sd->sc.option&OPTION_MADOGEAR) && rnd()%100 < 50 ) { + if( pc_ismadogear(sd) && rnd()%100 < 50 ) { short element = skill_get_ele(skill_num, skill_lv); if( !skill_num || element == -1 ) { //Take weapon's element struct status_data *sstatus = NULL; @@ -952,7 +952,7 @@ int battle_addmastery(struct map_session_data *sd,struct block_list *target,int damage += (skill * 5); if( (skill = pc_checkskill(sd,NC_RESEARCHFE)) > 0 && (status->def_ele == ELE_FIRE || status->def_ele == ELE_EARTH) ) damage += (skill * 10); - if( (sd->sc.option&OPTION_MADOGEAR) ) + if( pc_ismadogear(sd) ) damage += 20 + 20 * pc_checkskill(sd, NC_MADOLICENCE); if((skill = pc_checkskill(sd,HT_BEASTBANE)) > 0 && (status->race==RC_BRUTE || status->race==RC_INSECT) ) { diff --git a/src/map/pc.c b/src/map/pc.c index 16ce1e21d..a16befff0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -7221,6 +7221,21 @@ int pc_setriding(TBL_PC* sd, int flag) return 0; } +/*========================================== + * + *------------------------------------------*/ +int pc_setmadogear(TBL_PC* sd, int flag) +{ + if( flag ){ + if( pc_checkskill(sd,NC_MADOLICENCE) > 0 ) + pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR); + } else if( pc_ismadogear(sd) ){ + pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR); + } + + return 0; +} + /*========================================== * アイテムドロップ可不可判定 *------------------------------------------*/ @@ -8422,7 +8437,7 @@ void pc_overheat(struct map_session_data *sd, int val) { int heat = val, skill, limit[] = { 10, 20, 28, 46, 66 }; - if( !(sd->sc.option&OPTION_MADOGEAR) || sd->sc.data[SC_OVERHEAT] ) + if( !pc_ismadogear(sd) || sd->sc.data[SC_OVERHEAT] ) return; // already burning skill = cap_value(pc_checkskill(sd,NC_MAINFRAME),0,4); diff --git a/src/map/pc.h b/src/map/pc.h index f607b9ada..d06e94de3 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -613,7 +613,7 @@ enum e_pc_permission { #define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK ) #define pc_iscarton(sd) ( (sd)->sc.option&OPTION_CART ) #define pc_isfalcon(sd) ( (sd)->sc.option&OPTION_FALCON ) -#define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING ) +#define pc_isriding(sd) ( (sd)->sc.option&OPTION_RIDING || (sd)->sc.option&OPTION_DRAGON ) #define pc_isinvisible(sd) ( (sd)->sc.option&OPTION_INVISIBLE ) #define pc_is50overweight(sd) ( (sd)->weight*100 >= (sd)->max_weight*battle_config.natural_heal_weight_rate ) #define pc_is90overweight(sd) ( (sd)->weight*10 >= (sd)->max_weight*9 ) @@ -623,6 +623,8 @@ enum e_pc_permission { **/ #define pc_iswug(sd) ( (sd)->sc.option&OPTION_WUG ) #define pc_isridingwug(sd) ( (sd)->sc.option&OPTION_WUGRIDER ) +// Mechanic Magic Gear +#define pc_ismadogear(sd) ( (sd)->sc.option&OPTION_MADOGEAR ) #define pc_stop_walking(sd, type) unit_stop_walking(&(sd)->bl, type) #define pc_stop_attack(sd) unit_stop_attack(&(sd)->bl) @@ -786,6 +788,7 @@ int pc_setoption(struct map_session_data *,int); int pc_setcart(struct map_session_data* sd, int type); int pc_setfalcon(struct map_session_data* sd, int flag); int pc_setriding(struct map_session_data* sd, int flag); +int pc_setmadogear(struct map_session_data* sd, int flag); int pc_changelook(struct map_session_data *,int,int); int pc_equiplookall(struct map_session_data *sd); diff --git a/src/map/script.c b/src/map/script.c index 4ca65a02a..eb1876008 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7827,7 +7827,7 @@ BUILDIN_FUNC(checkriding) if( sd == NULL ) return 0;// no player attached, report source - if( pc_isriding(sd) || sd->sc.option&OPTION_MOUNTING ) + if( pc_isriding(sd) || pc_isridingwug(sd) ) script_pushint(st, 1); else script_pushint(st, 0); @@ -7856,6 +7856,67 @@ BUILDIN_FUNC(setriding) return 0; } +/// Returns if the player has a warg. +/// +/// checkwug() -> +/// +BUILDIN_FUNC(checkwug) +{ + TBL_PC* sd; + + sd = script_rid2sd(st); + if( sd == NULL ) + return 0;// no player attached, report source + + if( pc_iswug(sd) ) + script_pushint(st, 1); + else + script_pushint(st, 0); + + return 0; +} + +/// Returns if the player is wearing MADO Gear. +/// +/// checkmadogear() -> +/// +BUILDIN_FUNC(checkmadogear) +{ + TBL_PC* sd; + + sd = script_rid2sd(st); + if( sd == NULL ) + return 0;// no player attached, report source + + if( pc_ismadogear(sd) ) + script_pushint(st, 1); + else + script_pushint(st, 0); + + return 0; +} + +/// Sets if the player is riding MADO Gear. +/// defaults to 1 +/// +/// setmadogear ; +/// setmadogear; +BUILDIN_FUNC(setmadogear) +{ + int flag = 1; + TBL_PC* sd; + + sd = script_rid2sd(st); + if( sd == NULL ) + return 0;// no player attached, report source + + if( script_hasdata(st,2) ) + flag = script_getnum(st,2); + pc_setmadogear(sd, flag); + + return 0; +} + /// Sets the save point of the player. /// /// save "",, @@ -16220,6 +16281,9 @@ struct script_function buildin_func[] = { BUILDIN_DEF(checkfalcon,""), BUILDIN_DEF(setriding,"?"), BUILDIN_DEF(checkriding,""), + BUILDIN_DEF(checkwug,""), + BUILDIN_DEF(checkmadogear,""), + BUILDIN_DEF(setmadogear,""), BUILDIN_DEF2(savepoint,"save","sii"), BUILDIN_DEF(savepoint,"sii"), BUILDIN_DEF(gettimetick,"i"), diff --git a/src/map/skill.c b/src/map/skill.c index 7e1031e1a..32d0f38fe 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -566,7 +566,7 @@ int skillnotok (int skillid, struct map_session_data *sd) /** * These skills cannot be used while in mado gear (credits to Xantara) **/ - if(sd->sc.option&OPTION_MADOGEAR) { + if( pc_ismadogear(sd) ) { clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); return 1; } @@ -3045,7 +3045,8 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) skill_area_temp[2] = 0; map_foreachinrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill_castend_damage_id); break; - case WZ_WATERBALL: + case WZ_WATERBALL: + skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if (!status_isdead(target)) skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); if (skl->type>1 && !status_isdead(target) && !status_isdead(src)) { @@ -3067,6 +3068,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) { struct block_list *nbl = NULL; // Next Target of Chain skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); // Hit a Lightning on the current Target + skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if( skl->type > 1 ) { // Remaining Chains Hit nbl = battle_getenemyarea(src,target->x,target->y,2,BL_CHAR|BL_SKILL,target->id); // Search for a new Target around current one... @@ -3087,6 +3089,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) case WL_TETRAVORTEX_WIND: case WL_TETRAVORTEX_GROUND: skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); + skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if( skl->type >= 3 ) { // Final Hit if( !status_isdead(target) ) @@ -4631,7 +4634,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } if( status_isimmune(bl) || (dstmd && (dstmd->class_ == MOBID_EMPERIUM || mob_is_battleground(dstmd))) || - (skillid == AL_HEAL && dstsd && dstsd->sc.option&OPTION_MADOGEAR) )//Mado is immune to AL_HEAL + (skillid == AL_HEAL && dstsd && pc_ismadogear(dstsd)) )//Mado is immune to AL_HEAL heal=0; if( sd && dstsd && sd->status.partner_id == dstsd->status.char_id && (sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.sex == 0 ) @@ -7777,8 +7780,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case NC_SELFDESTRUCTION: if( sd ) { - if( sd->sc.option&OPTION_MADOGEAR ) - pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR); + if( pc_ismadogear(sd) ) + pc_setmadogear(sd, 0); clif_skill_nodamage(src, bl, skillid, skilllv, 1); skill_castend_damage_id(src, src, skillid, skilllv, tick, flag); } @@ -7805,7 +7808,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( sd ) { int heal; - if( dstsd && (dstsd->sc.option&OPTION_MADOGEAR) ) + if( dstsd && pc_ismadogear(dstsd) ) { heal = dstsd->status.max_hp * (3+3*skilllv) / 100; status_heal(bl,heal,0,2); @@ -11753,7 +11756,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh return 0; } } - if( sd->sc.option&OPTION_MADOGEAR ) { + if( pc_ismadogear(sd) ) { switch( skill ) { //Blacksmiths and Mastersmiths skills are unusable when Mado is equipped. [Jobbie] case BS_REPAIRWEAPON: case WS_MELTDOWN: case BS_HAMMERFALL: case WS_CARTBOOST: @@ -12261,8 +12264,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh } break; case RETURN_TO_ELDICASTES: - if( sd->sc.option&OPTION_MADOGEAR ) { //Cannot be used if Mado is equipped. - clif_skill_fail(sd,skill,0,0); + if( pc_ismadogear(sd) ) { //Cannot be used if Mado is equipped. + clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } break; @@ -12363,7 +12366,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh * Wug **/ case ST_WUG: - if( !(sd->sc.option&OPTION_WUG) ) { + if( !pc_iswug(sd) ) { clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12372,7 +12375,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh * Riding Wug **/ case ST_RIDINGWUG: - if( !(sd->sc.option&OPTION_WUGRIDER) ){ + if( !pc_isridingwug(sd) ){ clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12381,7 +12384,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh * Mechanic **/ case ST_MADO: - if( !(sd->sc.option&OPTION_MADOGEAR) ) { + if( !pc_ismadogear(sd) ) { clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } diff --git a/src/map/status.c b/src/map/status.c index a841e4be4..11b057081 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4699,9 +4699,9 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha else if( sd ) { if( pc_isriding(sd) || sd->sc.option&(OPTION_DRAGON|OPTION_MOUNTING) ) val = 25;//Same bonus - else if( sd->sc.option&OPTION_WUGRIDER ) + else if( pc_isridingwug(sd) ) val = 15 + 5 * pc_checkskill(sd, RA_WUGRIDER); - else if( sd->sc.option&OPTION_MADOGEAR ) { + else if( pc_ismadogear(sd) ) { val = (- 10 * (5 - pc_checkskill(sd,NC_MADOLICENCE))); if( sc->data[SC_ACCELERATION] ) val += 25; @@ -7540,8 +7540,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val_flag |= 1|2|4; if( sd ) { // Removes Animals - //if( pc_isriding(sd,OPTION_RIDING|OPTION_RIDING_DRAGON|OPTION_RIDING_WUG) ) pc_setriding(sd, 0); - //if( pc_iswarg(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_WUG); + if( pc_isriding(sd) ){ pc_setriding(sd, 0); pc_setoption(sd, sd->sc.option&~OPTION_DRAGON); } + if( pc_iswug(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_WUG); + if( pc_isridingwug(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_WUGRIDER); if( pc_isfalcon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_FALCON); if( sd->status.pet_id > 0 ) pet_menu(sd, 3); if( merc_is_hom_active(sd->hd) ) merc_hom_vaporize(sd,1); -- cgit v1.2.3-70-g09d2