- Added function battle_calc_gvg_damage for gvg related damage reductions. Fixes Gravitation being reduced as well as Pressure overriding max-castles restriction.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5588 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
557741cf43
commit
2f1e8fcdaa
@ -5,6 +5,9 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
|
|||||||
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
|
||||||
|
|
||||||
2006/03/13
|
2006/03/13
|
||||||
|
* Added function battle_calc_gvg_damage for gvg related damage reductions.
|
||||||
|
Fixes Gravitation being reduced as well as Pressure overriding max-castles
|
||||||
|
restriction. [Skotlex]
|
||||||
* Corrected char-server parameters so that the subnet config file is the
|
* Corrected char-server parameters so that the subnet config file is the
|
||||||
third parameter, not the second (which was conflicting with
|
third parameter, not the second (which was conflicting with
|
||||||
inter_athena.conf's argument), thanks to foobar. [Skotlex]
|
inter_athena.conf's argument), thanks to foobar. [Skotlex]
|
||||||
|
139
src/map/battle.c
139
src/map/battle.c
@ -535,15 +535,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
|
|||||||
struct mob_data *md = NULL;
|
struct mob_data *md = NULL;
|
||||||
struct status_change *sc;
|
struct status_change *sc;
|
||||||
struct status_change_entry *sci;
|
struct status_change_entry *sci;
|
||||||
int class_;
|
|
||||||
|
|
||||||
nullpo_retr(0, bl);
|
nullpo_retr(0, bl);
|
||||||
|
|
||||||
if (damage <= 0)
|
if (damage <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
class_ = status_get_class(bl);
|
|
||||||
|
|
||||||
if (bl->type == BL_MOB) {
|
if (bl->type == BL_MOB) {
|
||||||
md=(struct mob_data *)bl;
|
md=(struct mob_data *)bl;
|
||||||
} else if (bl->type == BL_PC) {
|
} else if (bl->type == BL_PC) {
|
||||||
@ -704,49 +701,17 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(md && md->guardian_data) {
|
if (battle_config.pk_mode && bl->type == BL_PC && damage > 0) {
|
||||||
if(class_ == MOBID_EMPERIUM && (flag&BF_SKILL && //Only a few skills can hit the Emperium.
|
if (flag & BF_WEAPON) {
|
||||||
skill_num != PA_PRESSURE && skill_num != MO_TRIPLEATTACK && skill_num != HW_GRAVITATION))
|
if (flag & BF_SHORT)
|
||||||
return 0;
|
damage = damage * 80/100;
|
||||||
if(src->type == BL_PC) {
|
if (flag & BF_LONG)
|
||||||
struct guild *g=guild_search(((struct map_session_data *)src)->status.guild_id);
|
damage = damage * 70/100;
|
||||||
if (g && class_ == MOBID_EMPERIUM && guild_checkskill(g,GD_APPROVAL) <= 0)
|
|
||||||
return 0;
|
|
||||||
if (g && battle_config.guild_max_castles && guild_checkcastles(g)>=battle_config.guild_max_castles)
|
|
||||||
return 0; // [MouseJstr]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (skill_num != PA_PRESSURE) { // Gloria Domini ignores WoE damage reductions
|
|
||||||
if (map_flag_gvg(bl->m)) { //GvG
|
|
||||||
if (md && md->guardian_data)
|
|
||||||
damage -= damage * (md->guardian_data->castle->defense/100) * (battle_config.castle_defense_rate/100);
|
|
||||||
|
|
||||||
if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
|
|
||||||
if (flag&BF_WEAPON)
|
|
||||||
damage = damage * battle_config.gvg_weapon_damage_rate/100;
|
|
||||||
if (flag&BF_MAGIC)
|
|
||||||
damage = damage * battle_config.gvg_magic_damage_rate/100;
|
|
||||||
if (flag&BF_MISC)
|
|
||||||
damage = damage * battle_config.gvg_misc_damage_rate/100;
|
|
||||||
} else { //Normal attacks get reductions based on range.
|
|
||||||
if (flag & BF_SHORT)
|
|
||||||
damage = damage * battle_config.gvg_short_damage_rate/100;
|
|
||||||
if (flag & BF_LONG)
|
|
||||||
damage = damage * battle_config.gvg_long_damage_rate/100;
|
|
||||||
}
|
|
||||||
} else if (battle_config.pk_mode && bl->type == BL_PC) {
|
|
||||||
if (flag & BF_WEAPON) {
|
|
||||||
if (flag & BF_SHORT)
|
|
||||||
damage = damage * 80/100;
|
|
||||||
if (flag & BF_LONG)
|
|
||||||
damage = damage * 70/100;
|
|
||||||
}
|
|
||||||
if (flag & BF_MAGIC)
|
|
||||||
damage = damage * 60/100;
|
|
||||||
if(flag & BF_MISC)
|
|
||||||
damage = damage * 60/100;
|
|
||||||
}
|
}
|
||||||
|
if (flag & BF_MAGIC)
|
||||||
|
damage = damage * 60/100;
|
||||||
|
if(flag & BF_MISC)
|
||||||
|
damage = damage * 60/100;
|
||||||
if(damage < 1) damage = 1;
|
if(damage < 1) damage = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,6 +734,74 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
|
|||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*==========================================
|
||||||
|
* Calculates GVG related damage adjustments.
|
||||||
|
*------------------------------------------
|
||||||
|
*/
|
||||||
|
int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag)
|
||||||
|
{
|
||||||
|
struct mob_data *md = NULL;
|
||||||
|
int class_;
|
||||||
|
|
||||||
|
if (damage <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
class_ = status_get_class(bl);
|
||||||
|
|
||||||
|
if (bl->type == BL_MOB)
|
||||||
|
md=(struct mob_data *)bl;
|
||||||
|
|
||||||
|
if(md && md->guardian_data) {
|
||||||
|
if(class_ == MOBID_EMPERIUM && flag&BF_SKILL)
|
||||||
|
//SKill inmunity.
|
||||||
|
switch (skill_num) {
|
||||||
|
case PA_PRESSURE:
|
||||||
|
case MO_TRIPLEATTACK:
|
||||||
|
case HW_GRAVITATION:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if(src->type != BL_MOB) {
|
||||||
|
struct guild *g=guild_search(status_get_guild_id(src));
|
||||||
|
if (!g) return 0;
|
||||||
|
if (class_ == MOBID_EMPERIUM && guild_checkskill(g,GD_APPROVAL) <= 0)
|
||||||
|
return 0;
|
||||||
|
if (battle_config.guild_max_castles &&
|
||||||
|
guild_checkcastles(g)>=battle_config.guild_max_castles)
|
||||||
|
return 0; // [MouseJstr]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (skill_num) {
|
||||||
|
//Skills with no damage reduction.
|
||||||
|
case PA_PRESSURE:
|
||||||
|
case HW_GRAVITATION:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (md && md->guardian_data) {
|
||||||
|
damage -= damage
|
||||||
|
* (md->guardian_data->castle->defense/100)
|
||||||
|
* (battle_config.castle_defense_rate/100);
|
||||||
|
}
|
||||||
|
if (flag & BF_SKILL) { //Skills get a different reduction than non-skills. [Skotlex]
|
||||||
|
if (flag&BF_WEAPON)
|
||||||
|
damage = damage * battle_config.gvg_weapon_damage_rate/100;
|
||||||
|
if (flag&BF_MAGIC)
|
||||||
|
damage = damage * battle_config.gvg_magic_damage_rate/100;
|
||||||
|
if (flag&BF_MISC)
|
||||||
|
damage = damage * battle_config.gvg_misc_damage_rate/100;
|
||||||
|
} else { //Normal attacks get reductions based on range.
|
||||||
|
if (flag & BF_SHORT)
|
||||||
|
damage = damage * battle_config.gvg_short_damage_rate/100;
|
||||||
|
if (flag & BF_LONG)
|
||||||
|
damage = damage * battle_config.gvg_long_damage_rate/100;
|
||||||
|
}
|
||||||
|
if(damage < 1) damage = 1;
|
||||||
|
}
|
||||||
|
return damage;
|
||||||
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* HP/SP‹z<EFBFBD>û‚ÌŒv<EFBFBD>Z
|
* HP/SP‹z<EFBFBD>û‚ÌŒv<EFBFBD>Z
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
@ -2329,14 +2362,21 @@ static struct Damage battle_calc_weapon_attack(
|
|||||||
|
|
||||||
if(wd.damage > 0 || wd.damage2 > 0)
|
if(wd.damage > 0 || wd.damage2 > 0)
|
||||||
{
|
{
|
||||||
if(wd.damage2<1)
|
if(wd.damage2<1) {
|
||||||
wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
|
wd.damage=battle_calc_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
else if(wd.damage<1)
|
if (map_flag_gvg(target->m))
|
||||||
|
wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
|
} else if(wd.damage<1) {
|
||||||
wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
|
wd.damage2=battle_calc_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
|
if (map_flag_gvg(target->m))
|
||||||
|
wd.damage2=battle_calc_gvg_damage(src,target,wd.damage2,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int d1=wd.damage+wd.damage2,d2=wd.damage2;
|
int d1=wd.damage+wd.damage2,d2=wd.damage2;
|
||||||
wd.damage=battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag);
|
wd.damage=battle_calc_damage(src,target,d1,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
|
if (map_flag_gvg(target->m))
|
||||||
|
wd.damage=battle_calc_gvg_damage(src,target,wd.damage,wd.div_,skill_num,skill_lv,wd.flag);
|
||||||
wd.damage2=(d2*100/d1)*wd.damage/100;
|
wd.damage2=(d2*100/d1)*wd.damage/100;
|
||||||
if(wd.damage > 1 && wd.damage2 < 1) wd.damage2=1;
|
if(wd.damage > 1 && wd.damage2 < 1) wd.damage2=1;
|
||||||
wd.damage-=wd.damage2;
|
wd.damage-=wd.damage2;
|
||||||
@ -2820,6 +2860,8 @@ struct Damage battle_calc_magic_attack(
|
|||||||
}
|
}
|
||||||
|
|
||||||
ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
|
ad.damage=battle_calc_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
|
||||||
|
if (map_flag_gvg(target->m))
|
||||||
|
ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag);
|
||||||
if (ad.damage == 0) //Magic attack blocked? Consider it a miss so it doesn't invokes additional effects. [Skotlex]
|
if (ad.damage == 0) //Magic attack blocked? Consider it a miss so it doesn't invokes additional effects. [Skotlex]
|
||||||
ad.dmg_lv = ATK_FLEE;
|
ad.dmg_lv = ATK_FLEE;
|
||||||
return ad;
|
return ad;
|
||||||
@ -3036,7 +3078,8 @@ struct Damage battle_calc_misc_attack(
|
|||||||
|
|
||||||
if (skill_num != PA_PRESSURE) //Pressure ignores all these things...
|
if (skill_num != PA_PRESSURE) //Pressure ignores all these things...
|
||||||
damage=battle_calc_damage(bl,target,damage,div_,skill_num,skill_lv,aflag); // <20>Å<EFBFBD>I<EFBFBD>C<EFBFBD>³
|
damage=battle_calc_damage(bl,target,damage,div_,skill_num,skill_lv,aflag); // <20>Å<EFBFBD>I<EFBFBD>C<EFBFBD>³
|
||||||
|
if (map_flag_gvg(target->m))
|
||||||
|
damage=battle_calc_gvg_damage(bl,target,damage,div_,skill_num,skill_lv,aflag);
|
||||||
md.damage=damage;
|
md.damage=damage;
|
||||||
md.div_=div_;
|
md.div_=div_;
|
||||||
md.blewcount=blewcount;
|
md.blewcount=blewcount;
|
||||||
|
@ -31,6 +31,8 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag
|
|||||||
|
|
||||||
// ダメージ最終計算
|
// ダメージ最終計算
|
||||||
int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
|
int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
|
||||||
|
int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int damage,int div_,int skill_num,int skill_lv,int flag);
|
||||||
|
|
||||||
enum { // 最終計算のフラグ
|
enum { // 最終計算のフラグ
|
||||||
BF_WEAPON = 0x0001,
|
BF_WEAPON = 0x0001,
|
||||||
BF_MAGIC = 0x0002,
|
BF_MAGIC = 0x0002,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user