From 3f13598714f2d6cecb1c1e5c382592a904798624 Mon Sep 17 00:00:00 2001 From: Jedzkie Date: Thu, 24 Dec 2015 10:43:11 +0800 Subject: Item Update: - Fix items that uses SPVanishRate bonus are not working properly. - Fix Velum Katzbalger item effect. - Added HPVanishRate bonus. --- db/const.txt | 1 + db/pre-re/item_db.conf | 20 ++++++++++---------- db/re/item_db.conf | 50 +++++++++++++++++++++++++------------------------- doc/item_bonus.txt | 3 +++ src/map/battle.c | 38 ++++++++++++++++++++++++++------------ src/map/map.h | 2 +- src/map/pc.c | 26 ++++++++++++++++++++------ src/map/pc.h | 2 ++ 8 files changed, 88 insertions(+), 54 deletions(-) diff --git a/db/const.txt b/db/const.txt index cca14517f..efdad29bc 100644 --- a/db/const.txt +++ b/db/const.txt @@ -529,6 +529,7 @@ bSkillHeal2 1088 bAddEffOnSkill 1089 bHealPower 1090 bHealPower2 1091 +bHPVanishRate 1092 bRestartFullRecover 2000 bNoCastCancel 2001 diff --git a/db/pre-re/item_db.conf b/db/pre-re/item_db.conf index 1185bc70a..27a80f4ee 100644 --- a/db/pre-re/item_db.conf +++ b/db/pre-re/item_db.conf @@ -5108,10 +5108,10 @@ item_db: ( EquipLv: 40 View: 2 Script: <" - bonus bAtkEle,Ele_Ghost; - bonus2 bSPVanishRate,30,30; - bonus bSPDrainValue,-1; - bonus bUnbreakableWeapon,0; + bonus bAtkEle, Ele_Ghost; + bonus2 bSPVanishRate, 30, 30; + bonus bSPDrainValue, -1; + bonus bUnbreakableWeapon, 1; "> }, { @@ -27330,8 +27330,8 @@ item_db: ( Weight: 10 Loc: 2 Script: <" - bonus2 bSPVanishRate,50,10; - if(BaseJob==Job_Sage) bonus bSPDrainValue,1; + bonus2 bSPVanishRate, 50, 10; + if (BaseJob == Job_Sage) bonus bSPDrainValue, 1; "> }, { @@ -74660,10 +74660,10 @@ item_db: ( Refine: false View: 2 Script: <" - bonus bAtkEle,Ele_Ghost; - bonus2 bSPVanishRate,45,30; - bonus bSPDrainValue,-1; - bonus bUnbreakableWeapon,0; + bonus bAtkEle, Ele_Ghost; + bonus2 bSPVanishRate, 45, 30; + bonus bSPDrainValue, -1; + bonus bUnbreakableWeapon, 1; "> }, { diff --git a/db/re/item_db.conf b/db/re/item_db.conf index 6c1b4c481..adf25baa8 100644 --- a/db/re/item_db.conf +++ b/db/re/item_db.conf @@ -4882,10 +4882,10 @@ item_db: ( EquipLv: 40 View: 2 Script: <" - bonus bAtkEle,Ele_Ghost; - bonus2 bSPVanishRate,30,30; - bonus bSPDrainValue,-1; - bonus bUnbreakableWeapon,0; + bonus bAtkEle, Ele_Ghost; + bonus2 bSPVanishRate, 30, 30; + bonus bSPDrainValue, -1; + bonus bUnbreakableWeapon, 1; "> }, { @@ -7874,7 +7874,7 @@ item_db: ( WeaponLv: 4 EquipLv: 95 View: 16 - Script: <" bonus3 bSPVanishRate,10000,10,BF_NORMAL; "> + Script: <" bonus3 bSPVanishRate, 1000, 10, BF_NORMAL; "> }, { Id: 1295 @@ -9370,8 +9370,8 @@ item_db: ( EquipLv: 95 View: 7 Script: <" - bonus bUnbreakableWeapon,0; - bonus3 bSPVanishRate,10000,10,BF_NORMAL; + bonus bUnbreakableWeapon, 1; + bonus3 bSPVanishRate, 1000, 10, BF_NORMAL; "> }, { @@ -14771,13 +14771,13 @@ item_db: ( EquipLv: 95 View: 10 Script: <" - bonus bInt,10; - bonus bUnbreakableWeapon,0; - bonus bUseSPrate,100; - bonus bMdef,20; - bonus3 bSPVanishRate,10000,5,BF_NORMAL|BF_SKILL; - if(getrefine()>5) { - bonus3 bSPVanishRate,10000,10,BF_NORMAL|BF_SKILL; + bonus bInt, 10; + bonus bUnbreakableWeapon, 0; + bonus bUseSPrate, 100; + bonus bMdef, 20; + bonus3 bSPVanishRate, 1000, 5, BF_NORMAL | BF_SKILL; + if (getrefine() >= 6) { + bonus3 bSPVanishRate, 1000, 10, BF_NORMAL | BF_SKILL; } "> }, @@ -35916,8 +35916,8 @@ item_db: ( Weight: 10 Loc: 2 Script: <" - bonus2 bSPVanishRate,50,10; - if(BaseJob==Job_Sage) bonus bSPDrainValue,1; + bonus2 bSPVanishRate, 50, 10; + if (BaseJob == Job_Sage) bonus bSPDrainValue, 1; "> }, { @@ -94221,18 +94221,18 @@ item_db: ( Trade: { nodrop: true notrade: true + nostorage: true noselltonpc: true nocart: true - nostorage: true - nogstorage: true nomail: true noauction: true + nogstorage: true } Script: <" - bonus bAtkEle,Ele_Ghost; - bonus2 bSPVanishRate,45,30; - bonus bSPDrainValue,-1; - bonus bUnbreakableWeapon,0; + bonus bAtkEle, Ele_Ghost; + bonus2 bSPVanishRate, 45, 30; + bonus bSPDrainValue, -1; + bonus bUnbreakableWeapon, 1; "> }, { @@ -119609,8 +119609,8 @@ item_db: ( EquipLv: 95 View: 11 Script: <" - bonus3 bSPVanishRate,10000,4,BF_NORMAL; - bonus bAspd,-5; + bonus3 bSPVanishRate, 1000, 4, BF_NORMAL; + bonus bAspd, -5; "> }, { @@ -134357,7 +134357,7 @@ item_db: ( WeaponLv: 4 EquipLv: 95 View: 3 - Script: <" bonus3 bSPVanishRate,10000,8,BF_NORMAL; "> + Script: <" bonus3 bHPVanishRate, 1000, 8, BF_NORMAL; "> }, { Id: 21003 diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index 6aeca16ea..f588921cd 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -353,7 +353,10 @@ bonus3 bSPDrainRateRace,r,n,x; Adds a n/10% chance to receive x% of damage deal HP/SP Vanish ------------ +bonus2 bHPVanishRate,n,x; Add the (n/10)% chance of decreasing enemy HP amount by x% when attacking bonus2 bSPVanishRate,n,x; Add the (n/10)% chance of decreasing enemy SP amount by x% when attacking + +bonus3 bHPVanishRate,n,x,bf; Add the (n/10)% chance of decreasing enemy HP amount by x% when attacking for criteria bf bonus3 bSPVanishRate,n,x,bf; Add the (n/10)% chance of decreasing enemy SP amount by x% when attacking for criteria bf HP/SP Gain diff --git a/src/map/battle.c b/src/map/battle.c index 96289fcc8..6c0e57863 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5668,11 +5668,20 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl } else // Some skills like Weaponry Research will cause damage even if attack is dodged d.dmg_lv = ATK_DEF; - if(sd && d.damage+d.damage2>1) { - if(sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd()%10000bonus.sp_vanish_rate && - ( (d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK) - || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK) )) - status_percent_damage(&sd->bl,target,0,-sd->bonus.sp_vanish_per,false); + // HPVanishRate + if (sd && d.damage + d.damage2 > 1) { + if (sd->bonus.hp_vanish_rate && sd->bonus.hp_vanish_trigger && rnd() % 1000 < sd->bonus.hp_vanish_rate && + ((d.flag&sd->bonus.hp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.hp_vanish_trigger&BF_RANGEMASK) + || (d.flag&sd->bonus.hp_vanish_trigger&BF_SKILLMASK))) + status_percent_damage(&sd->bl, target, -sd->bonus.hp_vanish_per, 0, false); + } + + // SPVanishRate + if (sd && d.damage + d.damage2 > 1) { + if (sd->bonus.sp_vanish_rate && sd->bonus.sp_vanish_trigger && rnd() % 1000 < sd->bonus.sp_vanish_rate && + ((d.flag&sd->bonus.sp_vanish_trigger&BF_WEAPONMASK) || (d.flag&sd->bonus.sp_vanish_trigger&BF_RANGEMASK) + || (d.flag&sd->bonus.sp_vanish_trigger&BF_SKILLMASK))) + status_percent_damage(&sd->bl, target, 0, -sd->bonus.sp_vanish_per, false); } return d; } @@ -5902,7 +5911,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama if (i == 0 || i == 2) type = race; else - type = boss?RC_BOSS:RC_NONBOSS; + type = boss ? RC_BOSS : RC_NONBOSS; hp = wd->hp_drain[type].value; if (wd->hp_drain[type].rate) @@ -5912,6 +5921,14 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama if (wd->sp_drain[type].rate) sp += battle->calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per); + // HPVanishRate + if (sd->bonus.hp_vanish_rate && rnd() % 1000 < sd->bonus.hp_vanish_rate && !sd->bonus.hp_vanish_trigger) + status_percent_damage(&sd->bl, tbl, (unsigned char)sd->bonus.hp_vanish_per, 0, false); + + // SPVanishRate + if (sd->bonus.sp_vanish_rate && rnd() % 1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger) + status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false); + if (hp) { if (wd->hp_drain[type].type) rhp += hp; @@ -5924,17 +5941,14 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int64 rdamage, int64 ldama } } - if (sd->bonus.sp_vanish_rate && rnd()%1000 < sd->bonus.sp_vanish_rate && !sd->bonus.sp_vanish_trigger) - status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->bonus.sp_vanish_per, false); - - if( sd->sp_gain_race_attack[race] ) + if (sd->sp_gain_race_attack[race]) tsp += sd->sp_gain_race_attack[race]; - if( sd->hp_gain_race_attack[race] ) + if (sd->hp_gain_race_attack[race]) thp += sd->hp_gain_race_attack[race]; if (!thp && !tsp) return; - status->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1); + status->heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain ? 3 : 1); if (rhp || rsp) status_zap(tbl, rhp, rsp); diff --git a/src/map/map.h b/src/map/map.h index dacd81f71..bc479cdcf 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -465,7 +465,7 @@ enum status_point_types { SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082 SP_DELAYRATE,SP_HP_DRAIN_RATE_RACE,SP_SP_DRAIN_RATE_RACE, // 1083-1085 SP_IGNORE_MDEF_RATE,SP_IGNORE_DEF_RATE,SP_SKILL_HEAL2,SP_ADDEFF_ONSKILL, //1086-1089 - SP_ADD_HEAL_RATE,SP_ADD_HEAL2_RATE, //1090-1091 + SP_ADD_HEAL_RATE, SP_ADD_HEAL2_RATE, SP_HP_VANISH_RATE, //1090-1092 SP_RESTART_FULL_RECOVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 SP_NO_CASTCANCEL2,SP_NO_MISC_DAMAGE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 diff --git a/src/map/pc.c b/src/map/pc.c index 157f7faab..59232cc7b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3168,11 +3168,18 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->left_weapon.sp_drain[RC_BOSS].type = val; } break; + case SP_HP_VANISH_RATE: + if (sd->state.lr_flag != 2) { + sd->bonus.hp_vanish_rate += type2; + sd->bonus.hp_vanish_per = max(sd->bonus.hp_vanish_per, val); + sd->bonus.hp_vanish_trigger = 0; + } + break; case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { + if (sd->state.lr_flag != 2) { sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,val); - sd->bonus.sp_vanish_trigger=0; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per, val); + sd->bonus.sp_vanish_trigger = 0; } break; case SP_GET_ZENY_NUM: @@ -3812,11 +3819,18 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) } } break; + case SP_HP_VANISH_RATE: + if (sd->state.lr_flag != 2) { + sd->bonus.hp_vanish_rate += type2; + sd->bonus.hp_vanish_per = max(sd->bonus.hp_vanish_per, type3); + sd->bonus.hp_vanish_trigger = val; + } + break; case SP_SP_VANISH_RATE: - if(sd->state.lr_flag != 2) { + if (sd->state.lr_flag != 2) { sd->bonus.sp_vanish_rate += type2; - sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per,type3); - sd->bonus.sp_vanish_trigger=val; + sd->bonus.sp_vanish_per = max(sd->bonus.sp_vanish_per, type3); + sd->bonus.sp_vanish_trigger = val; } break; diff --git a/src/map/pc.h b/src/map/pc.h index 93173f6c8..97f339bf6 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -377,6 +377,8 @@ BEGIN_ZEROED_BLOCK; // this block will be globally zeroed at the beginning of st short add_steal_rate; short add_heal_rate, add_heal2_rate; short sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value; + short hp_vanish_rate; + short hp_vanish_per, hp_vanish_trigger; short sp_vanish_rate; short sp_vanish_per, sp_vanish_trigger; unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest] -- cgit v1.2.3-60-g2f50