From 0e5784703b00fe94eb19e24298d3dde5dbc811da Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 27 Jul 2006 15:44:57 +0000 Subject: - 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 --- src/map/script.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/map/script.c') 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); -- cgit v1.2.3-70-g09d2