<?php
include_once $PATH_TO_CODE."/script/tick/allincludefortick.php";
class GainLifeTick extends Tick {
public function getName() {
return "Gain life";
}
public function run() {
executer("UPDATE objectInfo oCurrentLife JOIN objectInfo oMaxLife ON oMaxLife.objectId=oCurrentLife.objectId
SET oCurrentLife.value = IF(oCurrentLife.value < oMaxLife.value,
oCurrentLife.value+oMaxLife.value*0.1,
GREATEST(oMaxLife.value, oCurrentLife.value-1))
WHERE oMaxLife.type1=".RealObject::$REAL_OBJECT_INFO_TYPE1_LIFE_POINT."
AND oMaxLife.type2=".RealObject::$REAL_OBJECT_INFO_TYPE2_MAX_POINT."
AND oCurrentLife.type1=".RealObject::$REAL_OBJECT_INFO_TYPE1_LIFE_POINT."
AND oCurrentLife.type2=".RealObject::$REAL_OBJECT_INFO_TYPE2_CURRENT_POINT."
AND oMaxLife.value <> oCurrentLife.value");
}
}
?>