/**
*
* Author:
*oldj
*链接已屏蔽
*
* File: td-obj-monster.js
* @save-up: [td.js, ../td.html]
*
* Create Date: 2010-11-20 12:34:41
* Last Update: 2010-11-22 15:01:45
*
*/
// _TD.a.push begin
_TD.a.push(function (TD) {
// monster 瀵硅薄鐨勫睘鎬с€佹柟娉曘€傛敞鎰忓睘鎬т腑涓嶈鏈夋暟缁勩€佸璞$瓑
// 寮曠敤灞炴€э紝鍚﹀垯澶氫釜瀹炰緥鐨勭浉鍏冲睘鎬т細鍙戠敓鍐茬獊
var monster_obj = {
_init: function (cfg) {
cfg = cfg || {};
this.idx = cfg.idx || 1;
this.difficulty = cfg.difficulty || 1.0;
var attr = TD.getDefaultMonsterAttributes(this.idx);
this.speed = Math.floor(
(attr.speed + this.difficulty - 1) * (Math.random() * 0.5 + 0.75));
if (this.speed < 1) this.speed = 1;
if (this.speed > cfg.max_speed) this.speed = cfg.max_speed;
this.life = this.life0 = Math.floor(attr.life * this.difficulty * (Math.random() + 0.5));
if (this.life < 1) this.life = this.life0 = 1;
this.shield = Math.floor(attr.shield + Math.sqrt(this.difficulty) - 1);
if (this.shield < 0) this.shield = 0;
this.damage = Math.floor((attr.damage || 1) * (0.5 + Math.random()));
if (this.dam