summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c28
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/map.h3
-rw-r--r--src/map/pc.c12
-rw-r--r--src/map/skill.c14
-rw-r--r--src/map/status.c4
6 files changed, 29 insertions, 34 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 7ca35dc6e..b7350fbd4 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -300,6 +300,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
return 0;
}
+ if(sc->data[SC_HERMODE].timer != -1 && flag&BF_MAGIC)
+ return 0;
+
if(sc->data[SC_FOGWALL].timer != -1 && flag&BF_MAGIC
&& rand()%100 < 75 && !(skill_get_inf(skill_num)&INF_GROUND_SKILL))
return 0;
@@ -313,7 +316,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
status_change_end(bl, SC_KAUPE, -1);
return 0;
}
-
+
//Now damage increasing effects
if(sc->data[SC_AETERNA].timer!=-1 && skill_num != PA_PRESSURE && skill_num != PF_SOULBURN){
damage<<=1;
@@ -382,6 +385,14 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i
if((--sci->val3)<=0 || (sci->val2<=0) || skill_num == AL_HOLYLIGHT)
status_change_end(bl, SC_KYRIE, -1);
}
+
+ //Special no damage states
+ if(flag&BF_WEAPON && sd && sd->special_state.no_weapon_damage)
+ damage -= damage*sd->special_state.no_weapon_damage/100;
+
+ if(flag&BF_MAGIC && sd && sd->special_state.no_magic_damage)
+ damage -= damage*sd->special_state.no_magic_damage/100;
+
if (damage <= 0) return 0;
}
@@ -1076,11 +1087,6 @@ static struct Damage battle_calc_weapon_attack(
flag.hit =1;
} //End hit/miss calculation
- if(tsd && tsd->special_state.no_weapon_damage) {
- if (wd.div_ < 0) wd.div_*=-1;
- return wd;
- }
-
if (flag.hit && !flag.infdef) //No need to do the math for plants
{ //Hitting attack
@@ -2354,12 +2360,6 @@ struct Damage battle_calc_magic_attack(
if (flag.infdef && ad.damage > 0)
ad.damage = 1;
- if (tsd && status_isimmune(target)) {
- if (sd && battle_config.gtb_pvp_only) { // [MouseJstr]
- MATK_RATE(100 - battle_config.gtb_pvp_only);
- } else ad.damage = 0;
- }
-
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);
@@ -3280,7 +3280,7 @@ static const struct battle_data_short {
{ "item_auto_get", &battle_config.item_auto_get },
{ "drop_rate0item", &battle_config.drop_rate0item },
{ "pvp_exp", &battle_config.pvp_exp },
- { "gtb_pvp_only", &battle_config.gtb_pvp_only },
+ { "gtb_sc_immunity", &battle_config.gtb_sc_immunity},
{ "guild_max_castles", &battle_config.guild_max_castles },
{ "death_penalty_type", &battle_config.death_penalty_type },
{ "death_penalty_base", &battle_config.death_penalty_base },
@@ -3675,7 +3675,7 @@ void battle_set_defaults() {
battle_config.base_exp_rate=100;
battle_config.job_exp_rate=100;
battle_config.pvp_exp=1;
- battle_config.gtb_pvp_only=0;
+ battle_config.gtb_sc_immunity=50;
battle_config.death_penalty_type=0;
battle_config.death_penalty_base=0;
battle_config.death_penalty_job=0;
diff --git a/src/map/battle.h b/src/map/battle.h
index c926b3599..0d1669deb 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -124,7 +124,7 @@ extern struct Battle_Config {
unsigned short death_penalty_type;
unsigned short death_penalty_base,death_penalty_job;
unsigned short pvp_exp; // [MouseJstr]
- unsigned short gtb_pvp_only; // [MouseJstr]
+ unsigned short gtb_sc_immunity;
int zeny_penalty;
unsigned short restart_hp_rate;
unsigned short restart_sp_rate;
diff --git a/src/map/map.h b/src/map/map.h
index 4fa89f7aa..4fcc1ff22 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -494,14 +494,13 @@ struct map_session_data {
struct guild *gmaster_flag;
} state;
struct {
+ unsigned char no_weapon_damage, no_magic_damage;
unsigned killer : 1;
unsigned killable : 1;
unsigned restart_full_recover : 1;
unsigned no_castcancel : 1;
unsigned no_castcancel2 : 1;
unsigned no_sizefix : 1;
- unsigned no_magic_damage : 1;
- unsigned no_weapon_damage : 1;
unsigned no_gemstone : 1;
unsigned intravision : 1; // Maya Purple Card effect allowing to see Hiding/Cloaking people [DracoRPG]
} special_state;
diff --git a/src/map/pc.c b/src/map/pc.c
index e42aa454f..eeecf6a70 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1550,12 +1550,16 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
sd->special_state.no_sizefix = 1;
break;
case SP_NO_MAGIC_DAMAGE:
- if(sd->state.lr_flag != 2)
- sd->special_state.no_magic_damage = 1;
+ if(sd->state.lr_flag == 2)
+ break;
+ val+= sd->special_state.no_magic_damage;
+ sd->special_state.no_magic_damage = cap_value(val,0,100);
break;
case SP_NO_WEAPON_DAMAGE:
- if(sd->state.lr_flag != 2)
- sd->special_state.no_weapon_damage = 1;
+ if(sd->state.lr_flag == 2)
+ break;
+ val+= sd->special_state.no_weapon_damage;
+ sd->special_state.no_weapon_damage = cap_value(val,0,100);
break;
case SP_NO_GEMSTONE:
if(sd->state.lr_flag != 2)
diff --git a/src/map/skill.c b/src/map/skill.c
index 2db04b974..48cab9cd4 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2427,8 +2427,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int
if (status_isdead(src) || (src != bl && status_isdead(bl)))
return 1;
- if (skillid && skill_get_type(skillid) == BF_MAGIC &&
- !battle_config.gtb_pvp_only && status_isimmune(bl)) {
+ if (skillid && skill_get_type(skillid) == BF_MAGIC && status_isimmune(bl))
+ {
if (sd) clif_skill_fail(sd,skillid,0,0);
//GTB makes all targetted skills silently fail.
return 1;
@@ -3855,11 +3855,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
}
break;
- case BS_HAMMERFALL: /* ハンマーフォール */
- if(dstsd && dstsd->special_state.no_weapon_damage) {
- clif_skill_nodamage(src,bl,skillid,skilllv,0);
- break;
- }
+ case BS_HAMMERFALL:
clif_skill_nodamage(src,bl,skillid,skilllv,
sc_start(bl,SC_STUN,(20 + 10 * skilllv),skilllv,skill_get_time2(skillid,skilllv)));
break;
@@ -4778,10 +4774,6 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
break;
case NPC_LICK:
- if (dstsd && dstsd->special_state.no_weapon_damage ) {
- clif_skill_nodamage(src,bl,skillid,skilllv,0);
- break;
- }
status_zap(bl, 0, 100);
clif_skill_nodamage(src,bl,skillid,skilllv,
sc_start(bl,type,(skilllv*5),skilllv,skill_get_time2(skillid,skilllv)));
diff --git a/src/map/status.c b/src/map/status.c
index 7e7cadfb6..5cfc34f64 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -3670,8 +3670,8 @@ int status_isimmune(struct block_list *bl)
{
struct status_change *sc =status_get_sc(bl);
if (bl->type == BL_PC &&
- ((struct map_session_data *)bl)->special_state.no_magic_damage)
- return 1;
+ ((TBL_PC*)bl)->special_state.no_magic_damage)
+ return ((TBL_PC*)bl)->special_state.no_magic_damage > battle_config.gtb_sc_immunity;
if (sc && sc->count && sc->data[SC_HERMODE].timer != -1)
return 1;
return 0;