Index: src/map/battle.c
===================================================================
--- src/map/battle.c (revision 14116)
+++ src/map/battle.c (working copy)
@@ -269,9 +269,11 @@
int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,int skill_num,int skill_lv)
{
struct map_session_data *sd = NULL;
+ struct map_session_data *srcsd = NULL;
struct status_change *sc;
struct status_change_entry *sce;
int div_ = d->div_, flag = d->flag;
+ char atcmd_output[50];
nullpo_retr(0, bl);
@@ -282,6 +284,17 @@
if (bl->type == BL_PC) {
sd=(struct map_session_data *)bl;
+ srcsd=(struct map_session_data *)src;
+
+ if(flag&BF_MAGIC && srcsd->special_state.anti_no_magic_damage && sd->special_state.no_magic_damage){ //Anti-GTB by [Rad]
+ if(sd->special_state.no_magic_damage > srcsd->special_state.anti_no_magic_damage)
+ sd->special_state.no_magic_damage = sd->special_state.no_magic_damage - srcsd->special_state.anti_no_magic_damage;
+ if(sd->special_state.no_magic_damage < srcsd->special_state.anti_no_magic_damage)
+ sd->special_state.no_magic_damage = 0;
+ sprintf(atcmd_output, "GTB effect reduced to %d, due to an anti-gtb used by the attacker", sd->special_state.no_magic_damage); // Jumped to %s
+ clif_displaymessage(sd->fd, atcmd_output);
+
+ }
//Special no damage states
if(flag&BF_WEAPON && sd->special_state.no_weapon_damage)
damage -= damage*sd->special_state.no_weapon_damage/100;
@@ -529,6 +542,8 @@
mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_num<<16));
}
+ if(sd) status_calc_pc(sd,0); //calculate to return bNoMagicDamage to original
+
return damage;
}
Index: src/map/map.h
===================================================================
--- src/map/map.h (revision 14116)
+++ src/map/map.h (working copy)
@@ -327,7 +327,8 @@
SP_SP_GAIN_RACE, SP_SUBRACE2, SP_UNBREAKABLE_SHOES, // 2031-2033
SP_UNSTRIPABLE_WEAPON,SP_UNSTRIPABLE_ARMOR,SP_UNSTRIPABLE_HELM,SP_UNSTRIPABLE_SHIELD, // 2034-2037
SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040
- SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE //2041-2044
+ SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, //2041-2044
+ SP_ANTI_NO_MAGIC_DAMAGE // counter GTB mod [Rad]
};
enum _look {
Index: src/map/pc.c
===================================================================
--- src/map/pc.c (revision 14116)
+++ src/map/pc.c (working copy)
@@ -2283,6 +2283,12 @@
if(sd->state.lr_flag != 2)
sd->add_heal2_rate += val;
break;
+ case SP_ANTI_NO_MAGIC_DAMAGE:
+ if(sd->state.lr_flag == 2)
+ break;
+ val+= sd->special_state.anti_no_magic_damage;
+ sd->special_state.anti_no_magic_damage = cap_value(val,0,100);
+ break;
default:
ShowWarning("pc_bonus: unknown type %d %d !\n",type,val);
break;
Index: src/map/pc.h
===================================================================
--- src/map/pc.h (revision 14116)
+++ src/map/pc.h (working copy)
@@ -133,7 +133,7 @@
unsigned short autobonus;
} state;
struct {
- unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
+ unsigned char no_weapon_damage, no_magic_damage, no_misc_damage, anti_no_magic_damage;
unsigned restart_full_recover : 1;
unsigned no_castcancel : 1;
unsigned no_castcancel2 : 1;