From 37adb26ef191f5897aa77b59f2efe9474b7d2e56 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Wed, 4 Apr 2012 21:40:13 +0200 Subject: Adding monster::on_damage callback Reviewed-by: bjorn --- src/game-server/monster.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/game-server/monster.cpp') diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 34920b91..ec9db792 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -430,6 +430,19 @@ int Monster::damage(Actor *source, const Damage &damage) KILLSTEAL_PROTECTION_TIME); } } + + if (mSpecy->getDamageCallback().isValid()) + { + Script *script = ScriptManager::currentState(); + script->setMap(getMap()); + script->prepare(mSpecy->getDamageCallback()); + script->push(this); + script->push(source); + script->push(HPLoss); + // TODO: add exact damage parameters as well + script->execute(); + } + return HPLoss; } -- cgit v1.2.3-70-g09d2