summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c134
1 files changed, 106 insertions, 28 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index d06e02f6c..372616f83 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -988,7 +988,6 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_change_end(bl,SC_VOICEOFSIREN,INVALID_TIMER);
}
-
//Finally damage reductions....
// Assumptio doubles the def & mdef on RE mode, otherwise gives a reduction on the final damage. [Igniz]
#ifndef RENEWAL
@@ -1039,7 +1038,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
#ifdef RENEWAL
if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION)
#else
- if(sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)
+ if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION))
#endif
{
struct status_data *status = status_get_status_data(bl);
@@ -1143,7 +1142,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( sc && sc->data[SC__SHADOWFORM] ) {
struct block_list *s_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2);
- if( !s_bl ) { // If the shadow form target is not present remove the sc.
+ if( !s_bl || s_bl->m != bl->m ) { // If the shadow form target is not present remove the sc.
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
} else if( status_isdead(s_bl) || !battle->check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both.
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
@@ -1833,7 +1832,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.div_ = skill->get_num(GS_CHAINACTION,skill_lv);
wd.type = 0x08;
}
- else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW
+ else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW
&& (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->status.inventory[i].amount > 1){
int chance = rand()%100;
wd.type = 0x08;
@@ -1909,10 +1908,13 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if (rnd()%1000 < cri)
flag.cri = 1;
}
- if (flag.cri)
- {
+ if (flag.cri) {
wd.type = 0x0a;
+#ifdef RENEWAL
+ flag.hit = 1;
+#else
flag.idef = flag.idef2 = flag.hit = 1;
+#endif
} else { //Check for Perfect Hit
if(sd && sd->bonus.perfect_hit > 0 && rnd()%100 < sd->bonus.perfect_hit)
flag.hit = 1;
@@ -3041,7 +3043,9 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if( sc->data[SC_EDP] ){
switch(skill_id){
case AS_SPLASHER: case AS_VENOMKNIFE:
+#ifndef RENEWAL_EDP
case AS_GRIMTOOTH:
+#endif
break;
#ifndef RENEWAL_EDP
case ASC_BREAKER: case ASC_METEORASSAULT: break;
@@ -3372,9 +3376,26 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
if(skill_id == CR_GRANDCROSS || skill_id == NPC_GRANDDARKNESS)
return wd; //Enough, rest is not needed.
-
- if (sd)
- {
+#ifndef HMAP_ZONE_DAMAGE_CAP_TYPE
+ if( src && skill_id ) {
+ for(i = 0; i < map[src->m].zone->capped_skills_count; i++) {
+ if( skill_id == map[src->m].zone->capped_skills[i]->nameid && (map[src->m].zone->capped_skills[i]->type & src->type) ) {
+ if( src->type == BL_MOB && map[src->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
+ if( (((TBL_MOB*)src)->status.mode&MD_BOSS) && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ continue;
+ if( ((TBL_MOB*)src)->special_state.clone && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ continue;
+ }
+ if( wd.damage > map[src->m].zone->capped_skills[i]->cap )
+ wd.damage = map[src->m].zone->capped_skills[i]->cap;
+ if( wd.damage2 > map[src->m].zone->capped_skills[i]->cap )
+ wd.damage2 = map[src->m].zone->capped_skills[i]->cap;
+ break;
+ }
+ }
+ }
+#endif
+ if (sd) {
if (skill_id != CR_SHIELDBOOMERANG) //Only Shield boomerang doesn't takes the Star Crumbs bonus.
ATK_ADD2(wd.div_*sd->right_weapon.star, wd.div_*sd->left_weapon.star);
if (skill_id==MO_FINGEROFFENSIVE) { //The finger offensive spheres on moment of attack do count. [Skotlex]
@@ -3387,21 +3408,23 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, 2, wd.flag);
if( flag.lh )
wd.damage2 = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage2, 3, wd.flag);
-
+#ifdef RENEWAL
+ if( flag.cri )
+ ATK_ADDRATE(sd->bonus.crit_atk_rate>=100?sd->bonus.crit_atk_rate-60:40);
+#endif
if( skill_id == CR_SHIELDBOOMERANG || skill_id == PA_SHIELDCHAIN )
{ //Refine bonus applies after cards and elements.
short index= sd->equip_index[EQI_HAND_L];
if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR )
ATK_ADD(10*sd->status.inventory[index].refine);
}
- } //if (sd)
+ }
//Card Fix, tsd side
- if(tsd)
+ if(tsd) //if player on player then it was already measured above
wd.damage = battle->calc_cardfix(BF_WEAPON, src, target, nk, s_ele, s_ele_, wd.damage, flag.lh, wd.flag);
- if( flag.infdef )
- { //Plants receive 1 damage when hit
+ if( flag.infdef ) { //Plants receive 1 damage when hit
short class_ = status_get_class(target);
if( flag.hit || wd.damage > 0 )
wd.damage = wd.div_; // In some cases, right hand no need to have a weapon to increase damage
@@ -4063,6 +4086,25 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
MATK_ADD(50);
}
}
+#ifndef HMAP_ZONE_DAMAGE_CAP_TYPE
+ if( src && skill_id ) {
+ for(i = 0; i < map[src->m].zone->capped_skills_count; i++) {
+ if( skill_id == map[src->m].zone->capped_skills[i]->nameid && (map[src->m].zone->capped_skills[i]->type & src->type) ) {
+ if( src->type == BL_MOB && map[src->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
+ if( (((TBL_MOB*)src)->status.mode&MD_BOSS) && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ continue;
+ if( ((TBL_MOB*)src)->special_state.clone && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ continue;
+ }
+ if( ad.damage > map[src->m].zone->capped_skills[i]->cap )
+ ad.damage = map[src->m].zone->capped_skills[i]->cap;
+ if( ad.damage2 > map[src->m].zone->capped_skills[i]->cap )
+ ad.damage2 = map[src->m].zone->capped_skills[i]->cap;
+ break;
+ }
+ }
+ }
+#endif
#ifdef RENEWAL
ad.damage = battle->calc_cardfix(BF_MAGIC, src, target, nk, s_ele, 0, ad.damage, 0, ad.flag);
#endif
@@ -4446,8 +4488,26 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
md.dmg_lv=ATK_FLEE;
}
}
-
- md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
+#ifndef HMAP_ZONE_DAMAGE_CAP_TYPE
+ if( src && skill_id ) {
+ for(i = 0; i < map[src->m].zone->capped_skills_count; i++) {
+ if( skill_id == map[src->m].zone->capped_skills[i]->nameid && (map[src->m].zone->capped_skills[i]->type & src->type) ) {
+ if( src->type == BL_MOB && map[src->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
+ if( (((TBL_MOB*)src)->status.mode&MD_BOSS) && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ continue;
+ if( ((TBL_MOB*)src)->special_state.clone && !(map[src->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ continue;
+ }
+ if( md.damage > map[src->m].zone->capped_skills[i]->cap )
+ md.damage = map[src->m].zone->capped_skills[i]->cap;
+ if( md.damage2 > map[src->m].zone->capped_skills[i]->cap )
+ md.damage2 = map[src->m].zone->capped_skills[i]->cap;
+ break;
+ }
+ }
+ }
+#endif
+ md.damage = battle->calc_cardfix(BF_MISC, src, target, nk, s_ele, 0, md.damage, 0, md.flag);
if (sd && (i = pc_skillatk_bonus(sd, skill_id)))
md.damage += md.damage*i/100;
@@ -4522,6 +4582,28 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
memset(&d,0,sizeof(d));
break;
}
+
+#ifdef HMAP_ZONE_DAMAGE_CAP_TYPE
+ if( bl && skill_id ) {
+ int i;
+ for(i = 0; i < map[bl->m].zone->capped_skills_count; i++) {
+ if( skill_id == map[bl->m].zone->capped_skills[i]->nameid && (map[bl->m].zone->capped_skills[i]->type & bl->type) ) {
+ if( bl->type == BL_MOB && map[bl->m].zone->capped_skills[i]->subtype != MZS_NONE ) {
+ if( (((TBL_MOB*)bl)->status.mode&MD_BOSS) && !(map[bl->m].zone->disabled_skills[i]->subtype&MZS_BOSS) )
+ continue;
+ if( ((TBL_MOB*)bl)->special_state.clone && !(map[bl->m].zone->disabled_skills[i]->subtype&MZS_CLONE) )
+ continue;
+ }
+ if( d.damage > map[bl->m].zone->capped_skills[i]->cap )
+ d.damage = map[bl->m].zone->capped_skills[i]->cap;
+ if( d.damage2 > map[bl->m].zone->capped_skills[i]->cap )
+ d.damage2 = map[bl->m].zone->capped_skills[i]->cap;
+ break;
+ }
+ }
+ }
+#endif
+
if( d.damage + d.damage2 < 1 ) { //Miss/Absorbed
//Weapon attacks should go through to cause additional effects.
if (d.dmg_lv == ATK_DEF /*&& attack_type&(BF_MAGIC|BF_MISC)*/) // Isn't it that additional effects don't apply if miss?
@@ -5782,8 +5864,6 @@ static const struct _battle_data {
{ "status_cast_cancel", &battle_config.sc_castcancel, BL_NUL, BL_NUL, BL_ALL, },
{ "pc_status_def_rate", &battle_config.pc_sc_def_rate, 100, 0, INT_MAX, },
{ "mob_status_def_rate", &battle_config.mob_sc_def_rate, 100, 0, INT_MAX, },
- { "pc_luk_status_def", &battle_config.pc_luk_sc_def, 300, 1, INT_MAX, },
- { "mob_luk_status_def", &battle_config.mob_luk_sc_def, 300, 1, INT_MAX, },
{ "pc_max_status_def", &battle_config.pc_max_sc_def, 100, 0, INT_MAX, },
{ "mob_max_status_def", &battle_config.mob_max_sc_def, 100, 0, INT_MAX, },
{ "sg_miracle_skill_ratio", &battle_config.sg_miracle_skill_ratio, 1, 0, 10000, },
@@ -5869,7 +5949,7 @@ void Hercules_report(char* date, char *time_c) {
enum config_table {
C_CIRCULAR_AREA = 0x0001,
C_CELLNOSTACK = 0x0002,
- C_BETA_THREAD_TEST = 0x0004,
+ //C_BETA_THREAD_TEST = 0x0004, (free slot)
C_SCRIPT_CALLFUNC_CHECK = 0x0008,
C_OFFICIAL_WALKPATH = 0x0010,
C_RENEWAL = 0x0020,
@@ -5900,10 +5980,6 @@ void Hercules_report(char* date, char *time_c) {
config |= C_CELLNOSTACK;
#endif
-#ifdef BETA_THREAD_TEST
- config |= C_BETA_THREAD_TEST;
-#endif
-
#ifdef SCRIPT_CALLFUNC_CHECK
config |= C_SCRIPT_CALLFUNC_CHECK;
#endif
@@ -5940,15 +6016,15 @@ void Hercules_report(char* date, char *time_c) {
config |= C_RENEWAL_ASPD;
#endif
-/* not a ifdef because SECURE_NPCTIMEOUT is always defined, but either as 0 or higher */
-#if SECURE_NPCTIMEOUT
+#ifdef SECURE_NPCTIMEOUT
config |= C_SECURE_NPCTIMEOUT;
#endif
+
/* non-define part */
if( db_use_sqldbs )
config |= C_SQL_DBS;
- if( log_config.sql_logs )
+ if( logs->config.sql_logs )
config |= C_SQL_LOGS;
#define BFLAG_LENGTH 35
@@ -6100,8 +6176,10 @@ int battle_config_read(const char* cfgName)
count--;
- if (count == 0)
+ if (count == 0) {
battle->config_adjust();
+ clif->bc_ready();
+ }
return 0;
}
@@ -6166,4 +6244,4 @@ void battle_defaults(void) {
battle->config_adjust = battle_adjust_conf;
battle->get_enemy_area = battle_getenemyarea;
battle->damage_area = battle_damage_area;
-} \ No newline at end of file
+}