Esempio n. 1
0
        $_SESSION['current_tool'] = array();
    } else {
        $tool = $_SESSION['current_tool'];
        //      Если делаем трансплантацию, а заморозка уже прошла - имплант начинает повреждаться
        if ($tool['type'] == 'transplant' && $_SESSION['effects'][$target]['freeze'] < $curr_time) {
            $_SESSION['implant_stress'] += Autodoc::IMPLANT_BREAK_PER_SECOND * $time_spent;
        }
        //		Меняем цвет системы/органа, на которую действует инструмент
        if (array_key_exists($target, Autodoc::$systems)) {
            change_system_color($tool['target'], Autodoc::TOOL_COLOR_CHANGE_RATE * $time_spent, $tool['color']);
        }
        //		Наносим повреждения по всем системам
        if ($curr_tool['influence']) {
            $curr_tool['influence'][$target] = 100;
            foreach ($curr_tool['influence'] as $inf_system => $inf_quot) {
                $illness_quot = Autodoc::getDamageQuot($inf_system);
                $damage = $inf_quot * $illness_quot * Autodoc::TOOL_DAMAGE_RATE * $time_spent;
                change_system_stress($inf_system, $damage);
                //				Autodoc::message("Инструмент $curr_tool[name] повреждает систему $inf_system на $damage",1,0);
            }
        }
        $data['current_tool'] = $_SESSION['current_tool'];
        if ($data['current_tool']) {
            unset($data['current_tool']['changes']);
            $data['current_tool'] = array_merge($data['current_tool'], array('time_remain' => gmdate("i:s", $tool['end'] - $curr_time), 'html_color' => $tool['color'] ? rgb2html100($tool['color']) : '#FFFFFF', 'completed' => 100 * ($curr_time - $tool['start']) / ($tool['end'] - $tool['start']) . '%'));
        }
    }
}
// Инструмент в стадии включения/выключения
// Ищем кровотечения.
$wound_size = 0;