summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-02-18 18:15:31 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-02-18 18:15:31 +0000
commitb687d790d516bf46dd03767f0e479b4a6a41eac2 (patch)
treebbe7f0bfd5049093d03d85e6e5c0e18d9c082762
parent54d59b3f91a08ffc70e6a2f22776a1de25f89d93 (diff)
downloadhercules-b687d790d516bf46dd03767f0e479b4a6a41eac2.tar.gz
hercules-b687d790d516bf46dd03767f0e479b4a6a41eac2.tar.bz2
hercules-b687d790d516bf46dd03767f0e479b4a6a41eac2.tar.xz
hercules-b687d790d516bf46dd03767f0e479b4a6a41eac2.zip
Added 2 new item bonuses as per kenpachi's request:
- bonus2 bHPGainRaceAttack - bonus2 bSPGainRaceAttack git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15608 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--db/const.txt2
-rw-r--r--doc/item_bonus.txt3
-rw-r--r--src/map/battle.c8
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/pc.c9
-rw-r--r--src/map/pc.h2
-rw-r--r--src/map/status.c2
7 files changed, 25 insertions, 3 deletions
diff --git a/db/const.txt b/db/const.txt
index 1fee30019..2f4030130 100644
--- a/db/const.txt
+++ b/db/const.txt
@@ -559,6 +559,8 @@ bMagicHPGainValue 2044
bAddClassDropItem 2045
bWeaponMatk 2046
bMatk 2047
+bSPGainRaceAttack 2048
+bHPGainRaceAttack 2049
EQI_HEAD_TOP 1
EQI_ARMOR 2
diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt
index e0a9c3fbf..375f64175 100644
--- a/doc/item_bonus.txt
+++ b/doc/item_bonus.txt
@@ -422,3 +422,6 @@ bonus bMagicSPGainValue,n; Heals +n SP when killing an enemy with magic attack.
bonus bMagicHPGainValue,n; Heals +n HP when killing an enemy with magic attack.
bonus3 bAddClassDropItem,s,x,n; Adds an n/100% chance of dropping item s when killing monster class x.
+
+bonus2 bHPGainRaceAttack,x,n; Heals n HP when attacking x Race on every hit
+bonus2 bSPGainRaceAttack,x,n; Heals n SP when attacking x Race on every hit \ No newline at end of file
diff --git a/src/map/battle.c b/src/map/battle.c
index 3ca8480b4..1853b9cf1 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3792,7 +3792,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage,
sp = wd->sp_drain[type].value;
if (wd->sp_drain[type].rate)
sp += battle_calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per);
-
+
if (hp) {
if (wd->hp_drain[type].type)
rhp += hp;
@@ -3807,6 +3807,12 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage,
if (sd->sp_vanish_rate && rnd()%1000 < sd->sp_vanish_rate)
status_percent_damage(&sd->bl, tbl, 0, (unsigned char)sd->sp_vanish_per, false);
+
+ if( sd->sp_gain_race_attack[race] )
+ tsp += sd->sp_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);
diff --git a/src/map/map.h b/src/map/map.h
index f55140847..d8d0b00ea 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -370,7 +370,7 @@ enum _sp {
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_WEAPON_MATK, SP_BASE_MATK //2046-2047
+ SP_WEAPON_MATK, SP_BASE_MATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK //2046-2049
};
enum _look {
diff --git a/src/map/pc.c b/src/map/pc.c
index f20735167..9424c834b 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2971,7 +2971,14 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag != 2)
sd->ignore_def[type2] += val;
break;
-
+ case SP_SP_GAIN_RACE_ATTACK:
+ if(sd->state.lr_flag != 2)
+ sd->sp_gain_race_attack[type2] = cap_value(sd->sp_gain_race_attack[type2] + val, 0, INT16_MAX);
+ break;
+ case SP_HP_GAIN_RACE_ATTACK:
+ if(sd->state.lr_flag != 2)
+ sd->hp_gain_race_attack[type2] = cap_value(sd->hp_gain_race_attack[type2] + val, 0, INT16_MAX);
+ break;
default:
ShowWarning("pc_bonus2: unknown type %d %d %d!\n",type,type2,val);
break;
diff --git a/src/map/pc.h b/src/map/pc.h
index cb5a0ef77..a9b995115 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -249,6 +249,8 @@ struct map_session_data {
int ignore_def[RC_MAX];
int itemgrouphealrate[MAX_ITEMGROUP];
short sp_gain_race[RC_MAX];
+ short sp_gain_race_attack[RC_MAX];
+ short hp_gain_race_attack[RC_MAX];
// zeroed arrays end here.
// zeroed structures start here
struct s_autospell autospell[15], autospell2[15], autospell3[15];
diff --git a/src/map/status.c b/src/map/status.c
index dc0d8fdb2..3c3c8248f 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -2103,6 +2103,8 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
+ sizeof(sd->ignore_def)
+ sizeof(sd->itemgrouphealrate)
+ sizeof(sd->sp_gain_race)
+ + sizeof(sd->sp_gain_race_attack)
+ + sizeof(sd->hp_gain_race_attack)
);
memset (&sd->right_weapon.overrefine, 0, sizeof(sd->right_weapon) - sizeof(sd->right_weapon.atkmods));