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.c62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 384d2e71f..b2ee9cf1d 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -263,7 +263,7 @@ int battle_delay_damage(int64 tick, int amotion, struct block_list *src, struct
if (d_tbl && sc && check_distance_bl(target, d_tbl, sc->data[SC_DEVOTION]->val3) && damage > 0 && skill_id != PA_PRESSURE && skill_id != CR_REFLECTSHIELD)
damage = 0;
-
+
if ( !battle_config.delay_battle_damage || amotion <= 1 ) {
map->freeblock_lock();
status_fix_damage(src, target, damage, ddelay); // We have to separate here between reflect damage and others [icescope]
@@ -1528,9 +1528,6 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
case NPC_ENERGYDRAIN:
skillratio += 100 * skill_lv;
break;
- case NPC_EARTHQUAKE:
- skillratio += 100 + 100 * skill_lv + 100 * (skill_lv/2);
- break;
#ifdef RENEWAL
case WZ_HEAVENDRIVE:
case WZ_METEOR:
@@ -1894,6 +1891,9 @@ int battle_calc_skillratio(int attack_type, struct block_list *src, struct block
case NPC_PULSESTRIKE:
skillratio += 100 * (skill_lv-1);
break;
+ case NPC_EARTHQUAKE:
+ skillratio += 100 + 100 * skill_lv + 100 * (skill_lv / 2);
+ break;
case RG_BACKSTAP:
if( sd && sd->status.weapon == W_BOW && battle_config.backstab_bow_penalty )
skillratio += (200 + 40 * skill_lv) / 2;
@@ -3160,9 +3160,9 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
}
if( bl->type == BL_MOB && !status->isdead(bl) && src != bl) {
- if (damage > 0 )
+ if ( damage > 0 )
mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),flag);
- if (skill_id)
+ if (skill_id)
mob->skill_event((TBL_MOB*)bl,src,timer->gettick(),MSC_SKILLUSED|(skill_id<<16));
}
if( sd ) {
@@ -3601,15 +3601,6 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
ad.damage = battle->calc_defense(BF_MAGIC, src, target, skill_id, skill_lv, ad.damage, flag.imdef, 0);
- if (skill_id == NPC_EARTHQUAKE) {
- //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex]
- //Also divide the extra bonuses from atk2 based on the number in range [Kevin]
- if(mflag>0)
- ad.damage+= (sstatus->rhw.atk2*skillratio/100)/mflag;
- else
- ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id));
- }
-
if(ad.damage<1)
ad.damage=1;
else if(sc){//only applies when hit
@@ -4265,6 +4256,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.div_ = tstatus->size + 2 + ( (rnd()%100 < 50-tstatus->size*10) ? 1 : 0 );
break;
#ifdef RENEWAL
+ case PA_SHIELDCHAIN:
case NJ_KUNAI:
case HW_MAGICCRASHER:
case NJ_SYURIKEN:
@@ -4356,7 +4348,6 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
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 = rnd()%100;
- wd.type = 0x08;
switch(sc->data[SC_FEARBREEZE]->val1){
case 5:
if( chance < 3){// 3 % chance to attack 5 times.
@@ -4380,8 +4371,11 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
break;
}
}
- wd.div_ = min(wd.div_,sd->status.inventory[i].amount);
- sc->data[SC_FEARBREEZE]->val4 = wd.div_-1;
+ if ( wd.div_ > 1 ) {
+ wd.div_ = min(wd.div_, sd->status.inventory[i].amount);
+ sc->data[SC_FEARBREEZE]->val4 = wd.div_ - 1;
+ wd.type = 0x08;
+ }
}
}
@@ -4523,6 +4517,12 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
case NPC_UNDEADATTACK:
case NPC_TELEKINESISATTACK:
case NPC_BLEEDING:
+ case NPC_EARTHQUAKE:
+ case NPC_FIREBREATH:
+ case NPC_ICEBREATH:
+ case NPC_THUNDERBREATH:
+ case NPC_ACIDBREATH:
+ case NPC_DARKNESSBREATH:
hitrate += hitrate * 20 / 100;
break;
case KN_PIERCE:
@@ -4664,9 +4664,10 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
break;
}
break;
+
+ case PA_SHIELDCHAIN:
#endif
case CR_SHIELDBOOMERANG:
- case PA_SHIELDCHAIN:
wd.damage = sstatus->batk;
if (sd) {
int damagevalue = 0;
@@ -4783,6 +4784,16 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
break;
#ifdef RENEWAL
+ case PA_SHIELDCHAIN:
+ if ( sd ) {
+ short index = sd->equip_index[EQI_HAND_L];
+ if ( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_ARMOR ) {
+ ATK_ADD(sd->inventory_data[index]->weight / 10 + 4 * sd->status.inventory[index].refine);
+ }
+ } else
+ ATK_ADD(sstatus->rhw.atk2); //Else use Atk2
+ ATK_RATE(battle->calc_skillratio(BF_WEAPON, src, target, skill_id, skill_lv, skillratio, wflag));
+ break;
case NJ_TATAMIGAESHI:
ATK_RATE(200);
/* Fall through */
@@ -5054,6 +5065,16 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
//Div fix.
damage_div_fix(wd.damage, wd.div_);
#endif
+#if 0 // Can't find any source about this one even in eagis
+ if (skill_id == NPC_EARTHQUAKE) {
+ //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex]
+ //Also divide the extra bonuses from atk2 based on the number in range [Kevin]
+ if ( wflag>0 )
+ ATK_ADD((sstatus->rhw.atk2*skillratio / 100) / wflag);
+ else
+ ShowError("Zero range by %d:%s, divide per 0 avoided!\n", skill_id, skill->get_name(skill_id));
+ }
+#endif
//Post skill/vit reduction damage increases
if (sc) {
//SC skill damages
@@ -6704,9 +6725,10 @@ static const struct battle_data {
{ "bone_drop", &battle_config.bone_drop, 0, 0, 2, },
{ "buyer_name", &battle_config.buyer_name, 1, 0, 1, },
{ "skill_wall_check", &battle_config.skill_wall_check, 1, 0, 1, },
- { "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 1, 255, },
+ { "official_cell_stack_limit", &battle_config.official_cell_stack_limit, 1, 0, 255, },
{ "custom_cell_stack_limit", &battle_config.custom_cell_stack_limit, 1, 1, 255, },
{ "dancing_weaponswitch_fix", &battle_config.dancing_weaponswitch_fix, 1, 0, 1, },
+ { "check_occupied_cells", &battle_config.check_occupied_cells, 1, 0, 1, },
// eAthena additions
{ "item_logarithmic_drops", &battle_config.logarithmic_drops, 0, 0, 1, },