diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-05-29 12:48:08 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-05-29 12:48:08 +0000 |
commit | 2d7d5b8c0f59c6641e4b452492438b3fc9c982fc (patch) | |
tree | b3d6298dc2cd28189859ced3cc844ed9f0a91858 | |
parent | 6c5c324946c1e289de9521bff718f26e47b47362 (diff) | |
download | hercules-2d7d5b8c0f59c6641e4b452492438b3fc9c982fc.tar.gz hercules-2d7d5b8c0f59c6641e4b452492438b3fc9c982fc.tar.bz2 hercules-2d7d5b8c0f59c6641e4b452492438b3fc9c982fc.tar.xz hercules-2d7d5b8c0f59c6641e4b452492438b3fc9c982fc.zip |
- Support for SP Regen status just like HP Regen (by items, by a little time). Required in some new items from Ep 12.1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12743 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | db/const.txt | 1 | ||||
-rw-r--r-- | src/map/pc.c | 2 | ||||
-rw-r--r-- | src/map/status.c | 18 | ||||
-rw-r--r-- | src/map/status.h | 1 |
4 files changed, 14 insertions, 8 deletions
diff --git a/db/const.txt b/db/const.txt index 12b823d31..6579ec259 100644 --- a/db/const.txt +++ b/db/const.txt @@ -789,6 +789,7 @@ SC_SPCOST_RATE 272 SC_COMMONSC_RESIST 273 SC_SEVENWIND 274 SC_DEF_RATE 275 +SC_SPREGEN 276 e_gasp 0 e_what 1 diff --git a/src/map/pc.c b/src/map/pc.c index 289fc57b7..9c6f9686e 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6645,7 +6645,7 @@ int pc_checkitem(struct map_session_data *sd) if(!sd->status.inventory[i].equip) continue; - if (sd->status.inventory[i].equip&~pc_equippoint(sd,i)) { + if(sd->status.inventory[i].equip&~pc_equippoint(sd,i)) { sd->status.inventory[i].equip=0; calc_flag = 1; continue; diff --git a/src/map/status.c b/src/map/status.c index 98cfef6eb..0be72cc2e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4970,6 +4970,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 0; break; case SC_HPREGEN: + case SC_SPREGEN: case SC_STUN: case SC_SLEEP: case SC_POISON: @@ -5291,6 +5292,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick = 10000; break; case SC_HPREGEN: + case SC_SPREGEN: if( val1 == 0 ) return 0; // val1 = heal percent/amout // val2 = seconds between heals @@ -6924,15 +6926,17 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr data) break; case SC_HPREGEN: + case SC_SPREGEN: if( sd && --(sce->val4) >= 0 ) { - if( status->hp < status->max_hp ) - { - // val1 < 0 = per maxhp % - // val1 > 0 = exact amount - int hp = (sce->val1 < 0) ? (int)(sd->status.max_hp * -1 * sce->val1 / 100.) : sce->val1 ; - status_heal(bl, hp, 0, 2); - } + // val1 < 0 = per max% | val1 > 0 = exact amount + int hp = 0, sp = 0; + if( type == SC_HPREGEN && status->hp < status->max_hp ) + hp = (sce->val1 < 0) ? (int)(sd->status.max_hp * -1 * sce->val1 / 100.) : sce->val1 ; + else if( type == SC_SPREGEN && status->sp < status->max_sp ) + sp = (sce->val1 < 0) ? (int)(sd->status.max_sp * -1 * sce->val1 / 100.) : sce->val1 ; + + status_heal(bl, hp, sp, 2); sc_timer_next((sce->val2 * 1000) + tick, status_change_timer, bl->id, data ); return 0; } diff --git a/src/map/status.h b/src/map/status.h index 276cd1b1c..ebbb90884 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -293,6 +293,7 @@ typedef enum sc_type { SC_COMMONSC_RESIST, SC_SEVENWIND, SC_DEF_RATE, + SC_SPREGEN, SC_MAX, //Automatically updated max, used in for's to check we are within bounds. } sc_type; |