diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-09-14 18:46:41 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-09-14 18:46:41 +0000 |
commit | d83a44942aa80b5392a1b7cf519ccfe83ead0b6e (patch) | |
tree | da900aa664f3b95ce8f5a62877bd773a658cc103 /src | |
parent | 16d3c9a29e6418c61060e967ee355f833a5502a5 (diff) | |
download | hercules-d83a44942aa80b5392a1b7cf519ccfe83ead0b6e.tar.gz hercules-d83a44942aa80b5392a1b7cf519ccfe83ead0b6e.tar.bz2 hercules-d83a44942aa80b5392a1b7cf519ccfe83ead0b6e.tar.xz hercules-d83a44942aa80b5392a1b7cf519ccfe83ead0b6e.zip |
- Gravitional Field is now a MISC type of attack.
- battle_calc_return_damage now is only for BF_WEAPON attacks, added skill_magic_reflect to check whether a spell is bounced back or not.
- Magic reflection now effectively switches the caster/target (after damage has been calculated)
- Now when GTB completely blocks a spell, the spell animation will still come off, but with a single bolt and MISS damage.
- Removed hom_setting&0x2 since Homunculus can be hit by land spells.
- Monster Property now gives a Skill Failed message when attempted on players.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11203 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 66 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/skill.c | 62 |
3 files changed, 72 insertions, 58 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index 3ff567b90..9264fbedf 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2155,9 +2155,6 @@ struct Damage battle_calc_magic_attack( if(mflag) //mflag has a value when it was checked against an undead in skill.c [Skotlex] ad.blewcount = 0; //No knockback break; - case HW_GRAVITATION: - ad.dmotion = 0; //No flinch animation. - break; case PR_SANCTUARY: ad.dmotion = 0; //No flinch animation. break; @@ -2202,9 +2199,6 @@ struct Damage battle_calc_magic_attack( case PF_SOULBURN: ad.damage = tstatus->sp * 2; break; - case HW_GRAVITATION: - ad.damage = 200+200*skill_lv; - break; default: { if (skill_num == NPC_EARTHQUAKE) { @@ -2556,6 +2550,10 @@ struct Damage battle_calc_misc_attack( md.damage = 500+rand()%500 + 5*skill_lv * sstatus->int_; nk|=NK_IGNORE_FLEE|NK_NO_ELEFIX; //These two are not properties of the weapon based part. break; + case HW_GRAVITATION: + md.damage = 200+200*skill_lv; + md.dmotion = 0; //No flinch animation. + break; } if (nk&NK_SPLASHSPLIT){ // Divide ATK among targets @@ -2678,8 +2676,8 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl return d; } -//Calculates returned damage. direct is true if the skill was a direct attack (that is, not from another source, like a land spell -int battle_calc_return_damage(struct block_list* bl, int* damage, int direct, int flag) +//Calculates BF_WEAPON returned damage. +int battle_calc_return_damage(struct block_list* bl, int damage, int flag) { struct map_session_data* sd = NULL; struct status_change* sc; @@ -2690,37 +2688,23 @@ int battle_calc_return_damage(struct block_list* bl, int* damage, int direct, in if(sc && !sc->count) sc = NULL; - if(flag&BF_WEAPON && direct) { - //Bounces back part of the damage. - if (flag & BF_SHORT) { - if (sd && sd->short_weapon_damage_return) - { - rdamage += *damage * sd->short_weapon_damage_return / 100; - if(rdamage < 1) rdamage = 1; - } - if (sc && sc->data[SC_REFLECTSHIELD].timer != -1) - { - rdamage += *damage * sc->data[SC_REFLECTSHIELD].val2 / 100; - if (rdamage < 1) rdamage = 1; - } - } else if (flag & BF_LONG) { - if (sd && sd->long_weapon_damage_return) - { - rdamage += *damage * sd->long_weapon_damage_return / 100; - if (rdamage < 1) rdamage = 1; - } + //Bounces back part of the damage. + if (flag & BF_SHORT) { + if (sd && sd->short_weapon_damage_return) + { + rdamage += damage * sd->short_weapon_damage_return / 100; + if(rdamage < 1) rdamage = 1; } - } else - // magic_damage_return by [AppleGirl] and [Valaris] - if(flag&BF_MAGIC) - { - if( - (sd && sd->magic_damage_return && direct && rand()%100 < sd->magic_damage_return) - || (sc && sc->data[SC_MAGICMIRROR].timer != -1 && rand()%100 < sc->data[SC_MAGICMIRROR].val2) - ) - { //Bounces back full damage, you take none. - rdamage = *damage; - *damage = 0; + if (sc && sc->data[SC_REFLECTSHIELD].timer != -1) + { + rdamage += damage * sc->data[SC_REFLECTSHIELD].val2 / 100; + if (rdamage < 1) rdamage = 1; + } + } else if (flag & BF_LONG) { + if (sd && sd->long_weapon_damage_return) + { + rdamage += damage * sd->long_weapon_damage_return / 100; + if (rdamage < 1) rdamage = 1; } } return rdamage; @@ -2909,7 +2893,7 @@ int battle_weapon_attack(struct block_list* src, struct block_list* target, unsi damage = wd.damage + wd.damage2; if (damage > 0 && src != target) { - rdamage = battle_calc_return_damage(target, &damage, 1, wd.flag); + rdamage = battle_calc_return_damage(target, damage, wd.flag); if (rdamage > 0) { rdelay = clif_damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0); //Use Reflect Shield to signal this kind of skill trigger. [Skotlex] @@ -3162,10 +3146,6 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if (!su->group) return 0; - //For some mysterious reason ground-skills can't target homun. - if (target->type == BL_HOM && battle_config.hom_setting&0x2) - return 0; - if (su->group->src_id == target->id) { int inf2; diff --git a/src/map/battle.h b/src/map/battle.h index a4bab9b54..e4704ce2f 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -25,7 +25,7 @@ struct block_list; struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag); -int battle_calc_return_damage(struct block_list *bl, int *damage, int direct, int flag); +int battle_calc_return_damage(struct block_list *bl, int damage, int flag); void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss); diff --git a/src/map/skill.c b/src/map/skill.c index c2aa881f4..0740aa8ae 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1889,6 +1889,35 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in return count; //Return amount of knocked back cells. } + +//Checks if there should be magic reflection. +//type is the type of magic attack: 0: indirect (aoe), 1: direct (targetted) +static int skill_magic_reflect(struct block_list *src, struct block_list *target, int type) +{ + struct status_change *sc = status_get_sc(target); + struct map_session_data *sd; + BL_CAST(BL_PC, src, sd); + + if(sd && sd->magic_damage_return && type && rand()%100 < sd->magic_damage_return) + return 1; + + if(sc && sc->count) + { + if(sc->data[SC_MAGICMIRROR].timer != -1 && rand()%100 < sc->data[SC_MAGICMIRROR].val2) + return 1; + + if(sc->data[SC_KAITE].timer != -1 && (sd || status_get_lv(src) <= 80)) + { //Works on players or mobs with level under 80. + clif_specialeffect(target, 438, AREA); + if (--sc->data[SC_KAITE].val2 <= 0) + status_change_end(target, SC_KAITE, -1); + return 1; + } + } + + return 0; +} + /* * ========================================================================= * Does a skill attack with the given properties. @@ -1964,16 +1993,15 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } if (attack_type&BF_MAGIC) { - if(sc && sc->data[SC_KAITE].timer != -1 && (dmg.damage || dmg.damage2) - && !(sstatus->mode&MD_BOSS) && (sd || status_get_lv(src) <= 80) ) - { //Works on players or mobs with level under 80. - clif_specialeffect(bl, 438, AREA); - if (--sc->data[SC_KAITE].val2 <= 0) - status_change_end(bl, SC_KAITE, -1); - clif_skill_nodamage(bl,src,skillid,skilllv,1); - bl = src; //Just make the skill attack yourself @.@ + if (!(sstatus->mode&MD_BOSS) && (dmg.damage || dmg.damage2) && + skill_magic_reflect(src, bl, src==dsrc)) + { //Magic reflection, switch caster/target + struct block_list *tbl = bl; + bl = src; + src = tbl; + BL_CAST(BL_PC, src, sd); + BL_CAST(BL_PC, bl, tsd); sc = status_get_sc(bl); - tsd = (bl->type == BL_PC)?(TBL_PC*)bl:NULL; if (sc && !sc->count) sc = NULL; //Don't need it. //Spirit of Wizard blocks bounced back spells. @@ -2016,8 +2044,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds damage = dmg.damage + dmg.damage2; - if (damage > 0 && src != bl && skillid != WS_CARTTERMINATION) // FIXME(?): Quick and dirty check, but HSCR does bypass Shield Reflect... so I make it bypass the whole reflect thing [DracoRPG] - rdamage = battle_calc_return_damage(bl, &damage, src == dsrc, dmg.flag); + if (damage > 0 && dmg.flag&BF_WEAPON && src != bl && src == dsrc && + skillid != WS_CARTTERMINATION) // FIXME(?): Quick and dirty check, but HSCR does bypass Shield Reflect... so I make it bypass the whole reflect thing [DracoRPG] + rdamage = battle_calc_return_damage(bl, damage, dmg.flag); //Skill hit type type=(skillid==0)?5:skill_get_hit(skillid); @@ -2775,8 +2804,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int return 1; if (skillid && skill_get_type(skillid) == BF_MAGIC && status_isimmune(bl) == 100) - { //GTB makes all targetted magic fail silently. - if (sd) clif_skill_fail(sd,skillid,0,0); + { //GTB makes all targetted magic display miss with a single bolt. + clif_skill_damage(src, bl, tick, status_get_amotion(src), tstatus->dmotion, + 0, 1, skillid, skilllv, skill_get_hit(skillid)); return 1; } @@ -4483,6 +4513,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case WZ_ESTIMATION: if(sd) { + if (dstsd) { + clif_skill_fail(sd,skillid,0,0); + break; + } clif_skill_nodamage(src,bl,skillid,skilllv,1); clif_skill_estimation((struct map_session_data *)src,bl); } @@ -7545,7 +7579,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns break; case UNT_GRAVITATION: - skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; case UNT_DESPERADO: |