summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-27 15:44:57 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-27 15:44:57 +0000
commit0e5784703b00fe94eb19e24298d3dde5dbc811da (patch)
tree1ef976c17a6049639fb6a7248e7dcb28e70c480d /src/map/script.c
parente374dbba803c5d79ec3113bc80fece056193df31 (diff)
downloadhercules-0e5784703b00fe94eb19e24298d3dde5dbc811da.tar.gz
hercules-0e5784703b00fe94eb19e24298d3dde5dbc811da.tar.bz2
hercules-0e5784703b00fe94eb19e24298d3dde5dbc811da.tar.xz
hercules-0e5784703b00fe94eb19e24298d3dde5dbc811da.zip
- Now when you set the guardian's HP, if the guardian is spawned, it's HP will be updated accordingly (and if you set it to 0, the guardian is killed)
- Added functions status_set_hp/status_set_sp to set hp/sp to a given value. Applied usage of these on the Berserk and Soul Change code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7922 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/map/script.c b/src/map/script.c
index cf1ae0c17..1571d7d5d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7553,7 +7553,22 @@ int buildin_setcastledata(struct script_state *st)
case 23:
case 24:
case 25:
- gc->guardian[index-18].hp = value; break;
+ gc->guardian[index-18].hp = value;
+ if (gc->guardian[index-18].id)
+ { //Update this mob's HP.
+ struct block_list *bl = map_id2bl(gc->guardian[index-18].id);
+ if (!bl)
+ { //Wrong target?
+ gc->guardian[index-18].id = 0;
+ break;
+ }
+ if (value < 1) {
+ status_kill(bl);
+ break;
+ }
+ status_set_hp(bl, value, 0);
+ }
+ break;
default: return 0;
}
guild_castledatasave(gc->castle_id,index,value);