venomxxvii Posted June 4, 2013 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 31 Reputation: 0 Joined: 05/28/12 Last Seen: August 29, 2014 Share Posted June 4, 2013 (edited) Hello, i am wanting to create a card that counters the GTB by 50% Just wondering if this is possible and what script to use. > Example, GTB blocks 100% of magic attacks correct. Now if someone is wearing an the Counter GTB card, the GTB will only block magic attacks by 50% Edited August 29, 2020 by Haruka Mayumi make it simple and neat Quote Link to comment Share on other sites More sharing options...
Jaburak Posted June 4, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted June 4, 2013 Try this. Please let me know if it's working fine. Index: src/map/battle.c =================================================================== --- src/map/battle.c (revision 17331) +++ src/map/battle.c (working copy) @@ -734,9 +734,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 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_ret(bl); @@ -747,6 +749,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){ + 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_SUBRATE(sd->special_state.no_weapon_damage) @@ -1234,6 +1247,8 @@ if (skill_id) mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16)); } + if(sd) status_calc_pc(sd,0); + if( sd ) { if( pc_ismadogear(sd) && rnd()%100 < 50 ) { short element = skill_get_ele(skill_id, skill_lv); Index: src/map/map.h =================================================================== --- src/map/map.h (revision 17331) +++ src/map/map.h (working copy) @@ -411,7 +411,10 @@ 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, SP_ADD_CLASS_DROP_ITEM, //2041-2045 + SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, + SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, + SP_ANTI_NO_MAGIC_DAMAGE // + SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049 SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054 SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058 Index: src/map/pc.c =================================================================== --- src/map/pc.c (revision 17331) +++ src/map/pc.c (working copy) @@ -2635,6 +2635,12 @@ if(sd->state.lr_flag != 2) sd->bonus.add_varcast += 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; #endif default: ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 17331) +++ src/map/pc.h (working copy) @@ -173,7 +173,7 @@ unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc(). } 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 int restart_full_recover : 1; unsigned int no_castcancel : 1; unsigned int no_castcancel2 : 1; Quote Link to comment Share on other sites More sharing options...
venomxxvii Posted June 5, 2013 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 31 Reputation: 0 Joined: 05/28/12 Last Seen: August 29, 2014 Author Share Posted June 5, 2013 How to make this work? I mean, I am wondering if I can make another card which has the effect of reducing the effect of gtb by 50%. Like for example, I want to call that card Goldring Boss Card. If someone wearing GTB card, magic spells can't hit him but if the caster of magic will wear this Goldring Boss Card which has the effect of GTB by 50%, what script should it be? ^ ^ Quote Link to comment Share on other sites More sharing options...
Rebel Posted June 7, 2013 Group: Members Topic Count: 68 Topics Per Day: 0.01 Content Count: 436 Reputation: 32 Joined: 02/19/12 Last Seen: May 22, 2024 Share Posted June 7, 2013 bonus bAntiNoMagicDamage,50; Quote Link to comment Share on other sites More sharing options...
venomxxvii Posted June 9, 2013 Group: Members Topic Count: 12 Topics Per Day: 0.00 Content Count: 31 Reputation: 0 Joined: 05/28/12 Last Seen: August 29, 2014 Author Share Posted June 9, 2013 Try this. Please let me know if it's working fine. Index: src/map/battle.c =================================================================== --- src/map/battle.c (revision 17331) +++ src/map/battle.c (working copy) @@ -734,9 +734,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damage *d,int damage,uint16 skill_id,uint16 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_ret(bl); @@ -747,6 +749,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){ + 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_SUBRATE(sd->special_state.no_weapon_damage) @@ -1234,6 +1247,8 @@ if (skill_id) mobskill_event((TBL_MOB*)bl,src,gettick(),MSC_SKILLUSED|(skill_id<<16)); } + if(sd) status_calc_pc(sd,0); + if( sd ) { if( pc_ismadogear(sd) && rnd()%100 < 50 ) { short element = skill_get_ele(skill_id, skill_lv); Index: src/map/map.h =================================================================== --- src/map/map.h (revision 17331) +++ src/map/map.h (working copy) @@ -411,7 +411,10 @@ 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, SP_ADD_CLASS_DROP_ITEM, //2041-2045 + SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, + SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, + SP_ANTI_NO_MAGIC_DAMAGE // + SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049 SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054 SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058 Index: src/map/pc.c =================================================================== --- src/map/pc.c (revision 17331) +++ src/map/pc.c (working copy) @@ -2635,6 +2635,12 @@ if(sd->state.lr_flag != 2) sd->bonus.add_varcast += 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; #endif default: ShowWarning("pc_bonus: unknown type %d %d !\n",type,val); Index: src/map/pc.h =================================================================== --- src/map/pc.h (revision 17331) +++ src/map/pc.h (working copy) @@ -173,7 +173,7 @@ unsigned int permanent_speed : 1; // When 1, speed cannot be changed through status_calc_pc(). } 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 int restart_full_recover : 1; unsigned int no_castcancel : 1; unsigned int no_castcancel2 : 1; Not Working D: up up ^ Quote Link to comment Share on other sites More sharing options...
LatSo Posted June 21, 2013 Group: Members Topic Count: 69 Topics Per Day: 0.02 Content Count: 296 Reputation: 2 Joined: 04/11/13 Last Seen: December 22, 2020 Share Posted June 21, 2013 anyone have a working copy of this? Quote Link to comment Share on other sites More sharing options...
Question
venomxxvii
Hello, i am wanting to create a card that counters the GTB by 50%
Just wondering if this is possible and what script to use.
>
Example, GTB blocks 100% of magic attacks correct.
Now if someone is wearing an the Counter GTB card, the GTB will only block magic attacks by 50%
make it simple and neat
Link to comment
Share on other sites
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.